From patchwork Tue Dec 17 15:59:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 851422 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp432220wrq; Tue, 17 Dec 2024 08:00:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVM3X0WTDUqKQG0wI4zTCAtxmpEGknWByP8Ln9kezbSFpky2Dv/pB9A9p8uGI155rOPYH8eVQ==@linaro.org X-Google-Smtp-Source: AGHT+IEIPsn7qMf7VOVH8P5ioglgdNQc459L7snigoBy+Mc9Toq/LYh2o1XXl+llM36JNWALgFTH X-Received: by 2002:a17:906:311a:b0:aab:70d3:af43 with SMTP id a640c23a62f3a-aab779aae4cmr1738036266b.27.1734451217623; Tue, 17 Dec 2024 08:00:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734451217; cv=none; d=google.com; s=arc-20240605; b=Z01InBo+5Ue1jpB+0wWmvrszzgL93oOdBSmI0fUW0QNtfmRZSuYmC+pyqtcZ3ONHhw PVtVqX37nVUENCx8nN9GpLxnKuclT+9uQrXAcuT9VMc/ZHwN6qgObupRyc951PCAx9rp l7D4rDDe4V8cR0eZdq4nJnNLB/HM8xInK+WNMpoqCIiMWWZISf4M7aUGSDQFreQ89xlx 3jH6uXmU4NBhwOKTz71K1NFBukTMEh6YQrRnvVAL+JaPPvrVCeh52UKT1g22/gR9Y8kl Il0KEqlfjAbJ75FgqKXtGvE1n55wlouYHO1MUMowcm82qB7WZ4Ezd9DLTUwZXpMPoWvu Xx/g== 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=bzvtuvy3Ex7R0Wbm20qlm7V4mOErr3MO6bDVmFxs8QI=; fh=PbAJzxgHNn+FPLuzfbEyKTJ9FvtjJmhQh3SuAo3grP8=; b=D22m7PNhjL+X9w56qnMykmC4n96W5SXq0GIqzCh+y3UsE9aCC5Q2ybsFWwuqCskU2g xJTF7OYz/RlvLsSYvij6H9qkSaJNYzGzVxQAFL5d5kJx8wCC9wf7BpDgcSD38GmKxEx/ 90w189QT/Sur6ofeDQHhSBnaZN7USbNlR4n2MZ0TyzURtf0w4J1MngF+oxkPueBTwzy3 rCUDwmA6R4w2qy31/zVDn+mSrBXSAfCcouR0vl50LC5jFDB2X/14rjx74enKclL4nm/Y qdGUv2E+hoNaRR8JQvaUgg9HAaFSrkJ3gIuzbrwLPf1tkGZsKJ6r2Ojo41Y9e1NtX2Fh pQPQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X4m8JVwJ; 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-aab9639485asi494607266b.906.2024.12.17.08.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:17 -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=X4m8JVwJ; 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 B15CA80269; Tue, 17 Dec 2024 17:00:07 +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="X4m8JVwJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AE29D80250; Tue, 17 Dec 2024 17:00:06 +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 67702801CE for ; Tue, 17 Dec 2024 17:00:04 +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-436202dd7f6so59866945e9.0 for ; Tue, 17 Dec 2024 08:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734451204; x=1735056004; 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=bzvtuvy3Ex7R0Wbm20qlm7V4mOErr3MO6bDVmFxs8QI=; b=X4m8JVwJE2ydqPKkR/39vnTw66k2NODUnLEDmYZcYnCSKolnCpolQtOS5nWMeuPz3r 17FT4N0COGvOyVdefQJhR88cqOtAVQs3VmRxXsp1+S57aegSIC8HROk9q1sAr8qTqTmm sKVC9GjBatggPh1a6cuNmrR86tGAT3/b48YvdIGWySRun1sLYbZ9yuSdRbHt5SR2dTe5 JZkKj/eK3sUircUIL1nLFw00MchX8XrJekyYzUTLd00Q6lkgXr3AwXicaXZ3LGdNQkZ3 JGVTctFV4Mo7T05B1BpWPBfxrv6KodPamImeJehfKSAPlJt8ofMyr1C5e6MdZVPabFzo qURQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734451204; x=1735056004; 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=bzvtuvy3Ex7R0Wbm20qlm7V4mOErr3MO6bDVmFxs8QI=; b=TkK8MbpUHIC5n4p/aL9Re2wC959eNDXXvOnSiABgCyFlYokTNYeB+I2ILLNSsRyNry 9ssuy+6DfYijUKDd+70EsYH4ksilCJw9lGaEbqK9Pc0yzuE49bm6ga9fgR4EuDhuiW1j tPHALcTyX3OpEH0OggiZvq/P3yDSggpmF7TE+AGWcEN/vS2b6U7bn2xqQznwu4cOb05j QIsL0y6bnmEu7pi8YCH/HR0bBS6FEXiQuPSUcpKL2w58Ty0wXRw6dMcmGuWw0bMlyufX Vb+8vOXFskNXeKSDS5DjQXCYwO11wSQug4ygscwhwjl2BmacXqvIFoGQN28UvELYShOL tnrA== X-Gm-Message-State: AOJu0Yz4nrPpVjIqnD3b4J2kTPNTl2S2YL5aX1eX5a3z83Ao+i8liKKJ LSpzOGdfE8V+nxGrGpFvZtH8RRvL4k7X5Wj8ClM6EkTtULYk4Puj/OHFkABYczZkTzl+X/JztsR d9Jo= X-Gm-Gg: ASbGncsYUXJBHWdVST3hVwyX5JiPBlaUNaux8/PhZTJ8aUK/n+GmHuh8/ihtf7mWkzd l8QOb4OzddnJndnysTx+Q4H1hMBpG214WUNl0TTGa8a6WheMm481os3BHJ41v8pgsD2pE46xNEh US146p2fPs0IPPfj794n1n8lj+Nid1prrWsMvUuDIzvkdAzUqNTAn+IY3Rcfe61Gvx1iY36cKeU dC1oGs1uVgbZzvRNYLZTcarrV4cfMF4dq6A/INnZx9Txlh8to7fNCBKTfm4R6jIeQ== X-Received: by 2002:a05:600c:3ace:b0:434:f7ea:fb44 with SMTP id 5b1f17b1804b1-4362aa28778mr163557245e9.14.1734451203621; Tue, 17 Dec 2024 08:00:03 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c801ad9asm11390181f8f.58.2024.12.17.08.00.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:03 -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 , Rasmus Villemoes , Sughosh Ganu , Christian Marangi , Evgeny Bachinin Subject: [PATCH 1/5] common: board: Simplify array with function pointers with CONFIG_IS_ENABLED Date: Tue, 17 Dec 2024 16:59:32 +0100 Message-ID: <73f839b31900ffadcea27a6d58bd9ac5d65a9f1c.1734448827.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 Tue Dec 17 15:59:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 851423 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp432345wrq; Tue, 17 Dec 2024 08:00:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV7U9CWFlml7ZJINm+8O+aWE7CXjkVr4TCwzuAAPadiGfAM4E+ISlhKW6zvCrIKz+9o4PLzLQ==@linaro.org X-Google-Smtp-Source: AGHT+IHPfqEmj3W88J+1tkEbaGOye79pwekRZIIXtF2Jb0wZsRP54QyVLBH647GsEV5jZNBBS3jP X-Received: by 2002:a17:906:4fcc:b0:aa6:5910:49af with SMTP id a640c23a62f3a-aab77909ed6mr1664490666b.24.1734451226867; Tue, 17 Dec 2024 08:00:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734451226; cv=none; d=google.com; s=arc-20240605; b=aqd8CfgZ+tXhV/VAJ+SkeAaQWFCuZazDA/KK04pFfZA/IJGM+rUIOe0+0rnDbzxLiz X1MCIUatipqatjH0+DX8vFq5VW4YFjOpj2DtZeBmQcmheDxrxFrj142Y8mxwXxelqwSL /ubaVZFCu6fI59ol1myuGck4w5ZwzHagQxpATKxjBzYVIGwwo00mIbbPm+x4cnebFJSy AqIm2oqWPmujJBWgv3rxQkD7yGBmcZDVyYY2oe8b0DMuyCvZCrFn7bZa7CXeDiHdcOjw parIetpYqM0Vfgc2lt2RmHCslN/kBNWc0rYKtN6qXA+g7xcmc0hPswPu/qXTbntguoxN DExw== 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=yT2rj/WYoAY5tdlzxAsfm5J7Y/QzQwwoHMWZAc/nufM=; fh=7T9U8CxT8/pi4VxDQB+ogewXJ7jd6DKe4+xLsZpalAc=; b=WrfL4DOoM9YPSOkEgBdmbOlXAKu7OZWzEkVHrVVdQdkDS9jmbXqhdk2w41ETNw8uSt E82PeNUrVLRAmgQXl4HjltTMkYRmyvI7rW2acyHP+qVoH05ykyjV852gebE2R4jUHO2P vM+kPUDN6ikiug6P2rhxmsGQUWodPg0a0+Ow/WfY/46IqPbGPBliXGlhCfrD48LErW4n FGTVsbKT413fc6RPZsbOrTNhRYMgRSFpmGRu3NXe3oKTlZH248z5w8Ljiv/dqQ5hKoGj Yt+a71r0Ex1nUyJIMjevTs/064JsjiB75TKSZ35x8uheW+d+WlcZtqc5U7cu50iBpDVV 8yzg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=onCpzhug; 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-5d653011ee9si5189885a12.616.2024.12.17.08.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:26 -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=onCpzhug; 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 1C6F6802D5; Tue, 17 Dec 2024 17:00:11 +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="onCpzhug"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA65E80250; Tue, 17 Dec 2024 17:00:09 +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-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (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 0E3FD80107 for ; Tue, 17 Dec 2024 17:00:06 +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-x332.google.com with SMTP id 5b1f17b1804b1-4361815b96cso36796135e9.1 for ; Tue, 17 Dec 2024 08:00:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734451205; x=1735056005; 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=yT2rj/WYoAY5tdlzxAsfm5J7Y/QzQwwoHMWZAc/nufM=; b=onCpzhugS2QYQWda/SFbxg2xxfmlFvIVpKaz9fui650q/JTYTHfev8uoe9T06jNWMF S2YGDbgeSLVos0aKep0L8/y6L40adxHNujvLBANuLmqEKKAHUZ69lgbx8664lzORmcqb 0PIBgyU9iFPuDOl2satc/5lCaHpB8WGDIEtuxsYdpb2ap2OOuCtqV15R+G+jUvFGJW5G OwMkJrlx6tAmTYQ70myW3KbnOw8JzZbBJUujtyLK3RrmtZCVQt3eETfe+9NAGuVUYjXx Kz4ibErUEbsl4z/L6J7MmMC+UeFoNpMHZ4FbZAU5ozhUKu9FckIoiiTUgTOPtUO/6uC+ lDpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734451205; x=1735056005; 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=yT2rj/WYoAY5tdlzxAsfm5J7Y/QzQwwoHMWZAc/nufM=; b=VVbczZXUoygXrB6hOHsrP3BVUCQ/oU4Z2KdcwlRwPXWhirg6cjwdy7FbVTUsrz5Mik tYMdj1d9OFFf90kfpvRWlqcDYlK7zNiVVJiCKdpV18un+jpT5Ucx0PqiSqOjXLwBqRZv YRhqbySmuiInrX/z1rDyi6pC4OHYAjbMXvY79df0rhXI4iKoi057FItX0UShq7/aMMLb TtUGm8MuGPnsnHTIia9ZYArewuFAx54k+njXg5o92Geg0yUSx3AtfnLv+M/L/69hVRJ9 zodhBolNg2QvFVMEx9sDtDFU+Ba2srSJitpR8Zc8Wz/m/3zfVMUo9PRZz24cRB9A/siv 3VDA== X-Gm-Message-State: AOJu0YyVXMjuNJ4aCYUMVgGc+Cu9f8fNu3xaApdoLCe9Pa9BipcoAmoW ESCepfd5C0Q2Br/fHvHxQtqzjZDmU1sC/i0lVwhgXdb4nCiPfsp1NAT4SSqPQ05FqZvldlK5G1R 2ASk= X-Gm-Gg: ASbGncuCKBKxCNICw2n10dmewMXfVk2JGTGbhEtwjM4o9NZmwy8v2dpY2B6QGR1Ibk3 za3j2qk5MUpuE81/c0bEvijWeXoRlAjMeQymCuRFWiLAH1gbXd0Dq1q973UneGGbvP8+0Hds4+J l4aJegbbjHkq6vzKgZwn/X17MwZETBOGdvGy3QE0AYzN7d1SMPifyX37MqO4+dSzHvnUECCu97c n9hjdJ235sDIJrRoKFrOLVGSEcsK3ZAu18bTaJ629OBRJkEDOAoV67bCgm3uS+tMQ== X-Received: by 2002:a5d:47a2:0:b0:385:eecb:6f02 with SMTP id ffacd0b85a97d-38880ad97cfmr12875004f8f.28.1734451204926; Tue, 17 Dec 2024 08:00:04 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c801ad9asm11390181f8f.58.2024.12.17.08.00.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:04 -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 2/5] board_init_f(): use static calls Date: Tue, 17 Dec 2024 16:59:33 +0100 Message-ID: <3fff1720f52db5929f46666536a7ffb73eaf45b4.1734448827.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 1184 bytes less (-0.11%) - With LTO disabled, the code is 592 bytes smaller (-0.05%) - Execution time does not change in a noticeable way Signed-off-by: Jerome Forissier --- common/board_f.c | 167 +++++++++++++++++++++++---------------------- include/initcall.h | 25 +++++++ 2 files changed, 111 insertions(+), 81 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index a4d8850cb7d..ba1af3d8055 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,62 @@ 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 int initcall_run_f(void) +{ + int ret = 0; + + 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 +939,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 +990,12 @@ 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, -}; + return ret; +} void board_init_f(ulong boot_flags) { @@ -1000,7 +1005,7 @@ void board_init_f(ulong boot_flags) gd->flags &= ~GD_FLG_HAVE_CONSOLE; gd->boardf = &boardf; - if (initcall_run_list(init_sequence_f)) + if (initcall_run_f()) hang(); #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \ diff --git a/include/initcall.h b/include/initcall.h index 62d3bb67f08..72faab42ada 100644 --- a/include/initcall.h +++ b/include/initcall.h @@ -35,4 +35,29 @@ typedef int (*init_fnc_t)(void); */ int initcall_run_list(const init_fnc_t init_sequence[]); +#define INITCALL(_call) \ + do { \ + if (!ret) { \ + debug("%s(): calling %s()\n", __func__, #_call); \ + ret = _call(); \ + } \ + } while (0) + +#define INITCALL_EVT(_evt) \ + do { \ + if (!ret) { \ + debug("%s(): event %d/%s\n", __func__, _evt, \ + event_type_name(_evt)) ; \ + ret = event_notify_null(_evt); \ + } \ + } 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 Tue Dec 17 15:59:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 851424 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp432497wrq; Tue, 17 Dec 2024 08:00:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWOxBmr1aYHnl1VXViX2bl/LnIGps8IJBvomgAOcqUg0EXKElREgESAslz8Sv8PKV9ISWU5cw==@linaro.org X-Google-Smtp-Source: AGHT+IEV6f6oLt+9BHaBi7r6QYjfK/Da8H+vPAOejExCPAgxDidI+QxenkbLSi0SVBCS+2i2YPkX X-Received: by 2002:a05:6402:2787:b0:5d2:60d9:a2ae with SMTP id 4fb4d7f45d1cf-5d63c3bec23mr15231862a12.33.1734451237785; Tue, 17 Dec 2024 08:00:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734451237; cv=none; d=google.com; s=arc-20240605; b=KZuumehp77bJF+PCc7gUnHkWQLfRtpHcYsvJdqDoDJdREQz4BLWPVFmfoyUa1zsmH7 EWuxFFuorVFtr9x6K/ROewELtALetjbrM/XmOj2iZUKkJnqMLNThOCg9tZa77degPK3D NzMqzpWujIrAcVt7qiKPFnHJbIFEkJA3ije6nEewK9ZLD1Uyg6u5c3VjTz5jN8EYi2Ip 6qyKMiWwk0ckUIbpHO2joSaYm8aMoaI7Pl9kZUnENboCKPTuq141/53ju3dtoy4peVfr yhT6IUv9SSzQrhjC5XOl3urkGb5mhD8N0uYM1IvBGneiQlLNTCRYFZTFtMD4FP9//OXL 3eGg== 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=xidtNStbnwE+v0UOCwnLkOTG7ANuPpQ1sto+3K2OWSQ=; fh=7T9U8CxT8/pi4VxDQB+ogewXJ7jd6DKe4+xLsZpalAc=; b=LT6jXSDFrYGxPQTyRE+bEQ45cua0PX+AXCWGG4lwhmbTXArtZNWk1Ma3nJtkczzPtv MiaZ7/gTtZWC6n2mhflvSLoSYccd/YJLLuQt1z+Vb4qDV0Aoo4yRnmKNARohfZf/NWdG eHkx8/ijaEPfo5w00sjpIsF9ZuKeTa9fLJDZbSct9JnJ8+vqB51BaqIh2kmrX2UzutGb ewSm043xC+xMXy5AnQTBY3Mz0xkh4S1EsAPe4Ms6dKrf9NQgZK0VlM/we9lQGd26oRQA 8EP1disIsx/PB+boWrwgMbLkdVz1g13rtOADXMjU0JxdHQOs4k0b4VCh+bx34RYRMtHl uA4g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UkeJJstP; 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-5d652add9c8si5144983a12.128.2024.12.17.08.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:37 -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=UkeJJstP; 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 7FC408022E; Tue, 17 Dec 2024 17:00:12 +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="UkeJJstP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CB74380239; Tue, 17 Dec 2024 17:00:10 +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-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (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 080EC801CE for ; Tue, 17 Dec 2024 17:00:07 +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-x333.google.com with SMTP id 5b1f17b1804b1-434b3e32e9dso59750915e9.2 for ; Tue, 17 Dec 2024 08:00:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734451206; x=1735056006; 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=xidtNStbnwE+v0UOCwnLkOTG7ANuPpQ1sto+3K2OWSQ=; b=UkeJJstPweJLnImidwZNCP1besY23MLzSuJQUdgegA7irVoRz4GvQHQz3aih2veHSS nXK338tthcMBPO5apeQql2gl5dzGyaCQSXDWVFWfaielECJVrhrhkYR7hKwCrL6mS7Bm /iNjZrbFwDBFh8lmIVFFcQ+pwWcRJ8Ub/GD1lHKj3j4QsIq1KBez/9vgzfpKJYl2mNYP plnKI0E5ZN7EMn1RXz3GUkEiTJFd0GBWXdKb7aWR3yI2aR/FUX/f7dF0VQn70d6/uYaa wueF73OJ2Z0a7dgHsrA1CrC5tJCbkCTDmJhb3AwKkWpj2sCnP8zDQUnnO5tE30wAjBfI bLsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734451206; x=1735056006; 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=xidtNStbnwE+v0UOCwnLkOTG7ANuPpQ1sto+3K2OWSQ=; b=AEdBqFNI1tR9yc39XI/AGcp64QGZlHLmCF8luwR+e/8jCVKKFIh+K0GCLpfgAdn1Gy UePnsMKk1mn4ea5jZIjnUpXdYvxACg26kZEbEsNhxFKPvnk+Ue6AqtC5gPv4tHhigoCV foO+ruqdb3vuZK4yMc72Y35cICrGI1C0rNI4I+kZGyH1Vzh2Azlmr+eMDvYV5fKAi4+F rI8o6MPZt9e+f8Md29d4ePcklEcMpTV1l08ThXAd+1HOcVvLlJ54irONSzsTV5i223uE 4U2FSgYbmDSTN1gquL7DXYmCoXyRtyKsViAhd7FFHnu0z/eEB9Q8GRoMSnFXj3WiZqhE rOhA== X-Gm-Message-State: AOJu0Ywaa2IeX8+4hlbxxxjFrIX12xF1vutdXZIfQ+zDwpq30PAy+99z BHVqxo6YPSf39N2xK/k+1VVf+O8LRxunjaXq1m8wPyfa6259Vtji8NEuZc7WO/rwej0CJ3+Z158 Y9fc= X-Gm-Gg: ASbGncvdE4cL2RtZyCoUYq2JOofNePOzFBq7E7iu+GWBAYy8C6Giu4UeE4mHNZFMgL9 vo1feDdjJyuRWQt8fnSK3Mi96unn5+J8u+IGqoyaEsjV1blGSLFrh6kf+oQlS8+cAh3Jy6qQCLF T2XWbxIbOKt99TK1lBN81P7dVc4BQDwRGBsfNWcOHdOIy6vBcoM8CBQn4rd61tXnRmXsqPpsLd9 2QvAOJBw6yzj9DmeK/ntztF3CAcccyAeMyLTNil1v8daHpE+RzTUSIJVKrQtU8upA== X-Received: by 2002:a05:6000:1846:b0:385:fc8c:24b6 with SMTP id ffacd0b85a97d-38880ada79emr15001870f8f.27.1734451206067; Tue, 17 Dec 2024 08:00:06 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c801ad9asm11390181f8f.58.2024.12.17.08.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:05 -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 3/5] board_init_f_r(): use static calls Date: Tue, 17 Dec 2024 16:59:34 +0100 Message-ID: <0adfb649adecfd0b11e764342ca22ea0ebe438fb.1734448827.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 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index ba1af3d8055..b2c83af943a 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,17 +1034,18 @@ 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 +static int intcall_run_f_r(void) +{ + int ret = 0; - NULL, -}; + CONFIG_IS_ENABLED(X86_64, (INITCALL(init_cache_f_r);)) + + return ret; +} void board_init_f_r(void) { - if (initcall_run_list(init_sequence_f_r)) + if (initcall_run_f_r()) hang(); /* From patchwork Tue Dec 17 15:59:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 851426 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp432823wrq; Tue, 17 Dec 2024 08:01:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWSSu0rpqF9ZkiXmO7Pi8kREpFgGBC30Z112ZAEj+JSrHi6qCl7a5oG8i3Rx7IB/ucxVPxsvw==@linaro.org X-Google-Smtp-Source: AGHT+IFiVU/nFJCSm5cluQJS8rPcZpUwA1zGTLFuBhwpbYJk3lmXgv4Q//08udWivGI0Vh6b9sQM X-Received: by 2002:a17:906:cb8d:b0:aab:9535:47cf with SMTP id a640c23a62f3a-aab9535481amr1155579266b.56.1734451261001; Tue, 17 Dec 2024 08:01:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734451260; cv=none; d=google.com; s=arc-20240605; b=IRaR3CA9jqLZKWkMYskDoCvIARtotOryTwWo0YxjE3SQ4gnCraa7tSFMkISoKYIfhu M900pBYCXV9YLuHuUZwEBDYZgrfTNJR6jyAgXZyVeVe3viQ82fPFiKtRINCDYf7AOkwl La0fLDuVGTmN3WR9+iLbNhKedanvqzUFkfJpV6u/LdXCG7DHACy6+vVbttgRDZOWo0W3 tgXFgPs7FPpVaYykebqHPD/l0SILmA2tIwpPfs3yM/IUbhtVKMQv5JPnKX7F8OW4/foI FMejpNWlGDoWa6LkwWbMjnbLyCozI2zu+P2FZmZ4wkV17jINCBL3E47HYPV4WNQbsyZR 93vg== 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=Aq4WuncKKljg/pggdDuRLbKvEOhV5Tz1Mt4QJiNvWW4=; fh=EL7U5LWB4MDSGJLvR6xwxNfVAh/sQaOAd0REse5Vwf8=; b=VKjQsYVG77UrhFnIpQRrqPA6B+b1FvbzdMT63wyJZ7azr/mZF8FAJp5IApqai1YpLU Toy0D+V694/kzZzV9QYOwQc7w5H/67pC13wghj2aIaB5Q/avz6B56VukdeCQfSQ/bUJa DTS/CA/IZ3QNDFnOPWRahKfhufiPopwrwwSJ6JoDNVDDzaEm/d4eJkkyQGhHQsGY5Jmj WBqj/ajQ7FibftPFKZVAeL4RFPST6HsomqRUdXl24HHd6s0L8+aLDJARZuLBB44w+g8Y beNkx/wqs9q+03G9rDMC3fMQwsEeItOI+Zk144qV1L2eFLo7ZwKgYqYdxvgfVa0aYNqG dBVg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mrMAuEcT; 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-aab95fca285si481542066b.68.2024.12.17.08.00.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:59 -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=mrMAuEcT; 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 4515F80295; Tue, 17 Dec 2024 17:00:15 +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="mrMAuEcT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 272F38022E; Tue, 17 Dec 2024 17:00:12 +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-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (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 466BD80285 for ; Tue, 17 Dec 2024 17:00:08 +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-x432.google.com with SMTP id ffacd0b85a97d-385f07cd1a4so3779334f8f.1 for ; Tue, 17 Dec 2024 08:00:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734451207; x=1735056007; 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=Aq4WuncKKljg/pggdDuRLbKvEOhV5Tz1Mt4QJiNvWW4=; b=mrMAuEcTZSQvaG07eWe8bX7qDTCkbq3XKWfzM48Zw8+20LaO3zQEtIEEnwg6wkbPPs v4VscQ9Bh/Ogek0eVNh4fRN3avZTYWWz1eDeILqzNLhUYv1hm0VD+PfMe+e+wUrIeWAI 7N9N4aTOltaEzAGiyWhaVWLAq2j3ur8XFJL0xCi1F1vB4+lvKJMlC0WWbjVeVQe+W8B0 SBO8GDwL41YEdh0AqEa4W/OG7TfusmSMxkTXFHfJ+lq9XhH5l8zt7LBY3aJIwvVXn3BG LNWr4Aq2eKqifMj/vfZrH8kEBIdS9V/U0KbAdx28nC5cIDgg2VX1EXR1jczWz/9uW+h2 3LgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734451207; x=1735056007; 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=Aq4WuncKKljg/pggdDuRLbKvEOhV5Tz1Mt4QJiNvWW4=; b=aRIosMVs7lPccrucIcMZbKjEC/y9SNuSuejjQLT3Td8PYUGaAVCaGiHxcaV4ffvWk7 qE3eFWoAoHo5aNnaAnUvqVvaj5qlb+tuVsl35a9xtpujiZEZ+/3qQnMrxYx+PlLA0SUc rg/Pvy5ip1V2BOEijJnJI93QCL8+CzGe0nxlSo16n/gq5Vwk9TsXvJJpV+DJJHIPCvI3 FQhEiXbZxtkOWLpal/qm9RSO/d3LqgoxXeOB0xGUrqAhB5wceUdLeq09EwymxMon0hW4 urW+MZrTT3V2ERZdAxWfmK9eEQ6Zsf2tOXxNV/RAZdOVdKAjrleJw26hdrU3kvtZ8u0h MZ1A== X-Gm-Message-State: AOJu0YzXZX+vY/H5/qnHSw5SiEM5HseK9g2fWaJ7P73wLtgA+tX8wY3V a6sFnzyNHwHyXtj/Ee5CY2stDf3Cquldou9WdUGBNYT4fAQb8k34M0gPmyWCWf/F1itM6/d4mAq 865k= X-Gm-Gg: ASbGncvyjndQs2tVLAYvd8f4wLsal3ykRyzKso96uRW3T9rNg+sUs630MouOhqfJQXW PRBl2Ik+gb/nELUxZKh2DeeeiCHyQTEBIDHrXL4a7kLJt9xHae9lpUgipeb79MLhN+k1400+uad uUGXKG8CZpXdmulp1vAwlptG6BRN0/x/lONF26BBD+9ewbjHWyKzWBmDbaBQ6dlf4Ua4o0EDf0u u2fYU4rrowqiuVguMc9DEmkw8TvOOcpSFrJRWsmiiH3H0scpWB744v30QMNAHearw== X-Received: by 2002:a5d:64a7:0:b0:385:e9ca:4e18 with SMTP id ffacd0b85a97d-38880ac23d0mr14934132f8f.1.1734451207422; Tue, 17 Dec 2024 08:00:07 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c801ad9asm11390181f8f.58.2024.12.17.08.00.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:06 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Tom Rini , Simon Glass , Michal Simek , Jerome Forissier , Peter Robinson , Christian Marangi , Sughosh Ganu , Evgeny Bachinin , Caleb Connolly Subject: [PATCH 4/5] board_init_r(): use static calls Date: Tue, 17 Dec 2024 16:59:35 +0100 Message-ID: <828684c96f74e847d364224042da430ab90241e4.1734448827.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: 85/126 grow/shrink: 9/23 up/down: 19228/-20547 (-1319) Total: Before=1067523, After=1066204, chg -0.12% - Without LTO: add/remove: 0/24 grow/shrink: 1/0 up/down: 488/-1124 (-636) Total: Before=1118923, After=1118287, chg -0.06% Signed-off-by: Jerome Forissier --- common/board_r.c | 174 +++++++++++++++++++----------------- test/py/tests/test_trace.py | 8 +- 2 files changed, 94 insertions(+), 88 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index 19bcf3950d5..db28fc0b229 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -582,21 +582,22 @@ 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 int initcall_run_r(void) +{ + int ret = 0; + + 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 +605,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 +627,93 @@ 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); + + return ret; +} void board_init_r(gd_t *new_gd, ulong dest_addr) { @@ -734,7 +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)) + if (initcall_run_r()) hang(); /* NOTREACHED - run_main_loop() does not return */ 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 Tue Dec 17 15:59:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 851425 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp432652wrq; Tue, 17 Dec 2024 08:00:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVU6TcZEZd82W5WRO+S15dGeQYXXs/lZV9BoihO3rQCkf2uQ3MuhX4UR6hn/5y2qPvpTCj+mQ==@linaro.org X-Google-Smtp-Source: AGHT+IGVJ07FV3Ff9Cu9OCYZEDFWT/OwQ9iT/pA8oJhy5/2f2Ts6uLYWd5rpjaIhqY+voFtXHHsc X-Received: by 2002:a05:6402:26cf:b0:5d0:e826:f0ec with SMTP id 4fb4d7f45d1cf-5d63c2e5349mr16804161a12.4.1734451250094; Tue, 17 Dec 2024 08:00:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734451250; cv=none; d=google.com; s=arc-20240605; b=TRuxhzDy2kLE2It5sv/jm71A7F2hqOPRr22E3xDDjGCsD/OEOxReyI3dPv+x6mSPa9 3bPvM2QHTZkaKRWHHHFx345V05nWIqRH+XTKTGFM3BRS5qklbOkwNH0hOAmFd7ObuheV oPZYcLUwcGEVJMd+x2eIGcgg9P2G8hXcC5Xu5JMdPfEN34kMDQdAbLlUsWEh92aDx4Wt gZy2tRvVn09EM3RAmeWQU4ph7tFYHXuYQeACQUePEKmbMEWCz+evXHWoHI3IHm4ikRXH 8Ce9Q2N/+lHcSGbgh8P/CAQAyM36/T7os/O/RU4Lz3WDdBqM5lSuKkflG2F0yVGQSo5V 35KA== 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=bc5dcGomkTmzvvZyWwHhfntlWLKNrTTzvh9e4xyRGnc=; fh=kV+nLpDDwxLXgL4ZrL9moTa+SBOj1+lGP4nM/ORLrzw=; b=CKsEtMAhsRH8mL0oiDxZn6Axts6WSheDoR/BxYxBBZ7ld1pcq64qOlLHyitSLNbUw6 9VmbC85Sg9OgQSq3z2tCFLOfy0rpni80ljY4RbCDTHtsDY6ctdykLpSijttNOoCe39Lm OKpQq01ZirAXzozvrmrgsJPJcA8p5IcTPZNTJHuADX4m11ZjKmQCkueaCOdsQWEmLpOg 41hI6Ew/d/3qWmz09HdOTEaB1dB4e866o0eGpDzU8F+UIZGyeV/DvIkMXySgIH1YY9DR 4O3eqBe5ZW61nt3hUOaPZF3mOd+BhAGByRW4MJi2k8QOJ1/UyI2OKeRvCe0DsT1bljcR hm6A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d84CpowW; 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-5d653011ff5si5206889a12.612.2024.12.17.08.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:50 -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=d84CpowW; 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 DCA20801CE; Tue, 17 Dec 2024 17:00:14 +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="d84CpowW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0E2C180274; Tue, 17 Dec 2024 17:00:12 +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 83AC08022E for ; Tue, 17 Dec 2024 17:00:09 +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-4361f65ca01so53714645e9.1 for ; Tue, 17 Dec 2024 08:00:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734451209; x=1735056009; 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=bc5dcGomkTmzvvZyWwHhfntlWLKNrTTzvh9e4xyRGnc=; b=d84CpowWsc3zc5QalMgPAGdXv4jOKrsGWkaEmaA7Cp2OQGagtq6r2/awldIATOUneJ qznUsCuhBfX96E91cFG8HDfuQIIn0zhdOvBDxOnTCWE23eAq6Z72e0Yh7PhBtIqUDfWP KEkd4igL+R6YT6/jGdfZhSOOwMNDqJQt2CLl0dz9+fGV3IYLCbzhhfan0sFTKIqy3LEw htL7sTL6BkDG/Lqj9uwCkb16NYN7M1l38OuyQfhGC0fgIQ5jUBLx4LT7s3NIOlCUE98N F4wtfxHjD7ESolYCZYsS4VE3gV5SNZ/qrB4K3bfiuXxvg17uGkgGqJu4STlRaeODDm2a FT6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734451209; x=1735056009; 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=bc5dcGomkTmzvvZyWwHhfntlWLKNrTTzvh9e4xyRGnc=; b=l3GQo0705N+ndDoTOS8MyFG8UgFJwoByMcZs9hyA8P1D8Bg7n4JV202HH+a5ian8zb +0RncKHnfN/LHfbhkCia61gFjClSNOBuDYhfzmwqKWUoDtmiwlLB3fYCBEYQXsHBxYPo 78ghXxaCZZGmKZym9W2q3Hxn1yTQmqW83JV/ytMXZI3kW3plrE+uKZ2h8ltDfQl9aLPL PFJ6rMWVbBXS7HMw/hc21nNvz8dqKsG4+QktiUPi6/WlQAfd7dt9t+F2uUPXyB/M6sfa liyh9E4+jSUpb52ozINtyO7deP2TxSMkI6k5i8fcdtk1mP7HPy4R7HpLpaF3RkNhHy8e 12LQ== X-Gm-Message-State: AOJu0YwIRxFr4G+Nh2ah8qn4Zaf+sej8IebOnoytAmXEGVxPSJTkJ0V/ VKCAv1IdhJLJlbTnrImr+RhFlOjMGgrZo+bY+KS9a7pgBhpXivzXhNTFi2i/Aw4BcABkoY4ExUz bQF8= X-Gm-Gg: ASbGncuXakDY8RaeNAefVwGyJzmE5tPt5wtECV1hAu/n/5tTv0bB03Xrikf5+vjGSVX 4uJmzHryhbN0p6jYFHjimKHHVlJv6JCMvS9UJbHEADD+8MmBhZxdc/vGobI7x+Y4kJNOfPZPmjs pgN7BXvp0QBk0wDaT4/bUAZCfHpmD9R/4SxJwMKYLeQyvb37H/L+SYh9h3dn1TYFa4Huey9nhpf bkgg5GaT6dmW12DIW07k5q3w9IueukQkj7hMlG77Aeeg6/BQAoKGDA+r0xxHPI6Og== X-Received: by 2002:a05:600c:1e19:b0:435:1a2:2633 with SMTP id 5b1f17b1804b1-4362aa52c65mr164849365e9.15.1734451208693; Tue, 17 Dec 2024 08:00:08 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c801ad9asm11390181f8f.58.2024.12.17.08.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:08 -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 5/5] initcall: remove initcall_run_list() Date: Tue, 17 Dec 2024 16:59:36 +0100 Message-ID: <164daec366a7ad0e7c7a16b3d713fc1905a53125.1734448827.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 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 72faab42ada..c47a0410197 100644 --- a/include/initcall.h +++ b/include/initcall.h @@ -11,30 +11,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 (!ret) { \ 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; -}