Revision 8c52c8f3
b/hw/cirrus_vga.c | ||
---|---|---|
3209 | 3209 |
pci_register_bar((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE, |
3210 | 3210 |
PCI_BASE_ADDRESS_SPACE_MEMORY, cirrus_pci_mmio_map); |
3211 | 3211 |
} |
3212 |
|
|
3213 |
/* ROM BIOS */ |
|
3214 |
pci_add_option_rom((PCIDevice *)d, VGABIOS_CIRRUS_FILENAME); |
|
3215 | 3212 |
return 0; |
3216 | 3213 |
} |
3217 | 3214 |
|
... | ... | |
3226 | 3223 |
.qdev.size = sizeof(PCICirrusVGAState), |
3227 | 3224 |
.qdev.vmsd = &vmstate_pci_cirrus_vga, |
3228 | 3225 |
.init = pci_cirrus_vga_initfn, |
3226 |
.romfile = VGABIOS_CIRRUS_FILENAME, |
|
3229 | 3227 |
.config_write = pci_cirrus_write_config, |
3230 | 3228 |
}; |
3231 | 3229 |
|
b/hw/e1000.c | ||
---|---|---|
1121 | 1121 |
d->dev.qdev.info->name, d->dev.qdev.id, d); |
1122 | 1122 |
|
1123 | 1123 |
qemu_format_nic_info_str(&d->nic->nc, macaddr); |
1124 |
|
|
1125 |
if (!pci_dev->qdev.hotplugged) { |
|
1126 |
static int loaded = 0; |
|
1127 |
if (!loaded) { |
|
1128 |
pci_add_option_rom(&d->dev, "pxe-e1000.bin"); |
|
1129 |
loaded = 1; |
|
1130 |
} |
|
1131 |
} |
|
1132 | 1124 |
return 0; |
1133 | 1125 |
} |
1134 | 1126 |
|
... | ... | |
1146 | 1138 |
.qdev.vmsd = &vmstate_e1000, |
1147 | 1139 |
.init = pci_e1000_init, |
1148 | 1140 |
.exit = pci_e1000_uninit, |
1141 |
.romfile = "pxe-e1000.bin", |
|
1149 | 1142 |
.qdev.props = (Property[]) { |
1150 | 1143 |
DEFINE_NIC_PROPERTIES(E1000State, conf), |
1151 | 1144 |
DEFINE_PROP_END_OF_LIST(), |
b/hw/pci.c | ||
---|---|---|
63 | 63 |
.print_dev = pcibus_dev_print, |
64 | 64 |
.props = (Property[]) { |
65 | 65 |
DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1), |
66 |
DEFINE_PROP_STRING("romfile", PCIDevice, romfile), |
|
66 | 67 |
DEFINE_PROP_END_OF_LIST() |
67 | 68 |
} |
68 | 69 |
}; |
69 | 70 |
|
70 | 71 |
static void pci_update_mappings(PCIDevice *d); |
71 | 72 |
static void pci_set_irq(void *opaque, int irq_num, int level); |
73 |
static int pci_add_option_rom(PCIDevice *pdev); |
|
72 | 74 |
|
73 | 75 |
target_phys_addr_t pci_mem_base; |
74 | 76 |
static uint16_t pci_default_sub_vendor_id = PCI_SUBVENDOR_ID_REDHAT_QUMRANET; |
... | ... | |
1362 | 1364 |
rc = info->init(pci_dev); |
1363 | 1365 |
if (rc != 0) |
1364 | 1366 |
return rc; |
1367 |
|
|
1368 |
/* rom loading */ |
|
1369 |
if (pci_dev->romfile == NULL && info->romfile != NULL) |
|
1370 |
pci_dev->romfile = qemu_strdup(info->romfile); |
|
1371 |
pci_add_option_rom(pci_dev); |
|
1372 |
|
|
1365 | 1373 |
if (qdev->hotplugged) |
1366 | 1374 |
bus->hotplug(pci_dev, 1); |
1367 | 1375 |
return 0; |
... | ... | |
1445 | 1453 |
} |
1446 | 1454 |
|
1447 | 1455 |
/* Add an option rom for the device */ |
1448 |
int pci_add_option_rom(PCIDevice *pdev, const char *name)
|
|
1456 |
static int pci_add_option_rom(PCIDevice *pdev)
|
|
1449 | 1457 |
{ |
1450 | 1458 |
int size; |
1451 | 1459 |
char *path; |
1452 | 1460 |
void *ptr; |
1453 | 1461 |
|
1454 |
path = qemu_find_file(QEMU_FILE_TYPE_BIOS, name); |
|
1462 |
if (!pdev->romfile) |
|
1463 |
return 0; |
|
1464 |
if (strlen(pdev->romfile) == 0) |
|
1465 |
return 0; |
|
1466 |
|
|
1467 |
path = qemu_find_file(QEMU_FILE_TYPE_BIOS, pdev->romfile); |
|
1455 | 1468 |
if (path == NULL) { |
1456 |
path = qemu_strdup(name);
|
|
1469 |
path = qemu_strdup(pdev->romfile);
|
|
1457 | 1470 |
} |
1458 | 1471 |
|
1459 | 1472 |
size = get_image_size(path); |
1473 |
if (size < 0) { |
|
1474 |
qemu_error("%s: failed to find romfile \"%s\"\n", __FUNCTION__, |
|
1475 |
pdev->romfile); |
|
1476 |
return -1; |
|
1477 |
} |
|
1460 | 1478 |
if (size & (size - 1)) { |
1461 | 1479 |
size = 1 << qemu_fls(size); |
1462 | 1480 |
} |
b/hw/pci.h | ||
---|---|---|
244 | 244 |
int32_t version_id; |
245 | 245 |
|
246 | 246 |
/* Location of option rom */ |
247 |
char *romfile; |
|
247 | 248 |
ram_addr_t rom_offset; |
248 | 249 |
}; |
249 | 250 |
|
... | ... | |
256 | 257 |
pcibus_t size, int type, |
257 | 258 |
PCIMapIORegionFunc *map_func); |
258 | 259 |
|
259 |
int pci_add_option_rom(PCIDevice *pdev, const char *name); |
|
260 |
|
|
261 | 260 |
int pci_add_capability(PCIDevice *pci_dev, uint8_t cap_id, uint8_t cap_size); |
262 | 261 |
|
263 | 262 |
void pci_del_capability(PCIDevice *pci_dev, uint8_t cap_id, uint8_t cap_size); |
... | ... | |
385 | 384 |
|
386 | 385 |
/* pcie stuff */ |
387 | 386 |
int is_express; /* is this device pci express? */ |
387 |
|
|
388 |
/* rom bar */ |
|
389 |
const char *romfile; |
|
388 | 390 |
} PCIDeviceInfo; |
389 | 391 |
|
390 | 392 |
void pci_qdev_register(PCIDeviceInfo *info); |
b/hw/rtl8139.c | ||
---|---|---|
3353 | 3353 |
qemu_mod_timer(s->timer, |
3354 | 3354 |
rtl8139_get_next_tctr_time(s,qemu_get_clock(vm_clock))); |
3355 | 3355 |
#endif /* RTL8139_ONBOARD_TIMER */ |
3356 |
|
|
3357 |
if (!dev->qdev.hotplugged) { |
|
3358 |
static int loaded = 0; |
|
3359 |
if (!loaded) { |
|
3360 |
pci_add_option_rom(&s->dev, "pxe-rtl8139.bin"); |
|
3361 |
loaded = 1; |
|
3362 |
} |
|
3363 |
} |
|
3364 | 3356 |
return 0; |
3365 | 3357 |
} |
3366 | 3358 |
|
... | ... | |
3371 | 3363 |
.qdev.vmsd = &vmstate_rtl8139, |
3372 | 3364 |
.init = pci_rtl8139_init, |
3373 | 3365 |
.exit = pci_rtl8139_uninit, |
3366 |
.romfile = "pxe-rtl8139.bin", |
|
3374 | 3367 |
.qdev.props = (Property[]) { |
3375 | 3368 |
DEFINE_NIC_PROPERTIES(RTL8139State, conf), |
3376 | 3369 |
DEFINE_PROP_END_OF_LIST(), |
b/hw/virtio-pci.c | ||
---|---|---|
518 | 518 |
|
519 | 519 |
/* make the actual value visible */ |
520 | 520 |
proxy->nvectors = vdev->nvectors; |
521 |
|
|
522 |
if (!pci_dev->qdev.hotplugged) { |
|
523 |
static int loaded = 0; |
|
524 |
if (!loaded) { |
|
525 |
pci_add_option_rom(pci_dev, "pxe-virtio.bin"); |
|
526 |
loaded = 1; |
|
527 |
} |
|
528 |
} |
|
529 | 521 |
return 0; |
530 | 522 |
} |
531 | 523 |
|
... | ... | |
569 | 561 |
.qdev.size = sizeof(VirtIOPCIProxy), |
570 | 562 |
.init = virtio_net_init_pci, |
571 | 563 |
.exit = virtio_net_exit_pci, |
564 |
.romfile = "pxe-virtio.bin", |
|
572 | 565 |
.qdev.props = (Property[]) { |
573 | 566 |
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3), |
574 | 567 |
DEFINE_NIC_PROPERTIES(VirtIOPCIProxy, nic), |
Also available in: Unified diff