include/linux/mhi.h
Source file repositories/reference/linux-study-clean/include/linux/mhi.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/mhi.h- Extension
.h- Size
- 26787 bytes
- Lines
- 799
- 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/device.hlinux/dma-direction.hlinux/mutex.hlinux/skbuff.hlinux/slab.hlinux/spinlock.hlinux/wait.hlinux/workqueue.h
Detected Declarations
struct mhi_chanstruct mhi_eventstruct mhi_ctxtstruct mhi_cmdstruct mhi_buf_infostruct mhi_bufstruct image_infostruct mhi_link_infostruct mhi_channel_configstruct mhi_event_configstruct mhi_controller_configstruct mhi_controllerstruct mhi_devicestruct mhi_resultstruct mhi_driverenum mhi_callbackenum mhi_flagsenum mhi_device_typeenum mhi_ch_typeenum mhi_ee_typeenum mhi_stateenum mhi_ch_ee_maskenum mhi_er_data_typeenum mhi_db_brst_mode
Annotated Snippet
struct device_driver driver;
};
#define to_mhi_driver(drv) container_of_const(drv, struct mhi_driver, driver)
#define to_mhi_device(dev) container_of(dev, struct mhi_device, dev)
/**
* mhi_alloc_controller - Allocate the MHI Controller structure
* Allocate the mhi_controller structure using zero initialized memory
*/
struct mhi_controller *mhi_alloc_controller(void);
/**
* mhi_free_controller - Free the MHI Controller structure
* Free the mhi_controller structure which was previously allocated
*/
void mhi_free_controller(struct mhi_controller *mhi_cntrl);
/**
* mhi_register_controller - Register MHI controller
* @mhi_cntrl: MHI controller to register
* @config: Configuration to use for the controller
*/
int mhi_register_controller(struct mhi_controller *mhi_cntrl,
const struct mhi_controller_config *config);
/**
* mhi_unregister_controller - Unregister MHI controller
* @mhi_cntrl: MHI controller to unregister
*/
void mhi_unregister_controller(struct mhi_controller *mhi_cntrl);
/*
* module_mhi_driver() - Helper macro for drivers that don't do
* anything special other than using default mhi_driver_register() and
* mhi_driver_unregister(). This eliminates a lot of boilerplate.
* Each module may only use this macro once.
*/
#define module_mhi_driver(mhi_drv) \
module_driver(mhi_drv, mhi_driver_register, \
mhi_driver_unregister)
/*
* Macro to avoid include chaining to get THIS_MODULE
*/
#define mhi_driver_register(mhi_drv) \
__mhi_driver_register(mhi_drv, THIS_MODULE)
/**
* __mhi_driver_register - Register driver with MHI framework
* @mhi_drv: Driver associated with the device
* @owner: The module owner
*/
int __mhi_driver_register(struct mhi_driver *mhi_drv, struct module *owner);
/**
* mhi_driver_unregister - Unregister a driver for mhi_devices
* @mhi_drv: Driver associated with the device
*/
void mhi_driver_unregister(struct mhi_driver *mhi_drv);
/**
* mhi_set_mhi_state - Set MHI device state
* @mhi_cntrl: MHI controller
* @state: State to set
*/
void mhi_set_mhi_state(struct mhi_controller *mhi_cntrl,
enum mhi_state state);
/**
* mhi_notify - Notify the MHI client driver about client device status
* @mhi_dev: MHI device instance
* @cb_reason: MHI callback reason
*/
void mhi_notify(struct mhi_device *mhi_dev, enum mhi_callback cb_reason);
/**
* mhi_get_free_desc_count - Get transfer ring length
* Get # of TD available to queue buffers
* @mhi_dev: Device associated with the channels
* @dir: Direction of the channel
*/
int mhi_get_free_desc_count(struct mhi_device *mhi_dev,
enum dma_data_direction dir);
/**
* mhi_prepare_for_power_up - Do pre-initialization before power up.
* This is optional, call this before power up if
* the controller does not want bus framework to
* automatically free any allocated memory during
Annotation
- Immediate include surface: `linux/device.h`, `linux/dma-direction.h`, `linux/mutex.h`, `linux/skbuff.h`, `linux/slab.h`, `linux/spinlock.h`, `linux/wait.h`, `linux/workqueue.h`.
- Detected declarations: `struct mhi_chan`, `struct mhi_event`, `struct mhi_ctxt`, `struct mhi_cmd`, `struct mhi_buf_info`, `struct mhi_buf`, `struct image_info`, `struct mhi_link_info`, `struct mhi_channel_config`, `struct mhi_event_config`.
- 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.