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>
This commit is contained in:
Kyösti Mälkki 2020-06-16 11:25:01 +03:00 committed by Angel Pons
parent 7336f97deb
commit c7e2b6d140
1 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/io.h>
#include <device/mmio.h> #include <device/mmio.h>
#include <device/pci_ops.h> #include <device/pci_ops.h>
#include <console/console.h> #include <console/console.h>
@ -15,6 +14,13 @@
#include <cpu/x86/msr.h> #include <cpu/x86/msr.h>
#endif #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)) #define HAS_IOSF (CONFIG(SOC_INTEL_BAYTRAIL))
#if HAS_IOSF #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) static uint32_t reg_script_read_io(struct reg_script_context *ctx)
{ {
const struct reg_script *step = reg_script_get_step(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; break;
} }
} }
#endif
static uint32_t reg_script_read_mmio(struct reg_script_context *ctx) 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"; ctx->display_prefix = "PCI";
value = reg_script_read_pci(ctx); value = reg_script_read_pci(ctx);
break; break;
#if HAS_ARCH_IO
case REG_SCRIPT_TYPE_IO: case REG_SCRIPT_TYPE_IO:
ctx->display_prefix = "IO"; ctx->display_prefix = "IO";
value = reg_script_read_io(ctx); value = reg_script_read_io(ctx);
break; break;
#endif
case REG_SCRIPT_TYPE_MMIO: case REG_SCRIPT_TYPE_MMIO:
ctx->display_prefix = "MMIO"; ctx->display_prefix = "MMIO";
value = reg_script_read_mmio(ctx); value = reg_script_read_mmio(ctx);
@ -495,10 +505,12 @@ static void reg_script_write(struct reg_script_context *ctx)
ctx->display_prefix = "PCI"; ctx->display_prefix = "PCI";
reg_script_write_pci(ctx); reg_script_write_pci(ctx);
break; break;
#if HAS_ARCH_IO
case REG_SCRIPT_TYPE_IO: case REG_SCRIPT_TYPE_IO:
ctx->display_prefix = "IO"; ctx->display_prefix = "IO";
reg_script_write_io(ctx); reg_script_write_io(ctx);
break; break;
#endif
case REG_SCRIPT_TYPE_MMIO: case REG_SCRIPT_TYPE_MMIO:
ctx->display_prefix = "MMIO"; ctx->display_prefix = "MMIO";
reg_script_write_mmio(ctx); reg_script_write_mmio(ctx);