1 1.1 mycroft typedef u_char physaddr[3]; 2 1.1 mycroft typedef u_char physlen[3]; 3 1.1 mycroft #define ltophys _lto3b 4 1.1 mycroft #define phystol _3btol 5 1.1 mycroft 6 1.1 mycroft /* WD7000 registers */ 7 1.1 mycroft #define WDS_STAT 0 /* read */ 8 1.1 mycroft #define WDS_IRQSTAT 1 /* read */ 9 1.1 mycroft 10 1.1 mycroft #define WDS_CMD 0 /* write */ 11 1.1 mycroft #define WDS_IRQACK 1 /* write */ 12 1.1 mycroft #define WDS_HCR 2 /* write */ 13 1.1 mycroft 14 1.1 mycroft /* WDS_STAT (read) defs */ 15 1.1 mycroft #define WDSS_IRQ 0x80 16 1.1 mycroft #define WDSS_RDY 0x40 17 1.1 mycroft #define WDSS_REJ 0x20 18 1.1 mycroft #define WDSS_INIT 0x10 19 1.1 mycroft 20 1.1 mycroft /* WDS_IRQSTAT (read) defs */ 21 1.1 mycroft #define WDSI_MASK 0xc0 22 1.1 mycroft #define WDSI_ERR 0x00 23 1.1 mycroft #define WDSI_MFREE 0x80 24 1.1 mycroft #define WDSI_MSVC 0xc0 25 1.1 mycroft 26 1.1 mycroft /* WDS_CMD (write) defs */ 27 1.1 mycroft #define WDSC_NOOP 0x00 28 1.1 mycroft #define WDSC_INIT 0x01 29 1.1 mycroft #define WDSC_DISUNSOL 0x02 30 1.1 mycroft #define WDSC_ENAUNSOL 0x03 31 1.1 mycroft #define WDSC_IRQMFREE 0x04 32 1.1 mycroft #define WDSC_SCSIRESETSOFT 0x05 33 1.1 mycroft #define WDSC_SCSIRESETHARD 0x06 34 1.1 mycroft #define WDSC_MSTART(m) (0x80 + (m)) 35 1.1 mycroft #define WDSC_MMSTART(m) (0xc0 + (m)) 36 1.1 mycroft 37 1.1 mycroft /* WDS_HCR (write) defs */ 38 1.1 mycroft #define WDSH_IRQEN 0x08 39 1.1 mycroft #define WDSH_DRQEN 0x04 40 1.1 mycroft #define WDSH_SCSIRESET 0x02 41 1.1 mycroft #define WDSH_ASCRESET 0x01 42 1.1 mycroft 43 1.1 mycroft #define WDS_NSEG 17 44 1.1 mycroft 45 1.1 mycroft struct wds_scat_gath { 46 1.1 mycroft physlen seg_len; 47 1.1 mycroft physaddr seg_addr; 48 1.1 mycroft }; 49 1.1 mycroft 50 1.1 mycroft struct wds_cmd { 51 1.1 mycroft u_char opcode; 52 1.1 mycroft u_char targ; 53 1.1 mycroft struct scsi_generic scb; 54 1.1 mycroft u_char stat; 55 1.1 mycroft u_char venderr; 56 1.1 mycroft physlen len; 57 1.1 mycroft physaddr data; 58 1.1 mycroft physaddr link; 59 1.1 mycroft u_char write; 60 1.1 mycroft u_char xx[6]; 61 1.1 mycroft }; 62 1.1 mycroft 63 1.1 mycroft struct wds_scb { 64 1.1 mycroft struct wds_cmd cmd; 65 1.1 mycroft struct wds_cmd sense; 66 1.1 mycroft 67 1.1 mycroft struct wds_scat_gath scat_gath[WDS_NSEG]; 68 1.2 bouyer struct scsipi_sense_data sense_data; 69 1.1 mycroft 70 1.1 mycroft TAILQ_ENTRY(wds_scb) chain; 71 1.1 mycroft struct wds_scb *nexthash; 72 1.4 mycroft u_long hashkey; 73 1.2 bouyer struct scsipi_xfer *xs; 74 1.1 mycroft int flags; 75 1.1 mycroft #define SCB_ALLOC 0x01 76 1.1 mycroft #define SCB_ABORT 0x02 77 1.1 mycroft #ifdef WDSDIAG 78 1.1 mycroft #define SCB_SENDING 0x04 79 1.1 mycroft #endif 80 1.1 mycroft #define SCB_POLLED 0x08 81 1.1 mycroft #define SCB_SENSE 0x10 82 1.1 mycroft #define SCB_DONE 0x20 /* for internal commands only */ 83 1.1 mycroft #define SCB_BUFFER 0x40 84 1.1 mycroft int timeout; 85 1.1 mycroft 86 1.3 thorpej /* 87 1.3 thorpej * DMA maps used by the SCB. These maps are created in 88 1.3 thorpej * wds_init_scb(). 89 1.3 thorpej */ 90 1.3 thorpej 91 1.3 thorpej /* 92 1.3 thorpej * The DMA map maps an individual SCB. This map is permanently 93 1.3 thorpej * loaded in wds_init_scb(). 94 1.3 thorpej */ 95 1.3 thorpej bus_dmamap_t dmamap_self; 96 1.3 thorpej 97 1.3 thorpej /* 98 1.3 thorpej * This map maps the buffer involved in the transfer. 99 1.3 thorpej * Its contents are loaded into "scat_gath" above. 100 1.3 thorpej */ 101 1.3 thorpej bus_dmamap_t dmamap_xfer; 102 1.1 mycroft }; 103 1.1 mycroft 104 1.1 mycroft #define WDSX_SCSICMD 0x00 105 1.1 mycroft #define WDSX_SCSISG 0x01 106 1.1 mycroft #define WDSX_OPEN_RCVBUF 0x80 107 1.1 mycroft #define WDSX_RCV_CMD 0x81 108 1.1 mycroft #define WDSX_RCV_DATA 0x82 109 1.1 mycroft #define WDSX_RCV_DATASTAT 0x83 110 1.1 mycroft #define WDSX_SND_DATA 0x84 111 1.1 mycroft #define WDSX_SND_DATASTAT 0x85 112 1.1 mycroft #define WDSX_SND_CMDSTAT 0x86 113 1.1 mycroft #define WDSX_READINIT 0x88 114 1.1 mycroft #define WDSX_READSCSIID 0x89 115 1.1 mycroft #define WDSX_SETUNSOLIRQMASK 0x8a 116 1.1 mycroft #define WDSX_GETUNSOLIRQMASK 0x8b 117 1.1 mycroft #define WDSX_GETFIRMREV 0x8c 118 1.1 mycroft #define WDSX_EXECDIAG 0x8d 119 1.1 mycroft #define WDSX_SETEXECPARM 0x8e 120 1.1 mycroft #define WDSX_GETEXECPARM 0x8f 121 1.1 mycroft 122 1.1 mycroft struct wds_mbx_out { 123 1.1 mycroft u_char cmd; 124 1.1 mycroft physaddr scb_addr; 125 1.1 mycroft }; 126 1.1 mycroft 127 1.1 mycroft struct wds_mbx_in { 128 1.1 mycroft u_char stat; 129 1.1 mycroft physaddr scb_addr; 130 1.1 mycroft }; 131 1.1 mycroft 132 1.1 mycroft /* 133 1.1 mycroft * mbo.cmd values 134 1.1 mycroft */ 135 1.1 mycroft #define WDS_MBO_FREE 0x0 /* MBO entry is free */ 136 1.1 mycroft #define WDS_MBO_START 0x1 /* MBO activate entry */ 137 1.1 mycroft 138 1.1 mycroft /* 139 1.1 mycroft * mbi.stat values 140 1.1 mycroft */ 141 1.1 mycroft #define WDS_MBI_FREE 0x00 /* MBI entry is free */ 142 1.1 mycroft #define WDS_MBI_OK 0x01 /* completed without error */ 143 1.1 mycroft #define WDS_MBI_OKERR 0x02 /* completed with error */ 144 1.1 mycroft #define WDS_MBI_ETIME 0x04 145 1.1 mycroft #define WDS_MBI_ERESET 0x05 146 1.1 mycroft #define WDS_MBI_ETARCMD 0x06 147 1.1 mycroft #define WDS_MBI_ERESEL 0x80 148 1.1 mycroft #define WDS_MBI_ESEL 0x81 149 1.1 mycroft #define WDS_MBI_EABORT 0x82 150 1.1 mycroft #define WDS_MBI_ESRESET 0x83 151 1.1 mycroft #define WDS_MBI_EHRESET 0x84 152 1.1 mycroft 153 1.1 mycroft struct wds_setup { 154 1.1 mycroft u_char opcode; 155 1.1 mycroft u_char scsi_id; 156 1.1 mycroft u_char buson_t; 157 1.1 mycroft u_char busoff_t; 158 1.1 mycroft u_char xx; 159 1.1 mycroft physaddr mbaddr; 160 1.1 mycroft u_char nomb; 161 1.1 mycroft u_char nimb; 162 1.1 mycroft }; 163