Angel Pons | f23ae0b | 2020-04-02 23:48:12 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Damien Roth | bedbd67 | 2016-01-18 13:59:26 -0700 | [diff] [blame] | 2 | |
Kyösti Mälkki | 2446c1e | 2020-07-09 07:13:37 +0300 | [diff] [blame] | 3 | #include <amdblocks/biosram.h> |
Eric Biederman | fcd5ace | 2004-10-14 19:29:29 +0000 | [diff] [blame] | 4 | #include <console/console.h> |
| 5 | #include <device/device.h> |
Eric Biederman | fcd5ace | 2004-10-14 19:29:29 +0000 | [diff] [blame] | 6 | #include <cpu/amd/mtrr.h> |
Kyösti Mälkki | dbc4739 | 2012-08-05 12:11:40 +0300 | [diff] [blame] | 7 | |
Kyösti Mälkki | 17bb225 | 2017-04-19 19:55:54 +0300 | [diff] [blame] | 8 | void add_uma_resource_below_tolm(struct device *nb, int idx) |
| 9 | { |
Arthur Heymans | c435038 | 2021-10-28 12:35:39 +0200 | [diff] [blame] | 10 | uint32_t topmem = amd_topmem(); |
Kyösti Mälkki | 70d92b9 | 2017-04-19 19:57:01 +0300 | [diff] [blame] | 11 | uint32_t top_of_cacheable = restore_top_of_low_cacheable(); |
Kyösti Mälkki | 17bb225 | 2017-04-19 19:55:54 +0300 | [diff] [blame] | 12 | |
| 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 | |
| 22 | uma_resource(nb, idx, uma_base / KiB, uma_size / KiB); |
| 23 | } |