Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFA7CC6FD19 for ; Mon, 13 Mar 2023 21:36:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7E1A08613C; Mon, 13 Mar 2023 22:32:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="SGqVTh7s"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 40F2085D74; Mon, 13 Mar 2023 22:32:27 +0100 (CET) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (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 A804C86153 for ; Mon, 13 Mar 2023 22:32:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=troykiskyboundary@gmail.com Received: by mail-pg1-x52d.google.com with SMTP id h31so7775539pgl.6 for ; Mon, 13 Mar 2023 14:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678743132; 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=fuerZTHyaqERmyUKjpfLjPr4X/6iWRaiXq1zs09E9u0=; b=SGqVTh7sCBgl6O/8DAX9Iy1EuczibNReYQIoa+Ye5jQEI19EtZUjD8Kzmzl4SicgbN BQjeszRd8XJb7rGsSp5vMHwo68/i0T8dVRoLEr46Y46MpDg8bYqBurt1WQSyCJKY5tSD kKDH6M1pjlDlDfzFa5I6gQ3u0X0foI99PmFmv6xKkKaWAByb1oTJRqOPAknDPrOyzTX0 NjeQH3fy1VCP/GsecuDcdQ+acBgmlaXQ3Yg/j1CjAGblgu716vSu+3x2+Hh99ImgEnD/ GnWQXNXsKoK4EI3V/9icos7vbH1hhQ4Ro8XHpVO3GJPVA+K2/30sw6odPMUP/BpZaxoI wNbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678743132; 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=fuerZTHyaqERmyUKjpfLjPr4X/6iWRaiXq1zs09E9u0=; b=cTtm+wX79seWUHY7DuMwIXBqCslak7gttRWIGiXGZveN1YDgoeyuL/spuYfzoflGxB zyuwIkZHDm92Izdj53anbok5wmpZMvfPgR+mAFdfD+WWTWWU/wq8rUUcYhLH5Dj6T/DE c+w3tiBXQZXFij7Td7HvxNz5IKadLXD64r1QUOLUxq4HUE+GKYaBRDw4mDgzPtx7xvus ea1tTYJ7aC/SyvUWOBsugEpvxxweQKl3N6eIaheE2CXnPnGX76KAkqdvj3qYAJoPFZZf mS51W1WmSGnEav3ex/oprn550XBieSrnLeHasKN47lNxpsIZCP8AGm/zDkxOimOdUShb G9vw== X-Gm-Message-State: AO0yUKWUooo57jDpXEODb/9xVR5hLKAP8sizcvPt6LY+eZKNfPBYXKW1 5Yb8Zhi5OWSrRdT1nBL/DPE= X-Google-Smtp-Source: AK7set9xVHcBaQIVCdGFnumbNQDdn8oALDdLeMAE5AX4ixikC4OiIDxnkEhzaIjy7iD6x4hWeDIzZA== X-Received: by 2002:a62:3042:0:b0:5a8:31a1:2f05 with SMTP id w63-20020a623042000000b005a831a12f05mr29524489pfw.5.1678743131892; Mon, 13 Mar 2023 14:32:11 -0700 (PDT) Received: from OS2.boundarydevices.com. (wsip-184-189-120-117.oc.oc.cox.net. [184.189.120.117]) by smtp.gmail.com with ESMTPSA id s24-20020aa78298000000b005d4360ed2bbsm150797pfm.197.2023.03.13.14.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 14:32:11 -0700 (PDT) From: Troy Kisky To: sjg@chromium.org, trini@konsulko.com, u-boot@lists.denx.de Cc: gary.bisson@lairdconnect.com, Troy Kisky , Andre Przywara , Bin Meng Subject: [PATCH v3 17/23] ns16550: match when to define bdf with uart code Date: Mon, 13 Mar 2023 14:31:39 -0700 Message-Id: <20230313213146.1775650-18-troykiskyboundary@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230313213146.1775650-1-troykiskyboundary@gmail.com> References: <20230313213146.1775650-1-troykiskyboundary@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 When switching defined(CONFIG_PCI) to CONFIG_IS_ENABLED(PCI) bdf is no longer accessible. So add preprocessor protection to avoid access. Signed-off-by: Troy Kisky Reviewed-by: Simon Glass --- (no changes since v2) Changes in v2: - changed condition of when to include field bdf - added protection to another instance of bdf in uart.c - Thanks to Simon for getting this corrected arch/x86/cpu/apollolake/uart.c | 4 ++++ include/ns16550.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/cpu/apollolake/uart.c b/arch/x86/cpu/apollolake/uart.c index a9362436000..878aa48ed76 100644 --- a/arch/x86/cpu/apollolake/uart.c +++ b/arch/x86/cpu/apollolake/uart.c @@ -79,10 +79,12 @@ void apl_uart_init(pci_dev_t bdf, ulong base) static int apl_ns16550_probe(struct udevice *dev) { +#if IS_ENABLED_NOCHECK(CONFIG_PCI) && defined(CONFIG_SPL_BUILD) struct apl_ns16550_plat *plat = dev_get_plat(dev); if (!CONFIG_IS_ENABLED(PCI)) apl_uart_init(plat->ns16550.bdf, plat->ns16550.base); +#endif return ns16550_serial_probe(dev); } @@ -110,7 +112,9 @@ static int apl_ns16550_of_to_plat(struct udevice *dev) ns.reg_offset = 0; ns.clock = dtplat->clock_frequency; ns.fcr = UART_FCR_DEFVAL; +#if IS_ENABLED_NOCHECK(CONFIG_PCI) && defined(CONFIG_SPL_BUILD) ns.bdf = pci_ofplat_get_devfn(dtplat->reg[0]); +#endif memcpy(plat, &ns, sizeof(ns)); #else int ret; diff --git a/include/ns16550.h b/include/ns16550.h index e7e68663d03..41b977b5b26 100644 --- a/include/ns16550.h +++ b/include/ns16550.h @@ -74,7 +74,7 @@ struct ns16550_plat { int clock; u32 fcr; int flags; -#if defined(CONFIG_PCI) && defined(CONFIG_SPL) +#if IS_ENABLED_NOCHECK(CONFIG_PCI) && defined(CONFIG_SPL_BUILD) int bdf; #endif }; -- 2.34.1