@@ -39,41 +39,6 @@ static inline uint8_t trb_get_slotid(const struct trb *e)
3939 return (uint8_t )(e -> ctrl & 0xFF );
4040}
4141
42- /* === Event-ring consumer helpers (xHC produces; we only consume) === */
43-
44- static inline struct trb * evt_cur (struct xhci_hc * hc )
45- {
46- return & hc -> evt .base [hc -> evt .enqueue ];
47- }
48-
49- /* Is the next event TRB owned by software? (C-bit matches CCS/consumer cycle) */
50- static inline int evt_has_ready (struct xhci_hc * hc )
51- {
52- const struct trb * e = evt_cur (hc );
53- const uint32_t cbit = (e -> ctrl & TRB_CYCLE ) ? 1u : 0u ;
54- return (cbit == (hc -> evt .cycle & 1u ));
55- }
56-
57- /* Consume exactly one TRB and advance consumer cursor/cycle */
58- static inline void evt_consume (struct xhci_hc * hc )
59- {
60- struct trb * e = evt_cur (hc );
61- memset (e , 0 , sizeof (* e )); /* optional but handy */
62- hc -> evt .enqueue ++ ;
63- if (hc -> evt .enqueue == hc -> evt .num_trbs ) {
64- hc -> evt .enqueue = 0 ;
65- hc -> evt .cycle ^= 1u ; /* toggle consumer cycle on wrap */
66- }
67- }
68-
69- /* Program ERDP to the *next-to-consume* TRB, EHB clear (bit3=0) */
70- static inline void evt_update_erdp (struct xhci_hc * hc )
71- {
72- volatile uint8_t * ir0 = hc -> rt + XHCI_RT_IR0 ;
73- uint64_t erdp = hc -> evt .phys + ((uint64_t )hc -> evt .enqueue * sizeof (struct trb ));
74- mmio_write64 (ir0 + IR_ERDP , erdp ); /* keep EHB clear in steady state */
75- }
76-
7742static void xhci_handle_unrelated_transfer_event (struct xhci_hc * hc , struct trb * e )
7843{
7944 if (!hc || !e ) return ;
@@ -945,6 +910,7 @@ static void xhci_isr(uint8_t isr, uint64_t error, uint64_t irq, void *opaque)
945910 }
946911 memset (e , 0 , sizeof (* e ));
947912 erdp_cur = (erdp_cur + 16 ) & ~0x7ull ;
913+ dprintf ("erdp_cur=%lu\n" , erdp_cur );
948914 mmio_write64 (ir0 + IR_ERDP , erdp_cur );
949915 }
950916
0 commit comments