arches: lib: add main_decl.h for main() declaration

It is silly to have a single header to declare the main()
symbol, however some of the arches provided it while
lib/bootblock.c relied on the arch headers to declare it. Just
move the declaration into its own header file and utilize it.

Change-Id: I743b4c286956ae047c17fe46241b699feca73628
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/13681
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins)
This commit is contained in:
Aaron Durbin 2016-02-10 23:15:07 -06:00
parent 711455f244
commit 622eea7e81
8 changed files with 16 additions and 12 deletions

View File

@ -16,7 +16,7 @@
#ifndef __ARCH_STAGES_H
#define __ARCH_STAGES_H
extern void main(void);
#include <main_decl.h>
void stage_entry(void);

View File

@ -17,8 +17,7 @@
#define __ARCH_STAGES_H
#include <stdint.h>
extern void main(void);
#include <main_decl.h>
void stage_entry(void);

View File

@ -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);

View File

@ -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")));

View File

@ -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);

View File

@ -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. */

6
src/include/main_decl.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef _MAIN_DECL_H_
#define _MAIN_DECL_H_
void main(void);
#endif

View File

@ -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