device/resource: Add _kb postfix for resource allocators
There is a lot of going back-and-forth with the KiB arguments, start
the work to migrate away from this.
Change-Id: I329864d36137e9a99b5640f4f504c45a02060a40
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64658
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/mainboard/emulation/qemu-aarch64/mainboard.c b/src/mainboard/emulation/qemu-aarch64/mainboard.c
index 988502f..181536c 100644
--- a/src/mainboard/emulation/qemu-aarch64/mainboard.c
+++ b/src/mainboard/emulation/qemu-aarch64/mainboard.c
@@ -13,7 +13,7 @@
static void mainboard_enable(struct device *dev)
{
int ram_size_mb = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB);
- ram_resource(dev, 0, (uintptr_t)_dram / KiB, ram_size_mb * KiB);
+ ram_resource_kb(dev, 0, (uintptr_t)_dram / KiB, ram_size_mb * KiB);
}
struct chip_operations mainboard_ops = {
diff --git a/src/mainboard/emulation/qemu-armv7/mainboard.c b/src/mainboard/emulation/qemu-armv7/mainboard.c
index 439f243..4111caa 100644
--- a/src/mainboard/emulation/qemu-armv7/mainboard.c
+++ b/src/mainboard/emulation/qemu-armv7/mainboard.c
@@ -39,7 +39,7 @@
discovered = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB);
printk(BIOS_DEBUG, "%d MiB of RAM discovered\n", discovered);
- ram_resource(dev, 0, 0x60000000 >> 10, discovered << 10);
+ ram_resource_kb(dev, 0, 0x60000000 >> 10, discovered << 10);
init_gfx();
}
diff --git a/src/mainboard/emulation/qemu-i440fx/mainboard.c b/src/mainboard/emulation/qemu-i440fx/mainboard.c
index a7c6b32..13f0766 100644
--- a/src/mainboard/emulation/qemu-i440fx/mainboard.c
+++ b/src/mainboard/emulation/qemu-i440fx/mainboard.c
@@ -37,7 +37,7 @@
if (CONFIG(ARCH_RAMSTAGE_X86_64)) {
/* Reserve page tables in DRAM. FIXME: Remove once x86_64 page tables reside in CBMEM */
- reserved_ram_resource(dev, 0, CONFIG_ARCH_X86_64_PGTBL_LOC / KiB,
+ reserved_ram_resource_kb(dev, 0, CONFIG_ARCH_X86_64_PGTBL_LOC / KiB,
(6 * 0x1000) / KiB);
}
}
diff --git a/src/mainboard/emulation/qemu-i440fx/northbridge.c b/src/mainboard/emulation/qemu-i440fx/northbridge.c
index b55ace0..708e3a6 100644
--- a/src/mainboard/emulation/qemu-i440fx/northbridge.c
+++ b/src/mainboard/emulation/qemu-i440fx/northbridge.c
@@ -65,10 +65,10 @@
list[i].address, list[i].length);
if (list[i].address == 0) {
tomk = list[i].length / 1024;
- ram_resource(dev, idx++, 0, 640);
- ram_resource(dev, idx++, 768, tomk - 768);
+ ram_resource_kb(dev, idx++, 0, 640);
+ ram_resource_kb(dev, idx++, 768, tomk - 768);
} else {
- ram_resource(dev, idx++,
+ ram_resource_kb(dev, idx++,
list[i].address / 1024,
list[i].length / 1024);
}
@@ -99,10 +99,10 @@
printk(BIOS_DEBUG, "QEMU: cmos: %lu MiB RAM above 4G.\n", high / 1024);
/* Report the memory regions. */
- ram_resource(dev, idx++, 0, 640);
- ram_resource(dev, idx++, 768, tomk - 768);
+ ram_resource_kb(dev, idx++, 0, 640);
+ ram_resource_kb(dev, idx++, 768, tomk - 768);
if (high)
- ram_resource(dev, idx++, 4 * 1024 * 1024, high);
+ ram_resource_kb(dev, idx++, 4 * 1024 * 1024, high);
}
/* Reserve I/O ports used by QEMU */
@@ -119,10 +119,10 @@
}
/* A segment is legacy VGA region */
- mmio_resource(dev, idx++, 0xa0000 / KiB, (0xc0000 - 0xa0000) / KiB);
+ mmio_resource_kb(dev, idx++, 0xa0000 / KiB, (0xc0000 - 0xa0000) / KiB);
/* C segment to 1MB is reserved RAM (low tables) */
- reserved_ram_resource(dev, idx++, 0xc0000 / KiB, (1 * MiB - 0xc0000) / KiB);
+ reserved_ram_resource_kb(dev, idx++, 0xc0000 / KiB, (1 * MiB - 0xc0000) / KiB);
if (q35 && ((tomk * 1024) < 0xb0000000)) {
/*
diff --git a/src/mainboard/emulation/qemu-power8/mainboard.c b/src/mainboard/emulation/qemu-power8/mainboard.c
index cfee99f..6f8016c 100644
--- a/src/mainboard/emulation/qemu-power8/mainboard.c
+++ b/src/mainboard/emulation/qemu-power8/mainboard.c
@@ -11,7 +11,7 @@
}
/* Where does RAM live? */
- ram_resource(dev, 0, 2048, 32768);
+ ram_resource_kb(dev, 0, 2048, 32768);
}
struct chip_operations mainboard_ops = {
diff --git a/src/mainboard/emulation/qemu-power9/mainboard.c b/src/mainboard/emulation/qemu-power9/mainboard.c
index 6c178af..542339d 100644
--- a/src/mainboard/emulation/qemu-power9/mainboard.c
+++ b/src/mainboard/emulation/qemu-power9/mainboard.c
@@ -8,7 +8,7 @@
{
if (!dev)
die("No dev0; die\n");
- ram_resource(dev, 0, 0, (unsigned long)cbmem_top() / KiB);
+ ram_resource_kb(dev, 0, 0, (unsigned long)cbmem_top() / KiB);
}
struct chip_operations mainboard_ops = {
diff --git a/src/mainboard/emulation/qemu-q35/mainboard.c b/src/mainboard/emulation/qemu-q35/mainboard.c
index 534f606..594b256 100644
--- a/src/mainboard/emulation/qemu-q35/mainboard.c
+++ b/src/mainboard/emulation/qemu-q35/mainboard.c
@@ -55,12 +55,12 @@
if (CONFIG(ARCH_RAMSTAGE_X86_64)) {
/* Reserve page tables in DRAM. FIXME: Remove once x86_64 page tables reside in CBMEM */
- reserved_ram_resource(dev, 0, CONFIG_ARCH_X86_64_PGTBL_LOC / KiB,
+ reserved_ram_resource_kb(dev, 0, CONFIG_ARCH_X86_64_PGTBL_LOC / KiB,
(6 * 0x1000) / KiB);
}
smm_region(&tseg_base, &tseg_size);
- reserved_ram_resource(dev, ESMRAMC, tseg_base / 1024, tseg_size / 1024);
+ reserved_ram_resource_kb(dev, ESMRAMC, tseg_base / 1024, tseg_size / 1024);
}
diff --git a/src/mainboard/emulation/qemu-riscv/mainboard.c b/src/mainboard/emulation/qemu-riscv/mainboard.c
index 78cbfe2..af0df9c 100644
--- a/src/mainboard/emulation/qemu-riscv/mainboard.c
+++ b/src/mainboard/emulation/qemu-riscv/mainboard.c
@@ -14,7 +14,7 @@
}
dram_mb_detected = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB);
- ram_resource(dev, 0, (uintptr_t)_dram / KiB, dram_mb_detected * MiB / KiB);
+ ram_resource_kb(dev, 0, (uintptr_t)_dram / KiB, dram_mb_detected * MiB / KiB);
}
struct chip_operations mainboard_ops = {
diff --git a/src/mainboard/emulation/spike-riscv/mainboard.c b/src/mainboard/emulation/spike-riscv/mainboard.c
index 84a1155..2454f04 100644
--- a/src/mainboard/emulation/spike-riscv/mainboard.c
+++ b/src/mainboard/emulation/spike-riscv/mainboard.c
@@ -17,7 +17,7 @@
die("No dev0; die\n");
}
- ram_resource(dev, 0, 0x80000000/KiB, ram_size/KiB);
+ ram_resource_kb(dev, 0, 0x80000000/KiB, ram_size/KiB);
}
struct chip_operations mainboard_ops = {
diff --git a/src/mainboard/sifive/hifive-unleashed/mainboard.c b/src/mainboard/sifive/hifive-unleashed/mainboard.c
index 22bd9fa..9dde848 100644
--- a/src/mainboard/sifive/hifive-unleashed/mainboard.c
+++ b/src/mainboard/sifive/hifive-unleashed/mainboard.c
@@ -6,7 +6,7 @@
static void mainboard_enable(struct device *dev)
{
- ram_resource(dev, 0, (uintptr_t)_dram/KiB, sdram_size_mb()*KiB);
+ ram_resource_kb(dev, 0, (uintptr_t)_dram/KiB, sdram_size_mb()*KiB);
}
struct chip_operations mainboard_ops = {