hcd-ehci.c (0c28d0d07fbcd7aa44d231241d444d00882256e2) hcd-ehci.c (f4bbaaf584ed8d0a430b467bace15f338cba4c57)
1/*
2 * QEMU USB EHCI Emulation
3 *
4 * Copyright(c) 2008 Emutex Ltd. (address@hidden)
5 * Copyright(c) 2011-2012 Red Hat, Inc.
6 *
7 * Red Hat Authors:
8 * Gerd Hoffmann <kraxel@redhat.com>

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

764 trace_usb_ehci_port_wakeup(port->index);
765 *portsc |= PORTSC_FPRES;
766 ehci_raise_irq(s, USBSTS_PCD);
767 }
768
769 qemu_bh_schedule(s->async_bh);
770}
771
1/*
2 * QEMU USB EHCI Emulation
3 *
4 * Copyright(c) 2008 Emutex Ltd. (address@hidden)
5 * Copyright(c) 2011-2012 Red Hat, Inc.
6 *
7 * Red Hat Authors:
8 * Gerd Hoffmann <kraxel@redhat.com>

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

764 trace_usb_ehci_port_wakeup(port->index);
765 *portsc |= PORTSC_FPRES;
766 ehci_raise_irq(s, USBSTS_PCD);
767 }
768
769 qemu_bh_schedule(s->async_bh);
770}
771
772static int ehci_register_companion(USBBus *bus, USBPort *ports[],
773 uint32_t portcount, uint32_t firstport)
772static void ehci_register_companion(USBBus *bus, USBPort *ports[],
773 uint32_t portcount, uint32_t firstport,
774 Error **errp)
774{
775 EHCIState *s = container_of(bus, EHCIState, bus);
776 uint32_t i;
777
778 if (firstport + portcount > NB_PORTS) {
775{
776 EHCIState *s = container_of(bus, EHCIState, bus);
777 uint32_t i;
778
779 if (firstport + portcount > NB_PORTS) {
779 qerror_report(QERR_INVALID_PARAMETER_VALUE, "firstport",
780 "firstport on masterbus");
780 error_set(errp, QERR_INVALID_PARAMETER_VALUE, "firstport",
781 "firstport on masterbus");
782#if 0 /* conversion from qerror_report() to error_set() broke this: */
781 error_printf_unless_qmp(
782 "firstport value of %u makes companion take ports %u - %u, which "
783 "is outside of the valid range of 0 - %u\n", firstport, firstport,
784 firstport + portcount - 1, NB_PORTS - 1);
783 error_printf_unless_qmp(
784 "firstport value of %u makes companion take ports %u - %u, which "
785 "is outside of the valid range of 0 - %u\n", firstport, firstport,
786 firstport + portcount - 1, NB_PORTS - 1);
785 return -1;
787#endif
788 return;
786 }
787
788 for (i = 0; i < portcount; i++) {
789 if (s->companion_ports[firstport + i]) {
789 }
790
791 for (i = 0; i < portcount; i++) {
792 if (s->companion_ports[firstport + i]) {
790 qerror_report(QERR_INVALID_PARAMETER_VALUE, "masterbus",
791 "an USB masterbus");
793 error_set(errp, QERR_INVALID_PARAMETER_VALUE, "masterbus",
794 "an USB masterbus");
795#if 0 /* conversion from qerror_report() to error_set() broke this: */
792 error_printf_unless_qmp(
793 "port %u on masterbus %s already has a companion assigned\n",
794 firstport + i, bus->qbus.name);
796 error_printf_unless_qmp(
797 "port %u on masterbus %s already has a companion assigned\n",
798 firstport + i, bus->qbus.name);
795 return -1;
799#endif
800 return;
796 }
797 }
798
799 for (i = 0; i < portcount; i++) {
800 s->companion_ports[firstport + i] = ports[i];
801 s->ports[firstport + i].speedmask |=
802 USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL;
803 /* Ensure devs attached before the initial reset go to the companion */
804 s->portsc[firstport + i] = PORTSC_POWNER;
805 }
806
807 s->companion_count++;
808 s->caps[0x05] = (s->companion_count << 4) | portcount;
801 }
802 }
803
804 for (i = 0; i < portcount; i++) {
805 s->companion_ports[firstport + i] = ports[i];
806 s->ports[firstport + i].speedmask |=
807 USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL;
808 /* Ensure devs attached before the initial reset go to the companion */
809 s->portsc[firstport + i] = PORTSC_POWNER;
810 }
811
812 s->companion_count++;
813 s->caps[0x05] = (s->companion_count << 4) | portcount;
809
810 return 0;
811}
812
813static void ehci_wakeup_endpoint(USBBus *bus, USBEndpoint *ep,
814 unsigned int stream)
815{
816 EHCIState *s = container_of(bus, EHCIState, bus);
817 uint32_t portsc = s->portsc[ep->dev->port->index];
818

--- 1722 unchanged lines hidden ---
814}
815
816static void ehci_wakeup_endpoint(USBBus *bus, USBEndpoint *ep,
817 unsigned int stream)
818{
819 EHCIState *s = container_of(bus, EHCIState, bus);
820 uint32_t portsc = s->portsc[ep->dev->port->index];
821

--- 1722 unchanged lines hidden ---