Index: uspace/drv/bus/usb/xhci/bus.c
===================================================================
--- uspace/drv/bus/usb/xhci/bus.c	(revision 41abf3ccda2071a8e6aa6a16ce59c3a74c63e801)
+++ uspace/drv/bus/usb/xhci/bus.c	(revision a4e7e6e1d6be2559cff4a3ebce42f37ab483bbd3)
@@ -87,5 +87,5 @@
 
 	/* Address device */
-	if ((err = hc_address_device(bus->hc, dev, ep0)))
+	if ((err = hc_address_device(dev, ep0)))
 		goto err_added;
 
@@ -128,5 +128,5 @@
 	xhci_setup_endpoint_context(ep0, &ep_ctx);
 
-	if ((err = hc_update_endpoint(hc, dev->slot_id, 0, &ep_ctx)))
+	if ((err = hc_update_endpoint(dev, 0, &ep_ctx)))
 		return err;
 
@@ -238,5 +238,5 @@
 
 	/* Transition the device from the Addressed to the Configured state. */
-	if ((err = hc_configure_device(bus->hc, dev->slot_id))) {
+	if ((err = hc_configure_device(dev))) {
 		usb_log_warning("Failed to configure device " XHCI_DEV_FMT ".", XHCI_DEV_ARGS(*dev));
 		return err;
@@ -263,5 +263,5 @@
 
 	/* Issue one HC command to simultaneously drop all endpoints except zero. */
-	if ((err = hc_deconfigure_device(bus->hc, dev->slot_id))) {
+	if ((err = hc_deconfigure_device(dev))) {
 		usb_log_warning("Failed to deconfigure device " XHCI_DEV_FMT ".",
 		    XHCI_DEV_ARGS(*dev));
@@ -312,5 +312,4 @@
 {
 	int err;
-	xhci_bus_t *bus = bus_to_xhci_bus(endpoint_get_bus(ep_base));
 	xhci_endpoint_t *ep = xhci_endpoint_get(ep_base);
 	xhci_device_t *dev = xhci_device_get(ep_base->device);
@@ -319,5 +318,5 @@
 	xhci_setup_endpoint_context(ep, &ep_ctx);
 
-	if ((err = hc_add_endpoint(bus->hc, dev->slot_id, xhci_endpoint_index(ep), &ep_ctx)))
+	if ((err = hc_add_endpoint(dev, xhci_endpoint_index(ep), &ep_ctx)))
 		return err;
 
@@ -330,5 +329,4 @@
 static int endpoint_abort(endpoint_t *ep)
 {
-	xhci_bus_t *bus = bus_to_xhci_bus(endpoint_get_bus(ep));
 	xhci_device_t *dev = xhci_device_get(ep->device);
 
@@ -337,5 +335,5 @@
 	if (ep->active_batch) {
 		if (dev->slot_id) {
-			const int err = hc_stop_endpoint(bus->hc, dev->slot_id, xhci_endpoint_dci(xhci_endpoint_get(ep)));
+			const int err = hc_stop_endpoint(dev, xhci_endpoint_dci(xhci_endpoint_get(ep)));
 			if (err) {
 				usb_log_warning("Failed to stop endpoint %u of device " XHCI_DEV_FMT ": %s",
@@ -370,5 +368,4 @@
 {
 	int err;
-	xhci_bus_t *bus = bus_to_xhci_bus(endpoint_get_bus(ep_base));
 	xhci_endpoint_t *ep = xhci_endpoint_get(ep_base);
 	xhci_device_t *dev = xhci_device_get(ep_base->device);
@@ -379,5 +376,5 @@
 	if (dev->slot_id) {
 
-		if ((err = hc_drop_endpoint(bus->hc, dev->slot_id, xhci_endpoint_index(ep)))) {
+		if ((err = hc_drop_endpoint(dev, xhci_endpoint_index(ep)))) {
 			usb_log_error("Failed to drop endpoint " XHCI_EP_FMT ": %s", XHCI_EP_ARGS(*ep), str_error(err));
 		}
Index: uspace/drv/bus/usb/xhci/endpoint.c
===================================================================
--- uspace/drv/bus/usb/xhci/endpoint.c	(revision 41abf3ccda2071a8e6aa6a16ce59c3a74c63e801)
+++ uspace/drv/bus/usb/xhci/endpoint.c	(revision a4e7e6e1d6be2559cff4a3ebce42f37ab483bbd3)
@@ -346,5 +346,5 @@
 	const unsigned dci = xhci_endpoint_dci(ep);
 
-	if ((err = hc_reset_endpoint(hc, slot_id, dci)))
+	if ((err = hc_reset_endpoint(dev, dci)))
 		return err;
 
Index: uspace/drv/bus/usb/xhci/hc.c
===================================================================
--- uspace/drv/bus/usb/xhci/hc.c	(revision 41abf3ccda2071a8e6aa6a16ce59c3a74c63e801)
+++ uspace/drv/bus/usb/xhci/hc.c	(revision a4e7e6e1d6be2559cff4a3ebce42f37ab483bbd3)
@@ -764,7 +764,32 @@
 
 /**
+ * Fill a slot context that is part of an Input Context with appropriate
+ * values.
+ *
+ * @param ctx Slot context, zeroed out.
+ */
+static void xhci_setup_slot_context(xhci_device_t *dev, xhci_slot_ctx_t *ctx)
+{
+	/* Initialize slot_ctx according to section 4.3.3 point 3. */
+	XHCI_SLOT_ROOT_HUB_PORT_SET(*ctx, dev->rh_port);
+	XHCI_SLOT_CTX_ENTRIES_SET(*ctx, 1);
+	XHCI_SLOT_ROUTE_STRING_SET(*ctx, dev->route_str);
+	XHCI_SLOT_SPEED_SET(*ctx, usb_speed_to_psiv[dev->base.speed]);
+
+	/* Setup Transaction Translation. TODO: Test this with HS hub. */
+	if (dev->base.tt.dev != NULL) {
+		xhci_device_t *hub = xhci_device_get(dev->base.tt.dev);
+		XHCI_SLOT_TT_HUB_SLOT_ID_SET(*ctx, hub->slot_id);
+		XHCI_SLOT_TT_HUB_PORT_SET(*ctx, dev->base.tt.port);
+	}
+
+	// As we always allocate space for whole input context, we can set this to maximum
+	XHCI_SLOT_CTX_ENTRIES_SET(*ctx, 31);
+}
+
+/**
  * Prepare an empty Endpoint Input Context inside a dma buffer.
  */
-static int create_configure_ep_input_ctx(dma_buffer_t *dma_buf)
+static int create_configure_ep_input_ctx(xhci_device_t *dev, dma_buffer_t *dma_buf)
 {
 	const int err = dma_buffer_alloc(dma_buf, sizeof(xhci_input_ctx_t));
@@ -777,7 +802,5 @@
 	// Quoting sec. 4.6.5 and 4.6.6: A1, D0, D1 are down (already zeroed), A0 is up.
 	XHCI_INPUT_CTRL_CTX_ADD_SET(ictx->ctrl_ctx, 0);
-
-	// As we always allocate space for whole input context, we can set this to maximum
-	XHCI_SLOT_CTX_ENTRIES_SET(ictx->slot_ctx, 31);
+	xhci_setup_slot_context(dev, &ictx->slot_ctx);
 
 	return EOK;
@@ -790,7 +813,8 @@
  * @param ep0 EP0 of device TODO remove, can be fetched from dev
  */
-int hc_address_device(xhci_hc_t *hc, xhci_device_t *dev, xhci_endpoint_t *ep0)
+int hc_address_device(xhci_device_t *dev, xhci_endpoint_t *ep0)
 {
 	int err = ENOMEM;
+	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
 
 	/* Although we have the precise PSIV value on devices of tier 1,
@@ -810,22 +834,8 @@
 	/* Issue configure endpoint command (sec 4.3.5). */
 	dma_buffer_t ictx_dma_buf;
-	if ((err = create_configure_ep_input_ctx(&ictx_dma_buf))) {
+	if ((err = create_configure_ep_input_ctx(dev, &ictx_dma_buf))) {
 		goto err_dev_ctx;
 	}
 	xhci_input_ctx_t *ictx = ictx_dma_buf.virt;
-
-	/* Initialize slot_ctx according to section 4.3.3 point 3. */
-	XHCI_SLOT_ROOT_HUB_PORT_SET(ictx->slot_ctx, dev->rh_port);
-	XHCI_SLOT_CTX_ENTRIES_SET(ictx->slot_ctx, 1);
-	XHCI_SLOT_ROUTE_STRING_SET(ictx->slot_ctx, dev->route_str);
-	XHCI_SLOT_SPEED_SET(ictx->slot_ctx, usb_speed_to_psiv[dev->base.speed]);
-
-	/* Setup Transaction Translation. TODO: Test this with HS hub. */
-	if (dev->base.tt.dev != NULL) {
-		xhci_device_t *hub = xhci_device_get(dev->base.tt.dev);
-		XHCI_SLOT_TT_HUB_SLOT_ID_SET(ictx->slot_ctx, hub->slot_id);
-		XHCI_SLOT_TT_HUB_PORT_SET(ictx->slot_ctx, dev->base.tt.port);
-		XHCI_SLOT_MTT_SET(ictx->slot_ctx, 0); // MTT not supported yet
-	}
 
 	/* Copy endpoint 0 context and set A1 flag. */
@@ -856,15 +866,15 @@
  * @param slot_id Slot ID assigned to the device.
  */
-int hc_configure_device(xhci_hc_t *hc, uint32_t slot_id)
-{
+int hc_configure_device(xhci_device_t *dev)
+{
+	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
+
 	/* Issue configure endpoint command (sec 4.3.5). */
 	dma_buffer_t ictx_dma_buf;
-	const int err = create_configure_ep_input_ctx(&ictx_dma_buf);
+	const int err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
 	if (err)
 		return err;
 
-	// TODO: Set slot context and other flags. (probably forgot a lot of 'em)
-
-	return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .input_ctx = ictx_dma_buf);
+	return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = dev->slot_id, .input_ctx = ictx_dma_buf);
 }
 
@@ -872,10 +882,12 @@
  * Issue a Deconfigure Device command for a device in slot.
  *
- * @param slot_id Slot ID assigned to the device.
- */
-int hc_deconfigure_device(xhci_hc_t *hc, uint32_t slot_id)
-{
+ * @param dev The owner of the device
+ */
+int hc_deconfigure_device(xhci_device_t *dev)
+{
+	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
+
 	/* Issue configure endpoint command (sec 4.3.5) with the DC flag. */
-	return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .deconfigure = true);
+	return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = dev->slot_id, .deconfigure = true);
 }
 
@@ -883,13 +895,13 @@
  * Instruct xHC to add an endpoint with supplied endpoint context.
  *
- * @param slot_id Slot ID assigned to the device.
- * @param ep_idx Endpoint index (number + direction) in question
+ * @param dev The owner of the device
+ * @param ep_idx Endpoint DCI in question
  * @param ep_ctx Endpoint context of the endpoint
  */
-int hc_add_endpoint(xhci_hc_t *hc, uint32_t slot_id, uint8_t ep_idx, xhci_ep_ctx_t *ep_ctx)
+int hc_add_endpoint(xhci_device_t *dev, uint8_t ep_idx, xhci_ep_ctx_t *ep_ctx)
 {
 	/* Issue configure endpoint command (sec 4.3.5). */
 	dma_buffer_t ictx_dma_buf;
-	const int err = create_configure_ep_input_ctx(&ictx_dma_buf);
+	const int err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
 	if (err)
 		return err;
@@ -899,7 +911,6 @@
 	memcpy(&ictx->endpoint_ctx[ep_idx], ep_ctx, sizeof(xhci_ep_ctx_t));
 
-	// TODO: Set slot context and other flags. (probably forgot a lot of 'em)
-
-	return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .input_ctx = ictx_dma_buf);
+	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
+	return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = dev->slot_id, .input_ctx = ictx_dma_buf);
 }
 
@@ -907,12 +918,12 @@
  * Instruct xHC to drop an endpoint.
  *
- * @param slot_id Slot ID assigned to the device.
- * @param ep_idx Endpoint index (number + direction) in question
- */
-int hc_drop_endpoint(xhci_hc_t *hc, uint32_t slot_id, uint8_t ep_idx)
+ * @param dev The owner of the endpoint
+ * @param ep_idx Endpoint DCI in question
+ */
+int hc_drop_endpoint(xhci_device_t *dev, uint8_t ep_idx)
 {
 	/* Issue configure endpoint command (sec 4.3.5). */
 	dma_buffer_t ictx_dma_buf;
-	const int err = create_configure_ep_input_ctx(&ictx_dma_buf);
+	const int err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
 	if (err)
 		return err;
@@ -920,7 +931,7 @@
 	xhci_input_ctx_t *ictx = ictx_dma_buf.virt;
 	XHCI_INPUT_CTRL_CTX_DROP_SET(ictx->ctrl_ctx, ep_idx + 1); /* Preceded by slot ctx */
-	// TODO: Set slot context and other flags. (probably forgot a lot of 'em)
-
-	return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .input_ctx = ictx_dma_buf);
+
+	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
+	return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = dev->slot_id, .input_ctx = ictx_dma_buf);
 }
 
@@ -929,9 +940,9 @@
  * endpoint context.
  *
- * @param slot_id Slot ID assigned to the device.
- * @param ep_idx Endpoint index (number + direction) in question
+ * @param dev The owner of the endpoint
+ * @param ep_idx Endpoint DCI in question
  * @param ep_ctx Endpoint context of the endpoint
  */
-int hc_update_endpoint(xhci_hc_t *hc, uint32_t slot_id, uint8_t ep_idx, xhci_ep_ctx_t *ep_ctx)
+int hc_update_endpoint(xhci_device_t *dev, uint8_t ep_idx, xhci_ep_ctx_t *ep_ctx)
 {
 	dma_buffer_t ictx_dma_buf;
@@ -946,5 +957,6 @@
 	memcpy(&ictx->endpoint_ctx[ep_idx], ep_ctx, sizeof(xhci_ep_ctx_t));
 
-	return xhci_cmd_sync_inline(hc, EVALUATE_CONTEXT, .slot_id = slot_id, .input_ctx = ictx_dma_buf);
+	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
+	return xhci_cmd_sync_inline(hc, EVALUATE_CONTEXT, .slot_id = dev->slot_id, .input_ctx = ictx_dma_buf);
 }
 
@@ -952,10 +964,11 @@
  * Instruct xHC to stop running a transfer ring on an endpoint.
  *
- * @param slot_id Slot ID assigned to the device.
- * @param ep_idx Endpoint index (number + direction) in question
- */
-int hc_stop_endpoint(xhci_hc_t *hc, uint32_t slot_id, uint8_t ep_idx)
-{
-	return xhci_cmd_sync_inline(hc, STOP_ENDPOINT, .slot_id = slot_id, .endpoint_id = ep_idx);
+ * @param dev The owner of the endpoint
+ * @param ep_idx Endpoint DCI in question
+ */
+int hc_stop_endpoint(xhci_device_t *dev, uint8_t ep_idx)
+{
+	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
+	return xhci_cmd_sync_inline(hc, STOP_ENDPOINT, .slot_id = dev->slot_id, .endpoint_id = ep_idx);
 }
 
@@ -963,10 +976,11 @@
  * Instruct xHC to reset halted endpoint.
  *
- * @param slot_id Slot ID assigned to the device.
- * @param ep_idx Endpoint index (number + direction) in question
- */
-int hc_reset_endpoint(xhci_hc_t *hc, uint32_t slot_id, uint8_t ep_idx)
-{
-	return xhci_cmd_sync_inline(hc, RESET_ENDPOINT, .slot_id = slot_id, .endpoint_id = ep_idx);
+ * @param dev The owner of the endpoint
+ * @param ep_idx Endpoint DCI in question
+ */
+int hc_reset_endpoint(xhci_device_t *dev, uint8_t ep_idx)
+{
+	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
+	return xhci_cmd_sync_inline(hc, RESET_ENDPOINT, .slot_id = dev->slot_id, .endpoint_id = ep_idx);
 }
 
Index: uspace/drv/bus/usb/xhci/hc.h
===================================================================
--- uspace/drv/bus/usb/xhci/hc.h	(revision 41abf3ccda2071a8e6aa6a16ce59c3a74c63e801)
+++ uspace/drv/bus/usb/xhci/hc.h	(revision a4e7e6e1d6be2559cff4a3ebce42f37ab483bbd3)
@@ -120,14 +120,15 @@
 void hc_fini(xhci_hc_t *);
 void hc_ring_doorbell(xhci_hc_t *, unsigned, unsigned);
+
 int hc_enable_slot(xhci_hc_t *, uint32_t *);
 int hc_disable_slot(xhci_hc_t *, xhci_device_t *);
-int hc_address_device(xhci_hc_t *, xhci_device_t *, xhci_endpoint_t *);
-int hc_configure_device(xhci_hc_t *, uint32_t);
-int hc_deconfigure_device(xhci_hc_t *, uint32_t);
-int hc_add_endpoint(xhci_hc_t *, uint32_t, uint8_t, xhci_ep_ctx_t *);
-int hc_drop_endpoint(xhci_hc_t *, uint32_t, uint8_t);
-int hc_update_endpoint(xhci_hc_t *, uint32_t, uint8_t, xhci_ep_ctx_t *);
-int hc_stop_endpoint(xhci_hc_t *, uint32_t , uint8_t);
-int hc_reset_endpoint(xhci_hc_t *, uint32_t , uint8_t);
+int hc_address_device(xhci_device_t *, xhci_endpoint_t *);
+int hc_configure_device(xhci_device_t *);
+int hc_deconfigure_device(xhci_device_t *);
+int hc_add_endpoint(xhci_device_t *, uint8_t, xhci_ep_ctx_t *);
+int hc_drop_endpoint(xhci_device_t *, uint8_t);
+int hc_update_endpoint(xhci_device_t *, uint8_t, xhci_ep_ctx_t *);
+int hc_stop_endpoint(xhci_device_t *, uint8_t);
+int hc_reset_endpoint(xhci_device_t *, uint8_t);
 
 int hc_status(bus_t *, uint32_t *);
Index: uspace/drv/bus/usb/xhci/streams.c
===================================================================
--- uspace/drv/bus/usb/xhci/streams.c	(revision 41abf3ccda2071a8e6aa6a16ce59c3a74c63e801)
+++ uspace/drv/bus/usb/xhci/streams.c	(revision a4e7e6e1d6be2559cff4a3ebce42f37ab483bbd3)
@@ -327,5 +327,5 @@
 	}
 
-	hc_stop_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep));
+	hc_stop_endpoint(dev, xhci_endpoint_index(xhci_ep));
 	xhci_endpoint_free_transfer_ds(xhci_ep);
 
@@ -340,5 +340,5 @@
 	memset(&ep_ctx, 0, sizeof(ep_ctx));
 	xhci_setup_endpoint_context(xhci_ep, &ep_ctx);
-	return hc_update_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep), &ep_ctx);
+	return hc_update_endpoint(dev, xhci_endpoint_index(xhci_ep), &ep_ctx);
 }
 
@@ -361,5 +361,5 @@
 	 * Stop the endpoint, destroy the ring, and transition to streams.
 	 */
-	hc_stop_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep));
+	hc_stop_endpoint(dev, xhci_endpoint_index(xhci_ep));
 	xhci_endpoint_free_transfer_ds(xhci_ep);
 
@@ -381,5 +381,5 @@
 	setup_stream_context(xhci_ep, &ep_ctx, pstreams, 1);
 
-	return hc_update_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep), &ep_ctx);
+	return hc_update_endpoint(dev, xhci_endpoint_index(xhci_ep), &ep_ctx);
 }
 
@@ -434,5 +434,5 @@
 	 * Stop the endpoint, destroy the ring, and transition to streams.
 	 */
-	hc_stop_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep));
+	hc_stop_endpoint(dev, xhci_endpoint_index(xhci_ep));
 	xhci_endpoint_free_transfer_ds(xhci_ep);
 
@@ -455,5 +455,5 @@
 	setup_stream_context(xhci_ep, &ep_ctx, pstreams, 0);
 
-	return hc_update_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep), &ep_ctx);
+	return hc_update_endpoint(dev, xhci_endpoint_index(xhci_ep), &ep_ctx);
 
 err_init:
Index: uspace/drv/bus/usb/xhci/transfers.c
===================================================================
--- uspace/drv/bus/usb/xhci/transfers.c	(revision 41abf3ccda2071a8e6aa6a16ce59c3a74c63e801)
+++ uspace/drv/bus/usb/xhci/transfers.c	(revision a4e7e6e1d6be2559cff4a3ebce42f37ab483bbd3)
@@ -197,5 +197,5 @@
 	// Issue a Configure Endpoint command, if needed.
 	if (configure_endpoint_needed(setup)) {
-		const int err = hc_configure_device(hc, xhci_ep_to_dev(xhci_ep)->slot_id);
+		const int err = hc_configure_device(xhci_ep_to_dev(xhci_ep));
 		if (err)
 			return err;
