blob: 58f44ddfff2756caed004b1c92d811feda5bf164 [file] [log] [blame]
Angel Ponsf23ae0b2020-04-02 23:48:12 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Damien Rothbedbd672016-01-18 13:59:26 -07002
Kyösti Mälkki2446c1e2020-07-09 07:13:37 +03003#include <amdblocks/biosram.h>
Eric Biedermanfcd5ace2004-10-14 19:29:29 +00004#include <console/console.h>
5#include <device/device.h>
Eric Biedermanfcd5ace2004-10-14 19:29:29 +00006#include <cpu/amd/mtrr.h>
Kyösti Mälkkidbc47392012-08-05 12:11:40 +03007
Kyösti Mälkki17bb2252017-04-19 19:55:54 +03008void add_uma_resource_below_tolm(struct device *nb, int idx)
9{
Arthur Heymansc4350382021-10-28 12:35:39 +020010 uint32_t topmem = amd_topmem();
Kyösti Mälkki70d92b92017-04-19 19:57:01 +030011 uint32_t top_of_cacheable = restore_top_of_low_cacheable();
Kyösti Mälkki17bb2252017-04-19 19:55:54 +030012
13 if (top_of_cacheable == topmem)
14 return;
15
16 uint32_t uma_base = top_of_cacheable;
17 uint32_t uma_size = topmem - top_of_cacheable;
18
19 printk(BIOS_INFO, "%s: uma size 0x%08x, memory start 0x%08x\n",
20 __func__, uma_size, uma_base);
21
Kyösti Mälkki27d62992022-05-24 20:25:58 +030022 uma_resource_kb(nb, idx, uma_base / KiB, uma_size / KiB);
Kyösti Mälkki17bb2252017-04-19 19:55:54 +030023}