Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 700e2052 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

USB: xhci: fix lots of compiler warnings.



Turns out someone never built this code on a 64bit platform.

Someone owes me a beer...

Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b7258a4a
Loading
Loading
Loading
Loading
+87 −93
Original line number Diff line number Diff line
@@ -30,12 +30,11 @@ void xhci_dbg_regs(struct xhci_hcd *xhci)
{
	u32 temp;

	xhci_dbg(xhci, "// xHCI capability registers at 0x%x:\n",
			(unsigned int) xhci->cap_regs);
	xhci_dbg(xhci, "// xHCI capability registers at %p:\n",
			xhci->cap_regs);
	temp = xhci_readl(xhci, &xhci->cap_regs->hc_capbase);
	xhci_dbg(xhci, "// @%x = 0x%x (CAPLENGTH AND HCIVERSION)\n",
			(unsigned int) &xhci->cap_regs->hc_capbase,
			(unsigned int) temp);
	xhci_dbg(xhci, "// @%p = 0x%x (CAPLENGTH AND HCIVERSION)\n",
			&xhci->cap_regs->hc_capbase, temp);
	xhci_dbg(xhci, "//   CAPLENGTH: 0x%x\n",
			(unsigned int) HC_LENGTH(temp));
#if 0
@@ -43,29 +42,24 @@ void xhci_dbg_regs(struct xhci_hcd *xhci)
			(unsigned int) HC_VERSION(temp));
#endif

	xhci_dbg(xhci, "// xHCI operational registers at 0x%x:\n",
			(unsigned int) xhci->op_regs);
	xhci_dbg(xhci, "// xHCI operational registers at %p:\n", xhci->op_regs);

	temp = xhci_readl(xhci, &xhci->cap_regs->run_regs_off);
	xhci_dbg(xhci, "// @%x = 0x%x RTSOFF\n",
			(unsigned int) &xhci->cap_regs->run_regs_off,
	xhci_dbg(xhci, "// @%p = 0x%x RTSOFF\n",
			&xhci->cap_regs->run_regs_off,
			(unsigned int) temp & RTSOFF_MASK);
	xhci_dbg(xhci, "// xHCI runtime registers at 0x%x:\n",
			(unsigned int) xhci->run_regs);
	xhci_dbg(xhci, "// xHCI runtime registers at %p:\n", xhci->run_regs);

	temp = xhci_readl(xhci, &xhci->cap_regs->db_off);
	xhci_dbg(xhci, "// @%x = 0x%x DBOFF\n",
			(unsigned int) &xhci->cap_regs->db_off, temp);
	xhci_dbg(xhci, "// Doorbell array at 0x%x:\n",
			(unsigned int) xhci->dba);
	xhci_dbg(xhci, "// @%p = 0x%x DBOFF\n", &xhci->cap_regs->db_off, temp);
	xhci_dbg(xhci, "// Doorbell array at %p:\n", xhci->dba);
}

void xhci_print_cap_regs(struct xhci_hcd *xhci)
{
	u32 temp;

	xhci_dbg(xhci, "xHCI capability registers at 0x%x:\n",
			(unsigned int) xhci->cap_regs);
	xhci_dbg(xhci, "xHCI capability registers at %p:\n", xhci->cap_regs);

	temp = xhci_readl(xhci, &xhci->cap_regs->hc_capbase);
	xhci_dbg(xhci, "CAPLENGTH AND HCIVERSION 0x%x:\n",
@@ -146,8 +140,7 @@ void xhci_print_status(struct xhci_hcd *xhci)

void xhci_print_op_regs(struct xhci_hcd *xhci)
{
	xhci_dbg(xhci, "xHCI operational registers at 0x%x:\n",
			(unsigned int) xhci->op_regs);
	xhci_dbg(xhci, "xHCI operational registers at %p:\n", xhci->op_regs);
	xhci_print_command_reg(xhci);
	xhci_print_status(xhci);
}
@@ -168,9 +161,8 @@ void xhci_print_ports(struct xhci_hcd *xhci)
	addr = &xhci->op_regs->port_status_base;
	for (i = 0; i < ports; i++) {
		for (j = 0; j < NUM_PORT_REGS; ++j) {
			xhci_dbg(xhci, "0x%x port %s reg = 0x%x\n",
					(unsigned int) addr,
					names[j],
			xhci_dbg(xhci, "%p port %s reg = 0x%x\n",
					addr, names[j],
					(unsigned int) xhci_readl(xhci, addr));
			addr++;
		}
@@ -187,46 +179,46 @@ void xhci_print_ir_set(struct xhci_hcd *xhci, struct intr_reg *ir_set, int set_n
	if (temp == XHCI_INIT_VALUE)
		return;

	xhci_dbg(xhci, "  0x%x: ir_set[%i]\n", (unsigned int) ir_set, set_num);
	xhci_dbg(xhci, "  %p: ir_set[%i]\n", ir_set, set_num);

	xhci_dbg(xhci, "  0x%x: ir_set.pending = 0x%x\n",
			(unsigned int) addr, (unsigned int) temp);
	xhci_dbg(xhci, "  %p: ir_set.pending = 0x%x\n", addr,
			(unsigned int)temp);

	addr = &ir_set->irq_control;
	temp = xhci_readl(xhci, addr);
	xhci_dbg(xhci, "  0x%x: ir_set.control = 0x%x\n",
			(unsigned int) addr, (unsigned int) temp);
	xhci_dbg(xhci, "  %p: ir_set.control = 0x%x\n", addr,
			(unsigned int)temp);

	addr = &ir_set->erst_size;
	temp = xhci_readl(xhci, addr);
	xhci_dbg(xhci, "  0x%x: ir_set.erst_size = 0x%x\n",
			(unsigned int) addr, (unsigned int) temp);
	xhci_dbg(xhci, "  %p: ir_set.erst_size = 0x%x\n", addr,
			(unsigned int)temp);

	addr = &ir_set->rsvd;
	temp = xhci_readl(xhci, addr);
	if (temp != XHCI_INIT_VALUE)
		xhci_dbg(xhci, "  WARN: 0x%x: ir_set.rsvd = 0x%x\n",
				(unsigned int) addr, (unsigned int) temp);
		xhci_dbg(xhci, "  WARN: %p: ir_set.rsvd = 0x%x\n",
				addr, (unsigned int)temp);

	addr = &ir_set->erst_base[0];
	temp = xhci_readl(xhci, addr);
	xhci_dbg(xhci, "  0x%x: ir_set.erst_base[0] = 0x%x\n",
			(unsigned int) addr, (unsigned int) temp);
	xhci_dbg(xhci, "  %p: ir_set.erst_base[0] = 0x%x\n",
			addr, (unsigned int) temp);

	addr = &ir_set->erst_base[1];
	temp = xhci_readl(xhci, addr);
	xhci_dbg(xhci, "  0x%x: ir_set.erst_base[1] = 0x%x\n",
			(unsigned int) addr, (unsigned int) temp);
	xhci_dbg(xhci, "  %p: ir_set.erst_base[1] = 0x%x\n",
			addr, (unsigned int) temp);

	addr = &ir_set->erst_dequeue[0];
	temp = xhci_readl(xhci, addr);
	xhci_dbg(xhci, "  0x%x: ir_set.erst_dequeue[0] = 0x%x\n",
			(unsigned int) addr, (unsigned int) temp);
	xhci_dbg(xhci, "  %p: ir_set.erst_dequeue[0] = 0x%x\n",
			addr, (unsigned int) temp);

	addr = &ir_set->erst_dequeue[1];
	temp = xhci_readl(xhci, addr);
	xhci_dbg(xhci, "  0x%x: ir_set.erst_dequeue[1] = 0x%x\n",
			(unsigned int) addr, (unsigned int) temp);
	xhci_dbg(xhci, "  %p: ir_set.erst_dequeue[1] = 0x%x\n",
			addr, (unsigned int) temp);
}

void xhci_print_run_regs(struct xhci_hcd *xhci)
@@ -234,17 +226,16 @@ void xhci_print_run_regs(struct xhci_hcd *xhci)
	u32 temp;
	int i;

	xhci_dbg(xhci, "xHCI runtime registers at 0x%x:\n",
			(unsigned int) xhci->run_regs);
	xhci_dbg(xhci, "xHCI runtime registers at %p:\n", xhci->run_regs);
	temp = xhci_readl(xhci, &xhci->run_regs->microframe_index);
	xhci_dbg(xhci, "  0x%x: Microframe index = 0x%x\n",
			(unsigned int) &xhci->run_regs->microframe_index,
	xhci_dbg(xhci, "  %p: Microframe index = 0x%x\n",
			&xhci->run_regs->microframe_index,
			(unsigned int) temp);
	for (i = 0; i < 7; ++i) {
		temp = xhci_readl(xhci, &xhci->run_regs->rsvd[i]);
		if (temp != XHCI_INIT_VALUE)
			xhci_dbg(xhci, "  WARN: 0x%x: Rsvd[%i] = 0x%x\n",
					(unsigned int) &xhci->run_regs->rsvd[i],
			xhci_dbg(xhci, "  WARN: %p: Rsvd[%i] = 0x%x\n",
					&xhci->run_regs->rsvd[i],
					i, (unsigned int) temp);
	}
}
@@ -347,14 +338,16 @@ void xhci_debug_segment(struct xhci_hcd *xhci, struct xhci_segment *seg)

void xhci_dbg_ring_ptrs(struct xhci_hcd *xhci, struct xhci_ring *ring)
{
	xhci_dbg(xhci, "Ring deq = 0x%x (virt), 0x%x (dma)\n",
			(unsigned int) ring->dequeue,
			trb_virt_to_dma(ring->deq_seg, ring->dequeue));
	xhci_dbg(xhci, "Ring deq = %p (virt), 0x%llx (dma)\n",
			ring->dequeue,
			(unsigned long long)trb_virt_to_dma(ring->deq_seg,
							    ring->dequeue));
	xhci_dbg(xhci, "Ring deq updated %u times\n",
			ring->deq_updates);
	xhci_dbg(xhci, "Ring enq = 0x%x (virt), 0x%x (dma)\n",
			(unsigned int) ring->enqueue,
			trb_virt_to_dma(ring->enq_seg, ring->enqueue));
	xhci_dbg(xhci, "Ring enq = %p (virt), 0x%llx (dma)\n",
			ring->enqueue,
			(unsigned long long)trb_virt_to_dma(ring->enq_seg,
							    ring->enqueue));
	xhci_dbg(xhci, "Ring enq updated %u times\n",
			ring->enq_updates);
}
@@ -418,42 +411,42 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, struct xhci_device_control *ctx, dma_ad
	/* Fields are 32 bits wide, DMA addresses are in bytes */
	int field_size = 32 / 8;

	xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - drop flags\n",
			(unsigned int) &ctx->drop_flags,
			dma, ctx->drop_flags);
	xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - drop flags\n",
			&ctx->drop_flags, (unsigned long long)dma,
			ctx->drop_flags);
	dma += field_size;
	xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - add flags\n",
			(unsigned int) &ctx->add_flags,
			dma, ctx->add_flags);
	xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - add flags\n",
			&ctx->add_flags, (unsigned long long)dma,
			ctx->add_flags);
	dma += field_size;
	for (i = 0; i > 6; ++i) {
		xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - rsvd[%d]\n",
				(unsigned int) &ctx->rsvd[i],
				dma, ctx->rsvd[i], i);
		xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n",
				&ctx->rsvd[i], (unsigned long long)dma,
				ctx->rsvd[i], i);
		dma += field_size;
	}

	xhci_dbg(xhci, "Slot Context:\n");
	xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - dev_info\n",
			(unsigned int) &ctx->slot.dev_info,
			dma, ctx->slot.dev_info);
	xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info\n",
			&ctx->slot.dev_info,
			(unsigned long long)dma, ctx->slot.dev_info);
	dma += field_size;
	xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - dev_info2\n",
			(unsigned int) &ctx->slot.dev_info2,
			dma, ctx->slot.dev_info2);
	xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info2\n",
			&ctx->slot.dev_info2,
			(unsigned long long)dma, ctx->slot.dev_info2);
	dma += field_size;
	xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - tt_info\n",
			(unsigned int) &ctx->slot.tt_info,
			dma, ctx->slot.tt_info);
	xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tt_info\n",
			&ctx->slot.tt_info,
			(unsigned long long)dma, ctx->slot.tt_info);
	dma += field_size;
	xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - dev_state\n",
			(unsigned int) &ctx->slot.dev_state,
			dma, ctx->slot.dev_state);
	xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_state\n",
			&ctx->slot.dev_state,
			(unsigned long long)dma, ctx->slot.dev_state);
	dma += field_size;
	for (i = 0; i > 4; ++i) {
		xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - rsvd[%d]\n",
				(unsigned int) &ctx->slot.reserved[i],
				dma, ctx->slot.reserved[i], i);
		xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n",
				&ctx->slot.reserved[i], (unsigned long long)dma,
				ctx->slot.reserved[i], i);
		dma += field_size;
	}

@@ -461,30 +454,31 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, struct xhci_device_control *ctx, dma_ad
		last_ep_ctx = last_ep + 1;
	for (i = 0; i < last_ep_ctx; ++i) {
		xhci_dbg(xhci, "Endpoint %02d Context:\n", i);
		xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - ep_info\n",
				(unsigned int) &ctx->ep[i].ep_info,
				dma, ctx->ep[i].ep_info);
		xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info\n",
				&ctx->ep[i].ep_info,
				(unsigned long long)dma, ctx->ep[i].ep_info);
		dma += field_size;
		xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - ep_info2\n",
				(unsigned int) &ctx->ep[i].ep_info2,
				dma, ctx->ep[i].ep_info2);
		xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info2\n",
				&ctx->ep[i].ep_info2,
				(unsigned long long)dma, ctx->ep[i].ep_info2);
		dma += field_size;
		xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - deq[0]\n",
				(unsigned int) &ctx->ep[i].deq[0],
				dma, ctx->ep[i].deq[0]);
		xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - deq[0]\n",
				&ctx->ep[i].deq[0],
				(unsigned long long)dma, ctx->ep[i].deq[0]);
		dma += field_size;
		xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - deq[1]\n",
				(unsigned int) &ctx->ep[i].deq[1],
				dma, ctx->ep[i].deq[1]);
		xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - deq[1]\n",
				&ctx->ep[i].deq[1],
				(unsigned long long)dma, ctx->ep[i].deq[1]);
		dma += field_size;
		xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - tx_info\n",
				(unsigned int) &ctx->ep[i].tx_info,
				dma, ctx->ep[i].tx_info);
		xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tx_info\n",
				&ctx->ep[i].tx_info,
				(unsigned long long)dma, ctx->ep[i].tx_info);
		dma += field_size;
		for (j = 0; j < 3; ++j) {
			xhci_dbg(xhci, "@%08x (virt) @%08x (dma) %#08x - rsvd[%d]\n",
					(unsigned int) &ctx->ep[i].reserved[j],
					dma, ctx->ep[i].reserved[j], j);
			xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n",
					&ctx->ep[i].reserved[j],
					(unsigned long long)dma,
					ctx->ep[i].reserved[j], j);
			dma += field_size;
		}
	}
+17 −20
Original line number Diff line number Diff line
@@ -397,10 +397,8 @@ int xhci_run(struct usb_hcd *hcd)
	xhci_writel(xhci, temp, &xhci->op_regs->command);

	temp = xhci_readl(xhci, &xhci->ir_set->irq_pending);
	xhci_dbg(xhci, "// Enabling event ring interrupter 0x%x"
			" by writing 0x%x to irq_pending\n",
			(unsigned int) xhci->ir_set,
			(unsigned int) ER_IRQ_ENABLE(temp));
	xhci_dbg(xhci, "// Enabling event ring interrupter %p by writing 0x%x to irq_pending\n",
			xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp));
	xhci_writel(xhci, ER_IRQ_ENABLE(temp),
			&xhci->ir_set->irq_pending);
	xhci_print_ir_set(xhci, xhci->ir_set, 0);
@@ -431,8 +429,7 @@ int xhci_run(struct usb_hcd *hcd)
	xhci_writel(xhci, temp, &xhci->op_regs->command);
	/* Flush PCI posted writes */
	temp = xhci_readl(xhci, &xhci->op_regs->command);
	xhci_dbg(xhci, "// @%x = 0x%x\n",
			(unsigned int) &xhci->op_regs->command, temp);
	xhci_dbg(xhci, "// @%p = 0x%x\n", &xhci->op_regs->command, temp);
	if (doorbell)
		(*doorbell)(xhci);

@@ -660,7 +657,7 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
	if (ret || !urb->hcpriv)
		goto done;

	xhci_dbg(xhci, "Cancel URB 0x%x\n", (unsigned int) urb);
	xhci_dbg(xhci, "Cancel URB %p\n", urb);
	ep_index = xhci_get_endpoint_index(&urb->ep->desc);
	ep_ring = xhci->devs[urb->dev->slot_id]->ep_rings[ep_index];
	td = (struct xhci_td *) urb->hcpriv;
@@ -702,10 +699,10 @@ int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
	int ret;

	ret = xhci_check_args(hcd, udev, ep, 1, __func__);
	xhci_dbg(xhci, "%s called for udev %#x\n", __func__, (unsigned int) udev);
	if (ret <= 0)
		return ret;
	xhci = hcd_to_xhci(hcd);
	xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev);

	drop_flag = xhci_get_endpoint_flag(&ep->desc);
	if (drop_flag == SLOT_FLAG || drop_flag == EP0_FLAG) {
@@ -730,8 +727,8 @@ int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
	 */
	if ((ep_ctx->ep_info & EP_STATE_MASK) == EP_STATE_DISABLED ||
			in_ctx->drop_flags & xhci_get_endpoint_flag(&ep->desc)) {
		xhci_warn(xhci, "xHCI %s called with disabled ep %#x\n",
				__func__, (unsigned int) ep);
		xhci_warn(xhci, "xHCI %s called with disabled ep %p\n",
				__func__, ep);
		spin_unlock_irqrestore(&xhci->lock, flags);
		return 0;
	}
@@ -817,8 +814,8 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
	 * ignore this request.
	 */
	if (in_ctx->add_flags & xhci_get_endpoint_flag(&ep->desc)) {
		xhci_warn(xhci, "xHCI %s called with enabled ep %#x\n",
				__func__, (unsigned int) ep);
		xhci_warn(xhci, "xHCI %s called with enabled ep %p\n",
				__func__, ep);
		spin_unlock_irqrestore(&xhci->lock, flags);
		return 0;
	}
@@ -904,7 +901,7 @@ int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
		spin_unlock_irqrestore(&xhci->lock, flags);
		return -EINVAL;
	}
	xhci_dbg(xhci, "%s called for udev %#x\n", __func__, (unsigned int) udev);
	xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev);
	virt_dev = xhci->devs[udev->slot_id];

	/* See section 4.6.6 - A0 = 1; A1 = D0 = D1 = 0 */
@@ -1009,7 +1006,7 @@ void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
		spin_unlock_irqrestore(&xhci->lock, flags);
		return;
	}
	xhci_dbg(xhci, "%s called for udev %#x\n", __func__, (unsigned int) udev);
	xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev);
	virt_dev = xhci->devs[udev->slot_id];
	/* Free any rings allocated for added endpoints */
	for (i = 0; i < 31; ++i) {
@@ -1184,16 +1181,16 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
	xhci_dbg(xhci, "Op regs DCBAA ptr[0] = %#08x\n", temp);
	temp = xhci_readl(xhci, &xhci->op_regs->dcbaa_ptr[1]);
	xhci_dbg(xhci, "Op regs DCBAA ptr[1] = %#08x\n", temp);
	xhci_dbg(xhci, "Slot ID %d dcbaa entry[0] @%08x = %#08x\n",
	xhci_dbg(xhci, "Slot ID %d dcbaa entry[0] @%p = %#08x\n",
			udev->slot_id,
			(unsigned int) &xhci->dcbaa->dev_context_ptrs[2*udev->slot_id],
			&xhci->dcbaa->dev_context_ptrs[2*udev->slot_id],
			xhci->dcbaa->dev_context_ptrs[2*udev->slot_id]);
	xhci_dbg(xhci, "Slot ID %d dcbaa entry[1] @%08x = %#08x\n",
	xhci_dbg(xhci, "Slot ID %d dcbaa entry[1] @%p = %#08x\n",
			udev->slot_id,
			(unsigned int) &xhci->dcbaa->dev_context_ptrs[2*udev->slot_id+1],
			&xhci->dcbaa->dev_context_ptrs[2*udev->slot_id+1],
			xhci->dcbaa->dev_context_ptrs[2*udev->slot_id+1]);
	xhci_dbg(xhci, "Output Context DMA address = %#08x\n",
			virt_dev->out_ctx_dma);
	xhci_dbg(xhci, "Output Context DMA address = %#08llx\n",
			(unsigned long long)virt_dev->out_ctx_dma);
	xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id);
	xhci_dbg_ctx(xhci, virt_dev->in_ctx, virt_dev->in_ctx_dma, 2);
	xhci_dbg(xhci, "Slot ID %d Output Context:\n", udev->slot_id);
+33 −31
Original line number Diff line number Diff line
@@ -40,16 +40,15 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci, gfp_t flag
	seg = kzalloc(sizeof *seg, flags);
	if (!seg)
		return 0;
	xhci_dbg(xhci, "Allocating priv segment structure at 0x%x\n",
			(unsigned int) seg);
	xhci_dbg(xhci, "Allocating priv segment structure at %p\n", seg);

	seg->trbs = dma_pool_alloc(xhci->segment_pool, flags, &dma);
	if (!seg->trbs) {
		kfree(seg);
		return 0;
	}
	xhci_dbg(xhci, "// Allocating segment at 0x%x (virtual) 0x%x (DMA)\n",
			(unsigned int) seg->trbs, (u32) dma);
	xhci_dbg(xhci, "// Allocating segment at %p (virtual) 0x%llx (DMA)\n",
			seg->trbs, (unsigned long long)dma);

	memset(seg->trbs, 0, SEGMENT_SIZE);
	seg->dma = dma;
@@ -63,14 +62,12 @@ static void xhci_segment_free(struct xhci_hcd *xhci, struct xhci_segment *seg)
	if (!seg)
		return;
	if (seg->trbs) {
		xhci_dbg(xhci, "Freeing DMA segment at 0x%x"
				" (virtual) 0x%x (DMA)\n",
				(unsigned int) seg->trbs, (u32) seg->dma);
		xhci_dbg(xhci, "Freeing DMA segment at %p (virtual) 0x%llx (DMA)\n",
				seg->trbs, (unsigned long long)seg->dma);
		dma_pool_free(xhci->segment_pool, seg->trbs, seg->dma);
		seg->trbs = NULL;
	}
	xhci_dbg(xhci, "Freeing priv segment structure at 0x%x\n",
			(unsigned int) seg);
	xhci_dbg(xhci, "Freeing priv segment structure at %p\n", seg);
	kfree(seg);
}

@@ -98,8 +95,9 @@ static void xhci_link_segments(struct xhci_hcd *xhci, struct xhci_segment *prev,
		val |= TRB_TYPE(TRB_LINK);
		prev->trbs[TRBS_PER_SEGMENT-1].link.control = val;
	}
	xhci_dbg(xhci, "Linking segment 0x%x to segment 0x%x (DMA)\n",
			prev->dma, next->dma);
	xhci_dbg(xhci, "Linking segment 0x%llx to segment 0x%llx (DMA)\n",
			(unsigned long long)prev->dma,
			(unsigned long long)next->dma);
}

/* XXX: Do we need the hcd structure in all these functions? */
@@ -112,7 +110,7 @@ void xhci_ring_free(struct xhci_hcd *xhci, struct xhci_ring *ring)
		return;
	first_seg = ring->first_seg;
	seg = first_seg->next;
	xhci_dbg(xhci, "Freeing ring at 0x%x\n", (unsigned int) ring);
	xhci_dbg(xhci, "Freeing ring at %p\n", ring);
	while (seg != first_seg) {
		struct xhci_segment *next = seg->next;
		xhci_segment_free(xhci, seg);
@@ -137,7 +135,7 @@ static struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci,
	struct xhci_segment	*prev;

	ring = kzalloc(sizeof *(ring), flags);
	xhci_dbg(xhci, "Allocating ring at 0x%x\n", (unsigned int) ring);
	xhci_dbg(xhci, "Allocating ring at %p\n", ring);
	if (!ring)
		return 0;

@@ -169,8 +167,8 @@ static struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci,
		/* See section 4.9.2.1 and 6.4.4.1 */
		prev->trbs[TRBS_PER_SEGMENT-1].link.control |= (LINK_TOGGLE);
		xhci_dbg(xhci, "Wrote link toggle flag to"
				" segment 0x%x (virtual), 0x%x (DMA)\n",
				(unsigned int) prev, (u32) prev->dma);
				" segment %p (virtual), 0x%llx (DMA)\n",
				prev, (unsigned long long)prev->dma);
	}
	/* The ring is empty, so the enqueue pointer == dequeue pointer */
	ring->enqueue = ring->first_seg->trbs;
@@ -242,7 +240,8 @@ int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
	if (!dev->out_ctx)
		goto fail;
	dev->out_ctx_dma = dma;
	xhci_dbg(xhci, "Slot %d output ctx = 0x%x (dma)\n", slot_id, dma);
	xhci_dbg(xhci, "Slot %d output ctx = 0x%llx (dma)\n", slot_id,
			(unsigned long long)dma);
	memset(dev->out_ctx, 0, sizeof(*dev->out_ctx));

	/* Allocate the (input) device context for address device command */
@@ -250,7 +249,8 @@ int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
	if (!dev->in_ctx)
		goto fail;
	dev->in_ctx_dma = dma;
	xhci_dbg(xhci, "Slot %d input ctx = 0x%x (dma)\n", slot_id, dma);
	xhci_dbg(xhci, "Slot %d input ctx = 0x%llx (dma)\n", slot_id,
			(unsigned long long)dma);
	memset(dev->in_ctx, 0, sizeof(*dev->in_ctx));

	/* Allocate endpoint 0 ring */
@@ -266,10 +266,10 @@ int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
	 */
	xhci->dcbaa->dev_context_ptrs[2*slot_id] =
		(u32) dev->out_ctx_dma + (32);
	xhci_dbg(xhci, "Set slot id %d dcbaa entry 0x%x to 0x%x\n",
	xhci_dbg(xhci, "Set slot id %d dcbaa entry %p to 0x%llx\n",
			slot_id,
			(unsigned int) &xhci->dcbaa->dev_context_ptrs[2*slot_id],
			dev->out_ctx_dma);
			&xhci->dcbaa->dev_context_ptrs[2*slot_id],
			(unsigned long long)dev->out_ctx_dma);
	xhci->dcbaa->dev_context_ptrs[2*slot_id + 1] = 0;

	return 1;
@@ -339,7 +339,7 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
		dev->in_ctx->slot.tt_info = udev->tt->hub->slot_id;
		dev->in_ctx->slot.tt_info |= udev->ttport << 8;
	}
	xhci_dbg(xhci, "udev->tt = 0x%x\n", (unsigned int) udev->tt);
	xhci_dbg(xhci, "udev->tt = %p\n", udev->tt);
	xhci_dbg(xhci, "udev->ttport = 0x%x\n", udev->ttport);

	/* Step 4 - ring already allocated */
@@ -643,8 +643,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
		goto fail;
	memset(xhci->dcbaa, 0, sizeof *(xhci->dcbaa));
	xhci->dcbaa->dma = dma;
	xhci_dbg(xhci, "// Device context base array address = 0x%x (DMA), 0x%x (virt)\n",
			xhci->dcbaa->dma, (unsigned int) xhci->dcbaa);
	xhci_dbg(xhci, "// Device context base array address = 0x%llx (DMA), %p (virt)\n",
			(unsigned long long)xhci->dcbaa->dma, xhci->dcbaa);
	xhci_writel(xhci, (u32) 0, &xhci->op_regs->dcbaa_ptr[1]);
	xhci_writel(xhci, dma, &xhci->op_regs->dcbaa_ptr[0]);

@@ -668,8 +668,9 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
	xhci->cmd_ring = xhci_ring_alloc(xhci, 1, true, flags);
	if (!xhci->cmd_ring)
		goto fail;
	xhci_dbg(xhci, "Allocated command ring at 0x%x\n", (unsigned int) xhci->cmd_ring);
	xhci_dbg(xhci, "First segment DMA is 0x%x\n", (unsigned int) xhci->cmd_ring->first_seg->dma);
	xhci_dbg(xhci, "Allocated command ring at %p\n", xhci->cmd_ring);
	xhci_dbg(xhci, "First segment DMA is 0x%llx\n",
			(unsigned long long)xhci->cmd_ring->first_seg->dma);

	/* Set the address in the Command Ring Control register */
	val = xhci_readl(xhci, &xhci->op_regs->cmd_ring[0]);
@@ -705,15 +706,16 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
			sizeof(struct xhci_erst_entry)*ERST_NUM_SEGS, &dma);
	if (!xhci->erst.entries)
		goto fail;
	xhci_dbg(xhci, "// Allocated event ring segment table at 0x%x\n", dma);
	xhci_dbg(xhci, "// Allocated event ring segment table at 0x%llx\n",
			(unsigned long long)dma);

	memset(xhci->erst.entries, 0, sizeof(struct xhci_erst_entry)*ERST_NUM_SEGS);
	xhci->erst.num_entries = ERST_NUM_SEGS;
	xhci->erst.erst_dma_addr = dma;
	xhci_dbg(xhci, "Set ERST to 0; private num segs = %i, virt addr = 0x%x, dma addr = 0x%x\n",
	xhci_dbg(xhci, "Set ERST to 0; private num segs = %i, virt addr = %p, dma addr = 0x%llx\n",
			xhci->erst.num_entries,
			(unsigned int) xhci->erst.entries,
			xhci->erst.erst_dma_addr);
			xhci->erst.entries,
			(unsigned long long)xhci->erst.erst_dma_addr);

	/* set ring base address and size for each segment table entry */
	for (val = 0, seg = xhci->event_ring->first_seg; val < ERST_NUM_SEGS; val++) {
@@ -735,8 +737,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)

	xhci_dbg(xhci, "// Set ERST entries to point to event ring.\n");
	/* set the segment table base address */
	xhci_dbg(xhci, "// Set ERST base address for ir_set 0 = 0x%x\n",
			xhci->erst.erst_dma_addr);
	xhci_dbg(xhci, "// Set ERST base address for ir_set 0 = 0x%llx\n",
			(unsigned long long)xhci->erst.erst_dma_addr);
	xhci_writel(xhci, 0, &xhci->ir_set->erst_base[1]);
	val = xhci_readl(xhci, &xhci->ir_set->erst_base[0]);
	val &= ERST_PTR_MASK;
+35 −37

File changed.

Preview size limit exceeded, changes collapsed.