include/linux/thunderbolt.h
Source file repositories/reference/linux-study-clean/include/linux/thunderbolt.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/thunderbolt.h- Extension
.h- Size
- 22399 bytes
- Lines
- 699
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/device.hlinux/idr.hlinux/list.hlinux/mutex.hlinux/mod_devicetable.hlinux/pci.hlinux/uuid.hlinux/workqueue.h
Detected Declarations
struct fwnode_handlestruct devicestruct tbstruct tb_property_dirstruct tb_propertystruct tb_xdomainstruct tb_protocol_handlerstruct tb_servicestruct tb_service_driverstruct tb_nhistruct tb_ringstruct ring_framestruct ring_frameenum tb_cfg_pkg_typeenum tb_security_levelenum tb_property_typeenum tb_link_widthenum ring_desc_flagsfunction tb_phy_port_from_linkfunction tb_xdomain_disable_all_pathsfunction tb_xdomain_find_by_uuid_lockedfunction tb_xdomain_find_by_route_lockedfunction tb_xdomain_putfunction tb_is_xdomainfunction tb_service_putfunction tb_is_servicefunction tb_service_set_drvdatafunction tb_ring_rxfunction tb_ring_txfunction tb_ring_dma_devicefunction usb4_usb3_port_match
Annotated Snippet
extern const struct bus_type tb_bus_type;
extern const struct device_type tb_service_type;
extern const struct device_type tb_xdomain_type;
#define TB_LINKS_PER_PHY_PORT 2
static inline unsigned int tb_phy_port_from_link(unsigned int link)
{
return (link - 1) / TB_LINKS_PER_PHY_PORT;
}
/**
* struct tb_property_dir - XDomain property directory
* @uuid: Directory UUID or %NULL if root directory
* @properties: List of properties in this directory
*
* User needs to provide serialization if needed.
*/
struct tb_property_dir {
const uuid_t *uuid;
struct list_head properties;
};
enum tb_property_type {
TB_PROPERTY_TYPE_UNKNOWN = 0x00,
TB_PROPERTY_TYPE_DIRECTORY = 0x44,
TB_PROPERTY_TYPE_DATA = 0x64,
TB_PROPERTY_TYPE_TEXT = 0x74,
TB_PROPERTY_TYPE_VALUE = 0x76,
};
#define TB_PROPERTY_KEY_SIZE 8
/**
* struct tb_property - XDomain property
* @list: Used to link properties together in a directory
* @key: Key for the property (always terminated).
* @type: Type of the property
* @length: Length of the property data in dwords
* @value: Property value
*
* Users use @type to determine which field in @value is filled.
*/
struct tb_property {
struct list_head list;
char key[TB_PROPERTY_KEY_SIZE + 1];
enum tb_property_type type;
size_t length;
union {
struct tb_property_dir *dir;
u8 *data;
char *text;
u32 immediate;
} value;
};
struct tb_property_dir *tb_property_parse_dir(const u32 *block,
size_t block_len);
ssize_t tb_property_format_dir(const struct tb_property_dir *dir, u32 *block,
size_t block_len);
struct tb_property_dir *tb_property_copy_dir(const struct tb_property_dir *dir);
struct tb_property_dir *tb_property_create_dir(const uuid_t *uuid);
void tb_property_free_dir(struct tb_property_dir *dir);
int tb_property_add_immediate(struct tb_property_dir *parent, const char *key,
u32 value);
int tb_property_add_data(struct tb_property_dir *parent, const char *key,
const void *buf, size_t buflen);
int tb_property_add_text(struct tb_property_dir *parent, const char *key,
const char *text);
int tb_property_add_dir(struct tb_property_dir *parent, const char *key,
struct tb_property_dir *dir);
void tb_property_remove(struct tb_property *tb_property);
struct tb_property *tb_property_find(struct tb_property_dir *dir,
const char *key, enum tb_property_type type);
struct tb_property *tb_property_get_next(struct tb_property_dir *dir,
struct tb_property *prev);
#define tb_property_for_each(dir, property) \
for (property = tb_property_get_next(dir, NULL); \
property; \
property = tb_property_get_next(dir, property))
int tb_register_property_dir(const char *key, struct tb_property_dir *dir);
void tb_unregister_property_dir(const char *key, struct tb_property_dir *dir);
/**
* enum tb_link_width - Thunderbolt/USB4 link width
* @TB_LINK_WIDTH_SINGLE: Single lane link
* @TB_LINK_WIDTH_DUAL: Dual lane symmetric link
* @TB_LINK_WIDTH_ASYM_TX: Dual lane asymmetric Gen 4 link with 3 transmitters
Annotation
- Immediate include surface: `linux/types.h`, `linux/device.h`, `linux/idr.h`, `linux/list.h`, `linux/mutex.h`, `linux/mod_devicetable.h`, `linux/pci.h`, `linux/uuid.h`.
- Detected declarations: `struct fwnode_handle`, `struct device`, `struct tb`, `struct tb_property_dir`, `struct tb_property`, `struct tb_xdomain`, `struct tb_protocol_handler`, `struct tb_service`, `struct tb_service_driver`, `struct tb_nhi`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.