STRUCT MHI_EP_CNTRL(9)
πΈ struct mhi_ep_cntrl(9) πΈ
okay so bestie, we're in the Kernel API Manual and this page is all about struct mhi_ep_cntrl β literally the MHI Endpoint controller structure. it's the big main-character struct that holds everything the endpoint side needs. no cap, it's a long one, but we're gonna walk through every single field together, hand in hand π«Ά
β¨ SYNOPSIS β¨
like, here's the whole vibe of the struct, every field, exactly as it is β don't touch, just read π
struct mhi_ep_cntrl {
struct device *cntrl_dev;
struct mhi_ep_device *mhi_dev;
void __iomem *mmio;
struct mhi_ep_chan *mhi_chan;
struct mhi_ep_event *mhi_event;
struct mhi_ep_cmd *mhi_cmd;
struct mhi_ep_sm *sm;
struct mhi_chan_ctxt *ch_ctx_cache;
struct mhi_event_ctxt *ev_ctx_cache;
struct mhi_cmd_ctxt *cmd_ctx_cache;
u64 ch_ctx_host_pa;
u64 ev_ctx_host_pa;
u64 cmd_ctx_host_pa;
phys_addr_t ch_ctx_cache_phys;
phys_addr_t ev_ctx_cache_phys;
phys_addr_t cmd_ctx_cache_phys;
struct mhi_ep_db_info chdb[4];
struct mutex event_lock;
struct mutex state_lock;
spinlock_t list_lock;
struct list_head st_transition_list;
struct list_head ch_db_list;
struct workqueue_struct *wq;
struct work_struct state_work;
struct work_struct reset_work;
struct work_struct cmd_ring_work;
struct work_struct ch_ring_work;
struct kmem_cache *ring_item_cache;
struct kmem_cache *ev_ring_el_cache;
struct kmem_cache *tre_buf_cache;
void (*raise_irq)(struct mhi_ep_cntrl *mhi_cntrl, u32 vector);
int (*alloc_map)(struct mhi_ep_cntrl *mhi_cntrl, u64 pci_addr,
phys_addr_t *phys_ptr, void __iomem **virt, size_t size);
void (*unmap_free)(struct mhi_ep_cntrl *mhi_cntrl, u64 pci_addr,
phys_addr_t phys, void __iomem *virt, size_t size);
int (*read_sync)(struct mhi_ep_cntrl *mhi_cntrl, struct
mhi_ep_buf_info *buf_info);
int (*write_sync)(struct mhi_ep_cntrl *mhi_cntrl, struct
mhi_ep_buf_info *buf_info);
int (*read_async)(struct mhi_ep_cntrl *mhi_cntrl, struct
mhi_ep_buf_info *buf_info);
int (*write_async)(struct mhi_ep_cntrl *mhi_cntrl, struct
mhi_ep_buf_info *buf_info);
void (*flush_async)(struct mhi_ep_cntrl *mhi_cntrl);
enum mhi_state mhi_state;
u32 max_chan;
u32 mru;
u32 event_rings;
u32 hw_event_rings;
u32 chdb_offset;
u32 erdb_offset;
u32 index;
int irq;
bool enabled;
};
π Members π
π the pointers & basics
cntrl_devβ pointer to thestruct deviceof the physical bus that's acting as the MHI Endpoint controller. like, the actual device it lives on π¦mhi_devβ the MHI Endpoint device instance for this controllermmioβ the MMIO region that contains the MHI registersmhi_chanβ points to the channel configuration tablemhi_eventβ points to the event ring configurations tablemhi_cmdβ points to the command ring configurations tablesmβ the MHI Endpoint state machine (yes, she has a whole state machine, queen behavior π)
π§ the host context caches
ch_ctx_cacheβ cache of the host channel context data structureev_ctx_cacheβ cache of the host event context data structurecmd_ctx_cacheβ cache of the host command context data structure
β the host context physical addresses
ch_ctx_host_paβ physical address of the host channel context data structureev_ctx_host_paβ physical address of the host event context data structurecmd_ctx_host_paβ physical address of the host command context data structure
πΈ the cache physical addresses
ch_ctx_cache_physβ physical address of the host channel context cacheev_ctx_cache_physβ physical address of the host event context cachecmd_ctx_cache_physβ physical address of the host command context cache
π₯ doorbells, locks & lists
chdbβ array of channel doorbell interrupt infoevent_lockβ the lock protecting event ringsstate_lockβ the lock protecting state transitionslist_lockβ the lock protecting the state transition and channel doorbell listsst_transition_listβ list of state transitionsch_db_listβ list of queued channel doorbells
π«Ά the workqueue situation
wqβ a dedicated workqueue for handling rings and state changesstate_workβ the state transition workerreset_workβ the worker for MHI Endpoint resetcmd_ring_workβ the worker for processing command ringsch_ring_workβ the worker for processing channel rings
π the callbacks (iykyk)
raise_irqβ CB function for raising an IRQ to the hostalloc_mapβ CB function for allocating memory in the endpoint for storing host context and mapping itunmap_freeβ CB function to unmap and free the allocated memory in the endpoint for storing host contextread_syncβ CB function for reading from host memory synchronouslywrite_syncβ CB function for writing to host memory synchronouslyread_asyncβ CB function for reading from host memory asynchronouslywrite_asyncβ CB function for writing to host memory asynchronouslyflush_asyncβ CB function for flushing asynchronous read/writes
π the config & state bits
mhi_stateβ the MHI Endpoint statemax_chanβ maximum channels supported by the endpoint controllermruβ the MRU (Maximum Receive Unit) value of the endpoint controllerevent_ringsβ number of event rings supported by the endpoint controllerhw_event_ringsβ number of hardware event rings supported by the endpoint controllerchdb_offsetβ channel doorbell offset set by the hosterdb_offsetβ event ring doorbell offset set by the hostindexβ the MHI Endpoint controller indexirqβ the IRQ used by the endpoint controllerenabledβ check if the endpoint controller is enabled or not
π SEE ALSO π
go read these next bestie, they're all in the kernel file ./include/linux/mhi_ep.h:
struct mhi_ep_channel_config(9)struct mhi_ep_cntrl_config(9)struct mhi_ep_db_info(9)struct mhi_ep_buf_info(9)struct mhi_ep_device(9)struct mhi_ep_driver(9)__mhi_ep_driver_register(9)mhi_ep_driver_unregister(9)mhi_ep_register_controller(9)mhi_ep_unregister_controller(9)mhi_ep_power_up(9)mhi_ep_power_down(9)mhi_ep_queue_is_empty(9)mhi_ep_queue_skb(9)
π reminder bestie: this page lives in ./include/linux and it's dated October 2026 β that's the Linux kernel source tree, so check the actual header before you go shipping anything, fr fr.
okay that's the whole struct, you ate that π β¨ go be iconic with your endpoint controller ππ¦π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms