switch-coreboot/include/globalvars.h
Carl-Daniel Hailfinger cb9db3b6d0 We are woefully unaware about how much stack v3 really uses.
This is a complete rewrite of my earlier stack checker proposal.
It works for CAR and RAM, has better abstraction and actually gives us
nice results.
The stack checker is default off due to its rather measurable impact on
boot speed.
Diagnostic messages are printed on first initialization, directly after
RAM init and directly before passing control to the payload. Sample qemu
log is attached. Extract from that log follows:

coreboot-3.0.986 Fri Nov  7 04:04:37 CET 2008 starting...
(console_loglevel=8)
Initial lowest stack is 0x0008fe98
Choosing fallback boot.
[...]
Done RAM init code
After RAM init, lowest stack is 0x0008fe30
Done printk() buffer move
[...]
LAR: load_file_segments: Failed for normal/payload
Before handoff to payload, lowest stack is 0x0008bf50
FATAL: No usable payload found.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@1012 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-11-13 01:28:32 +00:00

72 lines
2.2 KiB
C

/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef GLOBALVARS_H
#define GLOBALVARS_H
/* you need to include all files that might be referenced in the global variables struct */
#include <console.h>
#include <types.h>
/* the sys_info struct is architecture-dependent, with parameters controlled from mainboard.h in some cases */
#ifdef CONFIG_CPU_AMD_K8
#include <mainboard.h>
#include <amd/k8/k8.h>
#include <amd/k8/sysconf.h>
#endif
#ifdef CONFIG_CPU_AMD_GEODELX
#include <amd_geodelx.h>
#endif
#ifdef CONFIG_BOARD_EMULATION_QEMU_X86
#include <qemu.h>
#endif
#ifdef CONFIG_CPU_VIA_C7
#include <via_c7.h>
#endif
#ifdef CONFIG_CPU_INTEL_CORE2
#include <northbridge/intel/i945/raminit.h>
#endif
/*
* struct global_vars is managed entirely from C code. Keep in mind that there
* is NO buffer at the end of the struct, so having zero-sized arrays at the
* end or similar stuff for which the compiler can't determine the final size
* will corrupt memory. If you don't try to be clever, everything will be fine.
*
* BIG FAT WARNING: Never write to global variables without using accessor
* functions. global_vars_init() is the place to call variable-specific
* initialization functions.
*/
struct global_vars {
#ifdef CONFIG_CONSOLE_BUFFER
struct printk_buffer *printk_buffer;
#endif
unsigned int loglevel;
/* these two values are of interest in many stages */
u32 init_detected;
struct sys_info sys_info;
/* has the spd hardware been set up? */
int spd_inited;
int ram_available;
#ifdef CONFIG_CHECK_STACK_USAGE
void *loweststack;
#endif
};
#endif /* GLOBALVARS_H */