drivers/usb/dwc2/hcd_queue.c
Source file repositories/reference/linux-study-clean/drivers/usb/dwc2/hcd_queue.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/dwc2/hcd_queue.c- Extension
.c- Size
- 63870 bytes
- Lines
- 2033
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/gcd.hlinux/kernel.hlinux/module.hlinux/spinlock.hlinux/interrupt.hlinux/dma-mapping.hlinux/io.hlinux/seq_buf.hlinux/slab.hlinux/usb.hlinux/usb/hcd.hlinux/usb/ch11.hcore.hhcd.h
Detected Declarations
struct dwc2_qh_print_datafunction Copyrightfunction dwc2_check_periodic_bandwidthfunction speciallyfunction pmap_unschedulefunction dwc2_get_ls_mapfunction pmap_printfunction dwc2_qh_printfunction dwc2_qh_schedule_printfunction dwc2_qh_schedule_printfunction dwc2_ls_pmap_schedulefunction dwc2_ls_pmap_unschedulefunction periodfunction dwc2_hs_pmap_unschedulefunction modefunction framefunction dwc2_hs_pmap_schedulefunction dwc2_ls_pmap_schedulefunction dwc2_uframe_schedulefunction dwc2_uframe_unschedulefunction dwc2_pick_first_framefunction dwc2_do_reservefunction dwc2_do_unreservefunction dwc2_unreserve_timer_fnfunction dwc2_check_max_xfer_sizefunction dwc2_schedule_periodicfunction dwc2_unreserve_timer_fnfunction dwc2_deschedule_periodicfunction dwc2_wait_timer_fnfunction dwc2_hcd_qh_unlinkfunction dwc2_qh_initfunction dwc2_hcd_qh_createfunction dwc2_hcd_qh_freefunction dwc2_hcd_qh_addfunction dwc2_hcd_qh_unlinkfunction dwc2_next_for_periodic_splitfunction dwc2_next_periodic_startfunction MISSfunction dwc2_hcd_qh_deactivatefunction dwc2_hcd_qtd_initfunction dwc2_hcd_qtd_add
Annotated Snippet
struct dwc2_qh_print_data {
struct dwc2_hsotg *hsotg;
struct dwc2_qh *qh;
};
/**
* dwc2_qh_print() - Helper function for dwc2_qh_schedule_print()
*
* @str: The string to print
* @data: A pointer to a struct dwc2_qh_print_data
*/
static void dwc2_qh_print(const char *str, void *data)
{
struct dwc2_qh_print_data *print_data = data;
dwc2_sch_dbg(print_data->hsotg, "QH=%p ...%s\n", print_data->qh, str);
}
/**
* dwc2_qh_schedule_print() - Print the periodic schedule
*
* @hsotg: The HCD state structure for the DWC OTG controller.
* @qh: QH to print.
*/
static void dwc2_qh_schedule_print(struct dwc2_hsotg *hsotg,
struct dwc2_qh *qh)
{
struct dwc2_qh_print_data print_data = { hsotg, qh };
int i;
/*
* The printing functions are quite slow and inefficient.
* If we don't have tracing turned on, don't run unless the special
* define is turned on.
*/
if (qh->schedule_low_speed) {
unsigned long *map = dwc2_get_ls_map(hsotg, qh);
dwc2_sch_dbg(hsotg, "QH=%p LS/FS trans: %d=>%d us @ %d us",
qh, qh->device_us,
DWC2_ROUND_US_TO_SLICE(qh->device_us),
DWC2_US_PER_SLICE * qh->ls_start_schedule_slice);
if (map) {
dwc2_sch_dbg(hsotg,
"QH=%p Whole low/full speed map %p now:\n",
qh, map);
pmap_print(map, DWC2_LS_PERIODIC_SLICES_PER_FRAME,
DWC2_LS_SCHEDULE_FRAMES, "Frame ", "slices",
dwc2_qh_print, &print_data);
}
}
for (i = 0; i < qh->num_hs_transfers; i++) {
struct dwc2_hs_transfer_time *trans_time = qh->hs_transfers + i;
int uframe = trans_time->start_schedule_us /
DWC2_HS_PERIODIC_US_PER_UFRAME;
int rel_us = trans_time->start_schedule_us %
DWC2_HS_PERIODIC_US_PER_UFRAME;
dwc2_sch_dbg(hsotg,
"QH=%p HS trans #%d: %d us @ uFrame %d + %d us\n",
qh, i, trans_time->duration_us, uframe, rel_us);
}
if (qh->num_hs_transfers) {
dwc2_sch_dbg(hsotg, "QH=%p Whole high speed map now:\n", qh);
pmap_print(hsotg->hs_periodic_bitmap,
DWC2_HS_PERIODIC_US_PER_UFRAME,
DWC2_HS_SCHEDULE_UFRAMES, "uFrame", "us",
dwc2_qh_print, &print_data);
}
}
#else
static inline void dwc2_qh_schedule_print(struct dwc2_hsotg *hsotg,
struct dwc2_qh *qh) {};
#endif
/**
* dwc2_ls_pmap_schedule() - Schedule a low speed QH
*
* @hsotg: The HCD state structure for the DWC OTG controller.
* @qh: QH for the periodic transfer.
* @search_slice: We'll start trying to schedule at the passed slice.
* Remember that slices are the units of the low speed
* schedule (think 25us or so).
*
* Wraps pmap_schedule() with the right parameters for low speed scheduling.
*
* Normally we schedule low speed devices on the map associated with the TT.
Annotation
- Immediate include surface: `linux/gcd.h`, `linux/kernel.h`, `linux/module.h`, `linux/spinlock.h`, `linux/interrupt.h`, `linux/dma-mapping.h`, `linux/io.h`, `linux/seq_buf.h`.
- Detected declarations: `struct dwc2_qh_print_data`, `function Copyright`, `function dwc2_check_periodic_bandwidth`, `function specially`, `function pmap_unschedule`, `function dwc2_get_ls_map`, `function pmap_print`, `function dwc2_qh_print`, `function dwc2_qh_schedule_print`, `function dwc2_qh_schedule_print`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.