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. |
Aaron Durbin | ce727e1 | 2013-12-12 10:27:11 -0800 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <cbmem.h> |
Aaron Durbin | bd74a4b | 2015-03-06 23:17:33 -0600 | [diff] [blame] | 17 | #include <stage_cache.h> |
Julius Werner | 18ea2d3 | 2014-10-07 16:42:17 -0700 | [diff] [blame] | 18 | #include <soc/smm.h> |
Aaron Durbin | ce727e1 | 2013-12-12 10:27:11 -0800 | [diff] [blame] | 19 | |
Aaron Durbin | bd74a4b | 2015-03-06 23:17:33 -0600 | [diff] [blame] | 20 | void stage_cache_external_region(void **base, size_t *size) |
Aaron Durbin | ce727e1 | 2013-12-12 10:27:11 -0800 | [diff] [blame] | 21 | { |
| 22 | char *smm_base; |
| 23 | /* 1MiB cache size */ |
| 24 | const long cache_size = CONFIG_SMM_RESERVED_SIZE; |
| 25 | |
| 26 | /* Ramstage cache lives in TSEG region which is the definition of |
| 27 | * cbmem_top(). */ |
| 28 | smm_base = cbmem_top(); |
| 29 | *size = cache_size; |
Aaron Durbin | bd74a4b | 2015-03-06 23:17:33 -0600 | [diff] [blame] | 30 | *base = &smm_base[smm_region_size() - cache_size]; |
Aaron Durbin | ce727e1 | 2013-12-12 10:27:11 -0800 | [diff] [blame] | 31 | } |