1 1.21 jdolecek /* $NetBSD: bhareg.h,v 1.21 2017/02/26 23:30:14 jdolecek Exp $ */ 2 1.7 thorpej 3 1.7 thorpej /*- 4 1.11 thorpej * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. 5 1.7 thorpej * All rights reserved. 6 1.7 thorpej * 7 1.7 thorpej * This code is derived from software contributed to The NetBSD Foundation 8 1.12 mycroft * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace 9 1.12 mycroft * Simulation Facility, NASA Ames Research Center. 10 1.7 thorpej * 11 1.7 thorpej * Redistribution and use in source and binary forms, with or without 12 1.7 thorpej * modification, are permitted provided that the following conditions 13 1.7 thorpej * are met: 14 1.7 thorpej * 1. Redistributions of source code must retain the above copyright 15 1.7 thorpej * notice, this list of conditions and the following disclaimer. 16 1.7 thorpej * 2. Redistributions in binary form must reproduce the above copyright 17 1.7 thorpej * notice, this list of conditions and the following disclaimer in the 18 1.7 thorpej * documentation and/or other materials provided with the distribution. 19 1.7 thorpej * 20 1.7 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21 1.7 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 1.7 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 1.7 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 1.7 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 1.7 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 1.7 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 1.7 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 1.7 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 1.7 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 1.7 thorpej * POSSIBILITY OF SUCH DAMAGE. 31 1.2 mycroft */ 32 1.2 mycroft 33 1.2 mycroft /* 34 1.2 mycroft * Originally written by Julian Elischer (julian (at) tfs.com) 35 1.2 mycroft * for TRW Financial Systems for use under the MACH(2.5) operating system. 36 1.2 mycroft * 37 1.2 mycroft * TRW Financial Systems, in accordance with their agreement with Carnegie 38 1.2 mycroft * Mellon University, makes this software available to CMU to distribute 39 1.2 mycroft * or use in any manner that they see fit as long as this message is kept with 40 1.2 mycroft * the software. For this reason TFS also grants any other persons or 41 1.2 mycroft * organisations permission to use or modify this software. 42 1.2 mycroft * 43 1.2 mycroft * TFS supplies this software to be publicly redistributed 44 1.2 mycroft * on the understanding that TFS is not responsible for the correct 45 1.2 mycroft * functioning of this software in any circumstances. 46 1.2 mycroft */ 47 1.2 mycroft 48 1.1 mycroft typedef u_int8_t physaddr[4]; 49 1.1 mycroft typedef u_int8_t physlen[4]; 50 1.1 mycroft #define ltophys _lto4l 51 1.1 mycroft #define phystol _4ltol 52 1.1 mycroft 53 1.1 mycroft /* 54 1.1 mycroft * I/O port offsets 55 1.1 mycroft */ 56 1.1 mycroft #define BHA_CTRL_PORT 0 /* control (wo) */ 57 1.1 mycroft #define BHA_STAT_PORT 0 /* status (ro) */ 58 1.1 mycroft #define BHA_CMD_PORT 1 /* command (wo) */ 59 1.1 mycroft #define BHA_DATA_PORT 1 /* data (ro) */ 60 1.1 mycroft #define BHA_INTR_PORT 2 /* interrupt status (ro) */ 61 1.6 jonathan #define BHA_EXTGEOM_PORT 3 /* extended geometry (ro) */ 62 1.1 mycroft 63 1.1 mycroft /* 64 1.1 mycroft * BHA_CTRL bits 65 1.1 mycroft */ 66 1.1 mycroft #define BHA_CTRL_HRST 0x80 /* Hardware reset */ 67 1.1 mycroft #define BHA_CTRL_SRST 0x40 /* Software reset */ 68 1.1 mycroft #define BHA_CTRL_IRST 0x20 /* Interrupt reset */ 69 1.1 mycroft #define BHA_CTRL_SCRST 0x10 /* SCSI bus reset */ 70 1.1 mycroft 71 1.1 mycroft /* 72 1.1 mycroft * BHA_STAT bits 73 1.1 mycroft */ 74 1.1 mycroft #define BHA_STAT_STST 0x80 /* Self test in Progress */ 75 1.1 mycroft #define BHA_STAT_DIAGF 0x40 /* Diagnostic Failure */ 76 1.1 mycroft #define BHA_STAT_INIT 0x20 /* Mbx Init required */ 77 1.1 mycroft #define BHA_STAT_IDLE 0x10 /* Host Adapter Idle */ 78 1.1 mycroft #define BHA_STAT_CDF 0x08 /* cmd/data out port full */ 79 1.1 mycroft #define BHA_STAT_DF 0x04 /* Data in port full */ 80 1.1 mycroft #define BHA_STAT_INVDCMD 0x01 /* Invalid command */ 81 1.1 mycroft 82 1.1 mycroft /* 83 1.1 mycroft * BHA_CMD opcodes 84 1.1 mycroft */ 85 1.1 mycroft #define BHA_NOP 0x00 /* No operation */ 86 1.1 mycroft #define BHA_MBX_INIT 0x01 /* Mbx initialization */ 87 1.1 mycroft #define BHA_START_SCSI 0x02 /* start scsi command */ 88 1.16 bouyer #define BHA_EXECUTE_BIOS_CMD 0x03 /* execute BIOS command */ 89 1.1 mycroft #define BHA_INQUIRE_REVISION 0x04 /* Adapter Inquiry */ 90 1.1 mycroft #define BHA_MBO_INTR_EN 0x05 /* Enable MBO available interrupt */ 91 1.1 mycroft #define BHA_SEL_TIMEOUT_SET 0x06 /* set selection time-out */ 92 1.1 mycroft #define BHA_BUS_ON_TIME_SET 0x07 /* set bus-on time */ 93 1.1 mycroft #define BHA_BUS_OFF_TIME_SET 0x08 /* set bus-off time */ 94 1.16 bouyer #define BHA_BUS_SPEED_SET 0x09 /* set bus transfer speed */ 95 1.1 mycroft #define BHA_INQUIRE_DEVICES 0x0a /* return installed devices 0-7 */ 96 1.1 mycroft #define BHA_INQUIRE_CONFIG 0x0b /* return configuration data */ 97 1.1 mycroft #define BHA_TARGET_EN 0x0c /* enable target mode */ 98 1.1 mycroft #define BHA_INQUIRE_SETUP 0x0d /* return setup data */ 99 1.16 bouyer #define BHA_WRITE_LRAM 0x1a /* write adapter local RAM */ 100 1.16 bouyer #define BHA_READ_LRAM 0x1b /* read adapter local RAM */ 101 1.16 bouyer #define BHA_WRITE_CHIP_FIFO 0x1c /* write bus master chip FIFO */ 102 1.16 bouyer #define BHA_READ_CHIP_FIFO 0x1d /* read bus master chip FIFO */ 103 1.16 bouyer #define BHA_ECHO 0x1f /* Echo command byte */ 104 1.16 bouyer #define BHA_ADAPTER_DIAGNOSTICS 0x20 /* host adapter diagnostics */ 105 1.16 bouyer #define BHA_SET_ADAPTER_OPTIONS 0x21 /* set adapter options */ 106 1.1 mycroft #define BHA_INQUIRE_DEVICES_2 0x23 /* return installed devices 8-15 */ 107 1.16 bouyer #define BHA_INQUIRE_TARG_DEVS 0x24 /* inquire target devices */ 108 1.16 bouyer #define BHA_DISABLE_HAC_INTR 0x25 /* disable host adapter interrupt */ 109 1.1 mycroft #define BHA_MBX_INIT_EXTENDED 0x81 /* Mbx initialization */ 110 1.16 bouyer #define BHA_EXECUTE_SCSI_CMD 0x83 /* execute SCSI command */ 111 1.1 mycroft #define BHA_INQUIRE_REVISION_3 0x84 /* Get 3rd firmware version byte */ 112 1.1 mycroft #define BHA_INQUIRE_REVISION_4 0x85 /* Get 4th firmware version byte */ 113 1.16 bouyer #define BHA_INQUIRE_PCI_INFO 0x86 /* get PCI host adapter information */ 114 1.1 mycroft #define BHA_INQUIRE_MODEL 0x8b /* Get hardware ID and revision */ 115 1.1 mycroft #define BHA_INQUIRE_PERIOD 0x8c /* Get synchronous period */ 116 1.1 mycroft #define BHA_INQUIRE_EXTENDED 0x8d /* Adapter Setup Inquiry */ 117 1.16 bouyer #define BHA_ROUND_ROBIN 0x8f /* Enable/Disable(default) 118 1.16 bouyer round robin */ 119 1.16 bouyer #define BHA_STORE_LRAM 0x90 /* store host adapter local RAM */ 120 1.16 bouyer #define BHA_FETCH_LRAM 0x91 /* fetch host adapter local RAM */ 121 1.16 bouyer #define BHA_SAVE_TO_EEPROM 0x92 /* store local RAM data in EEPROM */ 122 1.16 bouyer #define BHA_UPLOAD_AUTOSCSI 0x94 /* upload AutoSCSI code */ 123 1.3 jonathan #define BHA_MODIFY_IOPORT 0x95 /* change or disable I/O port */ 124 1.16 bouyer #define BHA_SET_CCB_FORMAT 0x96 /* set CCB format (legacy/wide lun) */ 125 1.16 bouyer #define BHA_WRITE_INQUIRY_BUF 0x9a /* write inquiry buffer */ 126 1.16 bouyer #define BHA_READ_INQUIRY_BUF 0x9b /* read inquiry buffer */ 127 1.16 bouyer #define BHA_FLASH_UP_DOWNLOAD 0xa7 /* flash upload/downlod */ 128 1.16 bouyer #define BHA_READ_SCAM_DATA 0xa8 /* read SCAM data */ 129 1.16 bouyer #define BHA_WRITE_SCAM_DATA 0xa9 /* write SCAM data */ 130 1.1 mycroft 131 1.1 mycroft /* 132 1.1 mycroft * BHA_INTR bits 133 1.1 mycroft */ 134 1.1 mycroft #define BHA_INTR_ANYINTR 0x80 /* Any interrupt */ 135 1.1 mycroft #define BHA_INTR_SCRD 0x08 /* SCSI reset detected */ 136 1.1 mycroft #define BHA_INTR_HACC 0x04 /* Command complete */ 137 1.1 mycroft #define BHA_INTR_MBOA 0x02 /* MBX out empty */ 138 1.1 mycroft #define BHA_INTR_MBIF 0x01 /* MBX in full */ 139 1.1 mycroft 140 1.1 mycroft struct bha_mbx_out { 141 1.1 mycroft physaddr ccb_addr; 142 1.16 bouyer u_int8_t reserved[3]; 143 1.16 bouyer u_int8_t cmd; 144 1.1 mycroft }; 145 1.1 mycroft 146 1.1 mycroft struct bha_mbx_in { 147 1.1 mycroft physaddr ccb_addr; 148 1.16 bouyer u_int8_t host_stat; 149 1.16 bouyer u_int8_t target_stat; 150 1.16 bouyer u_int8_t reserved; 151 1.16 bouyer u_int8_t comp_stat; 152 1.1 mycroft }; 153 1.1 mycroft 154 1.1 mycroft /* 155 1.1 mycroft * mbo.cmd values 156 1.1 mycroft */ 157 1.1 mycroft #define BHA_MBO_FREE 0x0 /* MBO entry is free */ 158 1.1 mycroft #define BHA_MBO_START 0x1 /* MBO activate entry */ 159 1.1 mycroft #define BHA_MBO_ABORT 0x2 /* MBO abort entry */ 160 1.1 mycroft 161 1.1 mycroft /* 162 1.16 bouyer * mbi.comp_stat values 163 1.1 mycroft */ 164 1.1 mycroft #define BHA_MBI_FREE 0x0 /* MBI entry is free */ 165 1.1 mycroft #define BHA_MBI_OK 0x1 /* completed without error */ 166 1.1 mycroft #define BHA_MBI_ABORT 0x2 /* aborted ccb */ 167 1.1 mycroft #define BHA_MBI_UNKNOWN 0x3 /* Tried to abort invalid CCB */ 168 1.1 mycroft #define BHA_MBI_ERROR 0x4 /* Completed with error */ 169 1.21 jdolecek #define BHA_MBI_BADCCB 0x5 /* invalid CCB */ 170 1.1 mycroft 171 1.1 mycroft #if defined(BIG_DMA) 172 1.1 mycroft WARNING...THIS WON'T WORK(won't fit on 1 page) 173 1.1 mycroft #if 0 174 1.1 mycroft #define BHA_NSEG 2048 /* Number of scatter gather segments - to much vm */ 175 1.1 mycroft #endif 176 1.1 mycroft #define BHA_NSEG 128 177 1.1 mycroft #else 178 1.1 mycroft #define BHA_NSEG 33 179 1.1 mycroft #endif /* BIG_DMA */ 180 1.1 mycroft 181 1.1 mycroft struct bha_scat_gath { 182 1.16 bouyer physlen seg_len; 183 1.1 mycroft physaddr seg_addr; 184 1.1 mycroft }; 185 1.1 mycroft 186 1.1 mycroft struct bha_ccb { 187 1.13 thorpej u_int8_t opcode; 188 1.14 wrstuden #if BYTE_ORDER == LITTLE_ENDIAN 189 1.13 thorpej u_int8_t :3, 190 1.13 thorpej data_in :1, 191 1.13 thorpej data_out :1, 192 1.13 thorpej wide_tag_enable :1, /* Wide Lun CCB format */ 193 1.13 thorpej wide_tag_type :2; /* Wide Lun CCB format */ 194 1.14 wrstuden #else 195 1.14 wrstuden u_int8_t wide_tag_type :2, /* Wide Lun CCB format */ 196 1.14 wrstuden wide_tag_enable :1, /* Wide Lun CCB format */ 197 1.14 wrstuden data_out :1, 198 1.14 wrstuden data_in :1, 199 1.14 wrstuden :3; 200 1.14 wrstuden #endif 201 1.13 thorpej u_int8_t scsi_cmd_length; 202 1.13 thorpej u_int8_t req_sense_length; 203 1.1 mycroft /*------------------------------------longword boundary */ 204 1.16 bouyer physlen data_length; 205 1.1 mycroft /*------------------------------------longword boundary */ 206 1.16 bouyer physaddr data_addr; 207 1.1 mycroft /*------------------------------------longword boundary */ 208 1.16 bouyer u_int8_t reserved1[2]; 209 1.16 bouyer u_int8_t host_stat; 210 1.16 bouyer u_int8_t target_stat; 211 1.1 mycroft /*------------------------------------longword boundary */ 212 1.13 thorpej u_int8_t target; 213 1.14 wrstuden #if BYTE_ORDER == LITTLE_ENDIAN 214 1.13 thorpej u_int8_t lun :5, 215 1.13 thorpej tag_enable :1, 216 1.13 thorpej tag_type :2; 217 1.14 wrstuden #else 218 1.14 wrstuden u_int8_t tag_type :2, 219 1.14 wrstuden tag_enable :1, 220 1.14 wrstuden lun :5; 221 1.14 wrstuden #endif 222 1.13 thorpej u_int8_t scsi_cmd[12]; 223 1.13 thorpej u_int8_t reserved2[1]; 224 1.13 thorpej u_int8_t link_id; 225 1.1 mycroft /*------------------------------------longword boundary */ 226 1.16 bouyer physaddr link_addr; 227 1.1 mycroft /*------------------------------------longword boundary */ 228 1.16 bouyer physaddr sense_ptr; 229 1.1 mycroft /*-----end of HW fields-----------------------longword boundary */ 230 1.18 thorpej struct scsi_sense_data scsi_sense; 231 1.1 mycroft /*------------------------------------longword boundary */ 232 1.1 mycroft struct bha_scat_gath scat_gath[BHA_NSEG]; 233 1.1 mycroft /*------------------------------------longword boundary */ 234 1.1 mycroft TAILQ_ENTRY(bha_ccb) chain; 235 1.16 bouyer struct bha_ccb *nexthash; 236 1.16 bouyer bus_addr_t hashkey; 237 1.16 bouyer 238 1.8 bouyer struct scsipi_xfer *xs; /* the scsipi_xfer for this cmd */ 239 1.16 bouyer 240 1.1 mycroft int flags; 241 1.1 mycroft #define CCB_ALLOC 0x01 242 1.1 mycroft #define CCB_ABORT 0x02 243 1.1 mycroft #ifdef BHADIAG 244 1.1 mycroft #define CCB_SENDING 0x04 245 1.1 mycroft #endif 246 1.1 mycroft int timeout; 247 1.7 thorpej 248 1.7 thorpej /* 249 1.7 thorpej * This DMA map maps the buffer involved in the transfer. 250 1.7 thorpej * Its contents are loaded into "scat_gath" above. 251 1.7 thorpej */ 252 1.7 thorpej bus_dmamap_t dmamap_xfer; 253 1.1 mycroft }; 254 1.1 mycroft 255 1.1 mycroft /* 256 1.1 mycroft * opcode fields 257 1.1 mycroft */ 258 1.1 mycroft #define BHA_INITIATOR_CCB 0x00 /* SCSI Initiator CCB */ 259 1.1 mycroft #define BHA_TARGET_CCB 0x01 /* SCSI Target CCB */ 260 1.16 bouyer #define BHA_INIT_SCAT_GATH_CCB 0x02 /* SCSI Initiator with S/G */ 261 1.16 bouyer #define BHA_INIT_RESID_CCB 0x03 /* SCSI Initiator w/ residual */ 262 1.16 bouyer #define BHA_INIT_RESID_SG_CCB 0x04 /* SCSI Initiator w/ residual and S/G */ 263 1.1 mycroft #define BHA_RESET_CCB 0x81 /* SCSI Bus reset */ 264 1.1 mycroft 265 1.1 mycroft /* 266 1.1 mycroft * bha_ccb.host_stat values 267 1.1 mycroft */ 268 1.16 bouyer #define BHA_OK 0x00 /* cmd ok */ 269 1.16 bouyer #define BHA_LINK_OK 0x0a /* Link cmd ok */ 270 1.16 bouyer #define BHA_LINK_IT 0x0b /* Link cmd ok + int */ 271 1.16 bouyer #define BHA_DATA_UNDRN 0x0c /* data underrun error */ 272 1.16 bouyer #define BHA_SEL_TIMEOUT 0x11 /* Selection time out */ 273 1.16 bouyer #define BHA_OVER_UNDER 0x12 /* Data over/under run */ 274 1.16 bouyer #define BHA_BUS_FREE 0x13 /* Bus dropped at unexpected time */ 275 1.16 bouyer #define BHA_INV_BUS 0x14 /* Invalid bus phase/sequence */ 276 1.16 bouyer #define BHA_BAD_MBO 0x15 /* Incorrect MBO cmd */ 277 1.16 bouyer #define BHA_BAD_CCB 0x16 /* Incorrect ccb opcode */ 278 1.16 bouyer #define BHA_BAD_LINK 0x17 /* Not same values of LUN for links */ 279 1.16 bouyer #define BHA_INV_TARGET 0x18 /* Invalid target direction */ 280 1.16 bouyer #define BHA_CCB_DUP 0x19 /* Duplicate CCB received */ 281 1.16 bouyer #define BHA_INV_CCB 0x1a /* Invalid CCB or segment list */ 282 1.16 bouyer #define BHA_AUTOSENSE_FAILED 0x1b /* auto REQUEST SENSE failed */ 283 1.16 bouyer #define BHA_TAGGED_MSG_REJ 0x1c /* tagged queueing message rejected */ 284 1.16 bouyer #define BHA_UNSUP_MSG_RECVD 0x1d /* unsupported message received */ 285 1.16 bouyer #define BHA_HARDWARE_FAILURE 0x20 /* host adapter hardware failure */ 286 1.16 bouyer #define BHA_TARG_IGNORED_ATN 0x21 /* target ignored ATN signal */ 287 1.16 bouyer #define BHA_HA_SCSI_BUS_RESET 0x22 /* host adapter asserted RST */ 288 1.16 bouyer #define BHA_OTHER_SCSI_BUS_RESET 0x23 /* other device asserted RST */ 289 1.16 bouyer #define BHA_BAD_RECONNECT 0x24 /* target reconnected improperly */ 290 1.16 bouyer #define BHA_HA_BUS_DEVICE_RESET 0x25 /* host adapter performed BDR */ 291 1.16 bouyer #define BHA_ABORT_QUEUE 0x26 /* abort queue generated */ 292 1.16 bouyer #define BHA_SOFTWARE_FAILURE 0x27 /* host adapter software failure */ 293 1.16 bouyer #define BHA_HARDWARE_WATCHDOG 0x30 /* host adapter watchdog timer fired */ 294 1.16 bouyer #define BHA_SCSI_PARITY_ERROR 0x34 /* SCSI parity error detected */ 295 1.1 mycroft 296 1.1 mycroft struct bha_extended_inquire { 297 1.1 mycroft struct { 298 1.1 mycroft u_char opcode; 299 1.1 mycroft u_char len; 300 1.1 mycroft } cmd; 301 1.1 mycroft struct { 302 1.1 mycroft u_char bus_type; /* Type of bus connected to */ 303 1.1 mycroft #define BHA_BUS_TYPE_24BIT 'A' /* ISA bus */ 304 1.1 mycroft #define BHA_BUS_TYPE_32BIT 'E' /* EISA/VLB/PCI bus */ 305 1.1 mycroft #define BHA_BUS_TYPE_MCA 'M' /* MicroChannel bus */ 306 1.1 mycroft u_char bios_address; /* Address of adapter BIOS */ 307 1.4 jonathan u_short sg_limit; 308 1.4 jonathan u_char mbox_count; 309 1.16 bouyer u_char mbox_baseaddr[4]; /* packed/unaligned u_int32_t */ 310 1.4 jonathan u_char intrflags; 311 1.16 bouyer #define BHA_INTR_FASTEISA 0x04 312 1.16 bouyer #define BHA_INTR_LEVEL 0x40 /* bit 6: level-sensitive interrupt */ 313 1.4 jonathan u_char firmware_level[3]; /* last 3 digits of firmware rev */ 314 1.16 bouyer u_char scsi_flags; /* supported SCSI features */ 315 1.16 bouyer #define BHA_SCSI_WIDE 0x01 /* host adapter is wide */ 316 1.16 bouyer #define BHA_SCSI_DIFFERENTIAL 0x02 /* host adapter is differential */ 317 1.16 bouyer #define BHA_SCSI_SCAM 0x04 /* host adapter supports SCAM */ 318 1.16 bouyer #define BHA_SCSI_ULTRA 0x08 /* host adapter supports Ultra */ 319 1.16 bouyer #define BHA_SCSI_TERMINATION 0x10 /* host adapter supports smart 320 1.16 bouyer termination */ 321 1.1 mycroft } reply; 322 1.1 mycroft }; 323 1.1 mycroft 324 1.1 mycroft struct bha_config { 325 1.1 mycroft struct { 326 1.1 mycroft u_char opcode; 327 1.1 mycroft } cmd; 328 1.1 mycroft struct { 329 1.1 mycroft u_char chan; 330 1.1 mycroft u_char intr; 331 1.14 wrstuden #if BYTE_ORDER == LITTLE_ENDIAN 332 1.14 wrstuden u_char scsi_dev :3, 333 1.14 wrstuden :5; 334 1.14 wrstuden #else 335 1.14 wrstuden u_char :5, 336 1.14 wrstuden scsi_dev :3; 337 1.14 wrstuden #endif 338 1.1 mycroft } reply; 339 1.1 mycroft }; 340 1.1 mycroft 341 1.1 mycroft struct bha_toggle { 342 1.1 mycroft struct { 343 1.1 mycroft u_char opcode; 344 1.1 mycroft u_char enable; 345 1.1 mycroft } cmd; 346 1.1 mycroft }; 347 1.1 mycroft 348 1.1 mycroft struct bha_mailbox { 349 1.1 mycroft struct { 350 1.1 mycroft u_char opcode; 351 1.1 mycroft u_char nmbx; 352 1.1 mycroft physaddr addr; 353 1.1 mycroft } cmd; 354 1.1 mycroft }; 355 1.1 mycroft 356 1.1 mycroft struct bha_model { 357 1.1 mycroft struct { 358 1.1 mycroft u_char opcode; 359 1.1 mycroft u_char len; 360 1.1 mycroft } cmd; 361 1.1 mycroft struct { 362 1.1 mycroft u_char id[4]; /* i.e bt742a -> '7','4','2','A' */ 363 1.1 mycroft u_char version[2]; /* i.e Board Revision 'H' -> 'H', 0x00 */ 364 1.1 mycroft } reply; 365 1.1 mycroft }; 366 1.1 mycroft 367 1.1 mycroft struct bha_revision { 368 1.1 mycroft struct { 369 1.1 mycroft u_char opcode; 370 1.1 mycroft } cmd; 371 1.1 mycroft struct { 372 1.1 mycroft u_char board_type; 373 1.1 mycroft u_char custom_feature; 374 1.1 mycroft char firm_revision; 375 1.1 mycroft u_char firm_version; 376 1.1 mycroft } reply; 377 1.1 mycroft }; 378 1.1 mycroft 379 1.1 mycroft struct bha_digit { 380 1.1 mycroft struct { 381 1.1 mycroft u_char opcode; 382 1.1 mycroft } cmd; 383 1.1 mycroft struct { 384 1.1 mycroft u_char digit; 385 1.1 mycroft } reply; 386 1.1 mycroft }; 387 1.1 mycroft 388 1.1 mycroft struct bha_devices { 389 1.1 mycroft struct { 390 1.1 mycroft u_char opcode; 391 1.1 mycroft } cmd; 392 1.1 mycroft struct { 393 1.10 thorpej u_char lun_map[8]; 394 1.1 mycroft } reply; 395 1.1 mycroft }; 396 1.1 mycroft 397 1.5 thorpej struct bha_sync { 398 1.14 wrstuden #if BYTE_ORDER == LITTLE_ENDIAN 399 1.14 wrstuden u_char offset :4, 400 1.14 wrstuden period :3, 401 1.14 wrstuden valid :1; 402 1.14 wrstuden #else 403 1.14 wrstuden u_char valid :1, 404 1.14 wrstuden period :3, 405 1.14 wrstuden offset :4; 406 1.14 wrstuden #endif 407 1.5 thorpej }; 408 1.5 thorpej 409 1.5 thorpej struct bha_setup_reply { 410 1.14 wrstuden #if BYTE_ORDER == LITTLE_ENDIAN 411 1.13 thorpej u_int8_t sync_neg :1, 412 1.13 thorpej parity :1, 413 1.13 thorpej :6; 414 1.14 wrstuden #else 415 1.14 wrstuden u_int8_t :6, 416 1.14 wrstuden parity :1, 417 1.14 wrstuden sync_neg :1; 418 1.14 wrstuden #endif 419 1.13 thorpej u_int8_t speed; 420 1.13 thorpej u_int8_t bus_on; 421 1.13 thorpej u_int8_t bus_off; 422 1.13 thorpej u_int8_t num_mbx; 423 1.13 thorpej u_int8_t mbx[3]; /*XXX */ 424 1.5 thorpej /* doesn't make sense with 32bit addresses */ 425 1.16 bouyer struct bha_sync sync_low[8]; 426 1.16 bouyer u_int8_t low_disc_info; 427 1.5 thorpej }; 428 1.5 thorpej 429 1.17 wiz /* additional reply data supplied by wide controllers */ 430 1.16 bouyer struct bha_setup_reply_wide { 431 1.16 bouyer u_int8_t signature; 432 1.16 bouyer u_int8_t letter_d; 433 1.16 bouyer u_int8_t ha_type; 434 1.16 bouyer u_int8_t low_wide_allowed; 435 1.16 bouyer u_int8_t low_wide_active; 436 1.16 bouyer struct bha_sync sync_high[8]; 437 1.16 bouyer u_int8_t high_disc_info; 438 1.16 bouyer u_int8_t reserved; 439 1.16 bouyer u_int8_t high_wide_allowed; 440 1.16 bouyer u_int8_t high_wide_active; 441 1.5 thorpej }; 442 1.5 thorpej 443 1.1 mycroft struct bha_setup { 444 1.1 mycroft struct { 445 1.1 mycroft u_char opcode; 446 1.1 mycroft u_char len; 447 1.1 mycroft } cmd; 448 1.5 thorpej struct bha_setup_reply reply; 449 1.16 bouyer struct bha_setup_reply_wide reply_w; /* for wide controllers */ 450 1.5 thorpej }; 451 1.5 thorpej 452 1.5 thorpej struct bha_period_reply { 453 1.5 thorpej u_char period[8]; 454 1.1 mycroft }; 455 1.1 mycroft 456 1.1 mycroft struct bha_period { 457 1.1 mycroft struct { 458 1.1 mycroft u_char opcode; 459 1.1 mycroft u_char len; 460 1.1 mycroft } cmd; 461 1.5 thorpej struct bha_period_reply reply; 462 1.5 thorpej struct bha_period_reply reply_w; /* for wide controllers */ 463 1.1 mycroft }; 464 1.3 jonathan 465 1.3 jonathan struct bha_isadisable { 466 1.3 jonathan struct { 467 1.3 jonathan u_char opcode; 468 1.3 jonathan u_char modifier; 469 1.3 jonathan } cmd; 470 1.3 jonathan }; 471 1.3 jonathan 472 1.3 jonathan /* 473 1.3 jonathan * bha_isadisable.modifier parameters 474 1.3 jonathan */ 475 1.3 jonathan #define BHA_IOMODIFY_330 0x00 476 1.3 jonathan #define BHA_IOMODIFY_334 0x01 477 1.3 jonathan #define BHA_IOMODIFY_DISABLE1 0x06 478 1.3 jonathan #define BHA_IOMODIFY_DISABLE2 0x07 479 1.1 mycroft 480 1.1 mycroft #define INT9 0x01 481 1.1 mycroft #define INT10 0x02 482 1.1 mycroft #define INT11 0x04 483 1.1 mycroft #define INT12 0x08 484 1.1 mycroft #define INT14 0x20 485 1.1 mycroft #define INT15 0x40 486 1.1 mycroft 487 1.1 mycroft #define EISADMA 0x00 488 1.1 mycroft #define CHAN0 0x01 489 1.1 mycroft #define CHAN5 0x20 490 1.1 mycroft #define CHAN6 0x40 491 1.1 mycroft #define CHAN7 0x80 492