1/* 2This software and ancillary information (herein called SOFTWARE ) 3called LinuxBIOS is made available under the terms described 4here. The SOFTWARE has been approved for release with associated 5LA-CC Number 00-34 . Unless otherwise indicated, this SOFTWARE has 6been authored by an employee or employees of the University of 7California, operator of the Los Alamos National Laboratory under 8Contract No. W-7405-ENG-36 with the U.S. Department of Energy. The 9U.S. Government has rights to use, reproduce, and distribute this 10SOFTWARE. The public may copy, distribute, prepare derivative works 11and publicly display this SOFTWARE without charge, provided that this 12Notice and any statement of authorship are reproduced on all copies. 13Neither the Government nor the University makes any warranty, express 14or implied, or assumes any liability or responsibility for the use of 15this SOFTWARE. If SOFTWARE is modified to produce derivative works, 16such modified SOFTWARE should be clearly marked, so as not to confuse 17it with the version available from LANL. 18 */ 19/* Copyright 2000, Ron Minnich, Advanced Computing Lab, LANL 20 * rminnich@lanl.gov 21 */ 22 23 24/* 25 * C Bootstrap code for the coreboot 26 */ 27 28#include <console/console.h> 29#include <version.h> 30#include <device/device.h> 31#include <device/pci.h> 32#include <delay.h> 33#include <stdlib.h> 34#include <reset.h> 35#include <boot/tables.h> 36#include <boot/elf.h> 37#include <cbfs.h> 38#if CONFIG_HAVE_ACPI_RESUME 39#include <arch/acpi.h> 40#endif 41#if CONFIG_WRITE_HIGH_TABLES 42#include <cbmem.h> 43#endif 44 45/** 46 * @brief Main function of the RAM part of coreboot. 47 * 48 * Coreboot is divided into Pre-RAM part and RAM part. 49 * 50 * Device Enumeration: 51 * In the dev_enumerate() phase, 52 */ 53 54void hardwaremain(int boot_complete); 55 56void hardwaremain(int boot_complete) 57{ 58 struct lb_memory *lb_mem; 59 60 post_code(POST_ENTRY_RAMSTAGE); 61 62 /* console_init() MUST PRECEDE ALL printk()! */ 63 console_init(); 64 65 post_code(POST_CONSOLE_READY); 66 67 printk(BIOS_NOTICE, "coreboot-%s%s %s %s...\n", 68 coreboot_version, coreboot_extra_version, coreboot_build, 69 (boot_complete)?"rebooting":"booting"); 70 71 post_code(POST_CONSOLE_BOOT_MSG); 72 73 /* If we have already booted attempt a hard reboot */ 74 if (boot_complete) { 75 hard_reset(); 76 } 77 78 /* FIXME: Is there a better way to handle this? */ 79 init_timer(); 80 81 /* Find the devices we don't have hard coded knowledge about. */ 82 dev_enumerate(); 83 post_code(POST_DEVICE_ENUMERATION_COMPLETE); 84 /* Now compute and assign the bus resources. */ 85 dev_configure(); 86 post_code(POST_DEVICE_CONFIGURATION_COMPLETE); 87 /* Now actually enable devices on the bus */ 88 dev_enable(); 89 /* And of course initialize devices on the bus */ 90 dev_initialize(); 91 post_code(POST_DEVICES_ENABLED); 92 93#if CONFIG_WRITE_HIGH_TABLES == 1 94 cbmem_initialize(); 95#endif 96#if CONFIG_HAVE_ACPI_RESUME == 1 97 suspend_resume(); 98 post_code(0x8a); 99#endif 100 101 /* Now that we have collected all of our information 102 * write our configuration tables. 103 */ 104 lb_mem = write_tables(); 105 cbfs_load_payload(lb_mem, CONFIG_CBFS_PREFIX "/payload"); 106 printk(BIOS_ERR, "Boot failed.\n"); 107} 108 109

