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 |
Furquan Shaikh | abde3b5 | 2014-08-26 15:39:51 -0700 | [diff] [blame^] | 31 | #define ENV_SECMON 0 |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 32 | |
| 33 | #elif defined(__PRE_RAM__) |
| 34 | #define ENV_BOOTBLOCK 0 |
| 35 | #define ENV_ROMSTAGE 1 |
| 36 | #define ENV_RAMSTAGE 0 |
| 37 | #define ENV_SMM 0 |
Furquan Shaikh | abde3b5 | 2014-08-26 15:39:51 -0700 | [diff] [blame^] | 38 | #define ENV_SECMON 0 |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 39 | |
| 40 | #elif defined(__SMM__) |
| 41 | #define ENV_BOOTBLOCK 0 |
| 42 | #define ENV_ROMSTAGE 0 |
| 43 | #define ENV_RAMSTAGE 0 |
| 44 | #define ENV_SMM 1 |
Furquan Shaikh | abde3b5 | 2014-08-26 15:39:51 -0700 | [diff] [blame^] | 45 | #define ENV_SECMON 0 |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 46 | |
Furquan Shaikh | abde3b5 | 2014-08-26 15:39:51 -0700 | [diff] [blame^] | 47 | #elif defined(__SECMON__) |
| 48 | #define ENV_BOOTBLOCK 0 |
| 49 | #define ENV_ROMSTAGE 0 |
| 50 | #define ENV_RAMSTAGE 0 |
| 51 | #define ENV_SMM 0 |
| 52 | #define ENV_SECMON 1 |
| 53 | |
| 54 | #else |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 55 | #define ENV_BOOTBLOCK 0 |
| 56 | #define ENV_ROMSTAGE 0 |
| 57 | #define ENV_RAMSTAGE 1 |
| 58 | #define ENV_SMM 0 |
Furquan Shaikh | abde3b5 | 2014-08-26 15:39:51 -0700 | [diff] [blame^] | 59 | #define ENV_SECMON 0 |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 60 | #endif |
Kyösti Mälkki | ef84401 | 2013-06-25 23:17:43 +0300 | [diff] [blame] | 61 | |
| 62 | /* For romstage and ramstage always build with simple device model, ie. |
| 63 | * PCI, PNP and CPU functions operate without use of devicetree. |
| 64 | * |
| 65 | * For ramstage individual source file may define __SIMPLE_DEVICE__ |
| 66 | * before including any header files to force that particular source |
| 67 | * be built with simple device model. |
| 68 | */ |
| 69 | |
| 70 | #if defined(__PRE_RAM__) || defined(__SMM__) |
| 71 | #define __SIMPLE_DEVICE__ |
| 72 | #endif |
| 73 | |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 74 | #endif /* _RULES_H */ |