blob: bb6fa18f2017a4eaed51ecf18f453a9ac5ffcf2d [file] [log] [blame]
David Hendricks8cbd5692017-12-01 20:49:48 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2014 Rockchip Inc.
Patrick Rudolphab0a7742019-01-02 14:04:02 +01005 * Copyright 2019 9Elements GmbH <patrick.rudolph@9elements.com>
David Hendricks8cbd5692017-12-01 20:49:48 -08006 *
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,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <cbmem.h>
18#include <soc/addressmap.h>
19#include <soc/sdram.h>
20#include <stdlib.h>
21#include <symbols.h>
22
23void *cbmem_top(void)
24{
Patrick Rudolph52acef12018-08-08 12:46:18 +020025 /* Make sure not to overlap with reserved ATF scratchpad */
Patrick Rudolphab0a7742019-01-02 14:04:02 +010026 return (void *)((uintptr_t)_dram + (sdram_size_mb() - 1) * MiB);
David Hendricks8cbd5692017-12-01 20:49:48 -080027}