drivers/scsi/nsp32.h

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

File Facts

System
Linux kernel
Corpus path
drivers/scsi/nsp32.h
Extension
.h
Size
21429 bytes
Lines
618
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 nsp32_cmd_priv {
	enum sam_status status;
};

static inline struct nsp32_cmd_priv *nsp32_priv(struct scsi_cmnd *cmd)
{
	return scsi_cmd_priv(cmd);
}

typedef struct _nsp32_target {
	unsigned char	syncreg;	/* value for SYNCREG   */
	unsigned char	ackwidth;	/* value for ACKWIDTH  */
	unsigned char   period;         /* sync period (0-255) */
	unsigned char	offset;		/* sync offset (0-15)  */
	int		sync_flag;	/* SDTR_*, 0           */
	int		limit_entry;	/* max speed limit entry designated
					   by EEPROM configuration */
	unsigned char   sample_reg;     /* SREQ hazard killer register */
} nsp32_target;

typedef struct _nsp32_hw_data {
	int           IrqNumber;
	int           BaseAddress;
	int           NumAddress;
	void __iomem *MmioAddress;
#define NSP32_MMIO_OFFSET 0x0800
	unsigned long MmioLength;

	struct scsi_cmnd *CurrentSC;

	struct pci_dev             *Pci;
	const struct pci_device_id *pci_devid;
	struct Scsi_Host           *Host;
	spinlock_t                  Lock;

	char info_str[100];

	/* allocated memory region */
	nsp32_sglun      *sg_list;	/* sglist virtuxal address         */
	dma_addr_t	  sg_paddr;     /* physical address of hw_sg_table */
	nsp32_autoparam  *autoparam;	/* auto parameter transfer region  */
	dma_addr_t	  auto_paddr;	/* physical address of autoparam   */
	int 		  cur_entry;	/* current sgt entry               */

	/* target/LUN */
	nsp32_lunt       *cur_lunt;	/* Current connected LUN table */
	nsp32_lunt        lunt[MAX_TARGET][MAX_LUN];  /* All LUN table */

	nsp32_target     *cur_target;	/* Current connected SCSI ID    */
	nsp32_target	  target[MAX_TARGET];	     /* SCSI ID */
	int		  cur_id;	/* Current connected target ID  */
	int		  cur_lun;	/* Current connected target LUN */

	/* behavior setting parameters */
	int		  trans_method;	/* transfer method flag            */
	int		  resettime;	/* Reset time                      */
	int 		  clock;       	/* clock dividing flag             */
	nsp32_sync_table *synct;	/* sync_table determined by clock  */
	int		  syncnum;	/* the max number of synct element */

	/* message buffer */
	unsigned char msgoutbuf[MSGOUTBUF_MAX]; /* msgout buffer    */
	char	      msgout_len;		/* msgoutbuf length */
	unsigned char msginbuf [MSGINBUF_MAX];	/* megin buffer     */
	char	      msgin_len;		/* msginbuf length  */

} nsp32_hw_data;

/*
 * TIME definition
 */
#define RESET_HOLD_TIME		10000	/* reset time in us (SCSI-2 says the
					   minimum is 25us) */
#define SEL_TIMEOUT_TIME	10000	/* 250ms defined in SCSI specification
					   (25.6us/1unit) */
#define ARBIT_TIMEOUT_TIME	100	/* 100us */
#define REQSACK_TIMEOUT_TIME	10000	/* max wait time for REQ/SACK assertion
					   or negation, 10000us == 10ms */

#endif /* _NSP32_H */
/* end */

Annotation

Implementation Notes