blob: 1886c6fa9317123e2a94fb20001636b5df73a017 [file] [log] [blame]
Martin Roth433659a2014-05-12 21:55:00 -06001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2013 Google, Inc.
Kyösti Mälkkif1e3c762014-12-22 12:28:07 +02005 * Copyright (C) 2014 Sage Electronic Engineering, LLC.
Martin Roth433659a2014-05-12 21:55:00 -06006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
Aaron Durbin2c4aab32015-03-06 23:26:06 -060012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Martin Roth433659a2014-05-12 21:55:00 -060013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Martin Roth433659a2014-05-12 21:55:00 -060015 */
16
17#include <arch/io.h>
18#include <cbmem.h>
Ben Gardnerfa6014a2015-12-08 21:20:25 -060019#include <soc/iosf.h>
20#include <soc/smm.h>
Marc Jones78687972015-04-22 23:16:31 -060021#include <drivers/intel/fsp1_0/fsp_util.h>
Martin Roth433659a2014-05-12 21:55:00 -060022
Kyösti Mälkkif1e3c762014-12-22 12:28:07 +020023uintptr_t smm_region_start(void)
Martin Roth433659a2014-05-12 21:55:00 -060024{
Kyösti Mälkkif1e3c762014-12-22 12:28:07 +020025 return (iosf_bunit_read(BUNIT_SMRRL) << 20);
26}
27
Martin Roth22138432015-01-30 20:56:05 -070028/** @brief get the top of usable low memory from the FSP's HOB list
29 *
30 * The FSP's reserved memory sits just below the SMM region. The memory
31 * region below it is usable memory.
Kyösti Mälkkif1e3c762014-12-22 12:28:07 +020032 *
33 * The entire memory map is shown in northcluster.c
Martin Roth22138432015-01-30 20:56:05 -070034 *
35 * @return pointer to the first byte of reserved memory
Kyösti Mälkkif1e3c762014-12-22 12:28:07 +020036 */
37
38void *cbmem_top(void)
39{
Martin Roth22138432015-01-30 20:56:05 -070040 return find_fsp_reserved_mem(*(void **)CBMEM_FSP_HOB_PTR);
Martin Roth433659a2014-05-12 21:55:00 -060041}