Kyösti Mälkki | ef84401 | 2013-06-25 23:17:43 +0300 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; version 2 of the License. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | */ |
| 18 | |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 19 | #ifndef _RULES_H |
| 20 | #define _RULES_H |
| 21 | |
| 22 | /* Useful helpers to tell whether the code is executing in bootblock, |
| 23 | * romstage, ramstage or SMM. |
| 24 | */ |
| 25 | |
| 26 | #if defined(__BOOT_BLOCK__) |
| 27 | #define ENV_BOOTBLOCK 1 |
| 28 | #define ENV_ROMSTAGE 0 |
| 29 | #define ENV_RAMSTAGE 0 |
| 30 | #define ENV_SMM 0 |
| 31 | |
| 32 | #elif defined(__PRE_RAM__) |
| 33 | #define ENV_BOOTBLOCK 0 |
| 34 | #define ENV_ROMSTAGE 1 |
| 35 | #define ENV_RAMSTAGE 0 |
| 36 | #define ENV_SMM 0 |
| 37 | |
| 38 | #elif defined(__SMM__) |
| 39 | #define ENV_BOOTBLOCK 0 |
| 40 | #define ENV_ROMSTAGE 0 |
| 41 | #define ENV_RAMSTAGE 0 |
| 42 | #define ENV_SMM 1 |
| 43 | #else |
| 44 | |
| 45 | #define ENV_BOOTBLOCK 0 |
| 46 | #define ENV_ROMSTAGE 0 |
| 47 | #define ENV_RAMSTAGE 1 |
| 48 | #define ENV_SMM 0 |
| 49 | #endif |
Kyösti Mälkki | ef84401 | 2013-06-25 23:17:43 +0300 | [diff] [blame] | 50 | |
| 51 | /* For romstage and ramstage always build with simple device model, ie. |
| 52 | * PCI, PNP and CPU functions operate without use of devicetree. |
| 53 | * |
| 54 | * For ramstage individual source file may define __SIMPLE_DEVICE__ |
| 55 | * before including any header files to force that particular source |
| 56 | * be built with simple device model. |
| 57 | */ |
| 58 | |
| 59 | #if defined(__PRE_RAM__) || defined(__SMM__) |
| 60 | #define __SIMPLE_DEVICE__ |
| 61 | #endif |
| 62 | |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 63 | #endif /* _RULES_H */ |