include/linux/hsi/hsi.h
Source file repositories/reference/linux-study-clean/include/linux/hsi/hsi.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/hsi/hsi.h- Extension
.h- Size
- 11736 bytes
- Lines
- 429
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/mutex.hlinux/scatterlist.hlinux/list.hlinux/module.hlinux/notifier.h
Detected Declarations
struct hsi_channelstruct hsi_configstruct hsi_board_infostruct hsi_clientstruct hsi_client_driverstruct hsi_msgstruct hsi_portstruct hsi_controllerfunction hsi_register_board_infofunction hsi_client_set_drvdatafunction hsi_unregister_client_driverfunction hsi_port_claimedfunction hsi_port_set_drvdatafunction hsi_add_clients_from_dtfunction hsi_controller_set_drvdatafunction hsi_idfunction hsi_port_idfunction hsi_setupfunction hsi_flushfunction hsi_async_readfunction hsi_async_writefunction hsi_start_txfunction hsi_stop_tx
Annotated Snippet
struct device_driver driver;
};
#define to_hsi_client_driver(drv) container_of(drv, struct hsi_client_driver,\
driver)
int hsi_register_client_driver(struct hsi_client_driver *drv);
static inline void hsi_unregister_client_driver(struct hsi_client_driver *drv)
{
driver_unregister(&drv->driver);
}
/**
* struct hsi_msg - HSI message descriptor
* @link: Free to use by the current descriptor owner
* @cl: HSI device client that issues the transfer
* @sgt: Head of the scatterlist array
* @context: Client context data associated to the transfer
* @complete: Transfer completion callback
* @destructor: Destructor to free resources when flushing
* @status: Status of the transfer when completed
* @actual_len: Actual length of data transferred on completion
* @channel: Channel were to TX/RX the message
* @ttype: Transfer type (TX if set, RX otherwise)
* @break_frame: if true HSI will send/receive a break frame. Data buffers are
* ignored in the request.
*/
struct hsi_msg {
struct list_head link;
struct hsi_client *cl;
struct sg_table sgt;
void *context;
void (*complete)(struct hsi_msg *msg);
void (*destructor)(struct hsi_msg *msg);
int status;
unsigned int actual_len;
unsigned int channel;
unsigned int ttype:1;
unsigned int break_frame:1;
};
struct hsi_msg *hsi_alloc_msg(unsigned int n_frag, gfp_t flags);
void hsi_free_msg(struct hsi_msg *msg);
/**
* struct hsi_port - HSI port device
* @device: Driver model representation of the device
* @tx_cfg: Current TX path configuration
* @rx_cfg: Current RX path configuration
* @num: Port number
* @shared: Set when port can be shared by different clients
* @claimed: Reference count of clients which claimed the port
* @lock: Serialize port claim
* @async: Asynchronous transfer callback
* @setup: Callback to set the HSI client configuration
* @flush: Callback to clean the HW state and destroy all pending transfers
* @start_tx: Callback to inform that a client wants to TX data
* @stop_tx: Callback to inform that a client no longer wishes to TX data
* @release: Callback to inform that a client no longer uses the port
* @n_head: Notifier chain for signaling port events to the clients.
*/
struct hsi_port {
struct device device;
struct hsi_config tx_cfg;
struct hsi_config rx_cfg;
unsigned int num;
unsigned int shared:1;
int claimed;
struct mutex lock;
int (*async)(struct hsi_msg *msg);
int (*setup)(struct hsi_client *cl);
int (*flush)(struct hsi_client *cl);
int (*start_tx)(struct hsi_client *cl);
int (*stop_tx)(struct hsi_client *cl);
int (*release)(struct hsi_client *cl);
/* private */
struct blocking_notifier_head n_head;
};
#define to_hsi_port(dev) container_of(dev, struct hsi_port, device)
#define hsi_get_port(cl) to_hsi_port((cl)->device.parent)
int hsi_event(struct hsi_port *port, unsigned long event);
int hsi_claim_port(struct hsi_client *cl, unsigned int share);
void hsi_release_port(struct hsi_client *cl);
static inline int hsi_port_claimed(struct hsi_client *cl)
Annotation
- Immediate include surface: `linux/device.h`, `linux/mutex.h`, `linux/scatterlist.h`, `linux/list.h`, `linux/module.h`, `linux/notifier.h`.
- Detected declarations: `struct hsi_channel`, `struct hsi_config`, `struct hsi_board_info`, `struct hsi_client`, `struct hsi_client_driver`, `struct hsi_msg`, `struct hsi_port`, `struct hsi_controller`, `function hsi_register_board_info`, `function hsi_client_set_drvdata`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern 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.