blob: d51746fbd193a324a931deb2476482c9a93be1d1 [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>
21#include <ramstage_cache.h>
Julius Werner18ea2d32014-10-07 16:42:17 -070022#include <soc/smm.h>
Aaron Durbince727e12013-12-12 10:27:11 -080023
24struct ramstage_cache *ramstage_cache_location(long *size)
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;
34 return (void *)&smm_base[smm_region_size() - cache_size];
35}