drivers/scsi/aha1740.h

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

File Facts

System
Linux kernel
Corpus path
drivers/scsi/aha1740.h
Extension
.h
Size
4982 bytes
Lines
155
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 aha1740_chain {
	u32 dataptr;		/* Location of data */
	u32 datalen;		/* Size of this part of chain */
};

/* These belong in scsi.h */
#define any2scsi(up, p)				\
(up)[0] = (((unsigned long)(p)) >> 16)  ;	\
(up)[1] = (((unsigned long)(p)) >> 8);		\
(up)[2] = ((unsigned long)(p));

#define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )

#define xany2scsi(up, p)	\
(up)[0] = ((long)(p)) >> 24;	\
(up)[1] = ((long)(p)) >> 16;	\
(up)[2] = ((long)(p)) >> 8;	\
(up)[3] = ((long)(p));

#define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
		      + (((long)(up)[2]) <<  8) +  ((long)(up)[3]) )

#define MAX_CDB 12
#define MAX_SENSE 14
#define MAX_STATUS 32

struct ecb {			/* Enhanced Control Block 6.1 */
	u16 cmdw;		/* Command Word */
	/* Flag Word 1 */
	u16 cne:1,		/* Control Block Chaining */
	:6, di:1,		/* Disable Interrupt */
	:2, ses:1,		/* Suppress Underrun error */
	:1, sg:1,		/* Scatter/Gather */
	:1, dsb:1,		/* Disable Status Block */
	 ars:1;			/* Automatic Request Sense */
	/* Flag Word 2 */
	u16 lun:3,		/* Logical Unit */
	 tag:1,			/* Tagged Queuing */
	 tt:2,			/* Tag Type */
	 nd:1,			/* No Disconnect */
	:1, dat:1,		/* Data transfer - check direction */
	 dir:1,			/* Direction of transfer 1 = datain */
	 st:1,			/* Suppress Transfer */
	 chk:1,			/* Calculate Checksum */
	:2, rec:1,:1;		/* Error Recovery */
	u16 nil0;		/* nothing */
	u32 dataptr;		/* Data or Scatter List ptr */
	u32 datalen;		/* Data or Scatter List len */
	u32 statusptr;		/* Status Block ptr */
	u32 linkptr;		/* Chain Address */
	u32 nil1;		/* nothing */
	u32 senseptr;		/* Sense Info Pointer */
	u8 senselen;		/* Sense Length */
	u8 cdblen;		/* CDB Length */
	u16 datacheck;		/* Data checksum */
	u8 cdb[MAX_CDB];	/* CDB area */
/* Hardware defined portion ends here, rest is driver defined */
	u8 sense[MAX_SENSE];	/* Sense area */
	u8 status[MAX_STATUS];	/* Status area */
	struct scsi_cmnd *SCpnt;	/* Link to the SCSI Command Block */
	void (*done) (struct scsi_cmnd *);	/* Completion Function */
};

#define	AHA1740CMD_NOP	 0x00	/* No OP */
#define AHA1740CMD_INIT	 0x01	/* Initiator SCSI Command */
#define AHA1740CMD_DIAG	 0x05	/* Run Diagnostic Command */
#define AHA1740CMD_SCSI	 0x06	/* Initialize SCSI */
#define AHA1740CMD_SENSE 0x08	/* Read Sense Information */
#define AHA1740CMD_DOWN  0x09	/* Download Firmware (yeah, I bet!) */
#define AHA1740CMD_RINQ  0x0a	/* Read Host Adapter Inquiry Data */
#define AHA1740CMD_TARG  0x10	/* Target SCSI Command */

#define AHA1740_ECBS 32
#define AHA1740_SCATTER 16

#endif

Annotation

Implementation Notes