Changeset b80c1ab in mainline for uspace/drv/bus/usb/xhci/rh.c
- Timestamp:
- 2017-11-14T23:17:54Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e76c0ea
- Parents:
- cfe4852
- git-author:
- Aearsis <Hlavaty.Ondrej@…> (2017-11-14 23:15:24)
- git-committer:
- Aearsis <Hlavaty.Ondrej@…> (2017-11-14 23:17:54)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/rh.c
rcfe4852 rb80c1ab 38 38 #include <usb/request.h> 39 39 #include <usb/debug.h> 40 #include <usb/host/utils/malloc32.h>41 40 #include <usb/host/bus.h> 42 41 #include <usb/host/ddf_helpers.h> 42 #include <usb/host/dma_buffer.h> 43 43 #include <usb/host/hcd.h> 44 44 … … 305 305 } 306 306 307 static inline int get_hub_available_bandwidth(xhci_hc_t *hc, xhci_device_t* dev, uint8_t speed, xhci_port_bandwidth_ctx_t *ctx) { 307 static inline int get_hub_available_bandwidth(xhci_hc_t *hc, xhci_device_t* dev, uint8_t speed, xhci_port_bandwidth_ctx_t *ctx) 308 { 309 int err = EOK; 310 308 311 // TODO: find a correct place for this function + API 309 312 // We need speed, because a root hub device has both USB 2 and USB 3 speeds … … 313 316 assert(ctx); 314 317 315 xhci_port_bandwidth_ctx_t *in_ctx = malloc32(sizeof(xhci_port_bandwidth_ctx_t));316 if (!in_ctx) {317 return ENOMEM;318 }319 320 318 xhci_cmd_t cmd; 321 319 xhci_cmd_init(&cmd, XHCI_CMD_GET_PORT_BANDWIDTH); 322 320 323 cmd.bandwidth_ctx = in_ctx; 321 if ((err = dma_buffer_alloc(&cmd.bandwidth_ctx, sizeof(xhci_port_bandwidth_ctx_t)))) 322 goto end; 323 324 324 cmd.device_speed = speed; 325 325 326 int err; 327 if ((err = xhci_cmd_sync(hc, &cmd))) { 326 if ((err = xhci_cmd_sync(hc, &cmd))) 328 327 goto end; 329 } 330 331 memcpy(ctx, in_ctx, sizeof(xhci_port_bandwidth_ctx_t)); 328 329 memcpy(ctx, cmd.bandwidth_ctx.virt, sizeof(xhci_port_bandwidth_ctx_t)); 332 330 333 331 end: 334 332 xhci_cmd_fini(&cmd); 335 return EOK;333 return err; 336 334 } 337 335
Note:
See TracChangeset
for help on using the changeset viewer.