Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2013 Google, Inc. |
Kyösti Mälkki | f1e3c76 | 2014-12-22 12:28:07 +0200 | [diff] [blame] | 5 | * Copyright (C) 2014 Sage Electronic Engineering, LLC. |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
Aaron Durbin | 2c4aab3 | 2015-03-06 23:26:06 -0600 | [diff] [blame] | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <arch/io.h> |
| 18 | #include <cbmem.h> |
Ben Gardner | fa6014a | 2015-12-08 21:20:25 -0600 | [diff] [blame] | 19 | #include <soc/iosf.h> |
| 20 | #include <soc/smm.h> |
Marc Jones | 7868797 | 2015-04-22 23:16:31 -0600 | [diff] [blame] | 21 | #include <drivers/intel/fsp1_0/fsp_util.h> |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 22 | |
Kyösti Mälkki | f1e3c76 | 2014-12-22 12:28:07 +0200 | [diff] [blame] | 23 | uintptr_t smm_region_start(void) |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 24 | { |
Kyösti Mälkki | f1e3c76 | 2014-12-22 12:28:07 +0200 | [diff] [blame] | 25 | return (iosf_bunit_read(BUNIT_SMRRL) << 20); |
| 26 | } |
| 27 | |
Martin Roth | 2213843 | 2015-01-30 20:56:05 -0700 | [diff] [blame] | 28 | /** @brief get the top of usable low memory from the FSP's HOB list |
| 29 | * |
| 30 | * The FSP's reserved memory sits just below the SMM region. The memory |
| 31 | * region below it is usable memory. |
Kyösti Mälkki | f1e3c76 | 2014-12-22 12:28:07 +0200 | [diff] [blame] | 32 | * |
| 33 | * The entire memory map is shown in northcluster.c |
Martin Roth | 2213843 | 2015-01-30 20:56:05 -0700 | [diff] [blame] | 34 | * |
| 35 | * @return pointer to the first byte of reserved memory |
Kyösti Mälkki | f1e3c76 | 2014-12-22 12:28:07 +0200 | [diff] [blame] | 36 | */ |
| 37 | |
| 38 | void *cbmem_top(void) |
| 39 | { |
Martin Roth | 2213843 | 2015-01-30 20:56:05 -0700 | [diff] [blame] | 40 | return find_fsp_reserved_mem(*(void **)CBMEM_FSP_HOB_PTR); |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 41 | } |