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>
|
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>
|
2009-04-22 10:17:38 +02:00
|
|
|
#include <boot/tables.h>
|
2003-04-22 21:02:15 +02:00
|
|
|
#include <boot/elf.h>
|
2009-04-14 09:40:01 +02:00
|
|
|
#include <cbfs.h>
|
2009-06-30 17:17:49 +02:00
|
|
|
#if CONFIG_HAVE_ACPI_RESUME
|
2009-04-13 19:57:44 +02:00
|
|
|
#include <arch/acpi.h>
|
2009-04-14 08:38:15 +02:00
|
|
|
#endif
|
2009-10-26 18:04:28 +01:00
|
|
|
#if CONFIG_WRITE_HIGH_TABLES
|
|
|
|
#include <cbmem.h>
|
|
|
|
#endif
|
2003-04-22 21:02:15 +02:00
|
|
|
|
2004-12-03 23:39:34 +01:00
|
|
|
/**
|
2009-10-26 18:04:28 +01:00
|
|
|
* @brief Main function of the RAM part of coreboot.
|
2004-12-03 23:39:34 +01:00
|
|
|
*
|
2009-10-26 18:04:28 +01:00
|
|
|
* Coreboot is divided into Pre-RAM part and RAM part.
|
2004-12-03 23:39:34 +01:00
|
|
|
*
|
|
|
|
* Device Enumeration:
|
|
|
|
* In the dev_enumerate() phase,
|
|
|
|
*/
|
2009-04-13 19:57:44 +02:00
|
|
|
|
2009-10-27 15:29:29 +01:00
|
|
|
void hardwaremain(int boot_complete);
|
|
|
|
|
2003-04-22 21:02:15 +02:00
|
|
|
void hardwaremain(int boot_complete)
|
|
|
|
{
|
|
|
|
struct lb_memory *lb_mem;
|
|
|
|
|
|
|
|
post_code(0x80);
|
2004-05-13 22:39:07 +02:00
|
|
|
|
2009-10-26 18:04:28 +01:00
|
|
|
/* console_init() MUST PRECEDE ALL printk()! */
|
2003-04-22 21:02:15 +02:00
|
|
|
console_init();
|
|
|
|
|
|
|
|
post_code(0x39);
|
2005-07-06 19:17:41 +02:00
|
|
|
|
2009-07-21 23:25:45 +02:00
|
|
|
printk(BIOS_NOTICE, "coreboot-%s%s %s %s...\n",
|
2008-01-18 16:08:58 +01:00
|
|
|
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-10-26 18:04:28 +01:00
|
|
|
#if CONFIG_WRITE_HIGH_TABLES == 1
|
|
|
|
cbmem_initialize();
|
|
|
|
#endif
|
2009-06-30 17:17:49 +02:00
|
|
|
#if CONFIG_HAVE_ACPI_RESUME == 1
|
2009-04-22 10:17:38 +02:00
|
|
|
suspend_resume();
|
|
|
|
post_code(0x8a);
|
2009-04-13 19:57:44 +02:00
|
|
|
#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();
|
2010-02-09 20:35:16 +01:00
|
|
|
cbfs_load_payload(lb_mem, CONFIG_CBFS_PREFIX "/payload");
|
2009-07-21 23:25:45 +02:00
|
|
|
printk(BIOS_ERR, "Boot failed.\n");
|
2003-04-22 21:02:15 +02:00
|
|
|
}
|
|
|
|
|