Aaron Durbin | ce727e1 | 2013-12-12 10:27:11 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2013 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. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #include <cbmem.h> |
Aaron Durbin | bd74a4b | 2015-03-06 23:17:33 -0600 | [diff] [blame^] | 21 | #include <stage_cache.h> |
Julius Werner | 18ea2d3 | 2014-10-07 16:42:17 -0700 | [diff] [blame] | 22 | #include <soc/smm.h> |
Aaron Durbin | ce727e1 | 2013-12-12 10:27:11 -0800 | [diff] [blame] | 23 | |
Aaron Durbin | bd74a4b | 2015-03-06 23:17:33 -0600 | [diff] [blame^] | 24 | void stage_cache_external_region(void **base, size_t *size) |
Aaron Durbin | ce727e1 | 2013-12-12 10:27:11 -0800 | [diff] [blame] | 25 | { |
| 26 | char *smm_base; |
| 27 | /* 1MiB cache size */ |
| 28 | const long cache_size = CONFIG_SMM_RESERVED_SIZE; |
| 29 | |
| 30 | /* Ramstage cache lives in TSEG region which is the definition of |
| 31 | * cbmem_top(). */ |
| 32 | smm_base = cbmem_top(); |
| 33 | *size = cache_size; |
Aaron Durbin | bd74a4b | 2015-03-06 23:17:33 -0600 | [diff] [blame^] | 34 | *base = &smm_base[smm_region_size() - cache_size]; |
Aaron Durbin | ce727e1 | 2013-12-12 10:27:11 -0800 | [diff] [blame] | 35 | } |