blob: 1a55d0113ecd8c7e1c87d79b911e5006595c16ab [file] [log] [blame]
Yidi Lin3d7b6062015-07-31 17:10:40 +08001/*
2 * This file is part of the coreboot project.
3 *
Tristan Shieh362a7342018-06-06 14:03:22 +08004 * Copyright 2018 MediaTek Inc.
Yidi Lin3d7b6062015-07-31 17:10:40 +08005 *
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.
Yidi Lin3d7b6062015-07-31 17:10:40 +080014 */
15
16#include <cbmem.h>
17#include <stddef.h>
CC Mae3413cc2015-08-06 14:07:50 +080018#include <stdlib.h>
Yidi Lin3d7b6062015-07-31 17:10:40 +080019#include <symbols.h>
Yidi Linc6d7dcc2016-02-04 17:26:48 +080020#include <soc/emi.h>
Yidi Lin3d7b6062015-07-31 17:10:40 +080021
Tristan Shieh4c8d4872018-06-06 13:35:12 +080022#define MAX_DRAM_ADDRESS ((uintptr_t)4 * GiB)
23
Arthur Heymans340e4b82019-10-23 17:25:58 +020024void *cbmem_top_chipset(void)
Yidi Lin3d7b6062015-07-31 17:10:40 +080025{
Tristan Shieh4c8d4872018-06-06 13:35:12 +080026 return (void *)min((uintptr_t)_dram + sdram_size(), MAX_DRAM_ADDRESS);
Yidi Lin3d7b6062015-07-31 17:10:40 +080027}