blob: a4f510d2f4ce90a47615068fde8e8fe80eb4fc1f [file] [log] [blame]
Aaron Durbince727e12013-12-12 10:27:11 -08001/*
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 Durbinbd74a4b2015-03-06 23:17:33 -060021#include <stage_cache.h>
Julius Werner18ea2d32014-10-07 16:42:17 -070022#include <soc/smm.h>
Aaron Durbince727e12013-12-12 10:27:11 -080023
Aaron Durbinbd74a4b2015-03-06 23:17:33 -060024void stage_cache_external_region(void **base, size_t *size)
Aaron Durbince727e12013-12-12 10:27:11 -080025{
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 Durbinbd74a4b2015-03-06 23:17:33 -060034 *base = &smm_base[smm_region_size() - cache_size];
Aaron Durbince727e12013-12-12 10:27:11 -080035}