drivers/usb/host/ehci-dbg.c
Source file repositories/reference/linux-study-clean/drivers/usb/host/ehci-dbg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/host/ehci-dbg.c- Extension
.c- Size
- 28250 bytes
- Lines
- 1082
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
- No C-style include directives detected by the generator.
Detected Declarations
struct debug_bufferfunction Copyrightfunction dbg_hcc_paramsfunction dbg_qtdfunction dbg_qhfunction dbg_itdfunction dbg_sitdfunction dbg_status_buffunction dbg_intr_buffunction dbg_command_buffunction dbg_port_buffunction dbg_statusfunction dbg_cmdfunction dbg_portfunction speed_charfunction token_markfunction qh_linesfunction fill_async_bufferfunction list_for_each_entryfunction fill_bandwidth_bufferfunction list_for_each_entryfunction output_buf_tds_dirfunction fill_periodic_bufferfunction fill_registers_bufferfunction ssize_tfunction fill_bufferfunction debug_outputfunction debug_closefunction debug_async_openfunction debug_bandwidth_openfunction debug_periodic_openfunction debug_registers_openfunction create_debug_filesfunction remove_debug_filesfunction dbg_hcs_paramsfunction dbg_command_buffunction dbg_intr_buffunction dbg_port_buffunction dbg_status
Annotated Snippet
static const struct file_operations debug_async_fops = {
.owner = THIS_MODULE,
.open = debug_async_open,
.read = debug_output,
.release = debug_close,
.llseek = default_llseek,
};
static const struct file_operations debug_bandwidth_fops = {
.owner = THIS_MODULE,
.open = debug_bandwidth_open,
.read = debug_output,
.release = debug_close,
.llseek = default_llseek,
};
static const struct file_operations debug_periodic_fops = {
.owner = THIS_MODULE,
.open = debug_periodic_open,
.read = debug_output,
.release = debug_close,
.llseek = default_llseek,
};
static const struct file_operations debug_registers_fops = {
.owner = THIS_MODULE,
.open = debug_registers_open,
.read = debug_output,
.release = debug_close,
.llseek = default_llseek,
};
static struct dentry *ehci_debug_root;
struct debug_buffer {
ssize_t (*fill_func)(struct debug_buffer *); /* fill method */
struct usb_bus *bus;
struct mutex mutex; /* protect filling of buffer */
size_t count; /* number of characters filled into buffer */
char *output_buf;
size_t alloc_size;
};
static inline char speed_char(u32 info1)
{
switch (info1 & (3 << 12)) {
case QH_FULL_SPEED:
return 'f';
case QH_LOW_SPEED:
return 'l';
case QH_HIGH_SPEED:
return 'h';
default:
return '?';
}
}
static inline char token_mark(struct ehci_hcd *ehci, __hc32 token)
{
__u32 v = hc32_to_cpu(ehci, token);
if (v & QTD_STS_ACTIVE)
return '*';
if (v & QTD_STS_HALT)
return '-';
if (!IS_SHORT_READ(v))
return ' ';
/* tries to advance through hw_alt_next */
return '/';
}
static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh,
char **nextp, unsigned *sizep)
{
u32 scratch;
u32 hw_curr;
struct list_head *entry;
struct ehci_qtd *td;
unsigned temp;
unsigned size = *sizep;
char *next = *nextp;
char mark;
__le32 list_end = EHCI_LIST_END(ehci);
struct ehci_qh_hw *hw = qh->hw;
if (hw->hw_qtd_next == list_end) /* NEC does this */
mark = '@';
else
mark = token_mark(ehci, hw->hw_token);
if (mark == '/') { /* qh_alt_next controls qh advance? */
Annotation
- Detected declarations: `struct debug_buffer`, `function Copyright`, `function dbg_hcc_params`, `function dbg_qtd`, `function dbg_qh`, `function dbg_itd`, `function dbg_sitd`, `function dbg_status_buf`, `function dbg_intr_buf`, `function dbg_command_buf`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: pattern 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.