drivers/scsi/bfa/bfa_ioc.h

Source file repositories/reference/linux-study-clean/drivers/scsi/bfa/bfa_ioc.h

File Facts

System
Linux kernel
Corpus path
drivers/scsi/bfa/bfa_ioc.h
Extension
.h
Size
34534 bytes
Lines
1086
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 bfa_timer_s {
	struct list_head	qe;
	bfa_timer_cbfn_t timercb;
	void		*arg;
	int		timeout;	/* in millisecs */
};

/*
 * Timer module structure
 */
struct bfa_timer_mod_s {
	struct list_head timer_q;
};

#define BFA_TIMER_FREQ 200 /* specified in millisecs */

void bfa_timer_beat(struct bfa_timer_mod_s *mod);
void bfa_timer_begin(struct bfa_timer_mod_s *mod, struct bfa_timer_s *timer,
			bfa_timer_cbfn_t timercb, void *arg,
			unsigned int timeout);
void bfa_timer_stop(struct bfa_timer_s *timer);

/*
 * Generic Scatter Gather Element used by driver
 */
struct bfa_sge_s {
	u32	sg_len;
	void		*sg_addr;
};

#define bfa_sge_word_swap(__sge) do {					     \
	((u32 *)(__sge))[0] = swab32(((u32 *)(__sge))[0]);      \
	((u32 *)(__sge))[1] = swab32(((u32 *)(__sge))[1]);      \
	((u32 *)(__sge))[2] = swab32(((u32 *)(__sge))[2]);      \
} while (0)

#define bfa_swap_words(_x)  (	\
	((u64)(_x) << 32) | ((u64)(_x) >> 32))

#ifdef __BIG_ENDIAN
#define bfa_sge_to_be(_x)
#define bfa_sge_to_le(_x)	bfa_sge_word_swap(_x)
#define bfa_sgaddr_le(_x)	bfa_swap_words(_x)
#else
#define	bfa_sge_to_be(_x)	bfa_sge_word_swap(_x)
#define bfa_sge_to_le(_x)
#define bfa_sgaddr_le(_x)	(_x)
#endif

/*
 * BFA memory resources
 */
struct bfa_mem_dma_s {
	struct list_head qe;		/* Queue of DMA elements */
	u32		mem_len;	/* Total Length in Bytes */
	u8		*kva;		/* kernel virtual address */
	u64		dma;		/* dma address if DMA memory */
	u8		*kva_curp;	/* kva allocation cursor */
	u64		dma_curp;	/* dma allocation cursor */
};
#define bfa_mem_dma_t struct bfa_mem_dma_s

struct bfa_mem_kva_s {
	struct list_head qe;		/* Queue of KVA elements */
	u32		mem_len;	/* Total Length in Bytes */
	u8		*kva;		/* kernel virtual address */
	u8		*kva_curp;	/* kva allocation cursor */
};
#define bfa_mem_kva_t struct bfa_mem_kva_s

struct bfa_meminfo_s {
	struct bfa_mem_dma_s dma_info;
	struct bfa_mem_kva_s kva_info;
};

/* BFA memory segment setup helpers */
static inline void bfa_mem_dma_setup(struct bfa_meminfo_s *meminfo,
				     struct bfa_mem_dma_s *dm_ptr,
				     size_t seg_sz)
{
	dm_ptr->mem_len = seg_sz;
	if (seg_sz)
		list_add_tail(&dm_ptr->qe, &meminfo->dma_info.qe);
}

static inline void bfa_mem_kva_setup(struct bfa_meminfo_s *meminfo,
				     struct bfa_mem_kva_s *kva_ptr,
				     size_t seg_sz)
{
	kva_ptr->mem_len = seg_sz;

Annotation

Implementation Notes