drivers/thunderbolt/icm.c
Source file repositories/reference/linux-study-clean/drivers/thunderbolt/icm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/thunderbolt/icm.c- Extension
.c- Size
- 66800 bytes
- Lines
- 2591
- 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.
- 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/delay.hlinux/mutex.hlinux/moduleparam.hlinux/pci.hlinux/pm_runtime.hlinux/platform_data/x86/apple.hlinux/sizes.hlinux/slab.hlinux/workqueue.hctl.hnhi_regs.htb.htunnel.h
Detected Declarations
struct usb4_switch_nvm_authstruct icmstruct icm_notificationstruct ep_name_entrystruct intel_vssfunction intel_vss_is_rtd3function phy_port_from_routefunction dual_link_from_linkfunction get_routefunction get_parent_routefunction pci2cio_wait_completionfunction pcie2cio_readfunction pcie2cio_writefunction icm_matchfunction icm_copyfunction icm_requestfunction runfunction icm_veto_beginfunction icm_veto_endfunction icm_firmware_runningfunction icm_xdomain_activatedfunction icm_dp_eventfunction icm_fr_is_supportedfunction icm_fr_get_switch_indexfunction icm_fr_get_routefunction icm_fr_save_devicesfunction icm_fr_driver_readyfunction icm_fr_approve_switchfunction icm_fr_add_switch_keyfunction icm_fr_challenge_switch_keyfunction icm_fr_approve_xdomain_pathsfunction icm_fr_disconnect_xdomain_pathsfunction add_switchfunction update_switchfunction remove_switchfunction add_xdomainfunction update_xdomainfunction remove_xdomainfunction icm_fr_device_connectedfunction icm_fr_device_disconnectedfunction icm_fr_xdomain_connectedfunction icm_fr_xdomain_disconnectedfunction icm_tr_cio_resetfunction icm_tr_driver_readyfunction icm_tr_approve_switchfunction icm_tr_add_switch_keyfunction icm_tr_challenge_switch_keyfunction icm_tr_approve_xdomain_paths
Annotated Snippet
struct usb4_switch_nvm_auth {
struct icm_usb4_switch_op_response reply;
struct icm_usb4_switch_op request;
struct icm *icm;
};
/**
* struct icm - Internal connection manager private data
* @request_lock: Makes sure only one message is send to ICM at time
* @rescan_work: Work used to rescan the surviving switches after resume
* @upstream_port: Pointer to the PCIe upstream port this host
* controller is connected. This is only set for systems
* where ICM needs to be started manually
* @vnd_cap: Vendor defined capability where PCIe2CIO mailbox resides
* (only set when @upstream_port is not %NULL)
* @safe_mode: ICM is in safe mode
* @max_boot_acl: Maximum number of preboot ACL entries (%0 if not supported)
* @rpm: Does the controller support runtime PM (RTD3)
* @can_upgrade_nvm: Can the NVM firmware be upgrade on this controller
* @proto_version: Firmware protocol version
* @last_nvm_auth: Last USB4 router NVM_AUTH result (or %NULL if not set)
* @veto: Is RTD3 veto in effect
* @is_supported: Checks if we can support ICM on this controller
* @cio_reset: Trigger CIO reset
* @get_mode: Read and return the ICM firmware mode (optional)
* @get_route: Find a route string for given switch
* @save_devices: Ask ICM to save devices to ACL when suspending (optional)
* @driver_ready: Send driver ready message to ICM
* @set_uuid: Set UUID for the root switch (optional)
* @device_connected: Handle device connected ICM message
* @device_disconnected: Handle device disconnected ICM message
* @xdomain_connected: Handle XDomain connected ICM message
* @xdomain_disconnected: Handle XDomain disconnected ICM message
* @rtd3_veto: Handle RTD3 veto notification ICM message
*/
struct icm {
struct mutex request_lock;
struct delayed_work rescan_work;
struct pci_dev *upstream_port;
int vnd_cap;
bool safe_mode;
size_t max_boot_acl;
bool rpm;
bool can_upgrade_nvm;
u8 proto_version;
struct usb4_switch_nvm_auth *last_nvm_auth;
bool veto;
bool (*is_supported)(struct tb *tb);
int (*cio_reset)(struct tb *tb);
int (*get_mode)(struct tb *tb);
int (*get_route)(struct tb *tb, u8 link, u8 depth, u64 *route);
void (*save_devices)(struct tb *tb);
int (*driver_ready)(struct tb *tb,
enum tb_security_level *security_level,
u8 *proto_version, size_t *nboot_acl, bool *rpm);
void (*set_uuid)(struct tb *tb);
void (*device_connected)(struct tb *tb,
const struct icm_pkg_header *hdr);
void (*device_disconnected)(struct tb *tb,
const struct icm_pkg_header *hdr);
void (*xdomain_connected)(struct tb *tb,
const struct icm_pkg_header *hdr);
void (*xdomain_disconnected)(struct tb *tb,
const struct icm_pkg_header *hdr);
void (*rtd3_veto)(struct tb *tb, const struct icm_pkg_header *hdr);
};
struct icm_notification {
struct work_struct work;
struct icm_pkg_header *pkg;
struct tb *tb;
};
struct ep_name_entry {
u8 len;
u8 type;
u8 data[];
};
#define EP_NAME_INTEL_VSS 0x10
/* Intel Vendor specific structure */
struct intel_vss {
u16 vendor;
u16 model;
u8 mc;
u8 flags;
u16 pci_devid;
u32 nvm_version;
};
Annotation
- Immediate include surface: `linux/delay.h`, `linux/mutex.h`, `linux/moduleparam.h`, `linux/pci.h`, `linux/pm_runtime.h`, `linux/platform_data/x86/apple.h`, `linux/sizes.h`, `linux/slab.h`.
- Detected declarations: `struct usb4_switch_nvm_auth`, `struct icm`, `struct icm_notification`, `struct ep_name_entry`, `struct intel_vss`, `function intel_vss_is_rtd3`, `function phy_port_from_route`, `function dual_link_from_link`, `function get_route`, `function get_parent_route`.
- Atlas domain: Driver Families / drivers/thunderbolt.
- 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.