From mboxrd@z Thu Jan 1 00:00:00 1970 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 D6614C6FA8E for ; Fri, 24 Feb 2023 18:15:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CBDB685BC1; Fri, 24 Feb 2023 19:14:15 +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="VCExzbeX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8F46085B8C; Fri, 24 Feb 2023 19:12:36 +0100 (CET) Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (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 71BC985BB2 for ; Fri, 24 Feb 2023 19:11:23 +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-pl1-x632.google.com with SMTP id e5so316195plg.8 for ; Fri, 24 Feb 2023 10:11:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=dHJ1nCLRAbtGJBXn7CTCty+NuOhbtqcGCy8YObMWx3k=; b=VCExzbeXtSwyJZ+HHysxMs617E8o+jHWtZ/VH3Y118hoQDT+ZLlrb7REMOMd0JQOvq IQbtrvN18VI3gPfGg1s4vNS0J/vj4Fdgea4twTIIguh03lltXbrvPEc/XFys3sZpsw2n mW0sOdV03qOf39y0Q0gZ0X+3TFhFMnwrAf7jy5mzykRrhYYzJJ37BVI3H/SlHou+baHg TkeuBAA663E2E8ngmTjMdP9FUHlTBSWtXJ7zbZ+Pbpn4z1sm5WHlJjEOZcY8A/YGJaCv JGBFZW2K0cz1WHg7VEnETjAax4esE1ZVP8IxppA2Th5T1HqBd8lRHo9AwpwLMiMHFKfC XHeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=dHJ1nCLRAbtGJBXn7CTCty+NuOhbtqcGCy8YObMWx3k=; b=MGe1UYHFeO5bfKwPVc+AXkwFxQdwhJIPsRVFI2cKC8EazHEsECTgNFrq6A3bxqdwKi EjywlLrxerF2OSLh++nNZcsZaAnWi5pJh7a4SSqAT9Igcwu/7g4i/cO2hJpXdSO3auOF 5QwUlwiYptqVcL0vv3Pdpfc2X0puiEBcVHpJ6lNgdz8LXsFumCZz2k83Hc2897Zqnwh1 HabqaYS7fy18WM+RtazG+KP4pVYc6mpDxY7iJ2yhAgs+VJqttR4HUoRFWdSOU2A9H7l8 0+zwOLKgZV6dZizntTua71N7Ty8yL/5Q0rDM2Bv0HB+agVp1CSmzdeNfoG/cgp2Pr+0p Jg0w== X-Gm-Message-State: AO0yUKWkTCScILxMuhHhCWgQYuHupcc96kJiIPXSa15ceJncFZt7R2wZ GtdCeha6nDKfdrzHRlceH5g= X-Google-Smtp-Source: AK7set8tncRwsZn9CCTKOfN39dMbuuF4IieKGORnMLkBGc0cfIyI+0oS/9NWBLvdRRg57z9vjbgXBQ== X-Received: by 2002:a17:903:2845:b0:19c:c9da:a62e with SMTP id kq5-20020a170903284500b0019cc9daa62emr3928854plb.54.1677262281491; Fri, 24 Feb 2023 10:11:21 -0800 (PST) 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 o1-20020a170902bcc100b0019c922911a2sm7513957pls.40.2023.02.24.10.11.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 10:11:21 -0800 (PST) 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 v2 18/26] ns16550: match when to define bdf with uart code Date: Fri, 24 Feb 2023 10:10:39 -0800 Message-Id: <20230224181047.2775829-19-troykiskyboundary@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230224181047.2775829-1-troykiskyboundary@gmail.com> References: <20230224181047.2775829-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.6 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 --- 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