18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * linux/drivers/acorn/scsi/fas216.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 1997-2000 Russell King 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * FAS216 generic driver 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#ifndef FAS216_H 108c2ecf20Sopenharmony_ci#define FAS216_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <scsi/scsi_eh.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include "queue.h" 158c2ecf20Sopenharmony_ci#include "msgqueue.h" 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci/* FAS register definitions */ 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci/* transfer count low */ 208c2ecf20Sopenharmony_ci#define REG_CTCL (0) 218c2ecf20Sopenharmony_ci#define REG_STCL (0) 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci/* transfer count medium */ 248c2ecf20Sopenharmony_ci#define REG_CTCM (1) 258c2ecf20Sopenharmony_ci#define REG_STCM (1) 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* fifo data */ 288c2ecf20Sopenharmony_ci#define REG_FF (2) 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* command */ 318c2ecf20Sopenharmony_ci#define REG_CMD (3) 328c2ecf20Sopenharmony_ci#define CMD_NOP 0x00 338c2ecf20Sopenharmony_ci#define CMD_FLUSHFIFO 0x01 348c2ecf20Sopenharmony_ci#define CMD_RESETCHIP 0x02 358c2ecf20Sopenharmony_ci#define CMD_RESETSCSI 0x03 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define CMD_TRANSFERINFO 0x10 388c2ecf20Sopenharmony_ci#define CMD_INITCMDCOMPLETE 0x11 398c2ecf20Sopenharmony_ci#define CMD_MSGACCEPTED 0x12 408c2ecf20Sopenharmony_ci#define CMD_PADBYTES 0x18 418c2ecf20Sopenharmony_ci#define CMD_SETATN 0x1a 428c2ecf20Sopenharmony_ci#define CMD_RSETATN 0x1b 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define CMD_SELECTWOATN 0x41 458c2ecf20Sopenharmony_ci#define CMD_SELECTATN 0x42 468c2ecf20Sopenharmony_ci#define CMD_SELECTATNSTOP 0x43 478c2ecf20Sopenharmony_ci#define CMD_ENABLESEL 0x44 488c2ecf20Sopenharmony_ci#define CMD_DISABLESEL 0x45 498c2ecf20Sopenharmony_ci#define CMD_SELECTATN3 0x46 508c2ecf20Sopenharmony_ci#define CMD_RESEL3 0x47 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define CMD_WITHDMA 0x80 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci/* status register (read) */ 558c2ecf20Sopenharmony_ci#define REG_STAT (4) 568c2ecf20Sopenharmony_ci#define STAT_IO (1 << 0) /* IO phase */ 578c2ecf20Sopenharmony_ci#define STAT_CD (1 << 1) /* CD phase */ 588c2ecf20Sopenharmony_ci#define STAT_MSG (1 << 2) /* MSG phase */ 598c2ecf20Sopenharmony_ci#define STAT_TRANSFERDONE (1 << 3) /* Transfer completed */ 608c2ecf20Sopenharmony_ci#define STAT_TRANSFERCNTZ (1 << 4) /* Transfer counter is zero */ 618c2ecf20Sopenharmony_ci#define STAT_PARITYERROR (1 << 5) /* Parity error */ 628c2ecf20Sopenharmony_ci#define STAT_REALBAD (1 << 6) /* Something bad */ 638c2ecf20Sopenharmony_ci#define STAT_INT (1 << 7) /* Interrupt */ 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#define STAT_BUSMASK (STAT_MSG|STAT_CD|STAT_IO) 668c2ecf20Sopenharmony_ci#define STAT_DATAOUT (0) /* Data out */ 678c2ecf20Sopenharmony_ci#define STAT_DATAIN (STAT_IO) /* Data in */ 688c2ecf20Sopenharmony_ci#define STAT_COMMAND (STAT_CD) /* Command out */ 698c2ecf20Sopenharmony_ci#define STAT_STATUS (STAT_CD|STAT_IO) /* Status In */ 708c2ecf20Sopenharmony_ci#define STAT_MESGOUT (STAT_MSG|STAT_CD) /* Message out */ 718c2ecf20Sopenharmony_ci#define STAT_MESGIN (STAT_MSG|STAT_CD|STAT_IO) /* Message In */ 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci/* bus ID for select / reselect */ 748c2ecf20Sopenharmony_ci#define REG_SDID (4) 758c2ecf20Sopenharmony_ci#define BUSID(target) ((target) & 7) 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci/* Interrupt status register (read) */ 788c2ecf20Sopenharmony_ci#define REG_INST (5) 798c2ecf20Sopenharmony_ci#define INST_SELWOATN (1 << 0) /* Select w/o ATN */ 808c2ecf20Sopenharmony_ci#define INST_SELATN (1 << 1) /* Select w/ATN */ 818c2ecf20Sopenharmony_ci#define INST_RESELECTED (1 << 2) /* Reselected */ 828c2ecf20Sopenharmony_ci#define INST_FUNCDONE (1 << 3) /* Function done */ 838c2ecf20Sopenharmony_ci#define INST_BUSSERVICE (1 << 4) /* Bus service */ 848c2ecf20Sopenharmony_ci#define INST_DISCONNECT (1 << 5) /* Disconnect */ 858c2ecf20Sopenharmony_ci#define INST_ILLEGALCMD (1 << 6) /* Illegal command */ 868c2ecf20Sopenharmony_ci#define INST_BUSRESET (1 << 7) /* SCSI Bus reset */ 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci/* Timeout register (write) */ 898c2ecf20Sopenharmony_ci#define REG_STIM (5) 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci/* Sequence step register (read) */ 928c2ecf20Sopenharmony_ci#define REG_IS (6) 938c2ecf20Sopenharmony_ci#define IS_BITS 0x07 948c2ecf20Sopenharmony_ci#define IS_SELARB 0x00 /* Select & Arb ok */ 958c2ecf20Sopenharmony_ci#define IS_MSGBYTESENT 0x01 /* One byte message sent*/ 968c2ecf20Sopenharmony_ci#define IS_NOTCOMMAND 0x02 /* Not in command state */ 978c2ecf20Sopenharmony_ci#define IS_EARLYPHASE 0x03 /* Early phase change */ 988c2ecf20Sopenharmony_ci#define IS_COMPLETE 0x04 /* Command ok */ 998c2ecf20Sopenharmony_ci#define IS_SOF 0x08 /* Sync off flag */ 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci/* Transfer period step (write) */ 1028c2ecf20Sopenharmony_ci#define REG_STP (6) 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci/* Synchronous Offset (write) */ 1058c2ecf20Sopenharmony_ci#define REG_SOF (7) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci/* Fifo state register (read) */ 1088c2ecf20Sopenharmony_ci#define REG_CFIS (7) 1098c2ecf20Sopenharmony_ci#define CFIS_CF 0x1f /* Num bytes in FIFO */ 1108c2ecf20Sopenharmony_ci#define CFIS_IS 0xe0 /* Step */ 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci/* config register 1 */ 1138c2ecf20Sopenharmony_ci#define REG_CNTL1 (8) 1148c2ecf20Sopenharmony_ci#define CNTL1_CID (7 << 0) /* Chip ID */ 1158c2ecf20Sopenharmony_ci#define CNTL1_STE (1 << 3) /* Self test enable */ 1168c2ecf20Sopenharmony_ci#define CNTL1_PERE (1 << 4) /* Parity enable reporting en. */ 1178c2ecf20Sopenharmony_ci#define CNTL1_PTE (1 << 5) /* Parity test enable */ 1188c2ecf20Sopenharmony_ci#define CNTL1_DISR (1 << 6) /* Disable Irq on SCSI reset */ 1198c2ecf20Sopenharmony_ci#define CNTL1_ETM (1 << 7) /* Extended Timing Mode */ 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci/* Clock conversion factor (read) */ 1228c2ecf20Sopenharmony_ci#define REG_CLKF (9) 1238c2ecf20Sopenharmony_ci#define CLKF_F37MHZ 0x00 /* 35.01 - 40 MHz */ 1248c2ecf20Sopenharmony_ci#define CLKF_F10MHZ 0x02 /* 10 MHz */ 1258c2ecf20Sopenharmony_ci#define CLKF_F12MHZ 0x03 /* 10.01 - 15 MHz */ 1268c2ecf20Sopenharmony_ci#define CLKF_F17MHZ 0x04 /* 15.01 - 20 MHz */ 1278c2ecf20Sopenharmony_ci#define CLKF_F22MHZ 0x05 /* 20.01 - 25 MHz */ 1288c2ecf20Sopenharmony_ci#define CLKF_F27MHZ 0x06 /* 25.01 - 30 MHz */ 1298c2ecf20Sopenharmony_ci#define CLKF_F32MHZ 0x07 /* 30.01 - 35 MHz */ 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci/* Chip test register (write) */ 1328c2ecf20Sopenharmony_ci#define REG_FTM (10) 1338c2ecf20Sopenharmony_ci#define TEST_FTM 0x01 /* Force target mode */ 1348c2ecf20Sopenharmony_ci#define TEST_FIM 0x02 /* Force initiator mode */ 1358c2ecf20Sopenharmony_ci#define TEST_FHI 0x04 /* Force high impedance mode */ 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci/* Configuration register 2 (read/write) */ 1388c2ecf20Sopenharmony_ci#define REG_CNTL2 (11) 1398c2ecf20Sopenharmony_ci#define CNTL2_PGDP (1 << 0) /* Pass Th/Generate Data Parity */ 1408c2ecf20Sopenharmony_ci#define CNTL2_PGRP (1 << 1) /* Pass Th/Generate Reg Parity */ 1418c2ecf20Sopenharmony_ci#define CNTL2_ACDPE (1 << 2) /* Abort on Cmd/Data Parity Err */ 1428c2ecf20Sopenharmony_ci#define CNTL2_S2FE (1 << 3) /* SCSI2 Features Enable */ 1438c2ecf20Sopenharmony_ci#define CNTL2_TSDR (1 << 4) /* Tristate DREQ */ 1448c2ecf20Sopenharmony_ci#define CNTL2_SBO (1 << 5) /* Select Byte Order */ 1458c2ecf20Sopenharmony_ci#define CNTL2_ENF (1 << 6) /* Enable features */ 1468c2ecf20Sopenharmony_ci#define CNTL2_DAE (1 << 7) /* Data Alignment Enable */ 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci/* Configuration register 3 (read/write) */ 1498c2ecf20Sopenharmony_ci#define REG_CNTL3 (12) 1508c2ecf20Sopenharmony_ci#define CNTL3_BS8 (1 << 0) /* Burst size 8 */ 1518c2ecf20Sopenharmony_ci#define CNTL3_MDM (1 << 1) /* Modify DMA mode */ 1528c2ecf20Sopenharmony_ci#define CNTL3_LBTM (1 << 2) /* Last Byte Transfer mode */ 1538c2ecf20Sopenharmony_ci#define CNTL3_FASTCLK (1 << 3) /* Fast SCSI clocking */ 1548c2ecf20Sopenharmony_ci#define CNTL3_FASTSCSI (1 << 4) /* Fast SCSI */ 1558c2ecf20Sopenharmony_ci#define CNTL3_G2CB (1 << 5) /* Group2 SCSI support */ 1568c2ecf20Sopenharmony_ci#define CNTL3_QTAG (1 << 6) /* Enable 3 byte msgs */ 1578c2ecf20Sopenharmony_ci#define CNTL3_ADIDCHK (1 << 7) /* Additional ID check */ 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci/* High transfer count (read/write) */ 1608c2ecf20Sopenharmony_ci#define REG_CTCH (14) 1618c2ecf20Sopenharmony_ci#define REG_STCH (14) 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci/* ID register (read only) */ 1648c2ecf20Sopenharmony_ci#define REG_ID (14) 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci/* Data alignment */ 1678c2ecf20Sopenharmony_ci#define REG_DAL (15) 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_citypedef enum { 1708c2ecf20Sopenharmony_ci PHASE_IDLE, /* we're not planning on doing anything */ 1718c2ecf20Sopenharmony_ci PHASE_SELECTION, /* selecting a device */ 1728c2ecf20Sopenharmony_ci PHASE_SELSTEPS, /* selection with command steps */ 1738c2ecf20Sopenharmony_ci PHASE_COMMAND, /* command sent */ 1748c2ecf20Sopenharmony_ci PHASE_MESSAGESENT, /* selected, and we're sending cmd */ 1758c2ecf20Sopenharmony_ci PHASE_DATAOUT, /* data out to device */ 1768c2ecf20Sopenharmony_ci PHASE_DATAIN, /* data in from device */ 1778c2ecf20Sopenharmony_ci PHASE_MSGIN, /* message in from device */ 1788c2ecf20Sopenharmony_ci PHASE_MSGIN_DISCONNECT, /* disconnecting from bus */ 1798c2ecf20Sopenharmony_ci PHASE_MSGOUT, /* after message out phase */ 1808c2ecf20Sopenharmony_ci PHASE_MSGOUT_EXPECT, /* expecting message out */ 1818c2ecf20Sopenharmony_ci PHASE_STATUS, /* status from device */ 1828c2ecf20Sopenharmony_ci PHASE_DONE /* Command complete */ 1838c2ecf20Sopenharmony_ci} phase_t; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_citypedef enum { 1868c2ecf20Sopenharmony_ci DMA_OUT, /* DMA from memory to chip */ 1878c2ecf20Sopenharmony_ci DMA_IN /* DMA from chip to memory */ 1888c2ecf20Sopenharmony_ci} fasdmadir_t; 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_citypedef enum { 1918c2ecf20Sopenharmony_ci fasdma_none, /* No dma */ 1928c2ecf20Sopenharmony_ci fasdma_pio, /* PIO mode */ 1938c2ecf20Sopenharmony_ci fasdma_pseudo, /* Pseudo DMA */ 1948c2ecf20Sopenharmony_ci fasdma_real_block, /* Real DMA, on block by block basis */ 1958c2ecf20Sopenharmony_ci fasdma_real_all /* Real DMA, on request by request */ 1968c2ecf20Sopenharmony_ci} fasdmatype_t; 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_citypedef enum { 1998c2ecf20Sopenharmony_ci neg_wait, /* Negotiate with device */ 2008c2ecf20Sopenharmony_ci neg_inprogress, /* Negotiation sent */ 2018c2ecf20Sopenharmony_ci neg_complete, /* Negotiation complete */ 2028c2ecf20Sopenharmony_ci neg_targcomplete, /* Target completed negotiation */ 2038c2ecf20Sopenharmony_ci neg_invalid /* Negotiation not supported */ 2048c2ecf20Sopenharmony_ci} neg_t; 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci#define MAGIC 0x441296bdUL 2078c2ecf20Sopenharmony_ci#define NR_MSGS 8 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci#define FASCAP_DMA (1 << 0) 2108c2ecf20Sopenharmony_ci#define FASCAP_PSEUDODMA (1 << 1) 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_citypedef struct { 2138c2ecf20Sopenharmony_ci unsigned long magic_start; 2148c2ecf20Sopenharmony_ci spinlock_t host_lock; 2158c2ecf20Sopenharmony_ci struct Scsi_Host *host; /* host */ 2168c2ecf20Sopenharmony_ci struct scsi_cmnd *SCpnt; /* currently processing command */ 2178c2ecf20Sopenharmony_ci struct scsi_cmnd *origSCpnt; /* original connecting command */ 2188c2ecf20Sopenharmony_ci struct scsi_cmnd *reqSCpnt; /* request sense command */ 2198c2ecf20Sopenharmony_ci struct scsi_cmnd *rstSCpnt; /* reset command */ 2208c2ecf20Sopenharmony_ci struct scsi_cmnd *pending_SCpnt[8]; /* per-device pending commands */ 2218c2ecf20Sopenharmony_ci int next_pending; /* next pending device */ 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci /* 2248c2ecf20Sopenharmony_ci * Error recovery 2258c2ecf20Sopenharmony_ci */ 2268c2ecf20Sopenharmony_ci wait_queue_head_t eh_wait; 2278c2ecf20Sopenharmony_ci struct timer_list eh_timer; 2288c2ecf20Sopenharmony_ci unsigned int rst_dev_status; 2298c2ecf20Sopenharmony_ci unsigned int rst_bus_status; 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci /* driver information */ 2328c2ecf20Sopenharmony_ci struct { 2338c2ecf20Sopenharmony_ci phase_t phase; /* current phase */ 2348c2ecf20Sopenharmony_ci void __iomem *io_base; /* iomem base of FAS216 */ 2358c2ecf20Sopenharmony_ci unsigned int io_shift; /* shift to adjust reg offsets by */ 2368c2ecf20Sopenharmony_ci unsigned char cfg[4]; /* configuration registers */ 2378c2ecf20Sopenharmony_ci const char *type; /* chip type */ 2388c2ecf20Sopenharmony_ci unsigned int irq; /* interrupt */ 2398c2ecf20Sopenharmony_ci int dma; /* dma channel */ 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci struct scsi_pointer SCp; /* current commands data pointer */ 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci MsgQueue_t msgs; /* message queue for connected device */ 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci unsigned int async_stp; /* Async transfer STP value */ 2468c2ecf20Sopenharmony_ci unsigned char msgin_fifo; /* bytes in fifo at time of message in */ 2478c2ecf20Sopenharmony_ci unsigned char message[256]; /* last message received from device */ 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci unsigned char disconnectable:1; /* this command can be disconnected */ 2508c2ecf20Sopenharmony_ci unsigned char aborting:1; /* aborting command */ 2518c2ecf20Sopenharmony_ci } scsi; 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci /* statistics information */ 2548c2ecf20Sopenharmony_ci struct { 2558c2ecf20Sopenharmony_ci unsigned int queues; 2568c2ecf20Sopenharmony_ci unsigned int removes; 2578c2ecf20Sopenharmony_ci unsigned int fins; 2588c2ecf20Sopenharmony_ci unsigned int reads; 2598c2ecf20Sopenharmony_ci unsigned int writes; 2608c2ecf20Sopenharmony_ci unsigned int miscs; 2618c2ecf20Sopenharmony_ci unsigned int disconnects; 2628c2ecf20Sopenharmony_ci unsigned int aborts; 2638c2ecf20Sopenharmony_ci unsigned int bus_resets; 2648c2ecf20Sopenharmony_ci unsigned int host_resets; 2658c2ecf20Sopenharmony_ci } stats; 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci /* configuration information */ 2688c2ecf20Sopenharmony_ci struct { 2698c2ecf20Sopenharmony_ci unsigned char clockrate; /* clock rate of FAS device (MHz) */ 2708c2ecf20Sopenharmony_ci unsigned char select_timeout; /* timeout (R5) */ 2718c2ecf20Sopenharmony_ci unsigned char sync_max_depth; /* Synchronous xfer max fifo depth */ 2728c2ecf20Sopenharmony_ci unsigned char wide_max_size; /* Maximum wide transfer size */ 2738c2ecf20Sopenharmony_ci unsigned char cntl3; /* Control Reg 3 */ 2748c2ecf20Sopenharmony_ci unsigned int asyncperiod; /* Async transfer period (ns) */ 2758c2ecf20Sopenharmony_ci unsigned int capabilities; /* driver capabilities */ 2768c2ecf20Sopenharmony_ci unsigned int disconnect_ok:1; /* Disconnects allowed? */ 2778c2ecf20Sopenharmony_ci } ifcfg; 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci /* queue handling */ 2808c2ecf20Sopenharmony_ci struct { 2818c2ecf20Sopenharmony_ci Queue_t issue; /* issue queue */ 2828c2ecf20Sopenharmony_ci Queue_t disconnected; /* disconnected command queue */ 2838c2ecf20Sopenharmony_ci } queues; 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci /* per-device info */ 2868c2ecf20Sopenharmony_ci struct fas216_device { 2878c2ecf20Sopenharmony_ci unsigned char disconnect_ok:1; /* device can disconnect */ 2888c2ecf20Sopenharmony_ci unsigned char parity_enabled:1; /* parity checking enabled */ 2898c2ecf20Sopenharmony_ci unsigned char parity_check:1; /* need to check parity checking */ 2908c2ecf20Sopenharmony_ci unsigned char period; /* sync xfer period in (*4ns) */ 2918c2ecf20Sopenharmony_ci unsigned char stp; /* synchronous transfer period */ 2928c2ecf20Sopenharmony_ci unsigned char sof; /* synchronous offset register */ 2938c2ecf20Sopenharmony_ci unsigned char wide_xfer; /* currently negociated wide transfer */ 2948c2ecf20Sopenharmony_ci neg_t sync_state; /* synchronous transfer mode */ 2958c2ecf20Sopenharmony_ci neg_t wide_state; /* wide transfer mode */ 2968c2ecf20Sopenharmony_ci } device[8]; 2978c2ecf20Sopenharmony_ci unsigned long busyluns[64/sizeof(unsigned long)];/* array of bits indicating LUNs busy */ 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci /* dma */ 3008c2ecf20Sopenharmony_ci struct { 3018c2ecf20Sopenharmony_ci fasdmatype_t transfer_type; /* current type of DMA transfer */ 3028c2ecf20Sopenharmony_ci fasdmatype_t (*setup) (struct Scsi_Host *host, struct scsi_pointer *SCp, fasdmadir_t direction, fasdmatype_t min_dma); 3038c2ecf20Sopenharmony_ci void (*pseudo)(struct Scsi_Host *host, struct scsi_pointer *SCp, fasdmadir_t direction, int transfer); 3048c2ecf20Sopenharmony_ci void (*stop) (struct Scsi_Host *host, struct scsi_pointer *SCp); 3058c2ecf20Sopenharmony_ci } dma; 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci /* miscellaneous */ 3088c2ecf20Sopenharmony_ci int internal_done; /* flag to indicate request done */ 3098c2ecf20Sopenharmony_ci struct scsi_eh_save ses; /* holds request sense restore info */ 3108c2ecf20Sopenharmony_ci unsigned long magic_end; 3118c2ecf20Sopenharmony_ci} FAS216_Info; 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci/* Function: int fas216_init (struct Scsi_Host *instance) 3148c2ecf20Sopenharmony_ci * Purpose : initialise FAS/NCR/AMD SCSI structures. 3158c2ecf20Sopenharmony_ci * Params : instance - a driver-specific filled-out structure 3168c2ecf20Sopenharmony_ci * Returns : 0 on success 3178c2ecf20Sopenharmony_ci */ 3188c2ecf20Sopenharmony_ciextern int fas216_init (struct Scsi_Host *instance); 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci/* Function: int fas216_add (struct Scsi_Host *instance, struct device *dev) 3218c2ecf20Sopenharmony_ci * Purpose : initialise FAS/NCR/AMD SCSI ic. 3228c2ecf20Sopenharmony_ci * Params : instance - a driver-specific filled-out structure 3238c2ecf20Sopenharmony_ci * Returns : 0 on success 3248c2ecf20Sopenharmony_ci */ 3258c2ecf20Sopenharmony_ciextern int fas216_add (struct Scsi_Host *instance, struct device *dev); 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci/* Function: int fas216_queue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt) 3288c2ecf20Sopenharmony_ci * Purpose : queue a command for adapter to process. 3298c2ecf20Sopenharmony_ci * Params : h - host adapter 3308c2ecf20Sopenharmony_ci * : SCpnt - Command to queue 3318c2ecf20Sopenharmony_ci * Returns : 0 - success, else error 3328c2ecf20Sopenharmony_ci */ 3338c2ecf20Sopenharmony_ciextern int fas216_queue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt); 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_ci/* Function: int fas216_noqueue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt) 3368c2ecf20Sopenharmony_ci * Purpose : queue a command for adapter to process, and process it to completion. 3378c2ecf20Sopenharmony_ci * Params : h - host adapter 3388c2ecf20Sopenharmony_ci * : SCpnt - Command to queue 3398c2ecf20Sopenharmony_ci * Returns : 0 - success, else error 3408c2ecf20Sopenharmony_ci */ 3418c2ecf20Sopenharmony_ciextern int fas216_noqueue_command(struct Scsi_Host *, struct scsi_cmnd *); 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ci/* Function: irqreturn_t fas216_intr (FAS216_Info *info) 3448c2ecf20Sopenharmony_ci * Purpose : handle interrupts from the interface to progress a command 3458c2ecf20Sopenharmony_ci * Params : info - interface to service 3468c2ecf20Sopenharmony_ci */ 3478c2ecf20Sopenharmony_ciextern irqreturn_t fas216_intr (FAS216_Info *info); 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ciextern void fas216_remove (struct Scsi_Host *instance); 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ci/* Function: void fas216_release (struct Scsi_Host *instance) 3528c2ecf20Sopenharmony_ci * Purpose : release all resources and put everything to bed for FAS/NCR/AMD SCSI ic. 3538c2ecf20Sopenharmony_ci * Params : instance - a driver-specific filled-out structure 3548c2ecf20Sopenharmony_ci * Returns : 0 on success 3558c2ecf20Sopenharmony_ci */ 3568c2ecf20Sopenharmony_ciextern void fas216_release (struct Scsi_Host *instance); 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ciextern void fas216_print_host(FAS216_Info *info, struct seq_file *m); 3598c2ecf20Sopenharmony_ciextern void fas216_print_stats(FAS216_Info *info, struct seq_file *m); 3608c2ecf20Sopenharmony_ciextern void fas216_print_devices(FAS216_Info *info, struct seq_file *m); 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci/* Function: int fas216_eh_abort(struct scsi_cmnd *SCpnt) 3638c2ecf20Sopenharmony_ci * Purpose : abort this command 3648c2ecf20Sopenharmony_ci * Params : SCpnt - command to abort 3658c2ecf20Sopenharmony_ci * Returns : FAILED if unable to abort 3668c2ecf20Sopenharmony_ci */ 3678c2ecf20Sopenharmony_ciextern int fas216_eh_abort(struct scsi_cmnd *SCpnt); 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ci/* Function: int fas216_eh_device_reset(struct scsi_cmnd *SCpnt) 3708c2ecf20Sopenharmony_ci * Purpose : Reset the device associated with this command 3718c2ecf20Sopenharmony_ci * Params : SCpnt - command specifing device to reset 3728c2ecf20Sopenharmony_ci * Returns : FAILED if unable to reset 3738c2ecf20Sopenharmony_ci */ 3748c2ecf20Sopenharmony_ciextern int fas216_eh_device_reset(struct scsi_cmnd *SCpnt); 3758c2ecf20Sopenharmony_ci 3768c2ecf20Sopenharmony_ci/* Function: int fas216_eh_bus_reset(struct scsi_cmnd *SCpnt) 3778c2ecf20Sopenharmony_ci * Purpose : Reset the complete bus associated with this command 3788c2ecf20Sopenharmony_ci * Params : SCpnt - command specifing bus to reset 3798c2ecf20Sopenharmony_ci * Returns : FAILED if unable to reset 3808c2ecf20Sopenharmony_ci */ 3818c2ecf20Sopenharmony_ciextern int fas216_eh_bus_reset(struct scsi_cmnd *SCpnt); 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_ci/* Function: int fas216_eh_host_reset(struct scsi_cmnd *SCpnt) 3848c2ecf20Sopenharmony_ci * Purpose : Reset the host associated with this command 3858c2ecf20Sopenharmony_ci * Params : SCpnt - command specifing host to reset 3868c2ecf20Sopenharmony_ci * Returns : FAILED if unable to reset 3878c2ecf20Sopenharmony_ci */ 3888c2ecf20Sopenharmony_ciextern int fas216_eh_host_reset(struct scsi_cmnd *SCpnt); 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_ci#endif /* FAS216_H */ 391