drivers/bus/mhi/common.h

Source file repositories/reference/linux-study-clean/drivers/bus/mhi/common.h

File Facts

System
Linux kernel
Corpus path
drivers/bus/mhi/common.h
Extension
.h
Size
10925 bytes
Lines
327
Domain
Driver Families
Bucket
drivers/bus
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct mhi_event_ctxt {
	__le32 intmod;
	__le32 ertype;
	__le32 msivec;

	__le64 rbase __packed __aligned(4);
	__le64 rlen __packed __aligned(4);
	__le64 rp __packed __aligned(4);
	__le64 wp __packed __aligned(4);
};

#define CHAN_CTX_CHSTATE_MASK		GENMASK(7, 0)
#define CHAN_CTX_BRSTMODE_MASK		GENMASK(9, 8)
#define CHAN_CTX_POLLCFG_MASK		GENMASK(15, 10)
#define CHAN_CTX_RESERVED_MASK		GENMASK(31, 16)
struct mhi_chan_ctxt {
	__le32 chcfg;
	__le32 chtype;
	__le32 erindex;

	__le64 rbase __packed __aligned(4);
	__le64 rlen __packed __aligned(4);
	__le64 rp __packed __aligned(4);
	__le64 wp __packed __aligned(4);
};

struct mhi_cmd_ctxt {
	__le32 reserved0;
	__le32 reserved1;
	__le32 reserved2;

	__le64 rbase __packed __aligned(4);
	__le64 rlen __packed __aligned(4);
	__le64 rp __packed __aligned(4);
	__le64 wp __packed __aligned(4);
};

struct mhi_ring_element {
	__le64 ptr;
	__le32 dword[2];
};

#define MHI_STATE_LIST				\
	mhi_state(RESET,	"RESET")	\
	mhi_state(READY,	"READY")	\
	mhi_state(M0,		"M0")		\
	mhi_state(M1,		"M1")		\
	mhi_state(M2,		"M2")		\
	mhi_state(M3,		"M3")		\
	mhi_state(M3_FAST,	"M3_FAST")	\
	mhi_state(BHI,		"BHI")		\
	mhi_state_end(SYS_ERR,	"SYS ERROR")

#undef mhi_state
#undef mhi_state_end

#define mhi_state(a, b)		case MHI_STATE_##a: return b;
#define mhi_state_end(a, b)	case MHI_STATE_##a: return b;

static inline const char *mhi_state_str(enum mhi_state state)
{
	switch (state) {
	MHI_STATE_LIST
	default:
		return "Unknown state";
	}
}

#endif /* _MHI_COMMON_H */

Annotation

Implementation Notes