blob: 4c2a97621ac61e65e7160174f03a919381a087f2 [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.
Aaron Durbince727e12013-12-12 10:27:11 -080014 */
15
16#include <cbmem.h>
Aaron Durbinbd74a4b2015-03-06 23:17:33 -060017#include <stage_cache.h>
Julius Werner18ea2d32014-10-07 16:42:17 -070018#include <soc/smm.h>
Aaron Durbince727e12013-12-12 10:27:11 -080019
Aaron Durbinbd74a4b2015-03-06 23:17:33 -060020void stage_cache_external_region(void **base, size_t *size)
Aaron Durbince727e12013-12-12 10:27:11 -080021{
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 Durbinbd74a4b2015-03-06 23:17:33 -060030 *base = &smm_base[smm_region_size() - cache_size];
Aaron Durbince727e12013-12-12 10:27:11 -080031}