Modify xhci event codes

This commit is contained in:
songyanguang 2024-11-07 10:46:01 +08:00
parent 57ceab57e6
commit d7b78ecd2a
1 changed files with 8 additions and 9 deletions

View File

@ -780,6 +780,7 @@ static int xhci_scratchpad_alloc ( struct xhci_host *xhci ) {
memset(scratch->array_addr, 0, array_len);
scratch->array_phy = phy_addr;
scratch->array = scratch->array_addr;
/*
* Allocate memory for storing all virtual address of physical pages allocated to xHCI as scratchpad buffer.
@ -928,14 +929,12 @@ static int xhci_command_alloc ( struct xhci_host *xhci ) {
goto err_writeq;
#endif
for(i = 0; i < XHCI_RING_ITEMS; i++){
trb_link = (struct xhci_trb_link *)&xhci->cmds->ring[i];
trb_link->reserved_c |= XHCI_TRB_C;
}
trb_link = (struct xhci_trb_link *)&xhci->cmds->ring[XHCI_RING_ITEMS - 1];
trb_link->reserved_c |= XHCI_TRB_TC;
trb_link->type = XHCI_TRB_LINK;
trb_link->flags = XHCI_TRB_TC;
trb_link->reserved_c |= XHCI_TRB_TC;
trb_link->next = CPU_TO_LE64 ( ( (uintptr_t)xhci->cmds_phy ) );
if ( ( rc = xhci_writeq ( xhci, ( cmds_phy | XHCI_CRCR_RCS ),
xhci->op_addr + XHCI_OP_CRCR ) ) != 0 )
@ -1019,7 +1018,7 @@ static int xhci_event_alloc ( struct xhci_host *xhci ) {
xhci->eseg = (struct xhci_er_seg *)xhci->eseg_addr;
memset(xhci->eseg, 0U, sizeof(*xhci->eseg));
xhci->eseg->base = CPU_TO_LE64 ( ( (uintptr_t)xhci->evts ) );
xhci->eseg->base = CPU_TO_LE64 ( xhci->evts_phy );
xhci->eseg->count = XHCI_RING_ITEMS; /* items of event ring TRB */
/* Program event ring registers */
@ -2955,10 +2954,10 @@ void xhci_event_process(struct xhci_host *xhci) {
/* check and ack event */
for (;;) {
/* Stop if we reach an empty TRB */
// DSB();
DSB();
// __asm__ __volatile__("dsb sy": : : "memory");
// __asm__ volatile("dmb ish\n\t");
BARRIER();
// BARRIER();
nidx = evts->nidx; /* index of dequeue trb */
cs = evts->cs; /* cycle state toggle by xHc */