blob: 1c68de894b32a8045c39f5f7b143987c846f331a [file] [log] [blame]
Jonathan Neuschäfer55b46452018-04-19 16:23:54 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2018 Jonathan Neuschäfer
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
16#include <cbmem.h>
Philipp Hugbb7f41d2018-07-07 14:21:30 +020017#include <soc/addressmap.h>
18#include <soc/sdram.h>
19#include <stdlib.h>
20#include <symbols.h>
Jonathan Neuschäfer55b46452018-04-19 16:23:54 +020021
22void *cbmem_top(void)
23{
Philipp Hugbb7f41d2018-07-07 14:21:30 +020024 return (void *)min((uintptr_t)_dram + sdram_size_mb() * MiB,
25 FU540_MAXDRAM);
Jonathan Neuschäfer55b46452018-04-19 16:23:54 +020026}