2003-04-22 21:02:15 +02:00
|
|
|
/*
|
|
|
|
This software and ancillary information (herein called SOFTWARE )
|
|
|
|
called LinuxBIOS is made available under the terms described
|
|
|
|
here. The SOFTWARE has been approved for release with associated
|
|
|
|
LA-CC Number 00-34 . Unless otherwise indicated, this SOFTWARE has
|
|
|
|
been authored by an employee or employees of the University of
|
|
|
|
California, operator of the Los Alamos National Laboratory under
|
|
|
|
Contract No. W-7405-ENG-36 with the U.S. Department of Energy. The
|
|
|
|
U.S. Government has rights to use, reproduce, and distribute this
|
|
|
|
SOFTWARE. The public may copy, distribute, prepare derivative works
|
|
|
|
and publicly display this SOFTWARE without charge, provided that this
|
|
|
|
Notice and any statement of authorship are reproduced on all copies.
|
|
|
|
Neither the Government nor the University makes any warranty, express
|
|
|
|
or implied, or assumes any liability or responsibility for the use of
|
|
|
|
this SOFTWARE. If SOFTWARE is modified to produce derivative works,
|
|
|
|
such modified SOFTWARE should be clearly marked, so as not to confuse
|
|
|
|
it with the version available from LANL.
|
|
|
|
*/
|
|
|
|
/* Copyright 2000, Ron Minnich, Advanced Computing Lab, LANL
|
|
|
|
* rminnich@lanl.gov
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2008-01-18 16:08:58 +01:00
|
|
|
* C Bootstrap code for the coreboot
|
2003-04-22 21:02:15 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <console/console.h>
|
|
|
|
#include <version.h>
|
|
|
|
#include <boot/tables.h>
|
2003-04-24 08:25:08 +02:00
|
|
|
#include <device/device.h>
|
|
|
|
#include <device/pci.h>
|
2003-07-19 06:28:22 +02:00
|
|
|
#include <delay.h>
|
2004-10-14 22:54:17 +02:00
|
|
|
#include <stdlib.h>
|
2003-04-22 21:02:15 +02:00
|
|
|
#include <part/hard_reset.h>
|
2004-10-27 10:53:57 +02:00
|
|
|
#include <part/init_timer.h>
|
2003-04-22 21:02:15 +02:00
|
|
|
#include <boot/elf.h>
|
2009-04-03 14:52:43 +02:00
|
|
|
#include <romfs.h>
|
2009-04-13 19:57:44 +02:00
|
|
|
#include <arch/acpi.h>
|
2003-04-22 21:02:15 +02:00
|
|
|
|
2004-12-03 23:39:34 +01:00
|
|
|
/**
|
2008-01-18 16:08:58 +01:00
|
|
|
* @brief Main function of the DRAM part of coreboot.
|
2004-12-03 23:39:34 +01:00
|
|
|
*
|
2008-01-18 16:08:58 +01:00
|
|
|
* Coreboot is divided into Pre-DRAM part and DRAM part.
|
2004-12-03 23:39:34 +01:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Device Enumeration:
|
|
|
|
* In the dev_enumerate() phase,
|
|
|
|
*/
|
2009-04-13 19:57:44 +02:00
|
|
|
|
2003-04-22 21:02:15 +02:00
|
|
|
void hardwaremain(int boot_complete)
|
|
|
|
{
|
|
|
|
struct lb_memory *lb_mem;
|
2009-04-13 20:44:06 +02:00
|
|
|
#if HAVE_ACPI_RESUME == 1
|
2009-04-13 19:57:44 +02:00
|
|
|
void *wake_vec;
|
2009-04-13 20:44:06 +02:00
|
|
|
#endif
|
2003-04-22 21:02:15 +02:00
|
|
|
|
|
|
|
post_code(0x80);
|
2004-05-13 22:39:07 +02:00
|
|
|
|
2003-04-22 21:02:15 +02:00
|
|
|
/* displayinit MUST PRECEDE ALL PRINTK! */
|
|
|
|
console_init();
|
|
|
|
|
|
|
|
post_code(0x39);
|
2005-07-06 19:17:41 +02:00
|
|
|
|
2008-01-18 16:08:58 +01:00
|
|
|
printk_notice("coreboot-%s%s %s %s...\n",
|
|
|
|
coreboot_version, coreboot_extra_version, coreboot_build,
|
2004-12-03 23:39:34 +01:00
|
|
|
(boot_complete)?"rebooting":"booting");
|
2003-04-22 21:02:15 +02:00
|
|
|
|
|
|
|
post_code(0x40);
|
|
|
|
|
|
|
|
/* If we have already booted attempt a hard reboot */
|
|
|
|
if (boot_complete) {
|
|
|
|
hard_reset();
|
|
|
|
}
|
2004-03-23 22:28:05 +01:00
|
|
|
|
2004-10-16 08:20:29 +02:00
|
|
|
/* FIXME: Is there a better way to handle this? */
|
|
|
|
init_timer();
|
2003-04-22 21:02:15 +02:00
|
|
|
|
2004-11-04 12:04:33 +01:00
|
|
|
/* Find the devices we don't have hard coded knowledge about. */
|
2003-04-22 21:02:15 +02:00
|
|
|
dev_enumerate();
|
|
|
|
post_code(0x66);
|
2004-11-04 12:04:33 +01:00
|
|
|
/* Now compute and assign the bus resources. */
|
2003-04-22 21:02:15 +02:00
|
|
|
dev_configure();
|
|
|
|
post_code(0x88);
|
2004-11-04 12:04:33 +01:00
|
|
|
/* Now actually enable devices on the bus */
|
2003-04-22 21:02:15 +02:00
|
|
|
dev_enable();
|
2004-11-04 12:04:33 +01:00
|
|
|
/* And of course initialize devices on the bus */
|
2003-04-22 21:02:15 +02:00
|
|
|
dev_initialize();
|
|
|
|
post_code(0x89);
|
|
|
|
|
2009-04-13 19:57:44 +02:00
|
|
|
#if HAVE_ACPI_RESUME == 1
|
|
|
|
|
|
|
|
#if MEM_TRAIN_SEQ != 0
|
|
|
|
#error "So far it works on AMD and MEM_TRAIN_SEQ == 0"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if _RAMBASE < 0x1F00000
|
|
|
|
#error "For ACPI RESUME you need to have _RAMBASE at least 31MB"
|
|
|
|
#error "Chipset support (S3_NVRAM_EARLY and ACPI_IS_WAKEUP_EARLY functions and memory ctrl)"
|
|
|
|
#error "And coreboot memory reserved in mainboard.c"
|
|
|
|
#endif
|
|
|
|
/* if we happen to be resuming find wakeup vector and jump to OS */
|
|
|
|
wake_vec = acpi_find_wakeup_vector();
|
|
|
|
if (wake_vec)
|
|
|
|
acpi_jump_to_wakeup(wake_vec);
|
|
|
|
#endif
|
|
|
|
|
2004-10-14 22:54:17 +02:00
|
|
|
/* Now that we have collected all of our information
|
|
|
|
* write our configuration tables.
|
|
|
|
*/
|
|
|
|
lb_mem = write_tables();
|
2009-04-01 12:48:39 +02:00
|
|
|
#if CONFIG_ROMFS == 1
|
2009-04-01 15:54:16 +02:00
|
|
|
# if USE_FALLBACK_IMAGE == 1
|
2009-04-01 12:48:39 +02:00
|
|
|
void (*pl)(void) = romfs_load_payload(lb_mem, "fallback/payload");
|
2009-04-01 15:54:16 +02:00
|
|
|
# else
|
2009-04-01 12:48:39 +02:00
|
|
|
void (*pl)(void) = romfs_load_payload(lb_mem, "normal/payload");
|
2009-04-01 15:54:16 +02:00
|
|
|
# endif
|
2004-03-17 18:10:32 +01:00
|
|
|
#endif
|
2009-04-01 12:48:39 +02:00
|
|
|
|
2009-04-01 15:54:16 +02:00
|
|
|
#if CONFIG_FS_PAYLOAD == 1
|
|
|
|
#warning "CONFIG_FS_PAYLOAD is deprecated."
|
|
|
|
filo(lb_mem);
|
|
|
|
#else
|
|
|
|
#warning "elfboot will soon be deprecated."
|
2009-04-01 12:48:39 +02:00
|
|
|
elfboot(lb_mem);
|
2009-04-01 15:54:16 +02:00
|
|
|
#endif
|
|
|
|
printk_err("Boot failed.\n");
|
2003-04-22 21:02:15 +02:00
|
|
|
}
|
|
|
|
|