From patchwork Wed Dec 18 15:53:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 851706 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp996907wrq; Wed, 18 Dec 2024 07:54:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU+uddc+2RQuvZM87f/CDEON88f32H0k0fwjhi3tx1JBO7hwhft/W+J5FwmEyDxriu3gTxsew==@linaro.org X-Google-Smtp-Source: AGHT+IH8ESEtqWaoFvi35KVYvJLxyDCF5Qbq35CURTi3CQcf0sCC3Wwk5lMXsfjBQWCUSGg5IXoD X-Received: by 2002:a05:6402:524d:b0:5d0:d183:cc05 with SMTP id 4fb4d7f45d1cf-5d7ee3a2948mr3463736a12.5.1734537272307; Wed, 18 Dec 2024 07:54:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734537272; cv=none; d=google.com; s=arc-20240605; b=PByLDiEJdXWEVA7NJj/qI9m7M3gprvk4ELDqBjXlqOdlZgrt6uk/vdEPBgMJS2uflh w6xywQHdawjeMatsJM+DpTZ78VyYrtdwyEtOWY1Xa5FUcFqCwpbQmztJHzMBP5Jht8D/ o8vsS47mo2S4kz/pt9dWlEGT7FVu1d+agdPSCbZe472CCQlaYuZZLNugGiNgE9wPg5am m5bd5bocc8vuI/6wAyCgWWopseyXb7JfpEq2zfCJ/bdagTP6+jYL2IC4fJIc6zak7kXq UzYxIqwxuFRXDvI/8YRgaQZ3mCh6xzybwD7oCef8QekEyhXaVCNNs1VOozhUu3Sj8kIs E0pg== 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=fLKxVQiwK6fGf0pDokn9UViCNwltX2SV1j5nr3oogSA=; fh=gnyibzfisinJgiA8gh/4S0mC+zmdvN06vEa6v6wPxO4=; b=gWvB0glKX5tPDnoSS/GYw1HdvE0wIveZ1+ZQxjRoWJ9ibq18pJk4oiYyrWqKDJ5vil 0060S8M5J/MZmZev8clFcs3Rc2KB77LXXVOwPqoTrfMTBorBmvdoknWLnLFtgCpmXaUq dMQJHgW7Z/arwUzXCPazSamt6G/Y5iPclzwqqJ/bLZWAtgMSUOa3C/ALOje+kXl5ttyJ yjOLllQohETfzaPyhl28lM8vpCNsbm+lO12OhWydzHi61hN3A4ETCBCqkncZJoqqJNGV 0tPziYWcm0ohF6bu8rwDYYpCsQIqm7aBGoCktH8Vgw1E7nVoeCOuQO04F557EpsayvQI IlFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RfSn8mni; 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-5d652f54e84si6622894a12.341.2024.12.18.07.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 07:54:32 -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=RfSn8mni; 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 1C0D980295; Wed, 18 Dec 2024 16:54:24 +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="RfSn8mni"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6F771802B4; Wed, 18 Dec 2024 16:54:22 +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 1FD8080269 for ; Wed, 18 Dec 2024 16:54:20 +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-434b3e32e9dso71697395e9.2 for ; Wed, 18 Dec 2024 07:54:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734537259; x=1735142059; 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=fLKxVQiwK6fGf0pDokn9UViCNwltX2SV1j5nr3oogSA=; b=RfSn8mniHB78GBF9E8kLSglMI1dm1OQvbpOZ339VfgI4lOo5LeEObLRHbcEGTX5H7f XPzQWMIuWYXUZooEXjVCLRQzhzkIwylbvQ9KXwS4f+VV+jNo3JqGqqK2NDxyKnZu3/8A eQeQuuvrLiB0lVngzwjCfN+eCrg1lBIqo0t9IW2eJuBcAiQ4kJEsAXqhksSb1ecS7FUf pLWpU5ymj8B9P+VAmsnLTjBqESoWeQHflHx6KjTm8vIl04plIFC9e2/j1h+WbgCJkwHf QfsgNi0KCVydHyhT04pM7hpUxUUihJbuqCvNj6ggJM+0fnRCnP24ymU894cizvtLhqvp 2kXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734537259; x=1735142059; 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=fLKxVQiwK6fGf0pDokn9UViCNwltX2SV1j5nr3oogSA=; b=FQXfCsfzbnjfRSCSGZ2ZRjRW0PNzpBPtsu5kKWafxW8RYdgjo0mFzaA/0HfqWfm4Qw UvzmpZ2N+YmfTE3fG2QvseWkUV3T1lcYnK/9PeyA3FLLpNaXysz9/m7/uHJxO2Y4fr2O AxKiNNgEyYnjFEOUjzwD/qV+zi1s1UWBrzRjQI/+gnN8gaZPNNPmY01A+klZ05R9pIYn vsx2vQya4WrdcKULaZduHT6IR980Zb0RpvsVc4YxwnwK7B9qEXJLhH3fHT31oEG3JC99 Zfw2xI3AqlVzOOdIsv9TAG6ApYDNG3mQYhmfrvS7bFUOAg6FDeC+ZtDFWOKGTfxk5F6Q XPnw== X-Gm-Message-State: AOJu0Yxdbp5RgqiC90xTrcRB/Riy+NlHw3Lwo6PFW0TwDEiRigrs0S10 ZzasESp3JwjNiQBgTg/nYZiwI3/CSPVlQBA37BZA0ouDV0GqWVn6/SFyDrxuwcqyquuT0KtbuPK rBNM= X-Gm-Gg: ASbGncsaLh7NLitsl5kIHqV2kSB4VHDuooQEyvJu7LlQSHwQq5d433i1s0OYSfHSJEE TjKmzywHNie76ta/EIrjG5WcDJDk4N0XTJl9LiZhDvLTQEkTZtx9J/6XHKH90to4Y/Z7JoGdb2F KnOaAmTN8vAUI5Oj/M1Af+Ix8y9z8TcLg9XTMdGatUz3bssTkKWTDO31wTFsFMeMjUEwYgQ1GUh sIjmhe47Uwcy3S96cWquku15Ll8r1Ku7c6YznBLK9GLHy1AQGiiN3JRJ9ihQr259g== X-Received: by 2002:a05:600c:3c83:b0:434:edcf:7474 with SMTP id 5b1f17b1804b1-43655406304mr27252595e9.33.1734537259292; Wed, 18 Dec 2024 07:54:19 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656afc125sm25181705e9.6.2024.12.18.07.54.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 07:54:18 -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 , Christian Marangi , Rasmus Villemoes , Sughosh Ganu , Evgeny Bachinin Subject: [PATCH v2 1/5] common: board: Simplify array with function pointers with CONFIG_IS_ENABLED Date: Wed, 18 Dec 2024 16:53:54 +0100 Message-ID: <4fd5a2e7651f8afe87f3424d5bb36669c93e5716.1734537135.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 23ebc41868c..19bcf3950d5 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 Wed Dec 18 15:53:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 851708 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp996983wrq; Wed, 18 Dec 2024 07:54:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWqEBo+i1GBL0T4AygwXsUglsCuRy1tZOv2CXcPRYIMd1bw69jRh3O/VyMU5Wj4LUi8Su3/UQ==@linaro.org X-Google-Smtp-Source: AGHT+IEDiBxd/BBeQKGTFXcIad9ElSuLjMm59P0vCq/Ll8OClIVt+fJdxOOYLOsCngpOh8TOtuDY X-Received: by 2002:a17:907:7712:b0:aa6:9461:a186 with SMTP id a640c23a62f3a-aabf48e977fmr260755666b.46.1734537281286; Wed, 18 Dec 2024 07:54:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734537281; cv=none; d=google.com; s=arc-20240605; b=SVlplsYm3fJrkzHD53buqCCoPd8rS7aeoqj25DQn4XTEloBp3V5wUQ5orNRuUVSrhD FrzetmxjmYAs8/O3y1Bx8NR9e5dXivl97PKXfPQ7jciZI1X5MZaQ63XNRgasDJxhaub1 /u99q2AEB+C1hqlVTlQpQ0rbeLMFZZmAc/U+mI3Rm8+akRqF2qjyzYqsAop1OrfXS9z0 2vtCju3/V3+fhsx0ZA7wYgTt/F0evBQoKDbIraMF2drLEza0fyTWlS50/5J/qqX2+0Ct 8OwoF0iiJxzUzm4R/KVLXgeLPKLY5ZdxeHCjzLiLntBNUU7OtUIJLFEpjptAebmcy4Dl BDIw== 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=dTyPqo4vst5GZ2KHXd/dNQbROPHiTTWCZFOG3Xa5M4E=; fh=7T9U8CxT8/pi4VxDQB+ogewXJ7jd6DKe4+xLsZpalAc=; b=K6XyWHM0JeOwBA8cvHtDcDYcdUlV9R6D/14TRaUWQ/R+o4VZx+9pHwJ5vPLp4ZBowq X9s5sA6nDpw0lowQSilE2Oqm0gvHPPNvAem7ujsEz2BF/VBePXvQqIkyvHy9O57en1OA 2OLVoXR72UeO1nRQ85AhhoEGdBuX2NECWfZ8KrnrgG4DkdmM6ps3mP6GHZI/CG4Lg1lF gRyZJE1g7bRodaixuXfyrHUn2lKVxevJDCkdMFvl5TjSvXog69byPo/7FFXcUFSBpdbP MxtjDRE6v+PFNao3rU2GzJWDgFwrW0/uKNiLGjVjftPuZkzThn60R/C17pmCpoJ+6+83 +TeQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QBgXi5kH; 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 a640c23a62f3a-aab95fd3fafsi637774066b.141.2024.12.18.07.54.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 07:54:41 -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=QBgXi5kH; 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 8014280312; Wed, 18 Dec 2024 16:54:24 +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="QBgXi5kH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 71EC080304; Wed, 18 Dec 2024 16:54:23 +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-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (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 2D8B580291 for ; Wed, 18 Dec 2024 16:54:21 +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-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3862d6d5765so4585915f8f.3 for ; Wed, 18 Dec 2024 07:54:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734537260; x=1735142060; 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=dTyPqo4vst5GZ2KHXd/dNQbROPHiTTWCZFOG3Xa5M4E=; b=QBgXi5kHGP42WorbMiNS6RahY6Th2+4IUVvL5VlYwjywmK+zEquwvvCOePgEg/4A4V YcJxtr5yJVhGJe8hzR9ppRguOVHcPAZLd64xjQttkxeODd+aN/swZPY9n07GuuTwY5R9 CvkiNAszLWIORV53MhriyX+4IgbhDnHfWGpmB9ildYhXhB8viYhY5LFMzn8bF5pd1Rdk zeWzW96w9zwTqGoeMHzNbBDhVlxl+zTq57pHm97wu6ixkwwKOBhov9VwyXG8S2tWtkIj JwZBEml2z6UG4UYktp2Ur3oUMw6bSGbpPOym12ube3GSa7Q3Ep0e+1Q0+Sg7PCAuu+or Fw6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734537260; x=1735142060; 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=dTyPqo4vst5GZ2KHXd/dNQbROPHiTTWCZFOG3Xa5M4E=; b=SAx0nu1Cui1yqLrgDwyZ5mzH9X0ETwXtPFqn5tYdutZ9YtGByPr5BNjFRl7iQNeywW 1Bn5FPf4TZ6aAMerUSGRKdBpq/X3KR8r7txzpQUPfessB5Ur4Q4qpfaNYCW5FmlmaBGc 2wA82NaHBHlIaPfG2CGq4EM7Td0mS/1LyHPK3TcPVln+Gtscfl8FpraifowA6RM/bfd0 t/7tYXW77vCkQiuODw0NwlDe/KFLsKqVL8uHYeS+RfY8/GSv724d0ZLH4z6UWjALHAih it92Xg6DvV1KPjFldEPvOJdPqOLBJlefySRJ0mMi+yDO5UhsOWe5EDYka0odMF+UsNzo OxQg== X-Gm-Message-State: AOJu0Yx7vyVFBtgTXBjJGMoDYPAMhyFKPT4lxQOX12JJgei7b9NOQh8+ PJEfPO+dp3jfomGFJmoBlLm9XO49hHCI7IYkhBojqDWXGALcxVoHMwouRz7A/cz73cRa5VjNYcI FHns= X-Gm-Gg: ASbGncvyd1MFcIs+qGhtIfivdQbw3V9JoiS16leyQHNupuYY9Xjd6u5IDzrj3OAToeM aXHjAa0bHV9+JtIo3DIYP30Neyu4iurjiUh8SvxUIsdnVlTZtZGJYti/Bw6rPATnmsR0jAnIQaf webBuExwdgarmQsAQdgtLlZzspz6hTruDPey7X3W3yfh7qN4+Qqe7VGum7mGChM6gq4/p6orkh7 iuvRmj7LIvfvb9S4Q7UX6HbbNpzaPf+qAA2tYoMKEEDnRjUemVCsV7U2xs8Ksv5tg== X-Received: by 2002:a05:6000:4a12:b0:385:f6b9:e750 with SMTP id ffacd0b85a97d-38a19adee0emr115746f8f.9.1734537260355; Wed, 18 Dec 2024 07:54:20 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656afc125sm25181705e9.6.2024.12.18.07.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 07:54:20 -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 v2 2/5] board_init_f(): use static calls Date: Wed, 18 Dec 2024 16:53:55 +0100 Message-ID: <252364e53d56fab1c77bda74563b24ad8a17d635.1734537135.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 1200 bytes less (-0.11%) - With LTO disabled, the code is 594 bytes smaller (-0.05%) - Execution time does not change in a noticeable way Signed-off-by: Jerome Forissier --- common/board_f.c | 165 +++++++++++++++++++++++---------------------- include/initcall.h | 27 ++++++++ 2 files changed, 110 insertions(+), 82 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index a4d8850cb7d..cebed85ed4d 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,60 @@ 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) +{ + 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_INIT(); #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 +937,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 +988,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 +1002,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..9398a3ec7d5 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()) { \ + debug("%s(): calling %s() failed\n", __func__, \ + #_call); \ + hang(); \ + } \ + } while (0) + +#define INITCALL_EVT(_evt) \ + do { \ + if (event_notify_null(_evt)) { \ + debug("%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 Wed Dec 18 15:53:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 851709 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp997056wrq; Wed, 18 Dec 2024 07:54:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUaY9pmqNGs0i7dyr5UA1LUVtcOe6ZjjiRuI7l/VPcQ3BzUd8f7KX17Y09NsWrwHNaCC1Uiqg==@linaro.org X-Google-Smtp-Source: AGHT+IHVFSSJzox5j6OKq3S/nEBdhut0/ge3swSsTbQkPrJEsreQBHFIodBUrWHwKsWuX85BoqNc X-Received: by 2002:a17:907:d87:b0:aa6:86d1:c3f8 with SMTP id a640c23a62f3a-aabf48c67dfmr303046366b.39.1734537295082; Wed, 18 Dec 2024 07:54:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734537295; cv=none; d=google.com; s=arc-20240605; b=XlynJO/C2fVlNHVHP28/6/0KsCXraD6L7uX2846ovQQahFGUx6bC+O9mnRL9zc0Fdz yYJ73x7+sqIsU7u/v4kLpESQA+LoJJwD185mfNuVR/I5rhnR/MdraXOYpjKj+J1is82x 15fphZlEm7Hg4J6cvexEDxReCf2e4/QJsBXxS/JlonhGgm3RC/R7FzwoAC/6EnqHwTZ+ qOBkoO1C2G6FbmdR+idgieVcyAP0Ipo72GacxSriO4Iu/UJDBVwDbuwvwYgrI8UG5QD6 +s4i14VBylwYtJBq4h4ffvyNLA38CM+pTip7eBB7Dq8bPYVqr8YdA/OaqUIFYaxXUxNQ QXNA== 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=GT1vHcgT5ZCeYIZlNTu7kydDcBrhOwED+EnNq6snnlI=; fh=0NdnFrg12Ax6Tb3+TYlQmpTA5PM/vy+1doATnleuoeY=; b=cji9yMpnzWh2agXZ9oTqGpdjh64Yceunj6FCYkQiH5Jfu+DUkRhDTCV/EpcDFWkmbR 6FK0S+z6xdp+Yjgmh2BQes7OOOepP8IYg88Msays+DD6a4JvXe4PoWmIAa1659OBN/ql pmKBOfcwUrk9PdUhFZwcEUusumSLZB+uMjTvywF7oYSgkEUl59L5mb/0NR/9MAfkbb8R UKZ/oPLa6kiBHpfjk7Crod10IAhpvbwLGV8PjEMsMd2mq4HUIiHhUKvG9oKiAKZagsDW LkqPU+rvGuOmhhiGpbQcPxaU0SBBXCZNy0UoC5DcrLAacvF91+otdCyxZg2GQrjyLKoU wFHA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zWtgjRSk; 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-aab960266adsi647312866b.211.2024.12.18.07.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 07:54:55 -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=zWtgjRSk; 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 9097680304; Wed, 18 Dec 2024 16:54:27 +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="zWtgjRSk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 36BFC80312; Wed, 18 Dec 2024 16:54:24 +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-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 1EC838022B for ; Wed, 18 Dec 2024 16:54:22 +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-x335.google.com with SMTP id 5b1f17b1804b1-4361fe642ddso68957615e9.2 for ; Wed, 18 Dec 2024 07:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734537261; x=1735142061; 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=GT1vHcgT5ZCeYIZlNTu7kydDcBrhOwED+EnNq6snnlI=; b=zWtgjRSkHQWBxOEAMuJAFVwhaLx8O3SLQevajCMwm/vK8ZIr8GJhErI3dwqvYOT/qk 96p+xH27LqWZ9PLNjSO1hIxoo2OYvHKl3gw0eAObt2U7FG9cmJOxC+sVPZoRUB62j/Yt 8MwPvq5W3cAfx7eLWGvnykP+TkrNLskTUuIZdutEEWyVS39/ZS7fcFb8Scakxa6OVCnn rq9RT4x1yTs6mABbbpsor4pgecXLjlELGB5xE+0YBVFbmJWQ7DbBZa4lNOhsnOWbm7cB CsR50vzAezA3nA+ZSKqVSq+cZG0JQmxYzzvXItBOKqHkOt9yamHZPEO/rHJAXJ+B7i9V xSxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734537261; x=1735142061; 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=GT1vHcgT5ZCeYIZlNTu7kydDcBrhOwED+EnNq6snnlI=; b=R7+i7ozb6ZdDafjlleSV5p1ux8F0yAwb4nl8s3gIQGBFM5fJWYpeJzL7UbasmUjnpc B1QfFVpCNw/FEcLEdYW0aTgOKqDIJnXf3AvzMwxBf7F0H+yqVBmy4o7kQRyo7P57jfpy o2TP3+qAOJT+cmBJPa8cDrXZAGZrP787Te0Fo3A3vz2J3tKbbEvXVNYPIgGXlSEHQdcs CVJn2K712hkLaOwfiFMBmuZbGR95+dEWrNtPNtST6dv9g9bw+RI7XGhHQuiASwVUteXu DIGV05og8mfvx4vL97aS73AVyC9ki5V1GBt8h1Y0VjsmNUaqkgSeIUctPUod7XCXyv1P UIuA== X-Gm-Message-State: AOJu0Ywj8wCO2XXrbPYIDZFqoqj0ohwivqY1SxBqAGX7Tu3Bcg30bMe2 r2SnYdsl2MNbhCCNqv5dSfO8E3xRhHfhoGOz+ph92vnf1sGYHdikvBceMhp7D4gblXTrLoujl0p y6js= X-Gm-Gg: ASbGnctVdlcaNRURHAqMz/2g0FFX7aA1uvJASy6YIK9exBnnD3EqN8K1PMuEHioLP8v 3atDHxYvGu8dvzuOAEiCEodPbnvplLTN/Pi5n2FdqvJUZgmwsUOlKonoa3lliehb9IBjsQdvMjI 29BvTSKeQuamI/8OKUKi/tD4L0wDe001oROUHbMhuOFNBI/+5lYbdy8AECSTQQCN1MfF2fvxkVj NttiT8t4tUgIqfoMGpYK91w1uEk6XVsC+lBqzu0jvKVG4Xmmr9t/0W72thM9OLnFg== X-Received: by 2002:a05:600c:4586:b0:434:a1d3:a306 with SMTP id 5b1f17b1804b1-4365534535bmr29473485e9.5.1734537261376; Wed, 18 Dec 2024 07:54:21 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656afc125sm25181705e9.6.2024.12.18.07.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 07:54:21 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Tom Rini , Simon Glass , Michal Simek , Jerome Forissier , Devarsh Thakkar , Jonas Karlman Subject: [PATCH v2 3/5] board_init_f_r(): use static calls Date: Wed, 18 Dec 2024 16:53:56 +0100 Message-ID: <217af7ee46d45348bb825caafa20bd91f18ff957.1734537135.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 Reviewed-by: Ilias Apalodimas --- 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 cebed85ed4d..f47275a2230 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -1016,8 +1016,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 @@ -1030,18 +1030,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 Wed Dec 18 15:53:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 851710 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp997114wrq; Wed, 18 Dec 2024 07:55:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWKLQQyJ3/IQLHclZJdJSy6r8UlpEJQr5fLJapa8Ym66lNKDvt+hcbzLWisaSLAmuSY+05gWw==@linaro.org X-Google-Smtp-Source: AGHT+IErFfpEICnu4vhK46sa848fYiBC1Q3xmpFY/j5JBxbnNr9IBXP838iQwxmbPk3AuMujqM42 X-Received: by 2002:a17:906:730a:b0:aa6:2c18:aaa2 with SMTP id a640c23a62f3a-aabf47a6402mr297156166b.27.1734537304643; Wed, 18 Dec 2024 07:55:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734537304; cv=none; d=google.com; s=arc-20240605; b=EhHjnghWmtHwxJOMQUvsa1ll+XH23pBLEcH/NuC260LDwFmBq7oBCssaqfJkGyu2bH F2GFWjX3CGPqpSh7uAsY0Fd+GssYizP0Lw0ZvTmPvXh8biAAYB7oaz90N2z+lAmuyjvI T6ot+0Kgy6nZ/JhOezfammWJSa0J7wIXHT0KjDLANBDQoVzPAh8ZxFu2QS8GT8LQfy4o qdScvwPqy2+JtkI68wc+/XwyE5Otg17VGqiJLQegj6bfHyD7RbdZXDK3cyWgugCZnOGP xOuphayyugP9wXieoTWtQujGatiDY3JS+oQ5HtGurI8DzAFNfnwU5LvrqWEgXv/dSRzj 8pZQ== 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=fsxw3Alwb3wcmuK5p5xByPEpjhZBP1J+ez9xHBVTDig=; fh=g6Gk3LQYSvEkBLi52EFnO+xFQWM7gxZoaS3NjgwvA5E=; b=M+F6JpBCmSy7g6EEzMXlkAnyHE1itzGpZuIrFhPNIG+scfFPGV/SqpVLTOCIBMeRB1 T1ZmHQPD2mEaEFurEbZAUqywGRfChX4lkIisz0EhL457mDmBxN7JY0ILqoGCPPDD7r39 k90rXtMgKzlCDY1hUgxBn7KbspD3KwXOIkt7FVOJDmqDYajBFtcRjRuc2jChIg74JoES 8QcSRuVDnxeM4g3Pj8gNzZDewfoegFhcwzoG+UmriHF0bkzD/vtqRn+cjsRnw0kIaFDh eendlYrNWZkj6falQucRptAxOsJDN+DHWdGPlzvjhsrGpfR3erROTA1qBF71cjbgRv6Y 7IiQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cg8VDSir; 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 a640c23a62f3a-aab962b41bdsi643868366b.277.2024.12.18.07.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 07:55:04 -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=cg8VDSir; 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 E938B80371; Wed, 18 Dec 2024 16:54:27 +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="cg8VDSir"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9C13580352; Wed, 18 Dec 2024 16:54:25 +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-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (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 5ABFA802EF for ; Wed, 18 Dec 2024 16:54:23 +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-wr1-x434.google.com with SMTP id ffacd0b85a97d-385dece873cso3172492f8f.0 for ; Wed, 18 Dec 2024 07:54:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734537262; x=1735142062; 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=fsxw3Alwb3wcmuK5p5xByPEpjhZBP1J+ez9xHBVTDig=; b=cg8VDSireQ1bEWwWosPv8sVsZnD7b65PsF/3x4NR3cjO9JO91S9ouY6txYORkWDKNC hNBlibgT1kX+S5PMmpcyjfSGSegxlOul+o6d6kUXg0tVqd0x3hN8AfLrmv/OPrnUYKZm In0YVptPGz+A4Jk+Ta44UD12Zxgc1Sb7IMPHbaB/GeBBCYYQ0yEsO+/pQKawA8d0QaHt ols3BZINHeFn2mW5qYpzKMoHL2nqLeI1UDNL0CwsaSx4bh0J6YRjmdHQww+3BHIdBPWs ItBESTOZuQTkzKtH+MbTqGRcChm+CGUjuSibe6RSmXPNb37MYuYj1huW+n2a7Ls31i7q wWtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734537262; x=1735142062; 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=fsxw3Alwb3wcmuK5p5xByPEpjhZBP1J+ez9xHBVTDig=; b=ohSYOPO1TowriZ9o9Ao+ksPzV/HRmWKJq93kxTPYuF5IFpk8bSBUIfTpHkEjyynu7X 54tFxwA8mzNYHo3No8Rx8D2udSgfzNpDK4aJfv0VIgFrkTHvb9j4y6rGzdYbW4CEz0o7 ViUOaH1nptn78MIzkRW9qxR44bbQtbiTPsuE2JSA/VJsUM3M0YP3ZSAr9aSAxlFsCKCP VrIKkz60i/P6L0tJIBAnSKtUttBkHMWPyCeWKq3+GoRgC3sxxv2yDcdDg6+U9JGOJJi1 JmRsF83N/N0FNQVqHC/97agPSoQ4B+0P3GyoFcOA/WVvzcaJTbZzV5PjxICjLljvduNc Jlsw== X-Gm-Message-State: AOJu0YxJwiU4OAz8lWc5kYIx2uVJiw3pj5YMIcoxDHAJWF9lRMPuRPSw x5ims2cFpADeaa+EES2Af3hIDqV4QDe3t9MbSku/Af74LvDzSnEc5htmq/Yxetu1ZC5UEiExJvc M/WE= X-Gm-Gg: ASbGncsDZ+DUItERzO9YfkWaphrR6kz1M0W1zOViCU6Iiumr+05Q5cqnvivJXm7rCy8 0qi/gOMruEJCJOqMCSU4kAFSz6cDE9oDAcRafXeggZGKRejxVaYyUfBFYZNiZDTBupzQeRBYp1L D9TsosEZGn2cHK52OXxMMu3ZTS19BDQwLQB5HI3RT9rHkoPnPR5F537VLp6p9rYYpiL9cTtR2jM Pl5ktS4qj9vVCG61d5xjyW1JjYRS8Il241MRBalifahmfwWFNWInFIVoN1ul0i1FQ== X-Received: by 2002:a05:6000:144c:b0:385:ec89:2f07 with SMTP id ffacd0b85a97d-388e4d5db3fmr2758907f8f.32.1734537262482; Wed, 18 Dec 2024 07:54:22 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656afc125sm25181705e9.6.2024.12.18.07.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 07:54:22 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Tom Rini , Simon Glass , Michal Simek , Jerome Forissier , Sughosh Ganu , Christian Marangi , Evgeny Bachinin , Caleb Connolly Subject: [PATCH v2 4/5] board_init_r(): use static calls Date: Wed, 18 Dec 2024 16:53:57 +0100 Message-ID: <0a23ea67d824450012a4d7c44df65a70a99e3424.1734537135.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_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: 9/22 up/down: 19608/-20915 (-1307) Total: Before=1067719, After=1066412, chg -0.12% - Without LTO: add/remove: 0/24 grow/shrink: 1/0 up/down: 488/-1124 (-636) Total: Before=1119091, After=1118455, chg -0.06% Signed-off-by: Jerome Forissier --- common/board_r.c | 171 ++++++++++++++++++------------------ test/py/tests/test_trace.py | 8 +- 2 files changed, 90 insertions(+), 89 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index 19bcf3950d5..ee54654ac71 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -582,21 +582,20 @@ 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) +{ + 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 +603,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 +625,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 +736,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 ec1e624722c..4c159ad9b16 100644 --- a/test/py/tests/test_trace.py +++ b/test/py/tests/test_trace.py @@ -175,7 +175,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 @@ -198,8 +198,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 @@ -248,7 +248,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 Wed Dec 18 15:53:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 851711 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp997183wrq; Wed, 18 Dec 2024 07:55:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWdJl0+QNbIri8/ZH/bF7EVMte47oeuZjc00hJ08k2UwuwjNqjlctOwrbntI+gP2qWJvEZD4Q==@linaro.org X-Google-Smtp-Source: AGHT+IGr2MLn0mYxDuOwafCAV8TDMEAjjdRmzn+zSFprQWF9EfIZ+4qZGgX4bxXVG/VhwovoDpJD X-Received: by 2002:a05:6402:26ca:b0:5d3:eceb:9c6c with SMTP id 4fb4d7f45d1cf-5d7ee403333mr2398428a12.29.1734537313823; Wed, 18 Dec 2024 07:55:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734537313; cv=none; d=google.com; s=arc-20240605; b=klcbXac5qwu77uVjAbCZcD0wWWE/cetUA+PTSCz1WyygrW1z44D/K3K/rxWzCLgPYu 53kfbd5TTRcEC0EjuKX/2uX34b7vJmYFTu6Nzu+TVKLchYXQZSxwrRPIpE5hjboDk0Vg UCXnqW1mty/uXJGB23ys5saAV5DjO8BM2AB+5v1KLMcoHN7ssoDMJ1dDhj6neGZl1lqd 0KntXhlhRkMnCnPK8HwuXEU1eRvIMcHRPQ1T9aJmQrJ5RPJ1VbPq3GmJn7DlHnJoUKLr H5OAISfUzZMcQIMfBpF8mo+oA605foW4+X13c1at7iJ2ykYrU+sv4RxKNXgTBaP+AU+d fU1Q== 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=BfQbeffR+wV3yx3YnO6qFvNIxYUPN2RkZEsAar5iRYA=; fh=kV+nLpDDwxLXgL4ZrL9moTa+SBOj1+lGP4nM/ORLrzw=; b=ZBAaOyrsd8h75b5OIMHXEMAB+muEOpGYmrbY7RtiIRbFex4dwn3jfOUHwEvQoM6NYG EUAD4RekqUXKekuPYFGp3+IUDyeDj7eKoghaEk0ibZSLuD6mSKKuS15NHU4YNFowgjrf MgqYNXvSekSb+GIJXMDXofyOO6edpVmPS6c3UTI1J1rF2ujiucjwD1LkuPkt4HDqWo7g f8ud7ycVEJGROtAm0xJnGZatbHJ8bu8PcCuIDeL2q+gSypa22FNYQYXbJgLZEc4XovyT jTLhcdfiNa7/cc3EgtDvZiQXc26kOsx2OD101NyjWx354qiLzs47Z6Iq6Xghu6rvUrDg zENw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sojm6M3v; 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-5d652f55aefsi6623379a12.356.2024.12.18.07.55.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 07:55:13 -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=Sojm6M3v; 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 48C93802F2; Wed, 18 Dec 2024 16:54:31 +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="Sojm6M3v"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A56128036D; Wed, 18 Dec 2024 16:54:26 +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-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 8921A80316 for ; Wed, 18 Dec 2024 16:54:24 +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-x330.google.com with SMTP id 5b1f17b1804b1-4362f61757fso53261495e9.2 for ; Wed, 18 Dec 2024 07:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734537264; x=1735142064; 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=BfQbeffR+wV3yx3YnO6qFvNIxYUPN2RkZEsAar5iRYA=; b=Sojm6M3vZnBPqfMOA1DttkBjPOe6HSDctgK26Q7HCW6Go4rRUuU/C+OQbHg6fwdrOg r2m5G/qe1h7xcr1ZlKklLnikQ5N3a2PQkj0zf/gPRwLNdCC1aVjppETg5Vs07pLh2Y1E v+B8wfvBwqPzTGgx97ZhYIFnQDA9yDZAr6+DNYO3ij4mgR30ouBRWlzGg7/lb3iXb6Z2 Cji/QUmEiLWKTu1VSRDi9Tx5vWMC1nKnyrbRS+LU/phGBQo0n1oQbXRdc9I88+fhiXV1 rZPsARdsX4dsN23r/OdSdrCADOe56qO9yZCJQBUOvmkCGk7ancMjeN3fJF/R8Ksp71jS Z+lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734537264; x=1735142064; 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=BfQbeffR+wV3yx3YnO6qFvNIxYUPN2RkZEsAar5iRYA=; b=PFGhlzfBATTp4NzqbmkwJo/TjJjw44AVh6vOUzxFWO7oSfLkV47PDEYgqdPxucwG1U C6ZN+KF791SmYXZsiTEMie5uFmSG8Z8UO9RKG4CCxyODaln7N1iRhywLEaPM/U08SoZC aUf9yIqD5fDnTdqmtp5ms8R5Rz7sGO58tO3cuX2tTb7pWIMOrtzi5UkwgcZJNjta7AJD kdAc3UoV6A0q5sealbnVemTyNRMtned1fv2i+N83R/M1FHOxMx78CNNKg5yVYSxjXh4p dZBODueXejhTSUL9pAahNPuiFJC3fHnJvYH3BqCxapR1hvOoLWvaXL+/Jz4hvY9TvNBJ OfZQ== X-Gm-Message-State: AOJu0YwkmyZe1/DiMKsXIghHEVm7ilwPXWqD0UnOqZU4c258M6qJ80Qx rO19mFlr252xp2SFDh0cv85d2TOySJbWzRiYpSR12I5uE8eRcV3Tkqp1io4AeHpbVW1U5hy4J8m 95Bo= X-Gm-Gg: ASbGncuy60DCmfa6HhBVDFgEuat1rQPcSVrHk05DqLiSECwJMvE276JZoQxK5ehlSRk M0S4yTd/SF+yZ0rxQ8T+ssO7sDejWPArDW2WP9dYjVIhWJ94YSgF9PsEwGGEh4Sg2+ak4yck+vn k1n/qL8keciuFkAJzAdcLhtPAQSnKnULIAlQ/jFn31ZvWkaM8+rsGIb6h5EiCBlKD40t6Fw4jOu kYacfE8mzdms9aoji7YBQOlase3SkGXNudb6f5vdpTjHHS6L5QdbMq5O8hRp/oCyw== X-Received: by 2002:a05:600c:350c:b0:435:d22:9c9e with SMTP id 5b1f17b1804b1-4365536be84mr29119275e9.19.1734537263764; Wed, 18 Dec 2024 07:54:23 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656afc125sm25181705e9.6.2024.12.18.07.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 07:54:23 -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 , Caleb Connolly , Dan Carpenter Subject: [PATCH v2 5/5] initcall: remove initcall_run_list() Date: Wed, 18 Dec 2024 16:53:58 +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 9398a3ec7d5..9d1af44778b 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 d24ed629732..78d9d02369b 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; -}