[PATCH v1 17/24] ns16550: match when to define bdf with uart code

Troy Kisky troykiskyboundary at gmail.com
Wed Feb 22 02:38:14 CET 2023


When switching defined(CONFIG_PCI) to CONFIG_IS_ENABLED(PCI)
bdf is no longer accessible. So change to preprocessor to avoid access.

Signed-off-by: Troy Kisky <troykiskyboundary at gmail.com>
---

 arch/x86/cpu/apollolake/uart.c | 6 +++---
 include/ns16550.h              | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/cpu/apollolake/uart.c b/arch/x86/cpu/apollolake/uart.c
index a9362436000..143217755ff 100644
--- a/arch/x86/cpu/apollolake/uart.c
+++ b/arch/x86/cpu/apollolake/uart.c
@@ -79,11 +79,11 @@ void apl_uart_init(pci_dev_t bdf, ulong base)
 
 static int apl_ns16550_probe(struct udevice *dev)
 {
+#if !CONFIG_IS_ENABLED(PCI)
 	struct apl_ns16550_plat *plat = dev_get_plat(dev);
 
-	if (!CONFIG_IS_ENABLED(PCI))
-		apl_uart_init(plat->ns16550.bdf, plat->ns16550.base);
-
+	apl_uart_init(plat->ns16550.bdf, plat->ns16550.base);
+#endif
 	return ns16550_serial_probe(dev);
 }
 
diff --git a/include/ns16550.h b/include/ns16550.h
index e7e68663d03..8d7eb7d8f9c 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 !CONFIG_IS_ENABLED(PCI) || CONFIG_IS_ENABLED(OF_PLATDATA)
 	int bdf;
 #endif
 };
-- 
2.34.1



More information about the U-Boot mailing list