summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2020-06-16 11:25:01 +0300
committerAngel Pons <th3fanbus@gmail.com>2020-06-17 21:13:36 +0000
commitc7e2b6d140225dd0c76a38060b7ed8fb4ef10e02 (patch)
treea6bafae3b8a8e7a1d7eb0ddec92b61c2bb2344f7
parent7336f97debc883d293e4d5f942c556d1f8931842 (diff)
lib/reg_script: Add guards for <arch/io.h>
Header and implementation only present for ARCH_X86 stages. Change-Id: I4b28e666a8a60bd0365cda8d7affa1eb063c4690 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42416 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/lib/reg_script.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/reg_script.c b/src/lib/reg_script.c
index 51ef689ac9..e0ae68cd0e 100644
--- a/src/lib/reg_script.c
+++ b/src/lib/reg_script.c
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#include <arch/io.h>
#include <device/mmio.h>
#include <device/pci_ops.h>
#include <console/console.h>
@@ -15,6 +14,13 @@
#include <cpu/x86/msr.h>
#endif
+#if ENV_X86
+#include <arch/io.h>
+#define HAS_ARCH_IO 1
+#else
+#define HAS_ARCH_IO 0
+#endif
+
#define HAS_IOSF (CONFIG(SOC_INTEL_BAYTRAIL))
#if HAS_IOSF
@@ -104,6 +110,7 @@ static void reg_script_write_pci(struct reg_script_context *ctx)
}
}
+#if HAS_ARCH_IO
static uint32_t reg_script_read_io(struct reg_script_context *ctx)
{
const struct reg_script *step = reg_script_get_step(ctx);
@@ -135,6 +142,7 @@ static void reg_script_write_io(struct reg_script_context *ctx)
break;
}
}
+#endif
static uint32_t reg_script_read_mmio(struct reg_script_context *ctx)
{
@@ -441,10 +449,12 @@ static uint64_t reg_script_read(struct reg_script_context *ctx)
ctx->display_prefix = "PCI";
value = reg_script_read_pci(ctx);
break;
+#if HAS_ARCH_IO
case REG_SCRIPT_TYPE_IO:
ctx->display_prefix = "IO";
value = reg_script_read_io(ctx);
break;
+#endif
case REG_SCRIPT_TYPE_MMIO:
ctx->display_prefix = "MMIO";
value = reg_script_read_mmio(ctx);
@@ -495,10 +505,12 @@ static void reg_script_write(struct reg_script_context *ctx)
ctx->display_prefix = "PCI";
reg_script_write_pci(ctx);
break;
+#if HAS_ARCH_IO
case REG_SCRIPT_TYPE_IO:
ctx->display_prefix = "IO";
reg_script_write_io(ctx);
break;
+#endif
case REG_SCRIPT_TYPE_MMIO:
ctx->display_prefix = "MMIO";
reg_script_write_mmio(ctx);