Revision 5650f5f4 hw/i386/pc_piix.c

b/hw/i386/pc_piix.c
61 61
static bool has_pci_info = true;
62 62

  
63 63
/* PC hardware initialisation */
64
static void pc_init1(MemoryRegion *system_memory,
64
static void pc_init1(QEMUMachineInitArgs *args,
65
                     MemoryRegion *system_memory,
65 66
                     MemoryRegion *system_io,
66
                     ram_addr_t ram_size,
67
                     const char *boot_device,
68
                     const char *kernel_filename,
69
                     const char *kernel_cmdline,
70
                     const char *initrd_filename,
71
                     const char *cpu_model,
72 67
                     int pci_enabled,
73 68
                     int kvmclock_enabled)
74 69
{
......
103 98
    object_property_add_child(qdev_get_machine(), "icc-bridge",
104 99
                              OBJECT(icc_bridge), NULL);
105 100

  
106
    pc_cpus_init(cpu_model, icc_bridge);
101
    pc_cpus_init(args->cpu_model, icc_bridge);
107 102

  
108 103
    if (kvm_enabled() && kvmclock_enabled) {
109 104
        kvmclock_create();
110 105
    }
111 106

  
112
    if (ram_size >= 0xe0000000 ) {
113
        above_4g_mem_size = ram_size - 0xe0000000;
107
    if (args->ram_size >= 0xe0000000) {
108
        above_4g_mem_size = args->ram_size - 0xe0000000;
114 109
        below_4g_mem_size = 0xe0000000;
115 110
    } else {
116 111
        above_4g_mem_size = 0;
117
        below_4g_mem_size = ram_size;
112
        below_4g_mem_size = args->ram_size;
118 113
    }
119 114

  
120 115
    if (pci_enabled) {
......
133 128
    /* allocate ram and load rom/bios */
134 129
    if (!xen_enabled()) {
135 130
        fw_cfg = pc_memory_init(system_memory,
136
                       kernel_filename, kernel_cmdline, initrd_filename,
131
                       args->kernel_filename, args->kernel_cmdline,
132
                       args->initrd_filename,
137 133
                       below_4g_mem_size, above_4g_mem_size,
138 134
                       rom_memory, &ram_memory, guest_info);
139 135
    }
......
149 145

  
150 146
    if (pci_enabled) {
151 147
        pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
152
                              system_memory, system_io, ram_size,
148
                              system_memory, system_io, args->ram_size,
153 149
                              below_4g_mem_size,
154 150
                              0x100000000ULL - below_4g_mem_size,
155 151
                              above_4g_mem_size,
......
208 204
        }
209 205
    }
210 206

  
211
    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
207
    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, args->boot_device,
212 208
                 floppy, idebus[0], idebus[1], rtc_state);
213 209

  
214 210
    if (pci_enabled && usb_enabled(false)) {
......
237 233

  
238 234
static void pc_init_pci(QEMUMachineInitArgs *args)
239 235
{
240
    ram_addr_t ram_size = args->ram_size;
241
    const char *cpu_model = args->cpu_model;
242
    const char *kernel_filename = args->kernel_filename;
243
    const char *kernel_cmdline = args->kernel_cmdline;
244
    const char *initrd_filename = args->initrd_filename;
245
    const char *boot_device = args->boot_device;
246
    pc_init1(get_system_memory(),
247
             get_system_io(),
248
             ram_size, boot_device,
249
             kernel_filename, kernel_cmdline,
250
             initrd_filename, cpu_model, 1, 1);
236
    pc_init1(args, get_system_memory(), get_system_io(), 1, 1);
251 237
}
252 238

  
253 239
static void pc_init_pci_1_6(QEMUMachineInitArgs *args)
......
293 279
/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
294 280
static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
295 281
{
296
    ram_addr_t ram_size = args->ram_size;
297
    const char *cpu_model = args->cpu_model;
298
    const char *kernel_filename = args->kernel_filename;
299
    const char *kernel_cmdline = args->kernel_cmdline;
300
    const char *initrd_filename = args->initrd_filename;
301
    const char *boot_device = args->boot_device;
302 282
    has_pci_info = false;
303 283
    disable_kvm_pv_eoi();
304 284
    enable_compat_apic_id_mode();
305
    pc_init1(get_system_memory(),
306
             get_system_io(),
307
             ram_size, boot_device,
308
             kernel_filename, kernel_cmdline,
309
             initrd_filename, cpu_model, 1, 0);
285
    pc_init1(args, get_system_memory(), get_system_io(), 1, 0);
310 286
}
311 287

  
312 288
static void pc_init_isa(QEMUMachineInitArgs *args)
313 289
{
314
    ram_addr_t ram_size = args->ram_size;
315
    const char *cpu_model = args->cpu_model;
316
    const char *kernel_filename = args->kernel_filename;
317
    const char *kernel_cmdline = args->kernel_cmdline;
318
    const char *initrd_filename = args->initrd_filename;
319
    const char *boot_device = args->boot_device;
320 290
    has_pci_info = false;
321
    if (cpu_model == NULL)
322
        cpu_model = "486";
291
    if (!args->cpu_model) {
292
        args->cpu_model = "486";
293
    }
323 294
    disable_kvm_pv_eoi();
324 295
    enable_compat_apic_id_mode();
325
    pc_init1(get_system_memory(),
326
             get_system_io(),
327
             ram_size, boot_device,
328
             kernel_filename, kernel_cmdline,
329
             initrd_filename, cpu_model, 0, 1);
296
    pc_init1(args, get_system_memory(), get_system_io(), 0, 1);
330 297
}
331 298

  
332 299
#ifdef CONFIG_XEN

Also available in: Unified diff