|
@@ -110,7 +110,7 @@ static void xhci_scratchpad_free(struct xhci_ctrl *ctrl)
|
|
|
|
|
|
ctrl->dcbaa->dev_context_ptrs[0] = 0;
|
|
|
|
|
|
- free((void *)(uintptr_t)ctrl->scratchpad->sp_array[0]);
|
|
|
+ free((void *)(uintptr_t)le64_to_cpu(ctrl->scratchpad->sp_array[0]));
|
|
|
free(ctrl->scratchpad->sp_array);
|
|
|
free(ctrl->scratchpad);
|
|
|
ctrl->scratchpad = NULL;
|
|
@@ -226,8 +226,9 @@ static void xhci_link_segments(struct xhci_segment *prev,
|
|
|
return;
|
|
|
prev->next = next;
|
|
|
if (link_trbs) {
|
|
|
- val_64 = (uintptr_t)next->trbs;
|
|
|
- prev->trbs[TRBS_PER_SEGMENT-1].link.segment_ptr = val_64;
|
|
|
+ val_64 = virt_to_phys(next->trbs);
|
|
|
+ prev->trbs[TRBS_PER_SEGMENT-1].link.segment_ptr =
|
|
|
+ cpu_to_le64(val_64);
|
|
|
|
|
|
/*
|
|
|
* Set the last TRB in the segment to
|
|
@@ -488,10 +489,10 @@ int xhci_alloc_virt_device(struct xhci_ctrl *ctrl, unsigned int slot_id)
|
|
|
/* Allocate endpoint 0 ring */
|
|
|
virt_dev->eps[0].ring = xhci_ring_alloc(1, true);
|
|
|
|
|
|
- byte_64 = (uintptr_t)(virt_dev->out_ctx->bytes);
|
|
|
+ byte_64 = virt_to_phys(virt_dev->out_ctx->bytes);
|
|
|
|
|
|
/* Point to output device context in dcbaa. */
|
|
|
- ctrl->dcbaa->dev_context_ptrs[slot_id] = byte_64;
|
|
|
+ ctrl->dcbaa->dev_context_ptrs[slot_id] = cpu_to_le64(byte_64);
|
|
|
|
|
|
xhci_flush_cache((uintptr_t)&ctrl->dcbaa->dev_context_ptrs[slot_id],
|
|
|
sizeof(__le64));
|
|
@@ -513,7 +514,7 @@ int xhci_mem_init(struct xhci_ctrl *ctrl, struct xhci_hccr *hccr,
|
|
|
uint64_t val_64;
|
|
|
uint64_t trb_64;
|
|
|
uint32_t val;
|
|
|
- unsigned long deq;
|
|
|
+ uint64_t deq;
|
|
|
int i;
|
|
|
struct xhci_segment *seg;
|
|
|
|
|
@@ -525,7 +526,7 @@ int xhci_mem_init(struct xhci_ctrl *ctrl, struct xhci_hccr *hccr,
|
|
|
return -ENOMEM;
|
|
|
}
|
|
|
|
|
|
- val_64 = (uintptr_t)ctrl->dcbaa;
|
|
|
+ val_64 = virt_to_phys(ctrl->dcbaa);
|
|
|
/* Set the pointer in DCBAA register */
|
|
|
xhci_writeq(&hcor->or_dcbaap, val_64);
|
|
|
|
|
@@ -533,7 +534,7 @@ int xhci_mem_init(struct xhci_ctrl *ctrl, struct xhci_hccr *hccr,
|
|
|
ctrl->cmd_ring = xhci_ring_alloc(1, true);
|
|
|
|
|
|
/* Set the address in the Command Ring Control register */
|
|
|
- trb_64 = (uintptr_t)ctrl->cmd_ring->first_seg->trbs;
|
|
|
+ trb_64 = virt_to_phys(ctrl->cmd_ring->first_seg->trbs);
|
|
|
val_64 = xhci_readq(&hcor->or_crcr);
|
|
|
val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) |
|
|
|
(trb_64 & (u64) ~CMD_RING_RSVD_BITS) |
|
|
@@ -563,10 +564,9 @@ int xhci_mem_init(struct xhci_ctrl *ctrl, struct xhci_hccr *hccr,
|
|
|
for (val = 0, seg = ctrl->event_ring->first_seg;
|
|
|
val < ERST_NUM_SEGS;
|
|
|
val++) {
|
|
|
- trb_64 = 0;
|
|
|
- trb_64 = (uintptr_t)seg->trbs;
|
|
|
+ trb_64 = virt_to_phys(seg->trbs);
|
|
|
struct xhci_erst_entry *entry = &ctrl->erst.entries[val];
|
|
|
- xhci_writeq(&entry->seg_addr, trb_64);
|
|
|
+ entry->seg_addr = cpu_to_le64(trb_64);
|
|
|
entry->seg_size = cpu_to_le32(TRBS_PER_SEGMENT);
|
|
|
entry->rsvd = 0;
|
|
|
seg = seg->next;
|
|
@@ -574,7 +574,7 @@ int xhci_mem_init(struct xhci_ctrl *ctrl, struct xhci_hccr *hccr,
|
|
|
xhci_flush_cache((uintptr_t)ctrl->erst.entries,
|
|
|
ERST_NUM_SEGS * sizeof(struct xhci_erst_entry));
|
|
|
|
|
|
- deq = (unsigned long)ctrl->event_ring->dequeue;
|
|
|
+ deq = virt_to_phys(ctrl->event_ring->dequeue);
|
|
|
|
|
|
/* Update HC event ring dequeue pointer */
|
|
|
xhci_writeq(&ctrl->ir_set->erst_dequeue,
|
|
@@ -589,7 +589,7 @@ int xhci_mem_init(struct xhci_ctrl *ctrl, struct xhci_hccr *hccr,
|
|
|
/* this is the event ring segment table pointer */
|
|
|
val_64 = xhci_readq(&ctrl->ir_set->erst_base);
|
|
|
val_64 &= ERST_PTR_MASK;
|
|
|
- val_64 |= ((uintptr_t)(ctrl->erst.entries) & ~ERST_PTR_MASK);
|
|
|
+ val_64 |= virt_to_phys(ctrl->erst.entries) & ~ERST_PTR_MASK;
|
|
|
|
|
|
xhci_writeq(&ctrl->ir_set->erst_base, val_64);
|
|
|
|
|
@@ -773,7 +773,7 @@ void xhci_setup_addressable_virt_dev(struct xhci_ctrl *ctrl,
|
|
|
|
|
|
debug("route string %x\n", route);
|
|
|
#endif
|
|
|
- slot_ctx->dev_info |= route;
|
|
|
+ slot_ctx->dev_info |= cpu_to_le32(route);
|
|
|
|
|
|
switch (speed) {
|
|
|
case USB_SPEED_SUPER:
|
|
@@ -857,7 +857,7 @@ void xhci_setup_addressable_virt_dev(struct xhci_ctrl *ctrl,
|
|
|
cpu_to_le32(((0 & MAX_BURST_MASK) << MAX_BURST_SHIFT) |
|
|
|
((3 & ERROR_COUNT_MASK) << ERROR_COUNT_SHIFT));
|
|
|
|
|
|
- trb_64 = (uintptr_t)virt_dev->eps[0].ring->first_seg->trbs;
|
|
|
+ trb_64 = virt_to_phys(virt_dev->eps[0].ring->first_seg->trbs);
|
|
|
ep0_ctx->deq = cpu_to_le64(trb_64 | virt_dev->eps[0].ring->cycle_state);
|
|
|
|
|
|
/*
|