pc_memory_init: Move memory calculation to the caller.
This patch moves above_4g_mem_size and below_4g_mem_size calculation in the caller of pc_memory_init (pc_init1). And the prototype of pc_memory_init is changed because there is no need anymore to have variable pointer and the ram_size parameter. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
3285cf4fe7
commit
e0e7e67b45
17
hw/pc.c
17
hw/pc.c
@ -957,29 +957,18 @@ void pc_cpus_init(const char *cpu_model)
|
||||
}
|
||||
}
|
||||
|
||||
void pc_memory_init(ram_addr_t ram_size,
|
||||
const char *kernel_filename,
|
||||
void pc_memory_init(const char *kernel_filename,
|
||||
const char *kernel_cmdline,
|
||||
const char *initrd_filename,
|
||||
ram_addr_t *below_4g_mem_size_p,
|
||||
ram_addr_t *above_4g_mem_size_p)
|
||||
ram_addr_t below_4g_mem_size,
|
||||
ram_addr_t above_4g_mem_size)
|
||||
{
|
||||
char *filename;
|
||||
int ret, linux_boot, i;
|
||||
ram_addr_t ram_addr, bios_offset, option_rom_offset;
|
||||
ram_addr_t below_4g_mem_size, above_4g_mem_size = 0;
|
||||
int bios_size, isa_bios_size;
|
||||
void *fw_cfg;
|
||||
|
||||
if (ram_size >= 0xe0000000 ) {
|
||||
above_4g_mem_size = ram_size - 0xe0000000;
|
||||
below_4g_mem_size = 0xe0000000;
|
||||
} else {
|
||||
below_4g_mem_size = ram_size;
|
||||
}
|
||||
*above_4g_mem_size_p = above_4g_mem_size;
|
||||
*below_4g_mem_size_p = below_4g_mem_size;
|
||||
|
||||
linux_boot = (kernel_filename != NULL);
|
||||
|
||||
/* allocate RAM */
|
||||
|
7
hw/pc.h
7
hw/pc.h
@ -129,12 +129,11 @@ void pc_cmos_set_s3_resume(void *opaque, int irq, int level);
|
||||
void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
|
||||
|
||||
void pc_cpus_init(const char *cpu_model);
|
||||
void pc_memory_init(ram_addr_t ram_size,
|
||||
const char *kernel_filename,
|
||||
void pc_memory_init(const char *kernel_filename,
|
||||
const char *kernel_cmdline,
|
||||
const char *initrd_filename,
|
||||
ram_addr_t *below_4g_mem_size_p,
|
||||
ram_addr_t *above_4g_mem_size_p);
|
||||
ram_addr_t below_4g_mem_size,
|
||||
ram_addr_t above_4g_mem_size);
|
||||
qemu_irq *pc_allocate_cpu_irq(void);
|
||||
void pc_vga_init(PCIBus *pci_bus);
|
||||
void pc_basic_device_init(qemu_irq *isa_irq,
|
||||
|
12
hw/pc_piix.c
12
hw/pc_piix.c
@ -92,9 +92,17 @@ static void pc_init1(ram_addr_t ram_size,
|
||||
kvmclock_create();
|
||||
}
|
||||
|
||||
if (ram_size >= 0xe0000000 ) {
|
||||
above_4g_mem_size = ram_size - 0xe0000000;
|
||||
below_4g_mem_size = 0xe0000000;
|
||||
} else {
|
||||
above_4g_mem_size = 0;
|
||||
below_4g_mem_size = ram_size;
|
||||
}
|
||||
|
||||
/* allocate ram and load rom/bios */
|
||||
pc_memory_init(ram_size, kernel_filename, kernel_cmdline, initrd_filename,
|
||||
&below_4g_mem_size, &above_4g_mem_size);
|
||||
pc_memory_init(kernel_filename, kernel_cmdline, initrd_filename,
|
||||
below_4g_mem_size, above_4g_mem_size);
|
||||
|
||||
cpu_irq = pc_allocate_cpu_irq();
|
||||
i8259 = i8259_init(cpu_irq[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user