drivers/scsi/sym53c8xx_2/sym_fw.h

Source file repositories/reference/linux-study-clean/drivers/scsi/sym53c8xx_2/sym_fw.h

File Facts

System
Linux kernel
Corpus path
drivers/scsi/sym53c8xx_2/sym_fw.h
Extension
.h
Size
5998 bytes
Lines
193
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 sym_fwa_ofs {
	SYM_GEN_FW_A(u_short)
};
struct sym_fwb_ofs {
	SYM_GEN_FW_B(u_short)
	SYM_GEN_B(u_short, start64)
	SYM_GEN_B(u_short, pm_handle)
};
struct sym_fwz_ofs {
	SYM_GEN_FW_Z(u_short)
};

/*
 *  Generates structure interface that contains 
 *  bus addresses within script A, B and Z.
 */
struct sym_fwa_ba {
	SYM_GEN_FW_A(u32)
};
struct sym_fwb_ba {
	SYM_GEN_FW_B(u32)
	SYM_GEN_B(u32, start64);
	SYM_GEN_B(u32, pm_handle);
};
struct sym_fwz_ba {
	SYM_GEN_FW_Z(u32)
};
#undef	SYM_GEN_A
#undef	SYM_GEN_B
#undef	SYM_GEN_Z

/*
 *  Let cc know about the name of the controller data structure.
 *  We need this for function prototype declarations just below.
 */
struct sym_hcb;

/*
 *  Generic structure that defines a firmware.
 */ 
struct sym_fw {
	char	*name;		/* Name we want to print out	*/
	u32	*a_base;	/* Pointer to script A template	*/
	int	a_size;		/* Size of script A		*/
	struct	sym_fwa_ofs
		*a_ofs;		/* Useful offsets in script A	*/
	u32	*b_base;	/* Pointer to script B template	*/
	int	b_size;		/* Size of script B		*/
	struct	sym_fwb_ofs
		*b_ofs;		/* Useful offsets in script B	*/
	u32	*z_base;	/* Pointer to script Z template	*/
	int	z_size;		/* Size of script Z		*/
	struct	sym_fwz_ofs
		*z_ofs;		/* Useful offsets in script Z	*/
	/* Setup and patch methods for this firmware */
	void	(*setup)(struct sym_hcb *, struct sym_fw *);
	void	(*patch)(struct Scsi_Host *);
};

/*
 *  Macro used to declare a firmware.
 */
#define SYM_FW_ENTRY(fw, name)					\
{								\
	name,							\
	(u32 *) &fw##a_scr, sizeof(fw##a_scr), &fw##a_ofs,	\
	(u32 *) &fw##b_scr, sizeof(fw##b_scr), &fw##b_ofs,	\
	(u32 *) &fw##z_scr, sizeof(fw##z_scr), &fw##z_ofs,	\
	fw##_setup, fw##_patch					\
}

/*
 *  Macros used from the C code to get useful
 *  SCRIPTS bus addresses.
 */
#define SCRIPTA_BA(np, label)	(np->fwa_bas.label)
#define SCRIPTB_BA(np, label)	(np->fwb_bas.label)
#define SCRIPTZ_BA(np, label)	(np->fwz_bas.label)

/*
 *  Macros used by scripts definitions.
 *
 *  HADDR_1 generates a reference to a field of the controller data.
 *  HADDR_2 generates a reference to a field of the controller data
 *          with offset.
 *  RADDR_1 generates a reference to a script processor register.
 *  RADDR_2 generates a reference to a script processor register
 *          with offset.
 *  PADDR_A generates a reference to another part of script A.
 *  PADDR_B generates a reference to another part of script B.

Annotation

Implementation Notes