Lines Matching refs:trb
43 static int xhci_send_command(int id, struct xhci_TRB_t *trb, const bool do_ring);
109 static __always_inline void xhci_get_trb(struct xhci_TRB_t *trb, const uint64_t address) in xhci_get_trb() argument
111 trb->param = __read8b(address); in xhci_get_trb()
112 trb->status = __read4b(address + 8); in xhci_get_trb()
113 trb->command = __read4b(address + 12); in xhci_get_trb()
122 static __always_inline void xhci_set_trb(struct xhci_TRB_t *trb, const uint64_t address) in xhci_set_trb() argument
124 __write8b(address, trb->param); in xhci_set_trb()
125 __write4b(address + 8, trb->status); in xhci_set_trb()
126 __write4b(address + 12, trb->command); in xhci_set_trb()
199 static __always_inline void __xhci_write_trb(struct xhci_ep_info_t *ep_info, struct xhci_TRB_t *trb) in __xhci_write_trb() argument
201 memcpy((void *)ep_info->current_ep_ring_vaddr, trb, sizeof(struct xhci_TRB_t)); in __xhci_write_trb()
1026 struct xhci_TRB_normal_t trb = {0}; in xhci_set_address() local
1027 trb.buf_paddr = virt_2_phys(input_ctx_buffer); in xhci_set_address()
1028 trb.bei = (block ? 1 : 0); in xhci_set_address()
1029 trb.TRB_type = TRB_TYPE_ADDRESS_DEVICE; in xhci_set_address()
1030 trb.intr_target = 0; in xhci_set_address()
1031 trb.cycle = xhci_hc[id].cmd_trb_cycle; in xhci_set_address()
1032 trb.Reserved |= ((slot_id << 8) & 0xffff); in xhci_set_address()
1034 retval = xhci_send_command(id, (struct xhci_TRB_t *)&trb, true); in xhci_set_address()
1041 struct xhci_TRB_cmd_complete_t *trb_done = (struct xhci_TRB_cmd_complete_t *)&trb; in xhci_set_address()
1069 struct xhci_TRB_setup_stage_t trb = {0}; in xhci_setup_stage() local
1070 trb.bmRequestType = packet->request_type; in xhci_setup_stage()
1071 trb.bRequest = packet->request; in xhci_setup_stage()
1072 trb.wValue = packet->value; in xhci_setup_stage()
1073 trb.wIndex = packet->index; in xhci_setup_stage()
1074 trb.wLength = packet->length; in xhci_setup_stage()
1075 trb.transfer_legth = 8; in xhci_setup_stage()
1076 trb.intr_target = 0; // 使用第0个interrupter in xhci_setup_stage()
1077 trb.cycle = ep->current_ep_ring_cycle; in xhci_setup_stage()
1078 trb.ioc = 0; in xhci_setup_stage()
1079 trb.idt = 1; in xhci_setup_stage()
1080 trb.TRB_type = TRB_TYPE_SETUP_STAGE; in xhci_setup_stage()
1081 trb.trt = direction; in xhci_setup_stage()
1084 __xhci_write_trb(ep, (struct xhci_TRB_t *)&trb); in xhci_setup_stage()
1107 struct xhci_TRB_data_stage_t trb = {0}; in xhci_data_stage() local
1114 trb.buf_paddr = virt_2_phys(buf_vaddr); in xhci_data_stage()
1115 trb.intr_target = 0; in xhci_data_stage()
1116 trb.TD_size = remain_packets; in xhci_data_stage()
1117 trb.transfer_length = (remain_bytes < max_packet ? size : max_packet); in xhci_data_stage()
1118 trb.dir = direction; in xhci_data_stage()
1119 trb.TRB_type = trb_type; in xhci_data_stage()
1120 trb.chain = 1; in xhci_data_stage()
1121 trb.ent = (remain_packets == 0); in xhci_data_stage()
1122 trb.cycle = ep->current_ep_ring_cycle; in xhci_data_stage()
1123 trb.ioc = 0; in xhci_data_stage()
1126 __xhci_write_trb(ep, (struct xhci_TRB_t *)&trb); in xhci_data_stage()
1138 memset(&trb, 0, sizeof(struct xhci_TRB_data_stage_t *)); in xhci_data_stage()
1139 trb.buf_paddr = virt_2_phys(status_vaddr); in xhci_data_stage()
1140 trb.intr_target = 0; in xhci_data_stage()
1141 trb.cycle = ep->current_ep_ring_cycle; in xhci_data_stage()
1142 trb.ioc = 1; in xhci_data_stage()
1143 trb.TRB_type = TRB_TYPE_EVENT_DATA; in xhci_data_stage()
1144 __xhci_write_trb(ep, (struct xhci_TRB_t *)&trb); in xhci_data_stage()
1162 struct xhci_TRB_status_stage_t trb = {0}; in xhci_status_stage() local
1165 trb.intr_target = 0; in xhci_status_stage()
1166 trb.cycle = ep->current_ep_ring_cycle; in xhci_status_stage()
1167 trb.ent = 0; in xhci_status_stage()
1168 trb.ioc = 1; in xhci_status_stage()
1169 trb.TRB_type = TRB_TYPE_STATUS_STAGE; in xhci_status_stage()
1170 trb.dir = direction; in xhci_status_stage()
1171 __xhci_write_trb(ep, (struct xhci_TRB_t *)&trb); in xhci_status_stage()
1176 struct xhci_TRB_data_stage_t trb = {0}; in xhci_status_stage() local
1177 trb.buf_paddr = virt_2_phys(status_buf_vaddr); in xhci_status_stage()
1178 trb.intr_target = 0; in xhci_status_stage()
1179 trb.TRB_type = TRB_TYPE_EVENT_DATA; in xhci_status_stage()
1180 trb.ioc = 1; in xhci_status_stage()
1182 trb.cycle = ep->current_ep_ring_cycle; in xhci_status_stage()
1184 __xhci_write_trb(ep, (struct xhci_TRB_t *)&trb); in xhci_status_stage()
1541 struct xhci_TRB_normal_t trb = {0}; in xhci_get_descriptor() local
1542 trb.TRB_type = TRB_TYPE_ENABLE_SLOT; in xhci_get_descriptor()
1544 if (xhci_send_command(id, (struct xhci_TRB_t *)&trb, true) != 0) in xhci_get_descriptor()
1551 uint32_t slot_id = ((struct xhci_TRB_cmd_complete_t *)&trb)->slot_id; in xhci_get_descriptor()
1757 struct xhci_TRB_normal_t trb = {0}; in xhci_configure_endpoint() local
1758 trb.buf_paddr = virt_2_phys(input_ctx_buffer); in xhci_configure_endpoint()
1759 trb.TRB_type = TRB_TYPE_CONFIG_EP; in xhci_configure_endpoint()
1760 trb.cycle = xhci_hc[id].cmd_trb_cycle; in xhci_configure_endpoint()
1761 trb.Reserved |= (((uint16_t)xhci_hc[id].ports[port_id].slot_id) << 8) & 0xffff; in xhci_configure_endpoint()
1766 retval = xhci_send_command(id, (struct xhci_TRB_t *)&trb, true); in xhci_configure_endpoint()
1774 struct xhci_TRB_cmd_complete_t *trb_done = (struct xhci_TRB_cmd_complete_t *)&trb; in xhci_configure_endpoint()
1970 static int xhci_send_command(int id, struct xhci_TRB_t *trb, const bool do_ring) in xhci_send_command() argument
1975 __write8b(xhci_hc[id].cmd_trb_vaddr, trb->param); // 参数 in xhci_send_command()
1976 __write4b(xhci_hc[id].cmd_trb_vaddr + 8, trb->status); // 状态 in xhci_send_command()
1977 __write4b(xhci_hc[id].cmd_trb_vaddr + 12, trb->command | xhci_hc[id].cmd_trb_cycle); // 命令 in xhci_send_command()
2012 xhci_get_trb(trb, origin_trb_vaddr); in xhci_send_command()
2013 trb->status &= (~XHCI_IRQ_DONE); in xhci_send_command()