[U-Boot] [PATCH 2/4] x86: qemu: Extract getting memory size to a separate routine

Bin Meng bmeng.cn at gmail.com
Tue Sep 10 06:17:20 UTC 2019


On Wed, Sep 4, 2019 at 12:54 AM Park, Aiden <aiden.park at intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > Sent: Thursday, August 29, 2019 2:53 AM
> > To: Simon Glass <sjg at chromium.org>; Park, Aiden <aiden.park at intel.com>;
> > U-Boot Mailing List <u-boot at lists.denx.de>
> > Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
> > Subject: [PATCH 2/4] 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 at gmail.com>
> > ---
> >
> >  arch/x86/cpu/qemu/dram.c              | 9 +++++++--
> >  arch/x86/include/asm/arch-qemu/qemu.h | 7 +++++++
> >  2 files changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/cpu/qemu/dram.c b/arch/x86/cpu/qemu/dram.c index
> > 736c4c3..c29b073 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;
> > diff --git a/arch/x86/include/asm/arch-qemu/qemu.h
> > b/arch/x86/include/asm/arch-qemu/qemu.h
> > index 100eb8e..c98deb2 100644
> > --- a/arch/x86/include/asm/arch-qemu/qemu.h
> > +++ b/arch/x86/include/asm/arch-qemu/qemu.h
> > @@ -37,4 +37,11 @@
> >  #define PMREGMISC    0x80
> >  #define PMIOSE               (1 << 0)
> >
> > +/**
> > + * qemu_get_low_memory_size() - Get low memory size
> > + *
> > + * @return:  size of memory below 4GiB
> > + */
> > +u32 qemu_get_low_memory_size(void);
> > +
> >  #endif /* _ARCH_QEMU_H_ */
> > --
> > 2.7.4
>
> Reviewed-by: Aiden Park <aiden.park at intel.com>

applied to u-boot-x86, thanks!


More information about the U-Boot mailing list