Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFD78C433F5 for ; Sun, 31 Oct 2021 03:04:19 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 92B8060ED3 for ; Sun, 31 Oct 2021 03:04:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 92B8060ED3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6576C835D2; Sun, 31 Oct 2021 04:04:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id B8012834B0; Sun, 31 Oct 2021 04:04:10 +0100 (CET) Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (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 790DF81BF4 for ; Sun, 31 Oct 2021 04:04:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=tom.rini@gmail.com Received: by mail-qt1-f182.google.com with SMTP id v17so12976022qtp.1 for ; Sat, 30 Oct 2021 20:04:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=QpBm5LvQBhuTKRsk/l8qtSRK/WcXdFeFbS0tHVCQhes=; b=mItOSIDgCTCaSbdk/PuHs9AX2/ILtW5K6BsltzCDzogZDuH8NXD86QmT0x1Bmr53BK kxxgcJ+UGrry6+AmesbrkyCXZEGKPsIqizUdeL+UVF4zoP80vguPeUd3gsdbvLHXNB+c X+2paTk9PbAfq5rc0Wo5BVr41dHwDFnjptOwwS5S7MWvqHAewSM4oXQx5IOOP+c0NAuh bK1RTygYKfbCFuKFsqemM19TDGTaS2xqZcbv3pamCcZDe9eCWQv05dWXxaY22WqiDvej Dw2oW/kQ+rnU7v/7EtQojVE0/n5E6EXjTGKBBedAba7oe7c2GLEaU682fjiTb/2Lsb6l IRjQ== X-Gm-Message-State: AOAM530bc9TvWqHqPo2ErLF6BPPudm63G+Z6eE781SCB2Z9FiLUpvX7w xbP0IlzrME7Up1skCU0h0wX/cq/8Mw== X-Google-Smtp-Source: ABdhPJwXYDY+T709y30RzyRu06LX5JHUGe8ExMs1j3Jq5683R3XEVCq8nQ2NTkoU/jB2Qy4gLOV2Qg== X-Received: by 2002:a05:622a:15:: with SMTP id x21mr21908387qtw.310.1635649443229; Sat, 30 Oct 2021 20:04:03 -0700 (PDT) Received: from bill-the-cat.lan (2603-6081-7b01-cbda-69ae-7072-bc75-c5b7.res6.spectrum.com. [2603:6081:7b01:cbda:69ae:7072:bc75:c5b7]) by smtp.gmail.com with ESMTPSA id g10sm7565291qko.38.2021.10.30.20.04.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Oct 2021 20:04:02 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Subject: [PATCH 01/10] spl: Make use of CONFIG_IS_ENABLED(OS_BOOT) in SPL/TPL common code paths Date: Sat, 30 Oct 2021 23:03:48 -0400 Message-Id: <20211031030357.1240731-1-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean When building a system that has both TPL and SPL_OS_BOOT, code which tests for CONFIG_SPL_OS_BOOT will be built and enabled in TPL, which is not correct. While there is no CONFIG_TPL_OS_BOOT symbol at this time (and likely will not ever be) we can use CONFIG_IS_ENABLED(OS_BOOT) in these common paths to ensure we only compile these parts in the SPL case. Signed-off-by: Tom Rini --- arch/arm/lib/spl.c | 2 +- common/spl/spl.c | 6 +++--- common/spl/spl_ext.c | 2 +- common/spl/spl_fat.c | 2 +- common/spl/spl_mmc.c | 2 +- common/spl/spl_nand.c | 2 +- common/spl/spl_nor.c | 2 +- common/spl/spl_sata.c | 2 +- common/spl/spl_spi.c | 4 ++-- common/spl/spl_ubi.c | 2 +- common/spl/spl_usb.c | 2 +- common/spl/spl_xip.c | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c index 4f9b84ba3449..b13897495dae 100644 --- a/arch/arm/lib/spl.c +++ b/arch/arm/lib/spl.c @@ -50,7 +50,7 @@ void __weak board_init_f(ulong dummy) * This function jumps to an image with argument. Normally an FDT or ATAGS * image. */ -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) #ifdef CONFIG_ARM64 void __noreturn jump_to_image_linux(struct spl_image_info *spl_image) { diff --git a/common/spl/spl.c b/common/spl/spl.c index 0c08da06e8f6..8bf91b48caa2 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -87,7 +87,7 @@ __weak int dram_init_banksize(void) * 0 to not start u-boot * positive if u-boot should start */ -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) __weak int spl_start_uboot(void) { puts(SPL_TPL_PROMPT @@ -353,7 +353,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image, panic("** no mkimage signature but raw image not supported"); #endif -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) ulong start, end; if (!bootz_setup((ulong)header, &start, &end)) { @@ -797,7 +797,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) spl_invoke_opensbi(&spl_image); break; #endif -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) case IH_OS_LINUX: debug("Jumping to Linux\n"); #if defined(CONFIG_SYS_SPL_ARGS_ADDR) diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c index d73f06276215..6a28fe9bdb50 100644 --- a/common/spl/spl_ext.c +++ b/common/spl/spl_ext.c @@ -64,7 +64,7 @@ end: return err < 0; } -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) int spl_load_image_ext_os(struct spl_image_info *spl_image, struct blk_desc *block_dev, int partition) { diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c index c2eb097365ff..576c2e876adc 100644 --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -112,7 +112,7 @@ end: return (err <= 0); } -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) int spl_load_image_fat_os(struct spl_image_info *spl_image, struct blk_desc *block_dev, int partition) { diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index d52f8a3eefe6..e1a7d25bd05a 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -218,7 +218,7 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image, } #endif -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) static int mmc_load_image_raw_os(struct spl_image_info *spl_image, struct mmc *mmc) { diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index 59f4a84a36ac..8ae7d04fa634 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -121,7 +121,7 @@ static int spl_nand_load_image(struct spl_image_info *spl_image, header = spl_get_load_buffer(0, sizeof(*header)); -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) if (!spl_start_uboot()) { /* * load parameter image diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c index 5270401db034..68c12413fa68 100644 --- a/common/spl/spl_nor.c +++ b/common/spl/spl_nor.c @@ -35,7 +35,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, */ spl_image->flags |= SPL_COPY_PAYLOAD_ONLY; -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) if (!spl_start_uboot()) { /* * Load Linux from its location in NOR flash to its defined diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c index 535a9219efa5..e9f6c5f050b4 100644 --- a/common/spl/spl_sata.c +++ b/common/spl/spl_sata.c @@ -88,7 +88,7 @@ static int spl_sata_load_image(struct spl_image_info *spl_image, return -ENODEV; } -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) if (spl_start_uboot() || spl_load_image_fat_os(spl_image, stor_dev, CONFIG_SYS_SATA_FAT_BOOT_PARTITION)) diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index 46ee4058e766..4e20a23dea09 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -18,7 +18,7 @@ #include #include -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) /* * Load the kernel, check for a valid header we can parse, and if found load * the kernel and then device tree. @@ -107,7 +107,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, payload_offs); } -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) if (spl_start_uboot() || spi_load_image_os(spl_image, flash, header)) #endif { diff --git a/common/spl/spl_ubi.c b/common/spl/spl_ubi.c index de6a63bd2d45..2f2d74a02de1 100644 --- a/common/spl/spl_ubi.c +++ b/common/spl/spl_ubi.c @@ -45,7 +45,7 @@ int spl_ubi_load_image(struct spl_image_info *spl_image, info.leb_start = CONFIG_SPL_UBI_LEB_START; info.peb_count = CONFIG_SPL_UBI_MAX_PEBS - info.peb_offset; -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) if (!spl_start_uboot()) { volumes[0].vol_id = CONFIG_SPL_UBI_LOAD_KERNEL_ID; volumes[0].load_addr = (void *)CONFIG_SYS_LOAD_ADDR; diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c index 3648de349273..67d503026ca8 100644 --- a/common/spl/spl_usb.c +++ b/common/spl/spl_usb.c @@ -47,7 +47,7 @@ int spl_usb_load(struct spl_image_info *spl_image, debug("boot mode - FAT\n"); -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) if (spl_start_uboot() || spl_load_image_fat_os(spl_image, stor_dev, partition)) #endif diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c index 8ce0a09ef3f4..ba4af38a3eca 100644 --- a/common/spl/spl_xip.c +++ b/common/spl/spl_xip.c @@ -12,7 +12,7 @@ static int spl_xip(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) if (!spl_start_uboot()) { spl_image->arg = (void *)CONFIG_SYS_FDT_BASE; spl_image->name = "Linux"; -- 2.25.1