#ifndef NCR5380_H
#define NCR5380_H
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/workqueue.h>
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_transport_spi.h>
#define NDEBUG_ARBITRATION …
#define NDEBUG_AUTOSENSE …
#define NDEBUG_DMA …
#define NDEBUG_HANDSHAKE …
#define NDEBUG_INFORMATION …
#define NDEBUG_INIT …
#define NDEBUG_INTR …
#define NDEBUG_LINKED …
#define NDEBUG_MAIN …
#define NDEBUG_NO_DATAOUT …
#define NDEBUG_NO_WRITE …
#define NDEBUG_PIO …
#define NDEBUG_PSEUDO_DMA …
#define NDEBUG_QUEUES …
#define NDEBUG_RESELECTION …
#define NDEBUG_SELECTION …
#define NDEBUG_USLEEP …
#define NDEBUG_LAST_BYTE_SENT …
#define NDEBUG_RESTART_SELECT …
#define NDEBUG_EXTENDED …
#define NDEBUG_C400_PREAD …
#define NDEBUG_C400_PWRITE …
#define NDEBUG_LISTS …
#define NDEBUG_ABORT …
#define NDEBUG_TAGS …
#define NDEBUG_MERGING …
#define NDEBUG_ANY …
#define OUTPUT_DATA_REG …
#define CURRENT_SCSI_DATA_REG …
#define INITIATOR_COMMAND_REG …
#define ICR_ASSERT_RST …
#define ICR_ARBITRATION_PROGRESS …
#define ICR_TRI_STATE …
#define ICR_ARBITRATION_LOST …
#define ICR_DIFF_ENABLE …
#define ICR_ASSERT_ACK …
#define ICR_ASSERT_BSY …
#define ICR_ASSERT_SEL …
#define ICR_ASSERT_ATN …
#define ICR_ASSERT_DATA …
#define ICR_BASE …
#define MODE_REG …
#define MR_BLOCK_DMA_MODE …
#define MR_TARGET …
#define MR_ENABLE_PAR_CHECK …
#define MR_ENABLE_PAR_INTR …
#define MR_ENABLE_EOP_INTR …
#define MR_MONITOR_BSY …
#define MR_DMA_MODE …
#define MR_ARBITRATE …
#define MR_BASE …
#define TARGET_COMMAND_REG …
#define TCR_LAST_BYTE_SENT …
#define TCR_ASSERT_REQ …
#define TCR_ASSERT_MSG …
#define TCR_ASSERT_CD …
#define TCR_ASSERT_IO …
#define STATUS_REG …
#define SR_RST …
#define SR_BSY …
#define SR_REQ …
#define SR_MSG …
#define SR_CD …
#define SR_IO …
#define SR_SEL …
#define SR_DBP …
#define SELECT_ENABLE_REG …
#define BUS_AND_STATUS_REG …
#define BASR_END_DMA_TRANSFER …
#define BASR_DRQ …
#define BASR_PARITY_ERROR …
#define BASR_IRQ …
#define BASR_PHASE_MATCH …
#define BASR_BUSY_ERROR …
#define BASR_ATN …
#define BASR_ACK …
#define START_DMA_SEND_REG …
#define INPUT_DATA_REG …
#define START_DMA_TARGET_RECEIVE_REG …
#define RESET_PARITY_INTERRUPT_REG …
#define START_DMA_INITIATOR_RECEIVE_REG …
#define CSR_RESET …
#define CSR_53C80_REG …
#define CSR_TRANS_DIR …
#define CSR_SCSI_BUFF_INTR …
#define CSR_53C80_INTR …
#define CSR_SHARED_INTR …
#define CSR_HOST_BUF_NOT_RDY …
#define CSR_SCSI_BUF_RDY …
#define CSR_GATED_53C80_IRQ …
#define CSR_BASE …
#define PHASE_MASK …
#define PHASE_DATAOUT …
#define PHASE_DATAIN …
#define PHASE_CMDOUT …
#define PHASE_STATIN …
#define PHASE_MSGOUT …
#define PHASE_MSGIN …
#define PHASE_UNKNOWN …
#define PHASE_SR_TO_TCR(phase) …
#ifndef NO_IRQ
#define NO_IRQ …
#endif
#define FLAG_DMA_FIXUP …
#define FLAG_NO_PSEUDO_DMA …
#define FLAG_LATE_DMA_SETUP …
#define FLAG_TOSHIBA_DELAY …
struct NCR5380_hostdata { … };
struct NCR5380_cmd { … };
#define NCR5380_PIO_CHUNK_SIZE …
#define NCR5380_REG_POLL_TIME …
static inline struct scsi_cmnd *NCR5380_to_scmd(struct NCR5380_cmd *ncmd_ptr)
{ … }
static inline struct NCR5380_cmd *NCR5380_to_ncmd(struct scsi_cmnd *cmd)
{ … }
#ifndef NDEBUG
#define NDEBUG …
#endif
#define dprintk(flg, fmt, ...) …
#define dsprintk(flg, host, fmt, ...) …
#if NDEBUG
#define NCR5380_dprint …
#define NCR5380_dprint_phase …
static void NCR5380_print_phase(struct Scsi_Host *instance);
static void NCR5380_print(struct Scsi_Host *instance);
#else
#define NCR5380_dprint(flg, arg) …
#define NCR5380_dprint_phase(flg, arg) …
#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 int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data,
unsigned int can_sleep);
static int NCR5380_poll_politely2(struct NCR5380_hostdata *,
unsigned int, u8, u8,
unsigned int, u8, u8, unsigned long);
static inline int NCR5380_poll_politely(struct NCR5380_hostdata *hostdata,
unsigned int reg, u8 bit, u8 val,
unsigned long wait)
{ … }
static int NCR5380_dma_xfer_len(struct NCR5380_hostdata *,
struct scsi_cmnd *);
static int NCR5380_dma_send_setup(struct NCR5380_hostdata *,
unsigned char *, int);
static int NCR5380_dma_recv_setup(struct NCR5380_hostdata *,
unsigned char *, int);
static int NCR5380_dma_residual(struct NCR5380_hostdata *);
static inline int NCR5380_dma_xfer_none(struct NCR5380_hostdata *hostdata,
struct scsi_cmnd *cmd)
{ … }
static inline int NCR5380_dma_setup_none(struct NCR5380_hostdata *hostdata,
unsigned char *data, int count)
{ … }
static inline int NCR5380_dma_residual_none(struct NCR5380_hostdata *hostdata)
{ … }
#endif