blob: 5740b77a4a827d5ab2879e59ea50188004d2ee6c [file] [log] [blame]
Kyösti Mälkkief844012013-06-25 23:17:43 +03001/*
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älkkie8792be2014-02-26 15:19:04 +020019#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 Shaikhabde3b52014-08-26 15:39:51 -070031#define ENV_SECMON 0
Kyösti Mälkkie8792be2014-02-26 15:19:04 +020032
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 Shaikhabde3b52014-08-26 15:39:51 -070038#define ENV_SECMON 0
Kyösti Mälkkie8792be2014-02-26 15:19:04 +020039
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 Shaikhabde3b52014-08-26 15:39:51 -070045#define ENV_SECMON 0
Kyösti Mälkkie8792be2014-02-26 15:19:04 +020046
Furquan Shaikhabde3b52014-08-26 15:39:51 -070047#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älkkie8792be2014-02-26 15:19:04 +020055#define ENV_BOOTBLOCK 0
56#define ENV_ROMSTAGE 0
57#define ENV_RAMSTAGE 1
58#define ENV_SMM 0
Furquan Shaikhabde3b52014-08-26 15:39:51 -070059#define ENV_SECMON 0
Kyösti Mälkkie8792be2014-02-26 15:19:04 +020060#endif
Kyösti Mälkkief844012013-06-25 23:17:43 +030061
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älkkie8792be2014-02-26 15:19:04 +020074#endif /* _RULES_H */