Revision 751c6a17 hw/pc.c
b/hw/pc.c | ||
---|---|---|
1126 | 1126 |
CPUState *env; |
1127 | 1127 |
qemu_irq *cpu_irq; |
1128 | 1128 |
qemu_irq *i8259; |
1129 |
int index;
|
|
1129 |
DriveInfo *dinfo;
|
|
1130 | 1130 |
BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; |
1131 | 1131 |
BlockDriverState *fd[MAX_FD]; |
1132 | 1132 |
int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled; |
... | ... | |
1356 | 1356 |
} |
1357 | 1357 |
|
1358 | 1358 |
for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { |
1359 |
index = drive_get_index(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); |
|
1360 |
if (index != -1) |
|
1361 |
hd[i] = drives_table[index].bdrv; |
|
1362 |
else |
|
1363 |
hd[i] = NULL; |
|
1359 |
dinfo = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); |
|
1360 |
hd[i] = dinfo ? dinfo->bdrv : NULL; |
|
1364 | 1361 |
} |
1365 | 1362 |
|
1366 | 1363 |
if (pci_enabled) { |
... | ... | |
1379 | 1376 |
#endif |
1380 | 1377 |
|
1381 | 1378 |
for(i = 0; i < MAX_FD; i++) { |
1382 |
index = drive_get_index(IF_FLOPPY, 0, i); |
|
1383 |
if (index != -1) |
|
1384 |
fd[i] = drives_table[index].bdrv; |
|
1385 |
else |
|
1386 |
fd[i] = NULL; |
|
1379 |
dinfo = drive_get(IF_FLOPPY, 0, i); |
|
1380 |
fd[i] = dinfo ? dinfo->bdrv : NULL; |
|
1387 | 1381 |
} |
1388 | 1382 |
floppy_controller = fdctrl_init(i8259[6], 2, 0, 0x3f0, fd); |
1389 | 1383 |
|
... | ... | |
1437 | 1431 |
|
1438 | 1432 |
/* Add virtio block devices */ |
1439 | 1433 |
if (pci_enabled) { |
1440 |
int index; |
|
1441 | 1434 |
int unit_id = 0; |
1442 | 1435 |
|
1443 |
while ((index = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) {
|
|
1436 |
while ((dinfo = drive_get(IF_VIRTIO, 0, unit_id)) != NULL) {
|
|
1444 | 1437 |
pci_dev = pci_create(virtio_blk_name, |
1445 |
drives_table[index].devaddr);
|
|
1438 |
dinfo->devaddr);
|
|
1446 | 1439 |
qdev_init(&pci_dev->qdev); |
1447 | 1440 |
unit_id++; |
1448 | 1441 |
} |
Also available in: Unified diff