Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2010 Google Inc |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; version 2 of |
| 9 | * the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
| 19 | * MA 02110-1301 USA |
| 20 | */ |
| 21 | |
Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 22 | #include <bootblock_common.h> |
David Hendricks | 3d7344a | 2013-01-08 21:05:06 -0800 | [diff] [blame] | 23 | #include <arch/hlt.h> |
David Hendricks | 50c0a50 | 2013-01-31 17:05:50 -0800 | [diff] [blame] | 24 | #include <arch/stages.h> |
Hung-Te Lin | fe18792 | 2013-02-01 01:09:24 +0800 | [diff] [blame] | 25 | #include <cbfs.h> |
Hung-Te Lin | b868d40 | 2013-02-06 22:01:18 +0800 | [diff] [blame] | 26 | #include <console/console.h> |
David Hendricks | 50c0a50 | 2013-01-31 17:05:50 -0800 | [diff] [blame] | 27 | |
| 28 | #include "stages.c" |
Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 29 | |
David Hendricks | 3d7344a | 2013-01-08 21:05:06 -0800 | [diff] [blame] | 30 | static int boot_cpu(void) |
| 31 | { |
| 32 | /* |
| 33 | * FIXME: This is a stub for now. All non-boot CPUs should be |
| 34 | * waiting for an interrupt. We could move the chunk of assembly |
| 35 | * which puts them to sleep in here... |
| 36 | */ |
| 37 | return 1; |
| 38 | } |
Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 39 | |
David Hendricks | 50c0a50 | 2013-01-31 17:05:50 -0800 | [diff] [blame] | 40 | void main(void) |
Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 41 | { |
Hung-Te Lin | 5f83f6c | 2013-02-04 14:38:03 +0800 | [diff] [blame] | 42 | const char *stage_name = "fallback/romstage"; |
| 43 | void *entry; |
Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 44 | |
| 45 | if (boot_cpu()) { |
David Hendricks | fba42a7 | 2013-01-17 15:07:35 -0800 | [diff] [blame] | 46 | bootblock_cpu_init(); |
David Hendricks | 211a5d5 | 2013-01-17 20:52:21 -0800 | [diff] [blame] | 47 | bootblock_mainboard_init(); |
Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 48 | } |
David Hendricks | 3d7344a | 2013-01-08 21:05:06 -0800 | [diff] [blame] | 49 | |
Hung-Te Lin | b868d40 | 2013-02-06 22:01:18 +0800 | [diff] [blame] | 50 | console_init(); |
Hung-Te Lin | 5f83f6c | 2013-02-04 14:38:03 +0800 | [diff] [blame] | 51 | printk(BIOS_INFO, "hello from bootblock\n"); |
David Hendricks | 211a5d5 | 2013-01-17 20:52:21 -0800 | [diff] [blame] | 52 | printk(BIOS_INFO, "bootblock main(): loading romstage\n"); |
Hung-Te Lin | 5f83f6c | 2013-02-04 14:38:03 +0800 | [diff] [blame] | 53 | entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, stage_name); |
Hung-Te Lin | 6fe0cab | 2013-01-22 18:57:56 +0800 | [diff] [blame] | 54 | |
David Hendricks | 211a5d5 | 2013-01-17 20:52:21 -0800 | [diff] [blame] | 55 | printk(BIOS_INFO, "bootblock main(): jumping to romstage\n"); |
Hung-Te Lin | 5f83f6c | 2013-02-04 14:38:03 +0800 | [diff] [blame] | 56 | if (entry) stage_exit(entry); |
Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 57 | hlt(); |
| 58 | } |