hcd-uhci.c (0c28d0d07fbcd7aa44d231241d444d00882256e2) hcd-uhci.c (f4bbaaf584ed8d0a430b467bace15f338cba4c57)
1/*
2 * USB UHCI controller emulation
3 *
4 * Copyright (c) 2005 Fabrice Bellard
5 *
6 * Copyright (c) 2008 Max Krasnyansky
7 * Magor rewrite of the UHCI data structures parser and frame processor
8 * Support for fully async operation and multiple outstanding transactions

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

1187 .complete = uhci_async_complete,
1188};
1189
1190static USBBusOps uhci_bus_ops = {
1191};
1192
1193static int usb_uhci_common_initfn(PCIDevice *dev)
1194{
1/*
2 * USB UHCI controller emulation
3 *
4 * Copyright (c) 2005 Fabrice Bellard
5 *
6 * Copyright (c) 2008 Max Krasnyansky
7 * Magor rewrite of the UHCI data structures parser and frame processor
8 * Support for fully async operation and multiple outstanding transactions

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

1187 .complete = uhci_async_complete,
1188};
1189
1190static USBBusOps uhci_bus_ops = {
1191};
1192
1193static int usb_uhci_common_initfn(PCIDevice *dev)
1194{
1195 Error *err = NULL;
1195 PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
1196 UHCIPCIDeviceClass *u = container_of(pc, UHCIPCIDeviceClass, parent_class);
1197 UHCIState *s = DO_UPCAST(UHCIState, dev, dev);
1198 uint8_t *pci_conf = s->dev.config;
1199 int i;
1200
1201 pci_conf[PCI_CLASS_PROG] = 0x00;
1202 /* TODO: reset value should be 0. */
1203 pci_conf[USB_SBRN] = USB_RELEASE_1; // release number
1204
1205 pci_config_set_interrupt_pin(pci_conf, u->info.irq_pin + 1);
1206
1207 if (s->masterbus) {
1208 USBPort *ports[NB_PORTS];
1209 for(i = 0; i < NB_PORTS; i++) {
1210 ports[i] = &s->ports[i].port;
1211 }
1196 PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
1197 UHCIPCIDeviceClass *u = container_of(pc, UHCIPCIDeviceClass, parent_class);
1198 UHCIState *s = DO_UPCAST(UHCIState, dev, dev);
1199 uint8_t *pci_conf = s->dev.config;
1200 int i;
1201
1202 pci_conf[PCI_CLASS_PROG] = 0x00;
1203 /* TODO: reset value should be 0. */
1204 pci_conf[USB_SBRN] = USB_RELEASE_1; // release number
1205
1206 pci_config_set_interrupt_pin(pci_conf, u->info.irq_pin + 1);
1207
1208 if (s->masterbus) {
1209 USBPort *ports[NB_PORTS];
1210 for(i = 0; i < NB_PORTS; i++) {
1211 ports[i] = &s->ports[i].port;
1212 }
1212 if (usb_register_companion(s->masterbus, ports, NB_PORTS,
1213 s->firstport, s, &uhci_port_ops,
1214 USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL) != 0) {
1213 usb_register_companion(s->masterbus, ports, NB_PORTS,
1214 s->firstport, s, &uhci_port_ops,
1215 USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL,
1216 &err);
1217 if (err) {
1218 error_report_err(err);
1215 return -1;
1216 }
1217 } else {
1218 usb_bus_new(&s->bus, sizeof(s->bus), &uhci_bus_ops, DEVICE(dev));
1219 for (i = 0; i < NB_PORTS; i++) {
1220 usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
1221 USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
1222 }

--- 180 unchanged lines hidden ---
1219 return -1;
1220 }
1221 } else {
1222 usb_bus_new(&s->bus, sizeof(s->bus), &uhci_bus_ops, DEVICE(dev));
1223 for (i = 0; i < NB_PORTS; i++) {
1224 usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
1225 USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
1226 }

--- 180 unchanged lines hidden ---