Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2014 Google Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | /* |
| 21 | * This file contains entry/exit functions for each stage during coreboot |
| 22 | * execution (bootblock entry and ramstage exit will depend on external |
| 23 | * loading). |
| 24 | * |
| 25 | * Entry points must be placed at the location the previous stage jumps |
| 26 | * to (the lowest address in the stage image). This is done by giving |
| 27 | * stage_entry() its own section in .text and placing it first in the |
| 28 | * linker script. |
| 29 | */ |
| 30 | |
| 31 | #include <arch/stages.h> |
| 32 | |
| 33 | void stage_entry(void) |
| 34 | { |
| 35 | main(); |
| 36 | } |
| 37 | |
| 38 | /* we had marked 'doit' as 'noreturn'. |
| 39 | * There is no apparent harm in leaving it as something we can return from, and in the one |
| 40 | * case where we call a payload, the payload is allowed to return. |
| 41 | * Hence, leave it as something we can return from. |
| 42 | */ |
| 43 | void stage_exit(void *addr) |
| 44 | { |
| 45 | void (*doit)(void) = addr; |
| 46 | /* |
| 47 | * Most stages load code so we need to sync caches here. Should maybe |
| 48 | * go into cbfs_load_stage() instead... |
| 49 | */ |
| 50 | //cache_sync_instructions(); |
| 51 | doit(); |
| 52 | } |