From 5c39f2c150612e04c0534348cc71e93e43026cf0 Mon Sep 17 00:00:00 2001
From: Troy Kisky <troykiskyboundary@gmail.com>
Date: Mon, 13 Mar 2023 14:31:43 -0700
Subject: [PATCH] x86: cpu: i386: cpu: only set pci_ram_top if
 CONFIG_IS_ENABLED(PCI)

This avoids an error when ifdef CONFIG_PCI is changed to
if CONFIG_IS_ENABLED(PCI)

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
[Rebased on top of u-boot/master]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
 arch/x86/cpu/i386/cpu.c           | 2 +-
 include/asm-generic/global_data.h | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c
index 91cd5d7c9e..8882532ebf 100644
--- a/arch/x86/cpu/i386/cpu.c
+++ b/arch/x86/cpu/i386/cpu.c
@@ -415,7 +415,7 @@ int cpu_phys_address_size(void)
 /* Don't allow PCI region 3 to use memory in the 2-4GB memory hole */
 static void setup_pci_ram_top(void)
 {
-	gd->pci_ram_top = 0x80000000U;
+	gd_set_pci_ram_top(0x80000000U);
 }
 
 static void setup_mtrr(void)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 8fc205ded1..d364f1b965 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -573,6 +573,13 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
 #define gd_malloc_start()	0
 #define gd_set_malloc_start(val)
 #endif
+
+#if CONFIG_IS_ENABLED(PCI)
+#define gd_set_pci_ram_top(val)	gd->pci_ram_top = val
+#else
+#define gd_set_pci_ram_top(val)
+#endif
+
 /**
  * enum gd_flags - global data flags
  *
-- 
2.39.5