summaryrefslogtreecommitdiff
path: root/arch/x86/cpu
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2019-08-29 02:53:04 -0700
committerBin Meng <bmeng.cn@gmail.com>2019-09-10 14:19:39 +0800
commitf4c0030074544e8d3105bc9e4debb82e964ab126 (patch)
treec0fa8a12d78de842b5917ba424e9523e088a530a /arch/x86/cpu
parentd2860c0088cb8e0303547b2130dd237374e91fde (diff)
x86: qemu: Extract getting memory size to a separate routine
This extracts getting memory size logic in dram_init() to a separate routine qemu_get_low_memory_size(). No functional changes. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Aiden Park <aiden.park@intel.com>
Diffstat (limited to 'arch/x86/cpu')
-rw-r--r--arch/x86/cpu/qemu/dram.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/x86/cpu/qemu/dram.c b/arch/x86/cpu/qemu/dram.c
index 736c4c3ace..c29b073d7c 100644
--- a/arch/x86/cpu/qemu/dram.c
+++ b/arch/x86/cpu/qemu/dram.c
@@ -9,7 +9,7 @@
DECLARE_GLOBAL_DATA_PTR;
-int dram_init(void)
+u32 qemu_get_low_memory_size(void)
{
u32 ram;
@@ -19,7 +19,12 @@ int dram_init(void)
ram |= ((u32)inb(CMOS_DATA_PORT)) << 6;
ram += 16 * 1024;
- gd->ram_size = ram * 1024;
+ return ram * 1024;
+}
+
+int dram_init(void)
+{
+ gd->ram_size = qemu_get_low_memory_size();
post_code(POST_DRAM);
return 0;