33 |
33 |
#include "scsi.h"
|
34 |
34 |
#include "virtio-blk.h"
|
35 |
35 |
#include "qemu-config.h"
|
|
36 |
#include "qemu-objects.h"
|
36 |
37 |
|
37 |
38 |
#if defined(TARGET_I386)
|
38 |
39 |
static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon,
|
... | ... | |
228 |
229 |
return dev;
|
229 |
230 |
}
|
230 |
231 |
|
231 |
|
void pci_device_hot_add(Monitor *mon, const QDict *qdict)
|
|
232 |
void pci_device_hot_add_print(Monitor *mon, const QObject *data)
|
|
233 |
{
|
|
234 |
QDict *qdict;
|
|
235 |
|
|
236 |
assert(qobject_type(data) == QTYPE_QDICT);
|
|
237 |
qdict = qobject_to_qdict(data);
|
|
238 |
|
|
239 |
monitor_printf(mon, "OK domain %d, bus %d, slot %d, function %d\n",
|
|
240 |
(int) qdict_get_int(qdict, "domain"),
|
|
241 |
(int) qdict_get_int(qdict, "bus"),
|
|
242 |
(int) qdict_get_int(qdict, "slot"),
|
|
243 |
(int) qdict_get_int(qdict, "function"));
|
|
244 |
|
|
245 |
}
|
|
246 |
|
|
247 |
/**
|
|
248 |
* pci_device_hot_add(): Hot add a PCI device
|
|
249 |
*
|
|
250 |
* Return a QDict with the following device information:
|
|
251 |
*
|
|
252 |
* - "domain": domain number
|
|
253 |
* - "bus": bus number
|
|
254 |
* - "slot": slot number
|
|
255 |
* - "function": function number
|
|
256 |
*
|
|
257 |
* Example:
|
|
258 |
*
|
|
259 |
* { "domain": 0, "bus": 0, "slot": 5, "function": 0 }
|
|
260 |
*/
|
|
261 |
void pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
232 |
262 |
{
|
233 |
263 |
PCIDevice *dev = NULL;
|
234 |
264 |
const char *pci_addr = qdict_get_str(qdict, "pci_addr");
|
... | ... | |
255 |
285 |
monitor_printf(mon, "invalid type: %s\n", type);
|
256 |
286 |
|
257 |
287 |
if (dev) {
|
258 |
|
monitor_printf(mon, "OK domain %d, bus %d, slot %d, function %d\n",
|
259 |
|
0, pci_bus_num(dev->bus), PCI_SLOT(dev->devfn),
|
260 |
|
PCI_FUNC(dev->devfn));
|
|
288 |
*ret_data =
|
|
289 |
qobject_from_jsonf("{ 'domain': 0, 'bus': %d, 'slot': %d, "
|
|
290 |
"'function': %d }", pci_bus_num(dev->bus),
|
|
291 |
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
|
|
292 |
assert(*ret_data != NULL);
|
261 |
293 |
} else
|
262 |
294 |
monitor_printf(mon, "failed to add %s\n", opts);
|
263 |
295 |
}
|