bus.c (68b459eaa660be17d3547aa581502fe2c572c84f) bus.c (f4bbaaf584ed8d0a430b467bace15f338cba4c57)
1#include "hw/hw.h"
2#include "hw/usb.h"
3#include "hw/qdev.h"
4#include "sysemu/sysemu.h"
5#include "monitor/monitor.h"
6#include "trace.h"
7
8static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent);

--- 346 unchanged lines hidden (view full) ---

355void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index,
356 USBPortOps *ops, int speedmask)
357{
358 usb_fill_port(port, opaque, index, ops, speedmask);
359 QTAILQ_INSERT_TAIL(&bus->free, port, next);
360 bus->nfree++;
361}
362
1#include "hw/hw.h"
2#include "hw/usb.h"
3#include "hw/qdev.h"
4#include "sysemu/sysemu.h"
5#include "monitor/monitor.h"
6#include "trace.h"
7
8static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent);

--- 346 unchanged lines hidden (view full) ---

355void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index,
356 USBPortOps *ops, int speedmask)
357{
358 usb_fill_port(port, opaque, index, ops, speedmask);
359 QTAILQ_INSERT_TAIL(&bus->free, port, next);
360 bus->nfree++;
361}
362
363int usb_register_companion(const char *masterbus, USBPort *ports[],
364 uint32_t portcount, uint32_t firstport,
365 void *opaque, USBPortOps *ops, int speedmask)
363void usb_register_companion(const char *masterbus, USBPort *ports[],
364 uint32_t portcount, uint32_t firstport,
365 void *opaque, USBPortOps *ops, int speedmask,
366 Error **errp)
366{
367 USBBus *bus;
368 int i;
369
370 QTAILQ_FOREACH(bus, &busses, next) {
371 if (strcmp(bus->qbus.name, masterbus) == 0) {
372 break;
373 }
374 }
375
376 if (!bus || !bus->ops->register_companion) {
367{
368 USBBus *bus;
369 int i;
370
371 QTAILQ_FOREACH(bus, &busses, next) {
372 if (strcmp(bus->qbus.name, masterbus) == 0) {
373 break;
374 }
375 }
376
377 if (!bus || !bus->ops->register_companion) {
377 qerror_report(QERR_INVALID_PARAMETER_VALUE, "masterbus",
378 "an USB masterbus");
378 error_set(errp, QERR_INVALID_PARAMETER_VALUE, "masterbus",
379 "an USB masterbus");
380#if 0 /* conversion from qerror_report() to error_set() broke this: */
379 if (bus) {
380 error_printf_unless_qmp(
381 "USB bus '%s' does not allow companion controllers\n",
382 masterbus);
383 }
381 if (bus) {
382 error_printf_unless_qmp(
383 "USB bus '%s' does not allow companion controllers\n",
384 masterbus);
385 }
384 return -1;
386#endif
387 return;
385 }
386
387 for (i = 0; i < portcount; i++) {
388 usb_fill_port(ports[i], opaque, i, ops, speedmask);
389 }
390
388 }
389
390 for (i = 0; i < portcount; i++) {
391 usb_fill_port(ports[i], opaque, i, ops, speedmask);
392 }
393
391 return bus->ops->register_companion(bus, ports, portcount, firstport);
394 bus->ops->register_companion(bus, ports, portcount, firstport, errp);
392}
393
394void usb_port_location(USBPort *downstream, USBPort *upstream, int portnr)
395{
396 if (upstream) {
397 snprintf(downstream->path, sizeof(downstream->path), "%s.%d",
398 upstream->path, portnr);
399 downstream->hubcount = upstream->hubcount + 1;

--- 357 unchanged lines hidden ---
395}
396
397void usb_port_location(USBPort *downstream, USBPort *upstream, int portnr)
398{
399 if (upstream) {
400 snprintf(downstream->path, sizeof(downstream->path), "%s.%d",
401 upstream->path, portnr);
402 downstream->hubcount = upstream->hubcount + 1;

--- 357 unchanged lines hidden ---