Revision 63ffb564 hw/pc.c

b/hw/pc.c
334 334
void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
335 335
                  const char *boot_device,
336 336
                  BusState *idebus0, BusState *idebus1,
337
                  FDCtrl *floppy_controller, ISADevice *s)
337
                  ISADevice *s)
338 338
{
339
    int val, nb;
340
    FDriveType fd0, fd1;
339
    int val, nb, nb_heads, max_track, last_sect, i;
340
    FDriveType fd_type[2];
341
    DriveInfo *fd[2];
341 342
    static pc_cmos_init_late_arg arg;
342 343

  
343 344
    /* various important CMOS locations needed by PC/Bochs bios */
......
379 380
    }
380 381

  
381 382
    /* floppy type */
382

  
383
    fd0 = fdctrl_get_drive_type(floppy_controller, 0);
384
    fd1 = fdctrl_get_drive_type(floppy_controller, 1);
385

  
386
    val = (cmos_get_fd_drive_type(fd0) << 4) | cmos_get_fd_drive_type(fd1);
383
    for (i = 0; i < 2; i++) {
384
        fd[i] = drive_get(IF_FLOPPY, 0, i);
385
        if (fd[i]) {
386
            bdrv_get_floppy_geometry_hint(fd[i]->bdrv, &nb_heads, &max_track,
387
                                          &last_sect, FDRIVE_DRV_NONE,
388
                                          &fd_type[i]);
389
        } else {
390
            fd_type[i] = FDRIVE_DRV_NONE;
391
        }
392
    }
393
    val = (cmos_get_fd_drive_type(fd_type[0]) << 4) |
394
        cmos_get_fd_drive_type(fd_type[1]);
387 395
    rtc_set_memory(s, 0x10, val);
388 396

  
389 397
    val = 0;
390 398
    nb = 0;
391
    if (fd0 < FDRIVE_DRV_NONE) {
399
    if (fd_type[0] < FDRIVE_DRV_NONE) {
392 400
        nb++;
393 401
    }
394
    if (fd1 < FDRIVE_DRV_NONE) {
402
    if (fd_type[1] < FDRIVE_DRV_NONE) {
395 403
        nb++;
396 404
    }
397 405
    switch (nb) {
......
1092 1100
}
1093 1101

  
1094 1102
void pc_basic_device_init(qemu_irq *isa_irq,
1095
                          FDCtrl **floppy_controller,
1096 1103
                          ISADevice **rtc_state)
1097 1104
{
1098 1105
    int i;
......
1153 1160
    for(i = 0; i < MAX_FD; i++) {
1154 1161
        fd[i] = drive_get(IF_FLOPPY, 0, i);
1155 1162
    }
1156
    *floppy_controller = fdctrl_init_isa(fd);
1163
    fdctrl_init_isa(fd);
1157 1164
}
1158 1165

  
1159 1166
void pc_pci_device_init(PCIBus *pci_bus)

Also available in: Unified diff