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. |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | /* |
| 17 | * This file contains entry/exit functions for each stage during coreboot |
| 18 | * execution (bootblock entry and ramstage exit will depend on external |
| 19 | * loading). |
| 20 | * |
| 21 | * Entry points must be placed at the location the previous stage jumps |
| 22 | * to (the lowest address in the stage image). This is done by giving |
| 23 | * stage_entry() its own section in .text and placing it first in the |
| 24 | * linker script. |
| 25 | */ |
| 26 | |
| 27 | #include <arch/stages.h> |
| 28 | |
| 29 | void stage_entry(void) |
| 30 | { |
| 31 | main(); |
| 32 | } |
| 33 | |
| 34 | /* we had marked 'doit' as 'noreturn'. |
| 35 | * There is no apparent harm in leaving it as something we can return from, and in the one |
| 36 | * case where we call a payload, the payload is allowed to return. |
| 37 | * Hence, leave it as something we can return from. |
| 38 | */ |
| 39 | void stage_exit(void *addr) |
| 40 | { |
| 41 | void (*doit)(void) = addr; |
| 42 | /* |
| 43 | * Most stages load code so we need to sync caches here. Should maybe |
| 44 | * go into cbfs_load_stage() instead... |
| 45 | */ |
| 46 | //cache_sync_instructions(); |
| 47 | doit(); |
| 48 | } |