summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/arm/include/arch/stages.h2
-rw-r--r--src/arch/arm64/include/arch/stages.h3
-rw-r--r--src/arch/mips/include/arch/stages.h2
-rw-r--r--src/arch/riscv/include/arch/stages.h2
-rw-r--r--src/include/bootblock_common.h2
-rw-r--r--src/include/bootstate.h9
-rw-r--r--src/include/main_decl.h6
-rw-r--r--src/soc/intel/apollolake/include/soc/bootblock.h2
8 files changed, 16 insertions, 12 deletions
diff --git a/src/arch/arm/include/arch/stages.h b/src/arch/arm/include/arch/stages.h
index 2d20604589..68a3bd116d 100644
--- a/src/arch/arm/include/arch/stages.h
+++ b/src/arch/arm/include/arch/stages.h
@@ -16,7 +16,7 @@
#ifndef __ARCH_STAGES_H
#define __ARCH_STAGES_H
-extern void main(void);
+#include <main_decl.h>
void stage_entry(void);
diff --git a/src/arch/arm64/include/arch/stages.h b/src/arch/arm64/include/arch/stages.h
index ce66cddd76..9a88ea7fbe 100644
--- a/src/arch/arm64/include/arch/stages.h
+++ b/src/arch/arm64/include/arch/stages.h
@@ -17,8 +17,7 @@
#define __ARCH_STAGES_H
#include <stdint.h>
-
-extern void main(void);
+#include <main_decl.h>
void stage_entry(void);
diff --git a/src/arch/mips/include/arch/stages.h b/src/arch/mips/include/arch/stages.h
index 664c136bbf..802199f532 100644
--- a/src/arch/mips/include/arch/stages.h
+++ b/src/arch/mips/include/arch/stages.h
@@ -16,7 +16,7 @@
#ifndef __MIPS_ARCH_STAGES_H
#define __MIPS_ARCH_STAGES_H
-extern void main(void);
+#include <main_decl.h>
void stage_entry(void);
diff --git a/src/arch/riscv/include/arch/stages.h b/src/arch/riscv/include/arch/stages.h
index 07a72a4446..90bd60b9a6 100644
--- a/src/arch/riscv/include/arch/stages.h
+++ b/src/arch/riscv/include/arch/stages.h
@@ -16,7 +16,7 @@
#ifndef __ARCH_STAGES_H
#define __ARCH_STAGES_H
-extern void main(void);
+#include <main_decl.h>
void stage_entry(void) __attribute__((section(".text.stage_entry")));
diff --git a/src/include/bootblock_common.h b/src/include/bootblock_common.h
index 1acbef4855..c8156d0236 100644
--- a/src/include/bootblock_common.h
+++ b/src/include/bootblock_common.h
@@ -16,6 +16,8 @@
#ifndef __BOOTBLOCK_COMMON_H
#define __BOOTBLOCK_COMMON_H
+#include <main_decl.h>
+
/* These are defined as weak no-ops that can be overridden by mainboard/SoC. */
void bootblock_mainboard_early_init(void);
void bootblock_mainboard_init(void);
diff --git a/src/include/bootstate.h b/src/include/bootstate.h
index c38d2ba959..0889018e18 100644
--- a/src/include/bootstate.h
+++ b/src/include/bootstate.h
@@ -20,6 +20,10 @@
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
+/* Only declare main() when in ramstage. */
+#if ENV_RAMSTAGE
+#include <main_decl.h>
+#endif
/* Control debugging of the boot state machine. */
#define BOOT_STATE_DEBUG 0
@@ -168,11 +172,6 @@ int boot_state_unblock(boot_state_t state, boot_state_sequence_t seq);
void boot_state_current_block(void);
void boot_state_current_unblock(void);
-#if ENV_RAMSTAGE
-/* Entry into the boot state machine. */
-void main(void);
-#endif
-
/* In order to schedule boot state callbacks at compile-time specify the
* entries in an array using the BOOT_STATE_INIT_ENTRIES and
* BOOT_STATE_INIT_ENTRY macros below. */
diff --git a/src/include/main_decl.h b/src/include/main_decl.h
new file mode 100644
index 0000000000..90c17161ed
--- /dev/null
+++ b/src/include/main_decl.h
@@ -0,0 +1,6 @@
+#ifndef _MAIN_DECL_H_
+#define _MAIN_DECL_H_
+
+void main(void);
+
+#endif
diff --git a/src/soc/intel/apollolake/include/soc/bootblock.h b/src/soc/intel/apollolake/include/soc/bootblock.h
index 655188bf62..933c7fecd4 100644
--- a/src/soc/intel/apollolake/include/soc/bootblock.h
+++ b/src/soc/intel/apollolake/include/soc/bootblock.h
@@ -3,6 +3,4 @@
#include <arch/cpu.h>
void asmlinkage bootblock_c_entry(void);
-/* provide prototype for lib/bootblock.c main as workaround */
-void main(void);
#endif