drivers/thunderbolt/tb.h
Source file repositories/reference/linux-study-clean/drivers/thunderbolt/tb.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/thunderbolt/tb.h- Extension
.h- Size
- 55175 bytes
- Lines
- 1560
- Domain
- Driver Families
- Bucket
- drivers/thunderbolt
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/nvmem-provider.hlinux/pci.hlinux/thunderbolt.hlinux/uuid.hlinux/bitfield.htb_regs.hctl.hdma_port.h
Detected Declarations
struct tb_nvmstruct tb_switch_tmustruct tb_switchstruct tb_bandwidth_groupstruct tb_portstruct usb4_portstruct tb_retimerstruct tb_path_hopstruct tb_pathstruct tb_cm_opsstruct usb4_port_margining_paramsenum tb_nvm_write_opsenum tb_switch_tmu_modeenum tb_path_portenum usb4_sb_targetenum usb4_margin_sw_error_counterenum usb4_margining_lanefunction tb_upstream_portfunction tb_is_upstream_portfunction tb_routefunction tb_port_has_remotefunction tb_port_is_nullfunction tb_port_is_nhifunction tb_port_is_pcie_downfunction tb_port_is_pcie_upfunction tb_port_is_dpinfunction tb_port_is_dpoutfunction tb_port_is_usb3_downfunction tb_port_is_usb3_upfunction tb_sw_readfunction tb_sw_writefunction tb_port_readfunction tb_port_writefunction tb_domain_putfunction tb_domain_eventfunction tb_switch_putfunction tb_is_switchfunction tb_switch_downstream_portfunction tb_switch_depthfunction tb_switch_is_light_ridgefunction tb_switch_is_eagle_ridgefunction tb_switch_is_cactus_ridgefunction tb_switch_is_falcon_ridgefunction tb_switch_is_alpine_ridgefunction tb_switch_is_titan_ridgefunction tb_switch_is_tiger_lakefunction tb_switch_is_icmfunction tb_switch_tmu_is_configured
Annotated Snippet
struct tb_nvm {
struct device *dev;
u32 major;
u32 minor;
int id;
struct nvmem_device *active;
size_t active_size;
struct nvmem_device *non_active;
void *buf;
void *buf_data_start;
size_t buf_data_size;
bool authenticating;
bool flushed;
const struct tb_nvm_vendor_ops *vops;
};
enum tb_nvm_write_ops {
WRITE_AND_AUTHENTICATE = 1,
WRITE_ONLY = 2,
AUTHENTICATE_ONLY = 3,
};
#define TB_SWITCH_KEY_SIZE 32
#define TB_SWITCH_MAX_DEPTH 6
#define USB4_SWITCH_MAX_DEPTH 5
/**
* enum tb_switch_tmu_mode - TMU mode
* @TB_SWITCH_TMU_MODE_OFF: TMU is off
* @TB_SWITCH_TMU_MODE_LOWRES: Uni-directional, normal mode
* @TB_SWITCH_TMU_MODE_HIFI_UNI: Uni-directional, HiFi mode
* @TB_SWITCH_TMU_MODE_HIFI_BI: Bi-directional, HiFi mode
* @TB_SWITCH_TMU_MODE_MEDRES_ENHANCED_UNI: Enhanced Uni-directional, MedRes mode
*
* Ordering is based on TMU accuracy level (highest last).
*/
enum tb_switch_tmu_mode {
TB_SWITCH_TMU_MODE_OFF,
TB_SWITCH_TMU_MODE_LOWRES,
TB_SWITCH_TMU_MODE_HIFI_UNI,
TB_SWITCH_TMU_MODE_HIFI_BI,
TB_SWITCH_TMU_MODE_MEDRES_ENHANCED_UNI,
};
/**
* struct tb_switch_tmu - Structure holding router TMU configuration
* @cap: Offset to the TMU capability (%0 if not found)
* @has_ucap: Does the switch support uni-directional mode
* @mode: TMU mode related to the upstream router. Reflects the HW
* setting. Don't care for host router.
* @mode_request: TMU mode requested to set. Related to upstream router.
* Don't care for host router.
*/
struct tb_switch_tmu {
int cap;
bool has_ucap;
enum tb_switch_tmu_mode mode;
enum tb_switch_tmu_mode mode_request;
};
/**
* struct tb_switch - a thunderbolt switch
* @dev: Device for the switch
* @config: Switch configuration
* @ports: Ports in this switch
* @dma_port: If the switch has port supporting DMA configuration based
* mailbox this will hold the pointer to that (%NULL
* otherwise). If set it also means the switch has
* upgradeable NVM.
* @tmu: The switch TMU configuration
* @tb: Pointer to the domain the switch belongs to
* @uid: Unique ID of the switch
* @uuid: UUID of the switch (or %NULL if not supported)
* @vendor: Vendor ID of the switch
* @device: Device ID of the switch
* @vendor_name: Name of the vendor (or %NULL if not known)
* @device_name: Name of the device (or %NULL if not known)
* @link_speed: Speed of the link in Gb/s
* @link_width: Width of the upstream facing link
* @preferred_link_width: Router preferred link width (only set for Gen 4 links)
* @link_usb4: Upstream link is USB4
* @generation: Switch Thunderbolt generation
* @cap_plug_events: Offset to the plug events capability (%0 if not found)
* @cap_vsec_tmu: Offset to the TMU vendor specific capability (%0 if not found)
* @cap_lc: Offset to the link controller capability (%0 if not found)
* @cap_lp: Offset to the low power (CLx for TBT) capability (%0 if not found)
* @is_unplugged: The switch is going away
* @drom: DROM of the switch (%NULL if not found)
* @nvm: Pointer to the NVM if the switch has one (%NULL otherwise)
* @no_nvm_upgrade: Prevent NVM upgrade of this switch
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/nvmem-provider.h`, `linux/pci.h`, `linux/thunderbolt.h`, `linux/uuid.h`, `linux/bitfield.h`, `tb_regs.h`, `ctl.h`.
- Detected declarations: `struct tb_nvm`, `struct tb_switch_tmu`, `struct tb_switch`, `struct tb_bandwidth_group`, `struct tb_port`, `struct usb4_port`, `struct tb_retimer`, `struct tb_path_hop`, `struct tb_path`, `struct tb_cm_ops`.
- Atlas domain: Driver Families / drivers/thunderbolt.
- Implementation status: source implementation candidate.
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.