drivers/scsi/csiostor/csio_mb.h

Source file repositories/reference/linux-study-clean/drivers/scsi/csiostor/csio_mb.h

File Facts

System
Linux kernel
Corpus path
drivers/scsi/csiostor/csio_mb.h
Extension
.h
Size
9482 bytes
Lines
264
Domain
Driver Families
Bucket
drivers/scsi
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 fw_fcoe_port_cmd_params {
	uint8_t		portid;
	uint8_t		idx;
	uint8_t		nstats;
};

#define CSIO_DUMP_MB(__hw, __num, __mb)					\
	csio_dbg(__hw, "\t%llx %llx %llx %llx %llx %llx %llx %llx\n",	\
		(unsigned long long)csio_rd_reg64(__hw, __mb),		\
		(unsigned long long)csio_rd_reg64(__hw, __mb + 8),	\
		(unsigned long long)csio_rd_reg64(__hw, __mb + 16),	\
		(unsigned long long)csio_rd_reg64(__hw, __mb + 24),	\
		(unsigned long long)csio_rd_reg64(__hw, __mb + 32),	\
		(unsigned long long)csio_rd_reg64(__hw, __mb + 40),	\
		(unsigned long long)csio_rd_reg64(__hw, __mb + 48),	\
		(unsigned long long)csio_rd_reg64(__hw, __mb + 56))

#define CSIO_MB_MAX_REGS	8
#define CSIO_MAX_MB_SIZE	64
#define CSIO_MB_POLL_FREQ	5		/*  5 ms */
#define CSIO_MB_DEFAULT_TMO	FW_CMD_MAX_TIMEOUT

/* Device master in HELLO command */
enum csio_dev_master { CSIO_MASTER_CANT, CSIO_MASTER_MAY, CSIO_MASTER_MUST };

enum csio_mb_owner { CSIO_MBOWNER_NONE, CSIO_MBOWNER_FW, CSIO_MBOWNER_PL };

enum csio_dev_state {
	CSIO_DEV_STATE_UNINIT,
	CSIO_DEV_STATE_INIT,
	CSIO_DEV_STATE_ERR
};

#define FW_PARAM_DEV(param) \
	(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | \
	 FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_##param))

#define FW_PARAM_PFVF(param) \
	(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_PFVF) | \
	 FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_PFVF_##param)|  \
	 FW_PARAMS_PARAM_Y_V(0) | \
	 FW_PARAMS_PARAM_Z_V(0))

#define CSIO_INIT_MBP(__mbp, __cp,  __tmo, __priv, __fn, __clear)	\
do {									\
	if (__clear)							\
		memset((__cp), 0,					\
			    CSIO_MB_MAX_REGS * sizeof(__be64));		\
	INIT_LIST_HEAD(&(__mbp)->list);					\
	(__mbp)->tmo		= (__tmo);				\
	(__mbp)->priv		= (void *)(__priv);			\
	(__mbp)->mb_cbfn	= (__fn);				\
	(__mbp)->mb_size	= sizeof(*(__cp));			\
} while (0)

struct csio_mbm_stats {
	uint32_t	n_req;		/* number of mbox req */
	uint32_t	n_rsp;		/* number of mbox rsp */
	uint32_t	n_activeq;	/* number of mbox req active Q */
	uint32_t	n_cbfnq;	/* number of mbox req cbfn Q */
	uint32_t	n_tmo;		/* number of mbox timeout */
	uint32_t	n_cancel;	/* number of mbox cancel */
	uint32_t	n_err;		/* number of mbox error */
};

/* Driver version of Mailbox */
struct csio_mb {
	struct list_head	list;			/* for req/resp */
							/* queue in driver */
	__be64			mb[CSIO_MB_MAX_REGS];	/* MB in HW format */
	int			mb_size;		/* Size of this
							 * mailbox.
							 */
	uint32_t		tmo;			/* Timeout */
	struct completion	cmplobj;		/* MB Completion
							 * object
							 */
	void			(*mb_cbfn) (struct csio_hw *, struct csio_mb *);
							/* Callback fn */
	void			*priv;			/* Owner private ptr */
};

struct csio_mbm {
	uint32_t		a_mbox;			/* Async mbox num */
	uint32_t		intr_idx;		/* Interrupt index */
	struct timer_list	timer;			/* Mbox timer */
	struct csio_hw		*hw;			/* Hardware pointer */
	struct list_head	req_q;			/* Mbox request queue */
	struct list_head	cbfn_q;			/* Mbox completion q */
	struct csio_mb		*mcurrent;		/* Current mailbox */

Annotation

Implementation Notes