Lines Matching refs:cid

39 void xhci_hc_irq_handler(uint64_t irq_num, uint64_t cid, struct pt_regs *regs);
589 int cid = xhci_find_hcid_by_irq_num(irq_num); in xhci_hc_irq_enable() local
591 if (WARN_ON(cid == -1)) in xhci_hc_irq_enable()
595 pci_start_msi(xhci_hc[cid].pci_dev_hdr); in xhci_hc_irq_enable()
598 xhci_hc_start_sched(cid); in xhci_hc_irq_enable()
600 xhci_hc_start_ports(cid); in xhci_hc_irq_enable()
605 int cid = xhci_find_hcid_by_irq_num(irq_num); in xhci_hc_irq_disable() local
607 if (WARN_ON(cid == -1)) in xhci_hc_irq_disable()
610 xhci_hc_stop_sched(cid); in xhci_hc_irq_disable()
612 pci_disable_msi(xhci_hc[cid].pci_dev_hdr); in xhci_hc_irq_disable()
625 int cid = xhci_find_hcid_by_irq_num(irq_num); in xhci_hc_irq_install() local
627 if (WARN_ON(cid == -1)) in xhci_hc_irq_install()
636 msi_desc.pci_dev = (struct pci_device_structure_header_t *)xhci_hc[cid].pci_dev_hdr; in xhci_hc_irq_install()
653 int cid = xhci_find_hcid_by_irq_num(irq_num); in xhci_hc_irq_uninstall() local
655 if (WARN_ON(cid == -1)) in xhci_hc_irq_uninstall()
657 xhci_hc_stop(cid); in xhci_hc_irq_uninstall()
667 void xhci_hc_irq_handler(uint64_t irq_num, uint64_t cid, struct pt_regs *regs) in xhci_hc_irq_handler() argument
674 xhci_write_op_reg32(cid, XHCI_OPS_USBSTS, xhci_read_op_reg32(cid, XHCI_OPS_USBSTS)); in xhci_hc_irq_handler()
677 const uint32_t iman0 = xhci_read_intr_reg32(cid, 0, XHCI_IR_MAN); in xhci_hc_irq_handler()
678 uint64_t dequeue_reg = xhci_read_intr_reg64(cid, 0, XHCI_IR_DEQUEUE); in xhci_hc_irq_handler()
684 xhci_write_intr_reg32(cid, 0, XHCI_IR_MAN, iman0 | 3); in xhci_hc_irq_handler()
689 uint64_t last_event_ring_vaddr = xhci_hc[cid].current_event_ring_vaddr; in xhci_hc_irq_handler()
690 xhci_get_trb(&event_trb, xhci_hc[cid].current_event_ring_vaddr); in xhci_hc_irq_handler()
696 …while ((event_trb.command & 1) == xhci_hc[cid].current_event_ring_cycle) // 循环处理处于当前周期的所有event ring in xhci_hc_irq_handler()
759 last_event_ring_vaddr = xhci_hc[cid].current_event_ring_vaddr; in xhci_hc_irq_handler()
760 xhci_hc[cid].current_event_ring_vaddr += sizeof(struct xhci_TRB_t); in xhci_hc_irq_handler()
761 xhci_get_trb(&event_trb, xhci_hc[cid].current_event_ring_vaddr); in xhci_hc_irq_handler()
764 xhci_hc[cid].current_event_ring_vaddr = xhci_hc[cid].event_ring_vaddr; in xhci_hc_irq_handler()
765 xhci_get_trb(&event_trb, xhci_hc[cid].current_event_ring_vaddr); in xhci_hc_irq_handler()
771 … xhci_write_intr_reg64(cid, 0, XHCI_IR_DEQUEUE, virt_2_phys(last_event_ring_vaddr) | (1 << 3)); in xhci_hc_irq_handler()
2095 int cid = xhci_hc_find_available_id(); in xhci_init() local
2096 if (cid < 0) in xhci_init()
2102 memset(&xhci_hc[cid], 0, sizeof(struct xhci_host_controller_t)); in xhci_init()
2103 xhci_hc[cid].controller_id = cid; in xhci_init()
2104 xhci_hc[cid].pci_dev_hdr = dev_hdr; in xhci_init()
2114 xhci_hc[cid].vbase = in xhci_init()
2115 … SPECIAL_MEMOEY_MAPPING_VIRT_ADDR_BASE + XHCI_MAPPING_OFFSET + 65536 * xhci_hc[cid].controller_id; in xhci_init()
2117 …mm_map_phys_addr(xhci_hc[cid].vbase, dev_hdr->BAR0 & (~0xf), 65536, PAGE_KERNEL_PAGE | PAGE_PWT | … in xhci_init()
2121 …xhci_hc[cid].vbase_op = xhci_hc[cid].vbase + (xhci_read_cap_reg32(cid, XHCI_CAPS_CAPLENGTH) & 0xff… in xhci_init()
2124 FAIL_ON_TO(xhci_hc_reset(cid), failed); in xhci_init()
2128 uint16_t iversion = *(uint16_t *)(xhci_hc[cid].vbase + XHCI_CAPS_HCIVERSION); in xhci_init()
2135 …memcpy(&hcc1, xhci_get_ptr_cap_reg32(cid, XHCI_CAPS_HCCPARAMS1), sizeof(struct xhci_caps_HCCPARAMS… in xhci_init()
2136 …memcpy(&hcc2, xhci_get_ptr_cap_reg32(cid, XHCI_CAPS_HCCPARAMS2), sizeof(struct xhci_caps_HCCPARAMS… in xhci_init()
2137 …memcpy(&hcs1, xhci_get_ptr_cap_reg32(cid, XHCI_CAPS_HCSPARAMS1), sizeof(struct xhci_caps_HCSPARAMS… in xhci_init()
2138 …memcpy(&hcs2, xhci_get_ptr_cap_reg32(cid, XHCI_CAPS_HCSPARAMS2), sizeof(struct xhci_caps_HCSPARAMS… in xhci_init()
2140 …xhci_hc[cid].db_offset = xhci_read_cap_reg32(cid, XHCI_CAPS_DBOFF) & (~0x3); // bits [1:0] reserved in xhci_init()
2142 …xhci_hc[cid].rts_offset = xhci_read_cap_reg32(cid, XHCI_CAPS_RTSOFF) & (~0x1f); // bits [4:0] rese… in xhci_init()
2145 xhci_hc[cid].ext_caps_off = 1UL * (hcc1.xECP) * 4; in xhci_init()
2146 xhci_hc[cid].context_size = (hcc1.csz) ? 64 : 32; in xhci_init()
2170 FAIL_ON_TO(xhci_hc_stop_legacy(cid), failed); in xhci_init()
2174 FAIL_ON_TO(xhci_hc_pair_ports(cid), failed); in xhci_init()
2179 xhci_hc[cid].page_size = (xhci_read_op_reg32(cid, XHCI_OPS_PAGESIZE) & 0xffff) << 12; in xhci_init()
2182 xhci_hc[cid].dcbaap_vaddr = (uint64_t)kzalloc(2048, 0); // 分配2KB的设备上下文地址数组空间 in xhci_init()
2186 if (unlikely(!xhci_is_aligned64(xhci_hc[cid].dcbaap_vaddr))) // 地址不是按照64byte对齐 in xhci_init()
2192 xhci_write_op_reg64(cid, XHCI_OPS_DCBAAP, virt_2_phys(xhci_hc[cid].dcbaap_vaddr)); in xhci_init()
2200 …xhci_hc[cid].scratchpad_buf_array_vaddr = (uint64_t)kzalloc(sizeof(uint64_t) * max_scratchpad_buf,… in xhci_init()
2201 __write8b(xhci_hc[cid].dcbaap_vaddr, virt_2_phys(xhci_hc[cid].scratchpad_buf_array_vaddr)); in xhci_init()
2206 uint64_t buf_vaddr = (uint64_t)kzalloc(xhci_hc[cid].page_size, 0); in xhci_init()
2207 __write8b(xhci_hc[cid].scratchpad_buf_array_vaddr, virt_2_phys(buf_vaddr)); in xhci_init()
2212 xhci_hc[cid].cmd_ring_vaddr = xhci_create_ring(XHCI_CMND_RING_TRBS); in xhci_init()
2213 xhci_hc[cid].cmd_trb_vaddr = xhci_hc[cid].cmd_ring_vaddr; in xhci_init()
2215 if (unlikely(!xhci_is_aligned64(xhci_hc[cid].cmd_ring_vaddr))) // 地址不是按照64byte对齐 in xhci_init()
2222 xhci_hc[cid].cmd_trb_cycle = XHCI_TRB_CYCLE_ON; in xhci_init()
2225 …xhci_write_op_reg64(cid, XHCI_OPS_CRCR, virt_2_phys(xhci_hc[cid].cmd_ring_vaddr) | xhci_hc[cid].cm… in xhci_init()
2230 xhci_write_op_reg32(cid, XHCI_OPS_CONFIG, max_slots); in xhci_init()
2233 xhci_write_op_reg32(cid, XHCI_OPS_DNCTRL, (1 << 1)); // 目前只有N1被支持 in xhci_init()
2236 FAIL_ON_TO(xhci_hc_init_intr(cid), failed_free_dyn); in xhci_init()
2247 if (xhci_hc[cid].dcbaap_vaddr) in xhci_init()
2248 kfree((void *)xhci_hc[cid].dcbaap_vaddr); in xhci_init()
2250 if (xhci_hc[cid].cmd_ring_vaddr) in xhci_init()
2251 kfree((void *)xhci_hc[cid].cmd_ring_vaddr); in xhci_init()
2253 if (xhci_hc[cid].event_ring_table_vaddr) in xhci_init()
2254 kfree((void *)xhci_hc[cid].event_ring_table_vaddr); in xhci_init()
2256 if (xhci_hc[cid].event_ring_vaddr) in xhci_init()
2257 kfree((void *)xhci_hc[cid].event_ring_vaddr); in xhci_init()
2262 mm_unmap_addr(xhci_hc[cid].vbase, 65536); in xhci_init()
2265 memset((void *)&xhci_hc[cid], 0, sizeof(struct xhci_host_controller_t)); in xhci_init()