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 78AE6C77B7C for ; Wed, 10 May 2023 23:07:16 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1686785D8B; Thu, 11 May 2023 01:07:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="cUJrKs3G"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 317C4860BC; Thu, 11 May 2023 01:07:12 +0200 (CEST) Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) (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 AE18B860A4 for ; Thu, 11 May 2023 01:07:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-yb1-xb35.google.com with SMTP id 3f1490d57ef6-b9a6ab9ede3so9940211276.2 for ; Wed, 10 May 2023 16:07:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1683760028; x=1686352028; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=1BVw1FmdkqygWrvth9ZY3Dcy44eLDWvLGmA0wQ7QlM8=; b=cUJrKs3GGQ2iinBg7ZD4wXms21Re+izBLD2lBUTFWNv/9BIQ1kcLsxPvZZ631gHnY7 DYYauPkY/IOOUElZ3mK0s40OgoMrwaOKF919YZctZzf+SQVGF1Nr1qqnLKAWbEtTHOIa 6YOQf3jzNsNPTMTN4FV05ZEu1/GWTGMLU2Cec= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683760028; x=1686352028; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1BVw1FmdkqygWrvth9ZY3Dcy44eLDWvLGmA0wQ7QlM8=; b=VeyAvosJU7Tz2uPRBCnnrncdduVuAVm6CfNYn/SeeU5LV2YAXTWvOg1HKiTBkzN+L4 mxHm6L8HVwx7RxXczODAml6eMa1qFootBfXrrObG6x1TuFIzDhvZL2cP0MQpluEVGuky i+xa+dxsM6VfKCVj9uO5XSm+pKb6oh78wctAQpG0ycIdw1o6MVXhYDbQimsux5pVQkLn LtqvQRs7hKBUCnLXa1iJdym4eKrhmugZedAO3z1PfbLwZuPcMIntxqORMVv6GwaVTvcC DRqOdR2Yol10dz0GZ0w7yQ+5Bpja5R5eWl/ZGYpkwA0kkeRe5U6sIu9W2Vj8DnSd77BA xKyQ== X-Gm-Message-State: AC+VfDzxwRm1BMKF0hzYESzsKWF3C6/D2TPn2UfRnbmMcwD8UIv8lF8z xSwB65/Hvji/RupgG6q5t2uWKQ== X-Google-Smtp-Source: ACHHUZ54P8ZYD/l4ln3a227cW2C/sv13MEatFrVIGlZL002bstOXv9t+ylDPzga1AhO0o0k2K3jZ0A== X-Received: by 2002:a25:ab81:0:b0:b9f:2fc8:d3a7 with SMTP id v1-20020a25ab81000000b00b9f2fc8d3a7mr17549786ybi.63.1683760028374; Wed, 10 May 2023 16:07:08 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-238a-0d17-77d4-33aa.res6.spectrum.com. [2603:6081:7b00:6400:238a:d17:77d4:33aa]) by smtp.gmail.com with ESMTPSA id w6-20020a258506000000b00b9e9286f1e6sm3932625ybk.55.2023.05.10.16.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 16:07:07 -0700 (PDT) Date: Wed, 10 May 2023 19:07:06 -0400 From: Tom Rini To: Troy Kisky Cc: Simon Glass , u-boot@lists.denx.de, gary.bisson@lairdconnect.com, Andre Przywara , Bin Meng Subject: Re: [PATCH v3 17/23] ns16550: match when to define bdf with uart code Message-ID: <20230510230706.GP2398826@bill-the-cat> References: <20230313213146.1775650-1-troykiskyboundary@gmail.com> <20230313213146.1775650-18-troykiskyboundary@gmail.com> <20230510204100.GA1757833@bill-the-cat> <20230510204929.GO2398826@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="DY5IVKoLZiXzTz8d" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett 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 --DY5IVKoLZiXzTz8d Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 10, 2023 at 03:05:38PM -0700, Troy Kisky wrote: > Hi Tom, >=20 > You are looking at an old patch, here's the new. It was the new one, sorry, I just edited out NOCHECK at least for now. >=20 > commit c969bedb9cb6029360e6fe7e25a331680fabe3ee > Author: Troy Kisky > Date: Thu Feb 23 08:01:46 2023 -0800 >=20 > ns16550: match when to define bdf with uart code >=20 > When switching defined(CONFIG_PCI) to CONFIG_IS_ENABLED(PCI) > bdf is no longer accessible. So add preprocessor protection > to avoid access. >=20 > Series-changes: 2 > - 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 >=20 > Signed-off-by: Troy Kisky > Reviewed-by: Simon Glass >=20 > diff --git a/arch/x86/cpu/apollolake/uart.c b/arch/x86/cpu/apollolake/uar= t.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) >=20 > static int apl_ns16550_probe(struct udevice *dev) > { > +#if IS_ENABLED_NOCHECK(CONFIG_PCI) && defined(CONFIG_SPL_BUILD) > struct apl_ns16550_plat *plat =3D dev_get_plat(dev); >=20 > if (!CONFIG_IS_ENABLED(PCI)) > apl_uart_init(plat->ns16550.bdf, plat->ns16550.base); > +#endif >=20 > return ns16550_serial_probe(dev); > } > @@ -110,7 +112,9 @@ static int apl_ns16550_of_to_plat(struct udevice *dev) > ns.reg_offset =3D 0; > ns.clock =3D dtplat->clock_frequency; > ns.fcr =3D UART_FCR_DEFVAL; > +#if IS_ENABLED_NOCHECK(CONFIG_PCI) && defined(CONFIG_SPL_BUILD) > ns.bdf =3D 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 > }; > __________________________ >=20 > It reads as, > If the bdf exists, then if spl var PCI is not enabled, then init uart. >=20 >=20 > The PCI code will handle it if PCI is enabled. >=20 >=20 > So, PCI needs to be enabled, and SPL_PCI needs to not be enabled, and > currently building for SPL So the case is CONFIG_PCI=3Dy, CONFIG_SPL_PCI=3Dn and CONFIG_SPL_BUILD=3Dy? That's what the code needs to test and express clearly and likely with a comment. --=20 Tom --DY5IVKoLZiXzTz8d Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmRcI5AACgkQFHw5/5Y0 tyxk+Qv/R2EdJHIhYheRh0mhsAUhScfajZLDp9cgwrCdqPlJiVPIHHng1ySIdmR9 hOafAG6nKkE47FE2yyW5YWadmdT8y2/Vw0/ReJd/X6IJC2t293fXf8XUDeDqDMb0 xXuDSjxbZtg0wg2YeNmniI6Na314U7D+2bmg6E+ClISKvi7JEdkoisI1B999Z8vG oY5q/2h98FV/w2X0rEqEio9/bLWk6dLwXgb9cP9XBT/13d/lRDVowgM5FPFa+Swq PPB3IJIGmVHIQrNv2ARzkvqT6HzAX6/4KQfY4zjpaVfhLF1eikKNzCoy54cyTteY 8GAdShb4ubUdyWLyPYxxFnKNT5QJRmcTZuBEPmEXNQTOaPgs9RtXznp/L4f4uSV0 wO2oGpZ1hW0/7RLQ5pEc2UxmHd/1enVYOdAV97OMm/BcUcApE65TgS9PMVKsWdon KFbkQ337G1ZU7o1tgZAClL+iNakRLnTgRbnkasV95bXVbELBqTOCiacyrEaRPwJs xAxAAXAq =msea -----END PGP SIGNATURE----- --DY5IVKoLZiXzTz8d--