drivers/scsi/NCR5380.h

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

File Facts

System
Linux kernel
Corpus path
drivers/scsi/NCR5380.h
Extension
.h
Size
11595 bytes
Lines
332
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 NCR5380_hostdata {
	NCR5380_implementation_fields;		/* Board-specific data */
	u8 __iomem *io;				/* Remapped 5380 address */
	u8 __iomem *pdma_io;			/* Remapped PDMA address */
	unsigned long poll_loops;		/* Register polling limit */
	spinlock_t lock;			/* Protects this struct */
	struct scsi_cmnd *connected;		/* Currently connected cmnd */
	struct list_head disconnected;		/* Waiting for reconnect */
	struct Scsi_Host *host;			/* SCSI host backpointer */
	struct workqueue_struct *work_q;	/* SCSI host work queue */
	struct work_struct main_task;		/* Work item for main loop */
	int flags;				/* Board-specific quirks */
	int dma_len;				/* Requested length of DMA */
	int read_overruns;	/* Transfer size reduction for DMA erratum */
	unsigned long io_port;			/* Device IO port */
	unsigned long base;			/* Device base address */
	struct list_head unissued;		/* Waiting to be issued */
	struct scsi_cmnd *selecting;		/* Cmnd to be connected */
	struct list_head autosense;		/* Priority cmnd queue */
	struct scsi_cmnd *sensing;		/* Cmnd needing autosense */
	struct scsi_eh_save ses;		/* Cmnd state saved for EH */
	unsigned char busy[8];			/* Index = target, bit = lun */
	unsigned char id_mask;			/* 1 << Host ID */
	unsigned char id_higher_mask;		/* All bits above id_mask */
	unsigned char last_message;		/* Last Message Out */
	unsigned long region_size;		/* Size of address/port range */
	char info[168];				/* Host banner message */
};

struct NCR5380_cmd {
	char *ptr;
	int this_residual;
	struct scatterlist *buffer;
	int status;
	int phase;
	struct list_head list;
};

#define NCR5380_PIO_CHUNK_SIZE		256

/* Time limit (ms) to poll registers when IRQs are disabled, e.g. during PDMA */
#define NCR5380_REG_POLL_TIME		10

static inline struct scsi_cmnd *NCR5380_to_scmd(struct NCR5380_cmd *ncmd_ptr)
{
	return ((struct scsi_cmnd *)ncmd_ptr) - 1;
}

static inline struct NCR5380_cmd *NCR5380_to_ncmd(struct scsi_cmnd *cmd)
{
	return scsi_cmd_priv(cmd);
}

#ifndef NDEBUG
#define NDEBUG (0)
#endif

#define dprintk(flg, fmt, ...) \
	do { if ((NDEBUG) & (flg)) \
		printk(KERN_DEBUG fmt, ## __VA_ARGS__); } while (0)

#define dsprintk(flg, host, fmt, ...) \
	do { if ((NDEBUG) & (flg)) \
		shost_printk(KERN_DEBUG, host, fmt, ## __VA_ARGS__); \
	} while (0)

#if NDEBUG
#define NCR5380_dprint(flg, arg) \
	do { if ((NDEBUG) & (flg)) NCR5380_print(arg); } while (0)
#define NCR5380_dprint_phase(flg, arg) \
	do { if ((NDEBUG) & (flg)) NCR5380_print_phase(arg); } while (0)
static void NCR5380_print_phase(struct Scsi_Host *instance);
static void NCR5380_print(struct Scsi_Host *instance);
#else
#define NCR5380_dprint(flg, arg)       do {} while (0)
#define NCR5380_dprint_phase(flg, arg) do {} while (0)
#endif

static int NCR5380_init(struct Scsi_Host *instance, int flags);
static int NCR5380_maybe_reset_bus(struct Scsi_Host *);
static void NCR5380_exit(struct Scsi_Host *instance);
static void NCR5380_information_transfer(struct Scsi_Host *instance);
static irqreturn_t NCR5380_intr(int irq, void *dev_id);
static void NCR5380_main(struct work_struct *work);
static const char *NCR5380_info(struct Scsi_Host *instance);
static void NCR5380_reselect(struct Scsi_Host *instance);
static bool NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *);
static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
static void NCR5380_transfer_pio(struct Scsi_Host *instance,
				 unsigned char *phase, int *count,

Annotation

Implementation Notes