mb/qemu-aarch64: Move probing dram to read_resources

While we are at it:
- Don't use _kb version of declaring resources
- Use cbmem_top instead of probing for memory again

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Change-Id: Iaaee41aec7806287ef1881372ec8ec47a4cd57d9
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76004
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
This commit is contained in:
Arthur Heymans 2023-06-22 19:29:17 +02:00 committed by Felix Held
parent 62ea7a8165
commit 80254118ac
1 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* SPDX-License-Identifier: GPL-2.0-or-later */
#include <ramdetect.h> #include <cbmem.h>
#include <symbols.h> #include <symbols.h>
#include <device/device.h> #include <device/device.h>
#include <bootmem.h> #include <bootmem.h>
@ -13,8 +13,6 @@ void bootmem_platform_add_ranges(void)
static void mainboard_enable(struct device *dev) static void mainboard_enable(struct device *dev)
{ {
int ram_size_mb = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB);
ram_resource_kb(dev, 0, (uintptr_t)_dram / KiB, ram_size_mb * KiB);
} }
struct chip_operations mainboard_ops = { struct chip_operations mainboard_ops = {
@ -44,6 +42,8 @@ static void qemu_aarch64_domain_read_resources(struct device *dev)
res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED; res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED;
mmio_range(dev, index++, VIRT_PCIE_ECAM_BASE, VIRT_PCIE_ECAM_SIZE); mmio_range(dev, index++, VIRT_PCIE_ECAM_BASE, VIRT_PCIE_ECAM_SIZE);
ram_from_to(dev, index++, (uintptr_t)_dram, (uintptr_t)cbmem_top());
} }
struct device_operations qemu_aarch64_pci_domain_ops = { struct device_operations qemu_aarch64_pci_domain_ops = {