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()
1024 struct xhci_TRB_normal_t trb = {0}; in xhci_set_address() local
1025 trb.buf_paddr = virt_2_phys(input_ctx_buffer); in xhci_set_address()
1026 trb.bei = (block ? 1 : 0); in xhci_set_address()
1027 trb.TRB_type = TRB_TYPE_ADDRESS_DEVICE; in xhci_set_address()
1028 trb.intr_target = 0; in xhci_set_address()
1029 trb.cycle = xhci_hc[id].cmd_trb_cycle; in xhci_set_address()
1030 trb.Reserved |= ((slot_id << 8) & 0xffff); in xhci_set_address()
1032 retval = xhci_send_command(id, (struct xhci_TRB_t *)&trb, true); in xhci_set_address()
1039 struct xhci_TRB_cmd_complete_t *trb_done = (struct xhci_TRB_cmd_complete_t *)&trb; in xhci_set_address()
1067 struct xhci_TRB_setup_stage_t trb = {0}; in xhci_setup_stage() local
1068 trb.bmRequestType = packet->request_type; in xhci_setup_stage()
1069 trb.bRequest = packet->request; in xhci_setup_stage()
1070 trb.wValue = packet->value; in xhci_setup_stage()
1071 trb.wIndex = packet->index; in xhci_setup_stage()
1072 trb.wLength = packet->length; in xhci_setup_stage()
1073 trb.transfer_legth = 8; in xhci_setup_stage()
1074 trb.intr_target = 0; // 使用第0个interrupter in xhci_setup_stage()
1075 trb.cycle = ep->current_ep_ring_cycle; in xhci_setup_stage()
1076 trb.ioc = 0; in xhci_setup_stage()
1077 trb.idt = 1; in xhci_setup_stage()
1078 trb.TRB_type = TRB_TYPE_SETUP_STAGE; in xhci_setup_stage()
1079 trb.trt = direction; in xhci_setup_stage()
1082 __xhci_write_trb(ep, (struct xhci_TRB_t *)&trb); in xhci_setup_stage()
1105 struct xhci_TRB_data_stage_t trb = {0}; in xhci_data_stage() local
1112 trb.buf_paddr = virt_2_phys(buf_vaddr); in xhci_data_stage()
1113 trb.intr_target = 0; in xhci_data_stage()
1114 trb.TD_size = remain_packets; in xhci_data_stage()
1115 trb.transfer_length = (remain_bytes < max_packet ? size : max_packet); in xhci_data_stage()
1116 trb.dir = direction; in xhci_data_stage()
1117 trb.TRB_type = trb_type; in xhci_data_stage()
1118 trb.chain = 1; in xhci_data_stage()
1119 trb.ent = (remain_packets == 0); in xhci_data_stage()
1120 trb.cycle = ep->current_ep_ring_cycle; in xhci_data_stage()
1121 trb.ioc = 0; in xhci_data_stage()
1124 __xhci_write_trb(ep, (struct xhci_TRB_t *)&trb); in xhci_data_stage()
1136 memset(&trb, 0, sizeof(struct xhci_TRB_data_stage_t *)); in xhci_data_stage()
1137 trb.buf_paddr = virt_2_phys(status_vaddr); in xhci_data_stage()
1138 trb.intr_target = 0; in xhci_data_stage()
1139 trb.cycle = ep->current_ep_ring_cycle; in xhci_data_stage()
1140 trb.ioc = 1; in xhci_data_stage()
1141 trb.TRB_type = TRB_TYPE_EVENT_DATA; in xhci_data_stage()
1142 __xhci_write_trb(ep, (struct xhci_TRB_t *)&trb); in xhci_data_stage()
1160 struct xhci_TRB_status_stage_t trb = {0}; in xhci_status_stage() local
1163 trb.intr_target = 0; in xhci_status_stage()
1164 trb.cycle = ep->current_ep_ring_cycle; in xhci_status_stage()
1165 trb.ent = 0; in xhci_status_stage()
1166 trb.ioc = 1; in xhci_status_stage()
1167 trb.TRB_type = TRB_TYPE_STATUS_STAGE; in xhci_status_stage()
1168 trb.dir = direction; in xhci_status_stage()
1169 __xhci_write_trb(ep, (struct xhci_TRB_t *)&trb); in xhci_status_stage()
1174 struct xhci_TRB_data_stage_t trb = {0}; in xhci_status_stage() local
1175 trb.buf_paddr = virt_2_phys(status_buf_vaddr); in xhci_status_stage()
1176 trb.intr_target = 0; in xhci_status_stage()
1177 trb.TRB_type = TRB_TYPE_EVENT_DATA; in xhci_status_stage()
1178 trb.ioc = 1; in xhci_status_stage()
1180 trb.cycle = ep->current_ep_ring_cycle; in xhci_status_stage()
1182 __xhci_write_trb(ep, (struct xhci_TRB_t *)&trb); in xhci_status_stage()
1539 struct xhci_TRB_normal_t trb = {0}; in xhci_get_descriptor() local
1540 trb.TRB_type = TRB_TYPE_ENABLE_SLOT; in xhci_get_descriptor()
1542 if (xhci_send_command(id, (struct xhci_TRB_t *)&trb, true) != 0) in xhci_get_descriptor()
1549 uint32_t slot_id = ((struct xhci_TRB_cmd_complete_t *)&trb)->slot_id; in xhci_get_descriptor()
1755 struct xhci_TRB_normal_t trb = {0}; in xhci_configure_endpoint() local
1756 trb.buf_paddr = virt_2_phys(input_ctx_buffer); in xhci_configure_endpoint()
1757 trb.TRB_type = TRB_TYPE_CONFIG_EP; in xhci_configure_endpoint()
1758 trb.cycle = xhci_hc[id].cmd_trb_cycle; in xhci_configure_endpoint()
1759 trb.Reserved |= (((uint16_t)xhci_hc[id].ports[port_id].slot_id) << 8) & 0xffff; in xhci_configure_endpoint()
1764 retval = xhci_send_command(id, (struct xhci_TRB_t *)&trb, true); in xhci_configure_endpoint()
1772 struct xhci_TRB_cmd_complete_t *trb_done = (struct xhci_TRB_cmd_complete_t *)&trb; in xhci_configure_endpoint()
1968 static int xhci_send_command(int id, struct xhci_TRB_t *trb, const bool do_ring) in xhci_send_command() argument
1973 __write8b(xhci_hc[id].cmd_trb_vaddr, trb->param); // 参数 in xhci_send_command()
1974 __write4b(xhci_hc[id].cmd_trb_vaddr + 8, trb->status); // 状态 in xhci_send_command()
1975 __write4b(xhci_hc[id].cmd_trb_vaddr + 12, trb->command | xhci_hc[id].cmd_trb_cycle); // 命令 in xhci_send_command()
2010 xhci_get_trb(trb, origin_trb_vaddr); in xhci_send_command()
2011 trb->status &= (~XHCI_IRQ_DONE); in xhci_send_command()