Skip to content

Commit 09f41f8

Browse files
author
Diego Ferrari
committed
[XHCI] mmu mappings
1 parent dccd0bb commit 09f41f8

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

kernel/input/xhci.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ bool XHCIDriver::init(){
110110
cap = (xhci_cap_regs*)mmio;
111111
kprintfv("[xHCI] caplength %llx",cap->caplength);
112112
uintptr_t op_base = mmio + cap->caplength;
113-
op = (xhci_op_regs*)op_base;
114-
ports = (xhci_port_regs*)(op_base + 0x400);
115-
db_base = mmio + (cap->dboff & ~0x1F);
116-
rt_base = mmio + (cap->rtsoff & ~0x1F);
113+
op = (xhci_op_regs*)PHYS_TO_VIRT(op_base);
114+
ports = (xhci_port_regs*)PHYS_TO_VIRT((op_base + 0x400));
115+
db_base = PHYS_TO_VIRT((mmio + (cap->dboff & ~0x1F)));
116+
rt_base = PHYS_TO_VIRT((mmio + (cap->rtsoff & ~0x1F)));
117117

118118
kprintfv("[xHCI] Resetting controller %llx",&op->usbcmd);
119119
op->usbcmd &= ~1;
@@ -539,7 +539,7 @@ bool XHCIDriver::poll(uint8_t address, uint8_t endpoint, void *out_buf, uint16_t
539539
}
540540

541541
void XHCIDriver::handle_interrupt(){
542-
trb* ev = &event_ring.ring[event_ring.index];
542+
trb* ev = (trb*)PHYS_TO_VIRT_P(&event_ring.ring[event_ring.index]);
543543
if (!((ev->control & 1) == event_ring.cycle_bit)) return;
544544
uint32_t type = (ev->control & TRB_TYPE_MASK) >> 10;
545545
uint64_t addr = ev->parameter;

0 commit comments

Comments
 (0)