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()
651 int cid = xhci_find_hcid_by_irq_num(irq_num); in xhci_hc_irq_uninstall() local
653 if (WARN_ON(cid == -1)) in xhci_hc_irq_uninstall()
655 xhci_hc_stop(cid); in xhci_hc_irq_uninstall()
665 void xhci_hc_irq_handler(uint64_t irq_num, uint64_t cid, struct pt_regs *regs) in xhci_hc_irq_handler() argument
672 xhci_write_op_reg32(cid, XHCI_OPS_USBSTS, xhci_read_op_reg32(cid, XHCI_OPS_USBSTS)); in xhci_hc_irq_handler()
675 const uint32_t iman0 = xhci_read_intr_reg32(cid, 0, XHCI_IR_MAN); in xhci_hc_irq_handler()
676 uint64_t dequeue_reg = xhci_read_intr_reg64(cid, 0, XHCI_IR_DEQUEUE); in xhci_hc_irq_handler()
682 xhci_write_intr_reg32(cid, 0, XHCI_IR_MAN, iman0 | 3); in xhci_hc_irq_handler()
687 uint64_t last_event_ring_vaddr = xhci_hc[cid].current_event_ring_vaddr; in xhci_hc_irq_handler()
688 xhci_get_trb(&event_trb, xhci_hc[cid].current_event_ring_vaddr); in xhci_hc_irq_handler()
694 …while ((event_trb.command & 1) == xhci_hc[cid].current_event_ring_cycle) // 循环处理处于当前周期的所有event ring in xhci_hc_irq_handler()
757 last_event_ring_vaddr = xhci_hc[cid].current_event_ring_vaddr; in xhci_hc_irq_handler()
758 xhci_hc[cid].current_event_ring_vaddr += sizeof(struct xhci_TRB_t); in xhci_hc_irq_handler()
759 xhci_get_trb(&event_trb, xhci_hc[cid].current_event_ring_vaddr); in xhci_hc_irq_handler()
762 xhci_hc[cid].current_event_ring_vaddr = xhci_hc[cid].event_ring_vaddr; in xhci_hc_irq_handler()
763 xhci_get_trb(&event_trb, xhci_hc[cid].current_event_ring_vaddr); in xhci_hc_irq_handler()
769 … xhci_write_intr_reg64(cid, 0, XHCI_IR_DEQUEUE, virt_2_phys(last_event_ring_vaddr) | (1 << 3)); in xhci_hc_irq_handler()
2093 int cid = xhci_hc_find_available_id(); in xhci_init() local
2094 if (cid < 0) in xhci_init()
2100 memset(&xhci_hc[cid], 0, sizeof(struct xhci_host_controller_t)); in xhci_init()
2101 xhci_hc[cid].controller_id = cid; in xhci_init()
2102 xhci_hc[cid].pci_dev_hdr = dev_hdr; in xhci_init()
2112 xhci_hc[cid].vbase = in xhci_init()
2113 … SPECIAL_MEMOEY_MAPPING_VIRT_ADDR_BASE + XHCI_MAPPING_OFFSET + 65536 * xhci_hc[cid].controller_id; in xhci_init()
2115 …mm_map_phys_addr(xhci_hc[cid].vbase, dev_hdr->BAR0 & (~0xf), 65536, PAGE_KERNEL_PAGE | PAGE_PWT | … in xhci_init()
2119 …xhci_hc[cid].vbase_op = xhci_hc[cid].vbase + (xhci_read_cap_reg32(cid, XHCI_CAPS_CAPLENGTH) & 0xff… in xhci_init()
2122 FAIL_ON_TO(xhci_hc_reset(cid), failed); in xhci_init()
2126 uint16_t iversion = *(uint16_t *)(xhci_hc[cid].vbase + XHCI_CAPS_HCIVERSION); in xhci_init()
2133 …memcpy(&hcc1, xhci_get_ptr_cap_reg32(cid, XHCI_CAPS_HCCPARAMS1), sizeof(struct xhci_caps_HCCPARAMS… in xhci_init()
2134 …memcpy(&hcc2, xhci_get_ptr_cap_reg32(cid, XHCI_CAPS_HCCPARAMS2), sizeof(struct xhci_caps_HCCPARAMS… in xhci_init()
2135 …memcpy(&hcs1, xhci_get_ptr_cap_reg32(cid, XHCI_CAPS_HCSPARAMS1), sizeof(struct xhci_caps_HCSPARAMS… in xhci_init()
2136 …memcpy(&hcs2, xhci_get_ptr_cap_reg32(cid, XHCI_CAPS_HCSPARAMS2), sizeof(struct xhci_caps_HCSPARAMS… in xhci_init()
2138 …xhci_hc[cid].db_offset = xhci_read_cap_reg32(cid, XHCI_CAPS_DBOFF) & (~0x3); // bits [1:0] reserved in xhci_init()
2140 …xhci_hc[cid].rts_offset = xhci_read_cap_reg32(cid, XHCI_CAPS_RTSOFF) & (~0x1f); // bits [4:0] rese… in xhci_init()
2143 xhci_hc[cid].ext_caps_off = 1UL * (hcc1.xECP) * 4; in xhci_init()
2144 xhci_hc[cid].context_size = (hcc1.csz) ? 64 : 32; in xhci_init()
2168 FAIL_ON_TO(xhci_hc_stop_legacy(cid), failed); in xhci_init()
2172 FAIL_ON_TO(xhci_hc_pair_ports(cid), failed); in xhci_init()
2177 xhci_hc[cid].page_size = (xhci_read_op_reg32(cid, XHCI_OPS_PAGESIZE) & 0xffff) << 12; in xhci_init()
2180 xhci_hc[cid].dcbaap_vaddr = (uint64_t)kzalloc(2048, 0); // 分配2KB的设备上下文地址数组空间 in xhci_init()
2184 if (unlikely(!xhci_is_aligned64(xhci_hc[cid].dcbaap_vaddr))) // 地址不是按照64byte对齐 in xhci_init()
2190 xhci_write_op_reg64(cid, XHCI_OPS_DCBAAP, virt_2_phys(xhci_hc[cid].dcbaap_vaddr)); in xhci_init()
2198 …xhci_hc[cid].scratchpad_buf_array_vaddr = (uint64_t)kzalloc(sizeof(uint64_t) * max_scratchpad_buf,… in xhci_init()
2199 __write8b(xhci_hc[cid].dcbaap_vaddr, virt_2_phys(xhci_hc[cid].scratchpad_buf_array_vaddr)); in xhci_init()
2204 uint64_t buf_vaddr = (uint64_t)kzalloc(xhci_hc[cid].page_size, 0); in xhci_init()
2205 __write8b(xhci_hc[cid].scratchpad_buf_array_vaddr, virt_2_phys(buf_vaddr)); in xhci_init()
2210 xhci_hc[cid].cmd_ring_vaddr = xhci_create_ring(XHCI_CMND_RING_TRBS); in xhci_init()
2211 xhci_hc[cid].cmd_trb_vaddr = xhci_hc[cid].cmd_ring_vaddr; in xhci_init()
2213 if (unlikely(!xhci_is_aligned64(xhci_hc[cid].cmd_ring_vaddr))) // 地址不是按照64byte对齐 in xhci_init()
2220 xhci_hc[cid].cmd_trb_cycle = XHCI_TRB_CYCLE_ON; in xhci_init()
2223 …xhci_write_op_reg64(cid, XHCI_OPS_CRCR, virt_2_phys(xhci_hc[cid].cmd_ring_vaddr) | xhci_hc[cid].cm… in xhci_init()
2228 xhci_write_op_reg32(cid, XHCI_OPS_CONFIG, max_slots); in xhci_init()
2231 xhci_write_op_reg32(cid, XHCI_OPS_DNCTRL, (1 << 1)); // 目前只有N1被支持 in xhci_init()
2234 FAIL_ON_TO(xhci_hc_init_intr(cid), failed_free_dyn); in xhci_init()
2245 if (xhci_hc[cid].dcbaap_vaddr) in xhci_init()
2246 kfree((void *)xhci_hc[cid].dcbaap_vaddr); in xhci_init()
2248 if (xhci_hc[cid].cmd_ring_vaddr) in xhci_init()
2249 kfree((void *)xhci_hc[cid].cmd_ring_vaddr); in xhci_init()
2251 if (xhci_hc[cid].event_ring_table_vaddr) in xhci_init()
2252 kfree((void *)xhci_hc[cid].event_ring_table_vaddr); in xhci_init()
2254 if (xhci_hc[cid].event_ring_vaddr) in xhci_init()
2255 kfree((void *)xhci_hc[cid].event_ring_vaddr); in xhci_init()
2260 mm_unmap_addr(xhci_hc[cid].vbase, 65536); in xhci_init()
2263 memset((void *)&xhci_hc[cid], 0, sizeof(struct xhci_host_controller_t)); in xhci_init()