Changeset 2cf28b9 in mainline for uspace/drv/bus/usb/xhci/bus.c
- Timestamp:
- 2017-10-25T15:22:45Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 62558202
- Parents:
- f668d60
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/bus.c
rf668d60 r2cf28b9 45 45 #include <stdbool.h> 46 46 47 #include "hc.h" 47 48 #include "bus.h" 48 49 #include "endpoint.h" … … 136 137 } 137 138 139 /* Calculate route string */ 140 xhci_device_t *xhci_hub = xhci_device_get(dev->hub); 141 xhci_dev->tier = xhci_hub->tier + 1; 142 xhci_dev->route_str = xhci_hub->route_str; 143 144 /* Roothub port is not part of the route string */ 145 if (xhci_dev->tier >= 2) { 146 const unsigned offset = 4 * (xhci_dev->tier - 2); 147 xhci_dev->route_str |= (dev->port & 0xf) << offset; 148 } 149 150 fibril_mutex_lock(&bus->base.guard); 138 151 /* Assign an address to the device */ 139 152 if ((err = address_device(hc, xhci_dev))) { … … 147 160 assert(bus->devices_by_slot[xhci_dev->slot_id] == NULL); 148 161 bus->devices_by_slot[xhci_dev->slot_id] = xhci_dev; 162 fibril_mutex_unlock(&bus->base.guard); 149 163 150 164 /* Read the device descriptor, derive the match ids */ … … 305 319 } 306 320 321 static int request_address(bus_t *bus_base, usb_address_t *addr, bool strict, usb_speed_t speed) 322 { 323 assert(addr); 324 325 if (*addr != USB_ADDRESS_DEFAULT) 326 /* xHCI does not allow software to assign addresses. */ 327 return ENOTSUP; 328 329 assert(strict); 330 331 xhci_bus_t *xhci_bus = bus_to_xhci_bus(bus_base); 332 333 if (xhci_bus->default_address_speed != USB_SPEED_MAX) 334 /* Already allocated */ 335 return ENOENT; 336 337 xhci_bus->default_address_speed = speed; 338 return EOK; 339 } 340 341 static int release_address(bus_t *bus_base, usb_address_t addr) 342 { 343 if (addr != USB_ADDRESS_DEFAULT) 344 return ENOTSUP; 345 346 xhci_bus_t *xhci_bus = bus_to_xhci_bus(bus_base); 347 348 xhci_bus->default_address_speed = USB_SPEED_MAX; 349 return EOK; 350 } 351 307 352 static usb_transfer_batch_t *create_batch(bus_t *bus, endpoint_t *ep) 308 353 { … … 327 372 .find_endpoint = find_endpoint, 328 373 329 .request_address = NULL,330 .release_address = NULL,374 .request_address = request_address, 375 .release_address = release_address, 331 376 .reset_toggle = reset_toggle, 332 377 … … 351 396 352 397 bus->base.ops = xhci_bus_ops; 398 bus->default_address_speed = USB_SPEED_MAX; 353 399 return EOK; 354 400 }
Note:
See TracChangeset
for help on using the changeset viewer.