1 /* $NetBSD: btlreg.h,v 1.4.2.3 2005/03/04 16:38:03 skrll Exp $ */
3 typedef uint8_t physaddr
[4];
4 typedef uint8_t physlen
[4];
11 #define BT_CTRL_PORT 0 /* control (wo) */
12 #define BT_STAT_PORT 0 /* status (ro) */
13 #define BT_CMD_PORT 1 /* command (wo) */
14 #define BT_DATA_PORT 1 /* data (ro) */
15 #define BT_INTR_PORT 2 /* interrupt status (ro) */
20 #define BT_CTRL_HRST 0x80 /* Hardware reset */
21 #define BT_CTRL_SRST 0x40 /* Software reset */
22 #define BT_CTRL_IRST 0x20 /* Interrupt reset */
23 #define BT_CTRL_SCRST 0x10 /* SCSI bus reset */
28 #define BT_STAT_STST 0x80 /* Self test in Progress */
29 #define BT_STAT_DIAGF 0x40 /* Diagnostic Failure */
30 #define BT_STAT_INIT 0x20 /* Mbx Init required */
31 #define BT_STAT_IDLE 0x10 /* Host Adapter Idle */
32 #define BT_STAT_CDF 0x08 /* cmd/data out port full */
33 #define BT_STAT_DF 0x04 /* Data in port full */
34 #define BT_STAT_INVDCMD 0x01 /* Invalid command */
39 #define BT_NOP 0x00 /* No operation */
40 #define BT_MBX_INIT 0x01 /* Mbx initialization */
41 #define BT_START_SCSI 0x02 /* start scsi command */
42 #define BT_INQUIRE_REVISION 0x04 /* Adapter Inquiry */
43 #define BT_MBO_INTR_EN 0x05 /* Enable MBO available interrupt */
45 #define BT_SEL_TIMEOUT_SET 0x06 /* set selection time-out */
46 #define BT_BUS_ON_TIME_SET 0x07 /* set bus-on time */
47 #define BT_BUS_OFF_TIME_SET 0x08 /* set bus-off time */
48 #define BT_SPEED_SET 0x09 /* set transfer speed */
50 #define BT_INQUIRE_DEVICES 0x0a /* return installed devices 0-7 */
51 #define BT_INQUIRE_CONFIG 0x0b /* return configuration data */
52 #define BT_TARGET_EN 0x0c /* enable target mode */
53 #define BT_INQUIRE_SETUP 0x0d /* return setup data */
54 #define BT_ECHO 0x1e /* Echo command data */
55 #define BT_INQUIRE_DEVICES_2 0x23 /* return installed devices 8-15 */
56 #define BT_MBX_INIT_EXTENDED 0x81 /* Mbx initialization */
57 #define BT_INQUIRE_REVISION_3 0x84 /* Get 3rd firmware version byte */
58 #define BT_INQUIRE_REVISION_4 0x85 /* Get 4th firmware version byte */
59 #define BT_INQUIRE_MODEL 0x8b /* Get hardware ID and revision */
60 #define BT_INQUIRE_PERIOD 0x8c /* Get synchronous period */
61 #define BT_INQUIRE_EXTENDED 0x8d /* Adapter Setup Inquiry */
62 #define BT_ROUND_ROBIN 0x8f /* Enable/Disable(default) round robin */
67 #define BT_INTR_ANYINTR 0x80 /* Any interrupt */
68 #define BT_INTR_SCRD 0x08 /* SCSI reset detected */
69 #define BT_INTR_HACC 0x04 /* Command complete */
70 #define BT_INTR_MBOA 0x02 /* MBX out empty */
71 #define BT_INTR_MBIF 0x01 /* MBX in full */
88 #define BT_MBO_FREE 0x0 /* MBO entry is free */
89 #define BT_MBO_START 0x1 /* MBO activate entry */
90 #define BT_MBO_ABORT 0x2 /* MBO abort entry */
95 #define BT_MBI_FREE 0x0 /* MBI entry is free */
96 #define BT_MBI_OK 0x1 /* completed without error */
97 #define BT_MBI_ABORT 0x2 /* aborted ccb */
98 #define BT_MBI_UNKNOWN 0x3 /* Tried to abort invalid CCB */
99 #define BT_MBI_ERROR 0x4 /* Completed with error */
102 #define BT_NSEG 2048 /* Number of scatter gather segments - to much vm */
104 #define BT_NSEG (MAXPHYS / PAGE_SIZE)
107 struct bt_scat_gath
{
114 u_char
:3, data_in
:1, data_out
:1,:3;
115 u_char scsi_cmd_length
;
116 u_char req_sense_length
;
117 /*------------------------------------longword boundary */
119 /*------------------------------------longword boundary */
121 /*------------------------------------longword boundary */
125 /*------------------------------------longword boundary */
131 /*------------------------------------longword boundary */
133 /*------------------------------------longword boundary */
135 /*-----end of HW fields-----------------------longword boundary */
136 struct scsi_sense_data scsi_sense
;
137 /*------------------------------------longword boundary */
138 struct bt_scat_gath scat_gath
[BT_NSEG
];
139 /*------------------------------------longword boundary */
140 TAILQ_ENTRY(bt_ccb
) chain
;
141 struct bt_ccb
*nexthash
;
143 struct scsipi_xfer
*xs
; /* the scsi_xfer for this cmd */
145 #define CCB_ALLOC 0x01
146 #define CCB_ABORT 0x02
148 #define CCB_SENDING 0x04
154 TAILQ_ENTRY(bt_buf
) chain
;
155 char buf
[4096 - 2 * sizeof(struct bt_buf
*)];
161 #define BT_INITIATOR_CCB 0x00 /* SCSI Initiator CCB */
162 #define BT_TARGET_CCB 0x01 /* SCSI Target CCB */
163 #define BT_INIT_SCAT_GATH_CCB 0x02 /* SCSI Initiator with scattter gather */
164 #define BT_RESET_CCB 0x81 /* SCSI Bus reset */
167 * bt_ccb.host_stat values
169 #define BT_OK 0x00 /* cmd ok */
170 #define BT_LINK_OK 0x0a /* Link cmd ok */
171 #define BT_LINK_IT 0x0b /* Link cmd ok + int */
172 #define BT_SEL_TIMEOUT 0x11 /* Selection time out */
173 #define BT_OVER_UNDER 0x12 /* Data over/under run */
174 #define BT_BUS_FREE 0x13 /* Bus dropped at unexpected time */
175 #define BT_INV_BUS 0x14 /* Invalid bus phase/sequence */
176 #define BT_BAD_MBO 0x15 /* Incorrect MBO cmd */
177 #define BT_BAD_CCB 0x16 /* Incorrect ccb opcode */
178 #define BT_BAD_LINK 0x17 /* Not same values of LUN for links */
179 #define BT_INV_TARGET 0x18 /* Invalid target direction */
180 #define BT_CCB_DUP 0x19 /* Duplicate CCB received */
181 #define BT_INV_CCB 0x1a /* Invalid CCB or segment list */
183 struct bt_extended_inquire
{
189 u_char bus_type
; /* Type of bus connected to */
190 #define BT_BUS_TYPE_24BIT 'A' /* ISA bus */
191 #define BT_BUS_TYPE_32BIT 'E' /* EISA/VLB/PCI bus */
192 #define BT_BUS_TYPE_MCA 'M' /* MicroChannel bus */
193 u_char bios_address
; /* Address of adapter BIOS */
194 u_short max_segment
; /* ? */
231 u_char id
[4]; /* i.e bt742a -> '7','4','2','A' */
232 u_char version
[2]; /* i.e Board Revision 'H' -> 'H', 0x00 */
242 u_char custom_feature
;
279 u_char mbx
[3]; /*XXX */
280 /* doesn't make sense with 32bit addresses */