1 #define ASC_VERSION "3.4" /* AdvanSys Driver Version */
4 * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters
6 * Copyright (c) 1995-2000 Advanced System Products, Inc.
7 * Copyright (c) 2000-2001 ConnectCom Solutions, Inc.
8 * Copyright (c) 2007 Matthew Wilcox <matthew@wil.cx>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
18 * As of March 8, 2000 Advanced System Products, Inc. (AdvanSys)
19 * changed its name to ConnectCom Solutions, Inc.
20 * On June 18, 2001 Initio Corp. acquired ConnectCom's SCSI assets
23 #include <linux/module.h>
24 #include <linux/string.h>
25 #include <linux/kernel.h>
26 #include <linux/types.h>
27 #include <linux/ioport.h>
28 #include <linux/interrupt.h>
29 #include <linux/delay.h>
30 #include <linux/slab.h>
32 #include <linux/proc_fs.h>
33 #include <linux/init.h>
34 #include <linux/blkdev.h>
35 #include <linux/isa.h>
36 #include <linux/eisa.h>
37 #include <linux/pci.h>
38 #include <linux/spinlock.h>
39 #include <linux/dma-mapping.h>
42 #include <asm/system.h>
45 #include <scsi/scsi_cmnd.h>
46 #include <scsi/scsi_device.h>
47 #include <scsi/scsi_tcq.h>
48 #include <scsi/scsi.h>
49 #include <scsi/scsi_host.h>
53 * 1. Although all of the necessary command mapping places have the
54 * appropriate dma_map.. APIs, the driver still processes its internal
55 * queue using bus_to_virt() and virt_to_bus() which are illegal under
56 * the API. The entire queue processing structure will need to be
57 * altered to fix this.
58 * 2. Need to add memory mapping workaround. Test the memory mapping.
59 * If it doesn't work revert to I/O port access. Can a test be done
61 * 3. Handle an interrupt not working. Keep an interrupt counter in
62 * the interrupt handler. In the timeout function if the interrupt
63 * has not occurred then print a message and run in polled mode.
64 * 4. Need to add support for target mode commands, cf. CAM XPT.
65 * 5. check DMA mapping functions for failure
66 * 6. Remove internal queueing
67 * 7. Use scsi_transport_spi
68 * 8. advansys_info is not safe against multiple simultaneous callers
70 * 10. Add module_param to override ISA/VLB ioport array
72 #warning this driver is still not properly converted to the DMA API
74 /* Enable driver assertions. */
75 #define ADVANSYS_ASSERT
77 /* Enable driver /proc statistics. */
78 #define ADVANSYS_STATS
80 /* Enable driver tracing. */
81 /* #define ADVANSYS_DEBUG */
84 * --- Asc Library Constants and Macros
87 #define ASC_LIB_VERSION_MAJOR 1
88 #define ASC_LIB_VERSION_MINOR 24
89 #define ASC_LIB_SERIAL_NUMBER 123
94 * Any instance where a 32-bit long or pointer type is assumed
95 * for precision or HW defined structures, the following define
96 * types must be used. In Linux the char, short, and int types
97 * are all consistent at 8, 16, and 32 bits respectively. Pointers
98 * and long types are 64 bits on Alpha and UltraSPARC.
100 #define ASC_PADDR __u32 /* Physical/Bus address data type. */
101 #define ASC_VADDR __u32 /* Virtual address data type. */
102 #define ASC_DCNT __u32 /* Unsigned Data count type. */
103 #define ASC_SDCNT __s32 /* Signed Data count type. */
106 * These macros are used to convert a virtual address to a
107 * 32-bit value. This currently can be used on Linux Alpha
108 * which uses 64-bit virtual address but a 32-bit bus address.
109 * This is likely to break in the future, but doing this now
110 * will give us time to change the HW and FW to handle 64-bit
113 #define ASC_VADDR_TO_U32 virt_to_bus
114 #define ASC_U32_TO_VADDR bus_to_virt
116 typedef unsigned char uchar
;
127 #define UW_ERR (uint)(0xFFFF)
128 #define isodd_word(val) ((((uint)val) & (uint)0x0001) != 0)
130 #define ASC_DVCLIB_CALL_DONE (1)
131 #define ASC_DVCLIB_CALL_FAILED (0)
132 #define ASC_DVCLIB_CALL_ERROR (-1)
134 #define PCI_VENDOR_ID_ASP 0x10cd
135 #define PCI_DEVICE_ID_ASP_1200A 0x1100
136 #define PCI_DEVICE_ID_ASP_ABP940 0x1200
137 #define PCI_DEVICE_ID_ASP_ABP940U 0x1300
138 #define PCI_DEVICE_ID_ASP_ABP940UW 0x2300
139 #define PCI_DEVICE_ID_38C0800_REV1 0x2500
140 #define PCI_DEVICE_ID_38C1600_REV1 0x2700
143 * Enable CC_VERY_LONG_SG_LIST to support up to 64K element SG lists.
144 * The SRB structure will have to be changed and the ASC_SRB2SCSIQ()
145 * macro re-defined to be able to obtain a ASC_SCSI_Q pointer from the
148 #define CC_VERY_LONG_SG_LIST 0
149 #define ASC_SRB2SCSIQ(srb_ptr) (srb_ptr)
151 #define PortAddr unsigned short /* port address size */
152 #define inp(port) inb(port)
153 #define outp(port, byte) outb((byte), (port))
155 #define inpw(port) inw(port)
156 #define outpw(port, word) outw((word), (port))
158 #define ASC_MAX_SG_QUEUE 7
159 #define ASC_MAX_SG_LIST 255
161 #define ASC_CS_TYPE unsigned short
163 #define ASC_IS_ISA (0x0001)
164 #define ASC_IS_ISAPNP (0x0081)
165 #define ASC_IS_EISA (0x0002)
166 #define ASC_IS_PCI (0x0004)
167 #define ASC_IS_PCI_ULTRA (0x0104)
168 #define ASC_IS_PCMCIA (0x0008)
169 #define ASC_IS_MCA (0x0020)
170 #define ASC_IS_VL (0x0040)
171 #define ASC_ISA_PNP_PORT_ADDR (0x279)
172 #define ASC_ISA_PNP_PORT_WRITE (ASC_ISA_PNP_PORT_ADDR+0x800)
173 #define ASC_IS_WIDESCSI_16 (0x0100)
174 #define ASC_IS_WIDESCSI_32 (0x0200)
175 #define ASC_IS_BIG_ENDIAN (0x8000)
176 #define ASC_CHIP_MIN_VER_VL (0x01)
177 #define ASC_CHIP_MAX_VER_VL (0x07)
178 #define ASC_CHIP_MIN_VER_PCI (0x09)
179 #define ASC_CHIP_MAX_VER_PCI (0x0F)
180 #define ASC_CHIP_VER_PCI_BIT (0x08)
181 #define ASC_CHIP_MIN_VER_ISA (0x11)
182 #define ASC_CHIP_MIN_VER_ISA_PNP (0x21)
183 #define ASC_CHIP_MAX_VER_ISA (0x27)
184 #define ASC_CHIP_VER_ISA_BIT (0x30)
185 #define ASC_CHIP_VER_ISAPNP_BIT (0x20)
186 #define ASC_CHIP_VER_ASYN_BUG (0x21)
187 #define ASC_CHIP_VER_PCI 0x08
188 #define ASC_CHIP_VER_PCI_ULTRA_3150 (ASC_CHIP_VER_PCI | 0x02)
189 #define ASC_CHIP_VER_PCI_ULTRA_3050 (ASC_CHIP_VER_PCI | 0x03)
190 #define ASC_CHIP_MIN_VER_EISA (0x41)
191 #define ASC_CHIP_MAX_VER_EISA (0x47)
192 #define ASC_CHIP_VER_EISA_BIT (0x40)
193 #define ASC_CHIP_LATEST_VER_EISA ((ASC_CHIP_MIN_VER_EISA - 1) + 3)
194 #define ASC_MAX_LIB_SUPPORTED_ISA_CHIP_VER 0x21
195 #define ASC_MAX_LIB_SUPPORTED_PCI_CHIP_VER 0x0A
196 #define ASC_MAX_VL_DMA_ADDR (0x07FFFFFFL)
197 #define ASC_MAX_VL_DMA_COUNT (0x07FFFFFFL)
198 #define ASC_MAX_PCI_DMA_ADDR (0xFFFFFFFFL)
199 #define ASC_MAX_PCI_DMA_COUNT (0xFFFFFFFFL)
200 #define ASC_MAX_ISA_DMA_ADDR (0x00FFFFFFL)
201 #define ASC_MAX_ISA_DMA_COUNT (0x00FFFFFFL)
202 #define ASC_MAX_EISA_DMA_ADDR (0x07FFFFFFL)
203 #define ASC_MAX_EISA_DMA_COUNT (0x07FFFFFFL)
205 #define ASC_SCSI_ID_BITS 3
206 #define ASC_SCSI_TIX_TYPE uchar
207 #define ASC_ALL_DEVICE_BIT_SET 0xFF
208 #define ASC_SCSI_BIT_ID_TYPE uchar
209 #define ASC_MAX_TID 7
210 #define ASC_MAX_LUN 7
211 #define ASC_SCSI_WIDTH_BIT_SET 0xFF
212 #define ASC_MAX_SENSE_LEN 32
213 #define ASC_MIN_SENSE_LEN 14
214 #define ASC_MAX_CDB_LEN 12
215 #define ASC_SCSI_RESET_HOLD_TIME_US 60
218 * Inquiry SPC-2 SPI Byte 1 EVPD (Enable Vital Product Data)
219 * and CmdDt (Command Support Data) field bit definitions.
221 #define ADV_INQ_RTN_VPD_AND_CMDDT 0x3
222 #define ADV_INQ_RTN_CMDDT_FOR_OP_CODE 0x2
223 #define ADV_INQ_RTN_VPD_FOR_PG_CODE 0x1
224 #define ADV_INQ_RTN_STD_INQUIRY_DATA 0x0
226 #define ASC_SCSIDIR_NOCHK 0x00
227 #define ASC_SCSIDIR_T2H 0x08
228 #define ASC_SCSIDIR_H2T 0x10
229 #define ASC_SCSIDIR_NODATA 0x18
230 #define SCSI_ASC_NOMEDIA 0x3A
231 #define ASC_SRB_HOST(x) ((uchar)((uchar)(x) >> 4))
232 #define ASC_SRB_TID(x) ((uchar)((uchar)(x) & (uchar)0x0F))
233 #define ASC_SRB_LUN(x) ((uchar)((uint)(x) >> 13))
234 #define PUT_CDB1(x) ((uchar)((uint)(x) >> 8))
235 #define MS_SDTR_LEN 0x03
236 #define MS_WDTR_LEN 0x02
238 #define ASC_SG_LIST_PER_Q 7
240 #define QS_READY 0x01
241 #define QS_DISC1 0x02
242 #define QS_DISC2 0x04
244 #define QS_ABORTED 0x40
246 #define QC_NO_CALLBACK 0x01
247 #define QC_SG_SWAP_QUEUE 0x02
248 #define QC_SG_HEAD 0x04
249 #define QC_DATA_IN 0x08
250 #define QC_DATA_OUT 0x10
251 #define QC_URGENT 0x20
252 #define QC_MSG_OUT 0x40
253 #define QC_REQ_SENSE 0x80
254 #define QCSG_SG_XFER_LIST 0x02
255 #define QCSG_SG_XFER_MORE 0x04
256 #define QCSG_SG_XFER_END 0x08
257 #define QD_IN_PROGRESS 0x00
258 #define QD_NO_ERROR 0x01
259 #define QD_ABORTED_BY_HOST 0x02
260 #define QD_WITH_ERROR 0x04
261 #define QD_INVALID_REQUEST 0x80
262 #define QD_INVALID_HOST_NUM 0x81
263 #define QD_INVALID_DEVICE 0x82
264 #define QD_ERR_INTERNAL 0xFF
265 #define QHSTA_NO_ERROR 0x00
266 #define QHSTA_M_SEL_TIMEOUT 0x11
267 #define QHSTA_M_DATA_OVER_RUN 0x12
268 #define QHSTA_M_DATA_UNDER_RUN 0x12
269 #define QHSTA_M_UNEXPECTED_BUS_FREE 0x13
270 #define QHSTA_M_BAD_BUS_PHASE_SEQ 0x14
271 #define QHSTA_D_QDONE_SG_LIST_CORRUPTED 0x21
272 #define QHSTA_D_ASC_DVC_ERROR_CODE_SET 0x22
273 #define QHSTA_D_HOST_ABORT_FAILED 0x23
274 #define QHSTA_D_EXE_SCSI_Q_FAILED 0x24
275 #define QHSTA_D_EXE_SCSI_Q_BUSY_TIMEOUT 0x25
276 #define QHSTA_D_ASPI_NO_BUF_POOL 0x26
277 #define QHSTA_M_WTM_TIMEOUT 0x41
278 #define QHSTA_M_BAD_CMPL_STATUS_IN 0x42
279 #define QHSTA_M_NO_AUTO_REQ_SENSE 0x43
280 #define QHSTA_M_AUTO_REQ_SENSE_FAIL 0x44
281 #define QHSTA_M_TARGET_STATUS_BUSY 0x45
282 #define QHSTA_M_BAD_TAG_CODE 0x46
283 #define QHSTA_M_BAD_QUEUE_FULL_OR_BUSY 0x47
284 #define QHSTA_M_HUNG_REQ_SCSI_BUS_RESET 0x48
285 #define QHSTA_D_LRAM_CMP_ERROR 0x81
286 #define QHSTA_M_MICRO_CODE_ERROR_HALT 0xA1
287 #define ASC_FLAG_SCSIQ_REQ 0x01
288 #define ASC_FLAG_BIOS_SCSIQ_REQ 0x02
289 #define ASC_FLAG_BIOS_ASYNC_IO 0x04
290 #define ASC_FLAG_SRB_LINEAR_ADDR 0x08
291 #define ASC_FLAG_WIN16 0x10
292 #define ASC_FLAG_WIN32 0x20
293 #define ASC_FLAG_ISA_OVER_16MB 0x40
294 #define ASC_FLAG_DOS_VM_CALLBACK 0x80
295 #define ASC_TAG_FLAG_EXTRA_BYTES 0x10
296 #define ASC_TAG_FLAG_DISABLE_DISCONNECT 0x04
297 #define ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX 0x08
298 #define ASC_TAG_FLAG_DISABLE_CHK_COND_INT_HOST 0x40
299 #define ASC_SCSIQ_CPY_BEG 4
300 #define ASC_SCSIQ_SGHD_CPY_BEG 2
301 #define ASC_SCSIQ_B_FWD 0
302 #define ASC_SCSIQ_B_BWD 1
303 #define ASC_SCSIQ_B_STATUS 2
304 #define ASC_SCSIQ_B_QNO 3
305 #define ASC_SCSIQ_B_CNTL 4
306 #define ASC_SCSIQ_B_SG_QUEUE_CNT 5
307 #define ASC_SCSIQ_D_DATA_ADDR 8
308 #define ASC_SCSIQ_D_DATA_CNT 12
309 #define ASC_SCSIQ_B_SENSE_LEN 20
310 #define ASC_SCSIQ_DONE_INFO_BEG 22
311 #define ASC_SCSIQ_D_SRBPTR 22
312 #define ASC_SCSIQ_B_TARGET_IX 26
313 #define ASC_SCSIQ_B_CDB_LEN 28
314 #define ASC_SCSIQ_B_TAG_CODE 29
315 #define ASC_SCSIQ_W_VM_ID 30
316 #define ASC_SCSIQ_DONE_STATUS 32
317 #define ASC_SCSIQ_HOST_STATUS 33
318 #define ASC_SCSIQ_SCSI_STATUS 34
319 #define ASC_SCSIQ_CDB_BEG 36
320 #define ASC_SCSIQ_DW_REMAIN_XFER_ADDR 56
321 #define ASC_SCSIQ_DW_REMAIN_XFER_CNT 60
322 #define ASC_SCSIQ_B_FIRST_SG_WK_QP 48
323 #define ASC_SCSIQ_B_SG_WK_QP 49
324 #define ASC_SCSIQ_B_SG_WK_IX 50
325 #define ASC_SCSIQ_W_ALT_DC1 52
326 #define ASC_SCSIQ_B_LIST_CNT 6
327 #define ASC_SCSIQ_B_CUR_LIST_CNT 7
328 #define ASC_SGQ_B_SG_CNTL 4
329 #define ASC_SGQ_B_SG_HEAD_QP 5
330 #define ASC_SGQ_B_SG_LIST_CNT 6
331 #define ASC_SGQ_B_SG_CUR_LIST_CNT 7
332 #define ASC_SGQ_LIST_BEG 8
333 #define ASC_DEF_SCSI1_QNG 4
334 #define ASC_MAX_SCSI1_QNG 4
335 #define ASC_DEF_SCSI2_QNG 16
336 #define ASC_MAX_SCSI2_QNG 32
337 #define ASC_TAG_CODE_MASK 0x23
338 #define ASC_STOP_REQ_RISC_STOP 0x01
339 #define ASC_STOP_ACK_RISC_STOP 0x03
340 #define ASC_STOP_CLEAN_UP_BUSY_Q 0x10
341 #define ASC_STOP_CLEAN_UP_DISC_Q 0x20
342 #define ASC_STOP_HOST_REQ_RISC_HALT 0x40
343 #define ASC_TIDLUN_TO_IX(tid, lun) (ASC_SCSI_TIX_TYPE)((tid) + ((lun)<<ASC_SCSI_ID_BITS))
344 #define ASC_TID_TO_TARGET_ID(tid) (ASC_SCSI_BIT_ID_TYPE)(0x01 << (tid))
345 #define ASC_TIX_TO_TARGET_ID(tix) (0x01 << ((tix) & ASC_MAX_TID))
346 #define ASC_TIX_TO_TID(tix) ((tix) & ASC_MAX_TID)
347 #define ASC_TID_TO_TIX(tid) ((tid) & ASC_MAX_TID)
348 #define ASC_TIX_TO_LUN(tix) (((tix) >> ASC_SCSI_ID_BITS) & ASC_MAX_LUN)
349 #define ASC_QNO_TO_QADDR(q_no) ((ASC_QADR_BEG)+((int)(q_no) << 6))
351 typedef struct asc_scsiq_1
{
360 ASC_PADDR sense_addr
;
365 typedef struct asc_scsiq_2
{
374 typedef struct asc_scsiq_3
{
381 typedef struct asc_scsiq_4
{
382 uchar cdb
[ASC_MAX_CDB_LEN
];
383 uchar y_first_sg_list_qp
;
384 uchar y_working_sg_qp
;
385 uchar y_working_sg_ix
;
388 ushort x_reconnect_rtn
;
389 ASC_PADDR x_saved_data_addr
;
390 ASC_DCNT x_saved_data_cnt
;
393 typedef struct asc_q_done_info
{
402 ASC_DCNT remain_bytes
;
405 typedef struct asc_sg_list
{
410 typedef struct asc_sg_head
{
413 ushort entry_to_copy
;
415 ASC_SG_LIST sg_list
[ASC_MAX_SG_LIST
];
418 #define ASC_MIN_SG_LIST 2
420 typedef struct asc_min_sg_head
{
423 ushort entry_to_copy
;
425 ASC_SG_LIST sg_list
[ASC_MIN_SG_LIST
];
428 #define QCX_SORT (0x0001)
429 #define QCX_COALEASE (0x0002)
431 typedef struct asc_scsi_q
{
435 ASC_SG_HEAD
*sg_head
;
436 ushort remain_sg_entry_cnt
;
437 ushort next_sg_index
;
440 typedef struct asc_scsi_req_q
{
444 ASC_SG_HEAD
*sg_head
;
447 uchar cdb
[ASC_MAX_CDB_LEN
];
448 uchar sense
[ASC_MIN_SENSE_LEN
];
451 typedef struct asc_scsi_bios_req_q
{
455 ASC_SG_HEAD
*sg_head
;
458 uchar cdb
[ASC_MAX_CDB_LEN
];
459 uchar sense
[ASC_MIN_SENSE_LEN
];
460 } ASC_SCSI_BIOS_REQ_Q
;
462 typedef struct asc_risc_q
{
471 typedef struct asc_sg_list_q
{
477 uchar sg_cur_list_cnt
;
480 typedef struct asc_risc_sg_list_q
{
484 ASC_SG_LIST sg_list
[7];
485 } ASC_RISC_SG_LIST_Q
;
487 #define ASC_EXE_SCSI_IO_MAX_IDLE_LOOP 0x1000000UL
488 #define ASC_EXE_SCSI_IO_MAX_WAIT_LOOP 1024
489 #define ASCQ_ERR_NO_ERROR 0
490 #define ASCQ_ERR_IO_NOT_FOUND 1
491 #define ASCQ_ERR_LOCAL_MEM 2
492 #define ASCQ_ERR_CHKSUM 3
493 #define ASCQ_ERR_START_CHIP 4
494 #define ASCQ_ERR_INT_TARGET_ID 5
495 #define ASCQ_ERR_INT_LOCAL_MEM 6
496 #define ASCQ_ERR_HALT_RISC 7
497 #define ASCQ_ERR_GET_ASPI_ENTRY 8
498 #define ASCQ_ERR_CLOSE_ASPI 9
499 #define ASCQ_ERR_HOST_INQUIRY 0x0A
500 #define ASCQ_ERR_SAVED_SRB_BAD 0x0B
501 #define ASCQ_ERR_QCNTL_SG_LIST 0x0C
502 #define ASCQ_ERR_Q_STATUS 0x0D
503 #define ASCQ_ERR_WR_SCSIQ 0x0E
504 #define ASCQ_ERR_PC_ADDR 0x0F
505 #define ASCQ_ERR_SYN_OFFSET 0x10
506 #define ASCQ_ERR_SYN_XFER_TIME 0x11
507 #define ASCQ_ERR_LOCK_DMA 0x12
508 #define ASCQ_ERR_UNLOCK_DMA 0x13
509 #define ASCQ_ERR_VDS_CHK_INSTALL 0x14
510 #define ASCQ_ERR_MICRO_CODE_HALT 0x15
511 #define ASCQ_ERR_SET_LRAM_ADDR 0x16
512 #define ASCQ_ERR_CUR_QNG 0x17
513 #define ASCQ_ERR_SG_Q_LINKS 0x18
514 #define ASCQ_ERR_SCSIQ_PTR 0x19
515 #define ASCQ_ERR_ISR_RE_ENTRY 0x1A
516 #define ASCQ_ERR_CRITICAL_RE_ENTRY 0x1B
517 #define ASCQ_ERR_ISR_ON_CRITICAL 0x1C
518 #define ASCQ_ERR_SG_LIST_ODD_ADDRESS 0x1D
519 #define ASCQ_ERR_XFER_ADDRESS_TOO_BIG 0x1E
520 #define ASCQ_ERR_SCSIQ_NULL_PTR 0x1F
521 #define ASCQ_ERR_SCSIQ_BAD_NEXT_PTR 0x20
522 #define ASCQ_ERR_GET_NUM_OF_FREE_Q 0x21
523 #define ASCQ_ERR_SEND_SCSI_Q 0x22
524 #define ASCQ_ERR_HOST_REQ_RISC_HALT 0x23
525 #define ASCQ_ERR_RESET_SDTR 0x24
528 * Warning code values are set in ASC_DVC_VAR 'warn_code'.
530 #define ASC_WARN_NO_ERROR 0x0000
531 #define ASC_WARN_IO_PORT_ROTATE 0x0001
532 #define ASC_WARN_EEPROM_CHKSUM 0x0002
533 #define ASC_WARN_IRQ_MODIFIED 0x0004
534 #define ASC_WARN_AUTO_CONFIG 0x0008
535 #define ASC_WARN_CMD_QNG_CONFLICT 0x0010
536 #define ASC_WARN_EEPROM_RECOVER 0x0020
537 #define ASC_WARN_CFG_MSW_RECOVER 0x0040
538 #define ASC_WARN_SET_PCI_CONFIG_SPACE 0x0080
541 * Error code values are set in ASC_DVC_VAR 'err_code'.
543 #define ASC_IERR_WRITE_EEPROM 0x0001
544 #define ASC_IERR_MCODE_CHKSUM 0x0002
545 #define ASC_IERR_SET_PC_ADDR 0x0004
546 #define ASC_IERR_START_STOP_CHIP 0x0008
547 #define ASC_IERR_IRQ_NO 0x0010
548 #define ASC_IERR_SET_IRQ_NO 0x0020
549 #define ASC_IERR_CHIP_VERSION 0x0040
550 #define ASC_IERR_SET_SCSI_ID 0x0080
551 #define ASC_IERR_GET_PHY_ADDR 0x0100
552 #define ASC_IERR_BAD_SIGNATURE 0x0200
553 #define ASC_IERR_NO_BUS_TYPE 0x0400
554 #define ASC_IERR_SCAM 0x0800
555 #define ASC_IERR_SET_SDTR 0x1000
556 #define ASC_IERR_RW_LRAM 0x8000
558 #define ASC_DEF_IRQ_NO 10
559 #define ASC_MAX_IRQ_NO 15
560 #define ASC_MIN_IRQ_NO 10
561 #define ASC_MIN_REMAIN_Q (0x02)
562 #define ASC_DEF_MAX_TOTAL_QNG (0xF0)
563 #define ASC_MIN_TAG_Q_PER_DVC (0x04)
564 #define ASC_DEF_TAG_Q_PER_DVC (0x04)
565 #define ASC_MIN_FREE_Q ASC_MIN_REMAIN_Q
566 #define ASC_MIN_TOTAL_QNG ((ASC_MAX_SG_QUEUE)+(ASC_MIN_FREE_Q))
567 #define ASC_MAX_TOTAL_QNG 240
568 #define ASC_MAX_PCI_ULTRA_INRAM_TOTAL_QNG 16
569 #define ASC_MAX_PCI_ULTRA_INRAM_TAG_QNG 8
570 #define ASC_MAX_PCI_INRAM_TOTAL_QNG 20
571 #define ASC_MAX_INRAM_TAG_QNG 16
572 #define ASC_IOADR_TABLE_MAX_IX 11
573 #define ASC_IOADR_GAP 0x10
574 #define ASC_LIB_SCSIQ_WK_SP 256
575 #define ASC_MAX_SYN_XFER_NO 16
576 #define ASC_SYN_MAX_OFFSET 0x0F
577 #define ASC_DEF_SDTR_OFFSET 0x0F
578 #define ASC_DEF_SDTR_INDEX 0x00
579 #define ASC_SDTR_ULTRA_PCI_10MB_INDEX 0x02
580 #define SYN_XFER_NS_0 25
581 #define SYN_XFER_NS_1 30
582 #define SYN_XFER_NS_2 35
583 #define SYN_XFER_NS_3 40
584 #define SYN_XFER_NS_4 50
585 #define SYN_XFER_NS_5 60
586 #define SYN_XFER_NS_6 70
587 #define SYN_XFER_NS_7 85
588 #define SYN_ULTRA_XFER_NS_0 12
589 #define SYN_ULTRA_XFER_NS_1 19
590 #define SYN_ULTRA_XFER_NS_2 25
591 #define SYN_ULTRA_XFER_NS_3 32
592 #define SYN_ULTRA_XFER_NS_4 38
593 #define SYN_ULTRA_XFER_NS_5 44
594 #define SYN_ULTRA_XFER_NS_6 50
595 #define SYN_ULTRA_XFER_NS_7 57
596 #define SYN_ULTRA_XFER_NS_8 63
597 #define SYN_ULTRA_XFER_NS_9 69
598 #define SYN_ULTRA_XFER_NS_10 75
599 #define SYN_ULTRA_XFER_NS_11 82
600 #define SYN_ULTRA_XFER_NS_12 88
601 #define SYN_ULTRA_XFER_NS_13 94
602 #define SYN_ULTRA_XFER_NS_14 100
603 #define SYN_ULTRA_XFER_NS_15 107
605 typedef struct ext_msg
{
611 uchar sdtr_xfer_period
;
612 uchar sdtr_req_ack_offset
;
627 #define xfer_period u_ext_msg.sdtr.sdtr_xfer_period
628 #define req_ack_offset u_ext_msg.sdtr.sdtr_req_ack_offset
629 #define wdtr_width u_ext_msg.wdtr.wdtr_width
630 #define mdp_b3 u_ext_msg.mdp_b3
631 #define mdp_b2 u_ext_msg.mdp_b2
632 #define mdp_b1 u_ext_msg.mdp_b1
633 #define mdp_b0 u_ext_msg.mdp_b0
635 typedef struct asc_dvc_cfg
{
636 ASC_SCSI_BIT_ID_TYPE can_tagged_qng
;
637 ASC_SCSI_BIT_ID_TYPE cmd_qng_enabled
;
638 ASC_SCSI_BIT_ID_TYPE disc_enable
;
639 ASC_SCSI_BIT_ID_TYPE sdtr_enable
;
642 uchar isa_dma_channel
;
644 ushort lib_serial_no
;
647 ushort mcode_version
;
648 uchar max_tag_qng
[ASC_MAX_TID
+ 1];
650 uchar sdtr_period_offset
[ASC_MAX_TID
+ 1];
651 uchar adapter_info
[6];
654 #define ASC_DEF_DVC_CNTL 0xFFFF
655 #define ASC_DEF_CHIP_SCSI_ID 7
656 #define ASC_DEF_ISA_DMA_SPEED 4
657 #define ASC_INIT_STATE_NULL 0x0000
658 #define ASC_INIT_STATE_BEG_GET_CFG 0x0001
659 #define ASC_INIT_STATE_END_GET_CFG 0x0002
660 #define ASC_INIT_STATE_BEG_SET_CFG 0x0004
661 #define ASC_INIT_STATE_END_SET_CFG 0x0008
662 #define ASC_INIT_STATE_BEG_LOAD_MC 0x0010
663 #define ASC_INIT_STATE_END_LOAD_MC 0x0020
664 #define ASC_INIT_STATE_BEG_INQUIRY 0x0040
665 #define ASC_INIT_STATE_END_INQUIRY 0x0080
666 #define ASC_INIT_RESET_SCSI_DONE 0x0100
667 #define ASC_INIT_STATE_WITHOUT_EEP 0x8000
668 #define ASC_BUG_FIX_IF_NOT_DWB 0x0001
669 #define ASC_BUG_FIX_ASYN_USE_SYN 0x0002
670 #define ASYN_SDTR_DATA_FIX_PCI_REV_AB 0x41
671 #define ASC_MIN_TAGGED_CMD 7
672 #define ASC_MAX_SCSI_RESET_WAIT 30
674 struct asc_dvc_var
; /* Forward Declaration. */
676 typedef struct asc_dvc_var
{
682 ASC_SCSI_BIT_ID_TYPE init_sdtr
;
683 ASC_SCSI_BIT_ID_TYPE sdtr_done
;
684 ASC_SCSI_BIT_ID_TYPE use_tagged_qng
;
685 ASC_SCSI_BIT_ID_TYPE unit_not_ready
;
686 ASC_SCSI_BIT_ID_TYPE queue_full_or_busy
;
687 ASC_SCSI_BIT_ID_TYPE start_motor
;
688 uchar scsi_reset_wait
;
693 uchar in_critical_cnt
;
695 uchar last_q_shortage
;
697 uchar cur_dvc_qng
[ASC_MAX_TID
+ 1];
698 uchar max_dvc_qng
[ASC_MAX_TID
+ 1];
699 ASC_SCSI_Q
*scsiq_busy_head
[ASC_MAX_TID
+ 1];
700 ASC_SCSI_Q
*scsiq_busy_tail
[ASC_MAX_TID
+ 1];
701 uchar sdtr_period_tbl
[ASC_MAX_SYN_XFER_NO
];
703 ASC_SCSI_BIT_ID_TYPE pci_fix_asyn_xfer_always
;
706 uchar dos_int13_table
[ASC_MAX_TID
+ 1];
707 ASC_DCNT max_dma_count
;
708 ASC_SCSI_BIT_ID_TYPE no_scam
;
709 ASC_SCSI_BIT_ID_TYPE pci_fix_asyn_xfer
;
710 uchar max_sdtr_index
;
711 uchar host_init_sdtr_index
;
712 struct asc_board
*drv_ptr
;
716 typedef struct asc_dvc_inq_info
{
717 uchar type
[ASC_MAX_TID
+ 1][ASC_MAX_LUN
+ 1];
720 typedef struct asc_cap_info
{
725 typedef struct asc_cap_info_array
{
726 ASC_CAP_INFO cap_info
[ASC_MAX_TID
+ 1][ASC_MAX_LUN
+ 1];
727 } ASC_CAP_INFO_ARRAY
;
729 #define ASC_MCNTL_NO_SEL_TIMEOUT (ushort)0x0001
730 #define ASC_MCNTL_NULL_TARGET (ushort)0x0002
731 #define ASC_CNTL_INITIATOR (ushort)0x0001
732 #define ASC_CNTL_BIOS_GT_1GB (ushort)0x0002
733 #define ASC_CNTL_BIOS_GT_2_DISK (ushort)0x0004
734 #define ASC_CNTL_BIOS_REMOVABLE (ushort)0x0008
735 #define ASC_CNTL_NO_SCAM (ushort)0x0010
736 #define ASC_CNTL_INT_MULTI_Q (ushort)0x0080
737 #define ASC_CNTL_NO_LUN_SUPPORT (ushort)0x0040
738 #define ASC_CNTL_NO_VERIFY_COPY (ushort)0x0100
739 #define ASC_CNTL_RESET_SCSI (ushort)0x0200
740 #define ASC_CNTL_INIT_INQUIRY (ushort)0x0400
741 #define ASC_CNTL_INIT_VERBOSE (ushort)0x0800
742 #define ASC_CNTL_SCSI_PARITY (ushort)0x1000
743 #define ASC_CNTL_BURST_MODE (ushort)0x2000
744 #define ASC_CNTL_SDTR_ENABLE_ULTRA (ushort)0x4000
745 #define ASC_EEP_DVC_CFG_BEG_VL 2
746 #define ASC_EEP_MAX_DVC_ADDR_VL 15
747 #define ASC_EEP_DVC_CFG_BEG 32
748 #define ASC_EEP_MAX_DVC_ADDR 45
749 #define ASC_EEP_DEFINED_WORDS 10
750 #define ASC_EEP_MAX_ADDR 63
751 #define ASC_EEP_RES_WORDS 0
752 #define ASC_EEP_MAX_RETRY 20
753 #define ASC_MAX_INIT_BUSY_RETRY 8
754 #define ASC_EEP_ISA_PNP_WSIZE 16
757 * These macros keep the chip SCSI id and ISA DMA speed
758 * bitfields in board order. C bitfields aren't portable
759 * between big and little-endian platforms so they are
763 #define ASC_EEP_GET_CHIP_ID(cfg) ((cfg)->id_speed & 0x0f)
764 #define ASC_EEP_GET_DMA_SPD(cfg) (((cfg)->id_speed & 0xf0) >> 4)
765 #define ASC_EEP_SET_CHIP_ID(cfg, sid) \
766 ((cfg)->id_speed = ((cfg)->id_speed & 0xf0) | ((sid) & ASC_MAX_TID))
767 #define ASC_EEP_SET_DMA_SPD(cfg, spd) \
768 ((cfg)->id_speed = ((cfg)->id_speed & 0x0f) | ((spd) & 0x0f) << 4)
770 typedef struct asceep_config
{
782 uchar id_speed
; /* low order 4 bits is chip scsi id */
783 /* high order 4 bits is isa dma speed */
784 uchar dos_int13_table
[ASC_MAX_TID
+ 1];
785 uchar adapter_info
[6];
790 #define ASC_PCI_CFG_LSW_SCSI_PARITY 0x0800
791 #define ASC_PCI_CFG_LSW_BURST_MODE 0x0080
792 #define ASC_PCI_CFG_LSW_INTR_ABLE 0x0020
794 #define ASC_EEP_CMD_READ 0x80
795 #define ASC_EEP_CMD_WRITE 0x40
796 #define ASC_EEP_CMD_WRITE_ABLE 0x30
797 #define ASC_EEP_CMD_WRITE_DISABLE 0x00
798 #define ASC_OVERRUN_BSIZE 0x00000048UL
799 #define ASC_CTRL_BREAK_ONCE 0x0001
800 #define ASC_CTRL_BREAK_STAY_IDLE 0x0002
801 #define ASCV_MSGOUT_BEG 0x0000
802 #define ASCV_MSGOUT_SDTR_PERIOD (ASCV_MSGOUT_BEG+3)
803 #define ASCV_MSGOUT_SDTR_OFFSET (ASCV_MSGOUT_BEG+4)
804 #define ASCV_BREAK_SAVED_CODE (ushort)0x0006
805 #define ASCV_MSGIN_BEG (ASCV_MSGOUT_BEG+8)
806 #define ASCV_MSGIN_SDTR_PERIOD (ASCV_MSGIN_BEG+3)
807 #define ASCV_MSGIN_SDTR_OFFSET (ASCV_MSGIN_BEG+4)
808 #define ASCV_SDTR_DATA_BEG (ASCV_MSGIN_BEG+8)
809 #define ASCV_SDTR_DONE_BEG (ASCV_SDTR_DATA_BEG+8)
810 #define ASCV_MAX_DVC_QNG_BEG (ushort)0x0020
811 #define ASCV_BREAK_ADDR (ushort)0x0028
812 #define ASCV_BREAK_NOTIFY_COUNT (ushort)0x002A
813 #define ASCV_BREAK_CONTROL (ushort)0x002C
814 #define ASCV_BREAK_HIT_COUNT (ushort)0x002E
816 #define ASCV_ASCDVC_ERR_CODE_W (ushort)0x0030
817 #define ASCV_MCODE_CHKSUM_W (ushort)0x0032
818 #define ASCV_MCODE_SIZE_W (ushort)0x0034
819 #define ASCV_STOP_CODE_B (ushort)0x0036
820 #define ASCV_DVC_ERR_CODE_B (ushort)0x0037
821 #define ASCV_OVERRUN_PADDR_D (ushort)0x0038
822 #define ASCV_OVERRUN_BSIZE_D (ushort)0x003C
823 #define ASCV_HALTCODE_W (ushort)0x0040
824 #define ASCV_CHKSUM_W (ushort)0x0042
825 #define ASCV_MC_DATE_W (ushort)0x0044
826 #define ASCV_MC_VER_W (ushort)0x0046
827 #define ASCV_NEXTRDY_B (ushort)0x0048
828 #define ASCV_DONENEXT_B (ushort)0x0049
829 #define ASCV_USE_TAGGED_QNG_B (ushort)0x004A
830 #define ASCV_SCSIBUSY_B (ushort)0x004B
831 #define ASCV_Q_DONE_IN_PROGRESS_B (ushort)0x004C
832 #define ASCV_CURCDB_B (ushort)0x004D
833 #define ASCV_RCLUN_B (ushort)0x004E
834 #define ASCV_BUSY_QHEAD_B (ushort)0x004F
835 #define ASCV_DISC1_QHEAD_B (ushort)0x0050
836 #define ASCV_DISC_ENABLE_B (ushort)0x0052
837 #define ASCV_CAN_TAGGED_QNG_B (ushort)0x0053
838 #define ASCV_HOSTSCSI_ID_B (ushort)0x0055
839 #define ASCV_MCODE_CNTL_B (ushort)0x0056
840 #define ASCV_NULL_TARGET_B (ushort)0x0057
841 #define ASCV_FREE_Q_HEAD_W (ushort)0x0058
842 #define ASCV_DONE_Q_TAIL_W (ushort)0x005A
843 #define ASCV_FREE_Q_HEAD_B (ushort)(ASCV_FREE_Q_HEAD_W+1)
844 #define ASCV_DONE_Q_TAIL_B (ushort)(ASCV_DONE_Q_TAIL_W+1)
845 #define ASCV_HOST_FLAG_B (ushort)0x005D
846 #define ASCV_TOTAL_READY_Q_B (ushort)0x0064
847 #define ASCV_VER_SERIAL_B (ushort)0x0065
848 #define ASCV_HALTCODE_SAVED_W (ushort)0x0066
849 #define ASCV_WTM_FLAG_B (ushort)0x0068
850 #define ASCV_RISC_FLAG_B (ushort)0x006A
851 #define ASCV_REQ_SG_LIST_QP (ushort)0x006B
852 #define ASC_HOST_FLAG_IN_ISR 0x01
853 #define ASC_HOST_FLAG_ACK_INT 0x02
854 #define ASC_RISC_FLAG_GEN_INT 0x01
855 #define ASC_RISC_FLAG_REQ_SG_LIST 0x02
856 #define IOP_CTRL (0x0F)
857 #define IOP_STATUS (0x0E)
858 #define IOP_INT_ACK IOP_STATUS
859 #define IOP_REG_IFC (0x0D)
860 #define IOP_SYN_OFFSET (0x0B)
861 #define IOP_EXTRA_CONTROL (0x0D)
862 #define IOP_REG_PC (0x0C)
863 #define IOP_RAM_ADDR (0x0A)
864 #define IOP_RAM_DATA (0x08)
865 #define IOP_EEP_DATA (0x06)
866 #define IOP_EEP_CMD (0x07)
867 #define IOP_VERSION (0x03)
868 #define IOP_CONFIG_HIGH (0x04)
869 #define IOP_CONFIG_LOW (0x02)
870 #define IOP_SIG_BYTE (0x01)
871 #define IOP_SIG_WORD (0x00)
872 #define IOP_REG_DC1 (0x0E)
873 #define IOP_REG_DC0 (0x0C)
874 #define IOP_REG_SB (0x0B)
875 #define IOP_REG_DA1 (0x0A)
876 #define IOP_REG_DA0 (0x08)
877 #define IOP_REG_SC (0x09)
878 #define IOP_DMA_SPEED (0x07)
879 #define IOP_REG_FLAG (0x07)
880 #define IOP_FIFO_H (0x06)
881 #define IOP_FIFO_L (0x04)
882 #define IOP_REG_ID (0x05)
883 #define IOP_REG_QP (0x03)
884 #define IOP_REG_IH (0x02)
885 #define IOP_REG_IX (0x01)
886 #define IOP_REG_AX (0x00)
887 #define IFC_REG_LOCK (0x00)
888 #define IFC_REG_UNLOCK (0x09)
889 #define IFC_WR_EN_FILTER (0x10)
890 #define IFC_RD_NO_EEPROM (0x10)
891 #define IFC_SLEW_RATE (0x20)
892 #define IFC_ACT_NEG (0x40)
893 #define IFC_INP_FILTER (0x80)
894 #define IFC_INIT_DEFAULT (IFC_ACT_NEG | IFC_REG_UNLOCK)
895 #define SC_SEL (uchar)(0x80)
896 #define SC_BSY (uchar)(0x40)
897 #define SC_ACK (uchar)(0x20)
898 #define SC_REQ (uchar)(0x10)
899 #define SC_ATN (uchar)(0x08)
900 #define SC_IO (uchar)(0x04)
901 #define SC_CD (uchar)(0x02)
902 #define SC_MSG (uchar)(0x01)
903 #define SEC_SCSI_CTL (uchar)(0x80)
904 #define SEC_ACTIVE_NEGATE (uchar)(0x40)
905 #define SEC_SLEW_RATE (uchar)(0x20)
906 #define SEC_ENABLE_FILTER (uchar)(0x10)
907 #define ASC_HALT_EXTMSG_IN (ushort)0x8000
908 #define ASC_HALT_CHK_CONDITION (ushort)0x8100
909 #define ASC_HALT_SS_QUEUE_FULL (ushort)0x8200
910 #define ASC_HALT_DISABLE_ASYN_USE_SYN_FIX (ushort)0x8300
911 #define ASC_HALT_ENABLE_ASYN_USE_SYN_FIX (ushort)0x8400
912 #define ASC_HALT_SDTR_REJECTED (ushort)0x4000
913 #define ASC_HALT_HOST_COPY_SG_LIST_TO_RISC ( ushort )0x2000
914 #define ASC_MAX_QNO 0xF8
915 #define ASC_DATA_SEC_BEG (ushort)0x0080
916 #define ASC_DATA_SEC_END (ushort)0x0080
917 #define ASC_CODE_SEC_BEG (ushort)0x0080
918 #define ASC_CODE_SEC_END (ushort)0x0080
919 #define ASC_QADR_BEG (0x4000)
920 #define ASC_QADR_USED (ushort)(ASC_MAX_QNO * 64)
921 #define ASC_QADR_END (ushort)0x7FFF
922 #define ASC_QLAST_ADR (ushort)0x7FC0
923 #define ASC_QBLK_SIZE 0x40
924 #define ASC_BIOS_DATA_QBEG 0xF8
925 #define ASC_MIN_ACTIVE_QNO 0x01
926 #define ASC_QLINK_END 0xFF
927 #define ASC_EEPROM_WORDS 0x10
928 #define ASC_MAX_MGS_LEN 0x10
929 #define ASC_BIOS_ADDR_DEF 0xDC00
930 #define ASC_BIOS_SIZE 0x3800
931 #define ASC_BIOS_RAM_OFF 0x3800
932 #define ASC_BIOS_RAM_SIZE 0x800
933 #define ASC_BIOS_MIN_ADDR 0xC000
934 #define ASC_BIOS_MAX_ADDR 0xEC00
935 #define ASC_BIOS_BANK_SIZE 0x0400
936 #define ASC_MCODE_START_ADDR 0x0080
937 #define ASC_CFG0_HOST_INT_ON 0x0020
938 #define ASC_CFG0_BIOS_ON 0x0040
939 #define ASC_CFG0_VERA_BURST_ON 0x0080
940 #define ASC_CFG0_SCSI_PARITY_ON 0x0800
941 #define ASC_CFG1_SCSI_TARGET_ON 0x0080
942 #define ASC_CFG1_LRAM_8BITS_ON 0x0800
943 #define ASC_CFG_MSW_CLR_MASK 0x3080
944 #define CSW_TEST1 (ASC_CS_TYPE)0x8000
945 #define CSW_AUTO_CONFIG (ASC_CS_TYPE)0x4000
946 #define CSW_RESERVED1 (ASC_CS_TYPE)0x2000
947 #define CSW_IRQ_WRITTEN (ASC_CS_TYPE)0x1000
948 #define CSW_33MHZ_SELECTED (ASC_CS_TYPE)0x0800
949 #define CSW_TEST2 (ASC_CS_TYPE)0x0400
950 #define CSW_TEST3 (ASC_CS_TYPE)0x0200
951 #define CSW_RESERVED2 (ASC_CS_TYPE)0x0100
952 #define CSW_DMA_DONE (ASC_CS_TYPE)0x0080
953 #define CSW_FIFO_RDY (ASC_CS_TYPE)0x0040
954 #define CSW_EEP_READ_DONE (ASC_CS_TYPE)0x0020
955 #define CSW_HALTED (ASC_CS_TYPE)0x0010
956 #define CSW_SCSI_RESET_ACTIVE (ASC_CS_TYPE)0x0008
957 #define CSW_PARITY_ERR (ASC_CS_TYPE)0x0004
958 #define CSW_SCSI_RESET_LATCH (ASC_CS_TYPE)0x0002
959 #define CSW_INT_PENDING (ASC_CS_TYPE)0x0001
960 #define CIW_CLR_SCSI_RESET_INT (ASC_CS_TYPE)0x1000
961 #define CIW_INT_ACK (ASC_CS_TYPE)0x0100
962 #define CIW_TEST1 (ASC_CS_TYPE)0x0200
963 #define CIW_TEST2 (ASC_CS_TYPE)0x0400
964 #define CIW_SEL_33MHZ (ASC_CS_TYPE)0x0800
965 #define CIW_IRQ_ACT (ASC_CS_TYPE)0x1000
966 #define CC_CHIP_RESET (uchar)0x80
967 #define CC_SCSI_RESET (uchar)0x40
968 #define CC_HALT (uchar)0x20
969 #define CC_SINGLE_STEP (uchar)0x10
970 #define CC_DMA_ABLE (uchar)0x08
971 #define CC_TEST (uchar)0x04
972 #define CC_BANK_ONE (uchar)0x02
973 #define CC_DIAG (uchar)0x01
974 #define ASC_1000_ID0W 0x04C1
975 #define ASC_1000_ID0W_FIX 0x00C1
976 #define ASC_1000_ID1B 0x25
977 #define ASC_EISA_REV_IOP_MASK (0x0C83)
978 #define ASC_EISA_PID_IOP_MASK (0x0C80)
979 #define ASC_EISA_CFG_IOP_MASK (0x0C86)
980 #define ASC_GET_EISA_SLOT(iop) (PortAddr)((iop) & 0xF000)
981 #define INS_HALTINT (ushort)0x6281
982 #define INS_HALT (ushort)0x6280
983 #define INS_SINT (ushort)0x6200
984 #define INS_RFLAG_WTM (ushort)0x7380
985 #define ASC_MC_SAVE_CODE_WSIZE 0x500
986 #define ASC_MC_SAVE_DATA_WSIZE 0x40
988 typedef struct asc_mc_saved
{
989 ushort data
[ASC_MC_SAVE_DATA_WSIZE
];
990 ushort code
[ASC_MC_SAVE_CODE_WSIZE
];
993 #define AscGetQDoneInProgress(port) AscReadLramByte((port), ASCV_Q_DONE_IN_PROGRESS_B)
994 #define AscPutQDoneInProgress(port, val) AscWriteLramByte((port), ASCV_Q_DONE_IN_PROGRESS_B, val)
995 #define AscGetVarFreeQHead(port) AscReadLramWord((port), ASCV_FREE_Q_HEAD_W)
996 #define AscGetVarDoneQTail(port) AscReadLramWord((port), ASCV_DONE_Q_TAIL_W)
997 #define AscPutVarFreeQHead(port, val) AscWriteLramWord((port), ASCV_FREE_Q_HEAD_W, val)
998 #define AscPutVarDoneQTail(port, val) AscWriteLramWord((port), ASCV_DONE_Q_TAIL_W, val)
999 #define AscGetRiscVarFreeQHead(port) AscReadLramByte((port), ASCV_NEXTRDY_B)
1000 #define AscGetRiscVarDoneQTail(port) AscReadLramByte((port), ASCV_DONENEXT_B)
1001 #define AscPutRiscVarFreeQHead(port, val) AscWriteLramByte((port), ASCV_NEXTRDY_B, val)
1002 #define AscPutRiscVarDoneQTail(port, val) AscWriteLramByte((port), ASCV_DONENEXT_B, val)
1003 #define AscPutMCodeSDTRDoneAtID(port, id, data) AscWriteLramByte((port), (ushort)((ushort)ASCV_SDTR_DONE_BEG+(ushort)id), (data));
1004 #define AscGetMCodeSDTRDoneAtID(port, id) AscReadLramByte((port), (ushort)((ushort)ASCV_SDTR_DONE_BEG+(ushort)id));
1005 #define AscPutMCodeInitSDTRAtID(port, id, data) AscWriteLramByte((port), (ushort)((ushort)ASCV_SDTR_DATA_BEG+(ushort)id), data);
1006 #define AscGetMCodeInitSDTRAtID(port, id) AscReadLramByte((port), (ushort)((ushort)ASCV_SDTR_DATA_BEG+(ushort)id));
1007 #define AscSynIndexToPeriod(index) (uchar)(asc_dvc->sdtr_period_tbl[ (index) ])
1008 #define AscGetChipSignatureByte(port) (uchar)inp((port)+IOP_SIG_BYTE)
1009 #define AscGetChipSignatureWord(port) (ushort)inpw((port)+IOP_SIG_WORD)
1010 #define AscGetChipVerNo(port) (uchar)inp((port)+IOP_VERSION)
1011 #define AscGetChipCfgLsw(port) (ushort)inpw((port)+IOP_CONFIG_LOW)
1012 #define AscGetChipCfgMsw(port) (ushort)inpw((port)+IOP_CONFIG_HIGH)
1013 #define AscSetChipCfgLsw(port, data) outpw((port)+IOP_CONFIG_LOW, data)
1014 #define AscSetChipCfgMsw(port, data) outpw((port)+IOP_CONFIG_HIGH, data)
1015 #define AscGetChipEEPCmd(port) (uchar)inp((port)+IOP_EEP_CMD)
1016 #define AscSetChipEEPCmd(port, data) outp((port)+IOP_EEP_CMD, data)
1017 #define AscGetChipEEPData(port) (ushort)inpw((port)+IOP_EEP_DATA)
1018 #define AscSetChipEEPData(port, data) outpw((port)+IOP_EEP_DATA, data)
1019 #define AscGetChipLramAddr(port) (ushort)inpw((PortAddr)((port)+IOP_RAM_ADDR))
1020 #define AscSetChipLramAddr(port, addr) outpw((PortAddr)((port)+IOP_RAM_ADDR), addr)
1021 #define AscGetChipLramData(port) (ushort)inpw((port)+IOP_RAM_DATA)
1022 #define AscSetChipLramData(port, data) outpw((port)+IOP_RAM_DATA, data)
1023 #define AscGetChipIFC(port) (uchar)inp((port)+IOP_REG_IFC)
1024 #define AscSetChipIFC(port, data) outp((port)+IOP_REG_IFC, data)
1025 #define AscGetChipStatus(port) (ASC_CS_TYPE)inpw((port)+IOP_STATUS)
1026 #define AscSetChipStatus(port, cs_val) outpw((port)+IOP_STATUS, cs_val)
1027 #define AscGetChipControl(port) (uchar)inp((port)+IOP_CTRL)
1028 #define AscSetChipControl(port, cc_val) outp((port)+IOP_CTRL, cc_val)
1029 #define AscGetChipSyn(port) (uchar)inp((port)+IOP_SYN_OFFSET)
1030 #define AscSetChipSyn(port, data) outp((port)+IOP_SYN_OFFSET, data)
1031 #define AscSetPCAddr(port, data) outpw((port)+IOP_REG_PC, data)
1032 #define AscGetPCAddr(port) (ushort)inpw((port)+IOP_REG_PC)
1033 #define AscIsIntPending(port) (AscGetChipStatus(port) & (CSW_INT_PENDING | CSW_SCSI_RESET_LATCH))
1034 #define AscGetChipScsiID(port) ((AscGetChipCfgLsw(port) >> 8) & ASC_MAX_TID)
1035 #define AscGetExtraControl(port) (uchar)inp((port)+IOP_EXTRA_CONTROL)
1036 #define AscSetExtraControl(port, data) outp((port)+IOP_EXTRA_CONTROL, data)
1037 #define AscReadChipAX(port) (ushort)inpw((port)+IOP_REG_AX)
1038 #define AscWriteChipAX(port, data) outpw((port)+IOP_REG_AX, data)
1039 #define AscReadChipIX(port) (uchar)inp((port)+IOP_REG_IX)
1040 #define AscWriteChipIX(port, data) outp((port)+IOP_REG_IX, data)
1041 #define AscReadChipIH(port) (ushort)inpw((port)+IOP_REG_IH)
1042 #define AscWriteChipIH(port, data) outpw((port)+IOP_REG_IH, data)
1043 #define AscReadChipQP(port) (uchar)inp((port)+IOP_REG_QP)
1044 #define AscWriteChipQP(port, data) outp((port)+IOP_REG_QP, data)
1045 #define AscReadChipFIFO_L(port) (ushort)inpw((port)+IOP_REG_FIFO_L)
1046 #define AscWriteChipFIFO_L(port, data) outpw((port)+IOP_REG_FIFO_L, data)
1047 #define AscReadChipFIFO_H(port) (ushort)inpw((port)+IOP_REG_FIFO_H)
1048 #define AscWriteChipFIFO_H(port, data) outpw((port)+IOP_REG_FIFO_H, data)
1049 #define AscReadChipDmaSpeed(port) (uchar)inp((port)+IOP_DMA_SPEED)
1050 #define AscWriteChipDmaSpeed(port, data) outp((port)+IOP_DMA_SPEED, data)
1051 #define AscReadChipDA0(port) (ushort)inpw((port)+IOP_REG_DA0)
1052 #define AscWriteChipDA0(port) outpw((port)+IOP_REG_DA0, data)
1053 #define AscReadChipDA1(port) (ushort)inpw((port)+IOP_REG_DA1)
1054 #define AscWriteChipDA1(port) outpw((port)+IOP_REG_DA1, data)
1055 #define AscReadChipDC0(port) (ushort)inpw((port)+IOP_REG_DC0)
1056 #define AscWriteChipDC0(port) outpw((port)+IOP_REG_DC0, data)
1057 #define AscReadChipDC1(port) (ushort)inpw((port)+IOP_REG_DC1)
1058 #define AscWriteChipDC1(port) outpw((port)+IOP_REG_DC1, data)
1059 #define AscReadChipDvcID(port) (uchar)inp((port)+IOP_REG_ID)
1060 #define AscWriteChipDvcID(port, data) outp((port)+IOP_REG_ID, data)
1062 static int AscWriteEEPCmdReg(PortAddr iop_base
, uchar cmd_reg
);
1063 static int AscWriteEEPDataReg(PortAddr iop_base
, ushort data_reg
);
1064 static void AscWaitEEPRead(void);
1065 static void AscWaitEEPWrite(void);
1066 static ushort
AscReadEEPWord(PortAddr
, uchar
);
1067 static ushort
AscWriteEEPWord(PortAddr
, uchar
, ushort
);
1068 static ushort
AscGetEEPConfig(PortAddr
, ASCEEP_CONFIG
*, ushort
);
1069 static int AscSetEEPConfigOnce(PortAddr
, ASCEEP_CONFIG
*, ushort
);
1070 static int AscSetEEPConfig(PortAddr
, ASCEEP_CONFIG
*, ushort
);
1071 static int AscStartChip(PortAddr
);
1072 static int AscStopChip(PortAddr
);
1073 static void AscSetChipIH(PortAddr
, ushort
);
1074 static int AscIsChipHalted(PortAddr
);
1075 static void AscAckInterrupt(PortAddr
);
1076 static void AscDisableInterrupt(PortAddr
);
1077 static void AscEnableInterrupt(PortAddr
);
1078 static void AscSetBank(PortAddr
, uchar
);
1079 static int AscResetChipAndScsiBus(ASC_DVC_VAR
*);
1081 static uchar
AscGetIsaDmaSpeed(PortAddr
);
1082 #endif /* CONFIG_ISA */
1083 static uchar
AscReadLramByte(PortAddr
, ushort
);
1084 static ushort
AscReadLramWord(PortAddr
, ushort
);
1085 #if CC_VERY_LONG_SG_LIST
1086 static ASC_DCNT
AscReadLramDWord(PortAddr
, ushort
);
1087 #endif /* CC_VERY_LONG_SG_LIST */
1088 static void AscWriteLramWord(PortAddr
, ushort
, ushort
);
1089 static void AscWriteLramByte(PortAddr
, ushort
, uchar
);
1090 static ASC_DCNT
AscMemSumLramWord(PortAddr
, ushort
, int);
1091 static void AscMemWordSetLram(PortAddr
, ushort
, ushort
, int);
1092 static void AscMemWordCopyPtrToLram(PortAddr
, ushort
, uchar
*, int);
1093 static void AscMemDWordCopyPtrToLram(PortAddr
, ushort
, uchar
*, int);
1094 static void AscMemWordCopyPtrFromLram(PortAddr
, ushort
, uchar
*, int);
1095 static ushort
AscInitAscDvcVar(ASC_DVC_VAR
*);
1096 static ushort
AscInitFromEEP(ASC_DVC_VAR
*);
1097 static ushort
AscInitMicroCodeVar(ASC_DVC_VAR
*);
1098 static int AscTestExternalLram(ASC_DVC_VAR
*);
1099 static uchar
AscMsgOutSDTR(ASC_DVC_VAR
*, uchar
, uchar
);
1100 static uchar
AscCalSDTRData(ASC_DVC_VAR
*, uchar
, uchar
);
1101 static void AscSetChipSDTR(PortAddr
, uchar
, uchar
);
1102 static uchar
AscGetSynPeriodIndex(ASC_DVC_VAR
*, uchar
);
1103 static uchar
AscAllocFreeQueue(PortAddr
, uchar
);
1104 static uchar
AscAllocMultipleFreeQueue(PortAddr
, uchar
, uchar
);
1105 static int AscHostReqRiscHalt(PortAddr
);
1106 static int AscStopQueueExe(PortAddr
);
1107 static int AscSendScsiQueue(ASC_DVC_VAR
*,
1108 ASC_SCSI_Q
*scsiq
, uchar n_q_required
);
1109 static int AscPutReadyQueue(ASC_DVC_VAR
*, ASC_SCSI_Q
*, uchar
);
1110 static int AscPutReadySgListQueue(ASC_DVC_VAR
*, ASC_SCSI_Q
*, uchar
);
1111 static int AscSetChipSynRegAtID(PortAddr
, uchar
, uchar
);
1112 static int AscSetRunChipSynRegAtID(PortAddr
, uchar
, uchar
);
1113 static ushort
AscInitLram(ASC_DVC_VAR
*);
1114 static ushort
AscInitQLinkVar(ASC_DVC_VAR
*);
1115 static int AscSetLibErrorCode(ASC_DVC_VAR
*, ushort
);
1116 static int AscIsrChipHalted(ASC_DVC_VAR
*);
1117 static uchar
_AscCopyLramScsiDoneQ(PortAddr
, ushort
,
1118 ASC_QDONE_INFO
*, ASC_DCNT
);
1119 static int AscIsrQDone(ASC_DVC_VAR
*);
1121 static ushort
AscGetEisaChipCfg(PortAddr
);
1122 #endif /* CONFIG_ISA */
1123 static uchar
AscGetChipScsiCtrl(PortAddr
);
1124 static uchar
AscGetChipVersion(PortAddr
, ushort
);
1125 static ASC_DCNT
AscLoadMicroCode(PortAddr
, ushort
, uchar
*, ushort
);
1126 static void AscToggleIRQAct(PortAddr
);
1127 static inline ulong
DvcEnterCritical(void);
1128 static inline void DvcLeaveCritical(ulong
);
1129 static void DvcSleepMilliSecond(ASC_DCNT
);
1130 static void DvcDelayNanoSecond(ASC_DVC_VAR
*, ASC_DCNT
);
1131 static void DvcPutScsiQ(PortAddr
, ushort
, uchar
*, int);
1132 static void DvcGetQinfo(PortAddr
, ushort
, uchar
*, int);
1133 static ushort
AscInitAsc1000Driver(ASC_DVC_VAR
*);
1134 static void AscAsyncFix(ASC_DVC_VAR
*, struct scsi_device
*);
1135 static int AscExeScsiQueue(ASC_DVC_VAR
*, ASC_SCSI_Q
*);
1136 static int AscISR(ASC_DVC_VAR
*);
1137 static uint
AscGetNumOfFreeQueue(ASC_DVC_VAR
*, uchar
, uchar
);
1138 static int AscSgListToQueue(int);
1140 static void AscEnableIsaDma(uchar
);
1141 #endif /* CONFIG_ISA */
1142 static const char *advansys_info(struct Scsi_Host
*shost
);
1145 * --- Adv Library Constants and Macros
1148 #define ADV_LIB_VERSION_MAJOR 5
1149 #define ADV_LIB_VERSION_MINOR 14
1152 * Define Adv Library required special types.
1156 * Portable Data Types
1158 * Any instance where a 32-bit long or pointer type is assumed
1159 * for precision or HW defined structures, the following define
1160 * types must be used. In Linux the char, short, and int types
1161 * are all consistent at 8, 16, and 32 bits respectively. Pointers
1162 * and long types are 64 bits on Alpha and UltraSPARC.
1164 #define ADV_PADDR __u32 /* Physical address data type. */
1165 #define ADV_VADDR __u32 /* Virtual address data type. */
1166 #define ADV_DCNT __u32 /* Unsigned Data count type. */
1167 #define ADV_SDCNT __s32 /* Signed Data count type. */
1170 * These macros are used to convert a virtual address to a
1171 * 32-bit value. This currently can be used on Linux Alpha
1172 * which uses 64-bit virtual address but a 32-bit bus address.
1173 * This is likely to break in the future, but doing this now
1174 * will give us time to change the HW and FW to handle 64-bit
1177 #define ADV_VADDR_TO_U32 virt_to_bus
1178 #define ADV_U32_TO_VADDR bus_to_virt
1180 #define AdvPortAddr void __iomem * /* Virtual memory address size */
1183 * Define Adv Library required memory access macros.
1185 #define ADV_MEM_READB(addr) readb(addr)
1186 #define ADV_MEM_READW(addr) readw(addr)
1187 #define ADV_MEM_WRITEB(addr, byte) writeb(byte, addr)
1188 #define ADV_MEM_WRITEW(addr, word) writew(word, addr)
1189 #define ADV_MEM_WRITEDW(addr, dword) writel(dword, addr)
1191 #define ADV_CARRIER_COUNT (ASC_DEF_MAX_HOST_QNG + 15)
1194 * For wide boards a CDB length maximum of 16 bytes
1197 #define ADV_MAX_CDB_LEN 16
1200 * Define total number of simultaneous maximum element scatter-gather
1201 * request blocks per wide adapter. ASC_DEF_MAX_HOST_QNG (253) is the
1202 * maximum number of outstanding commands per wide host adapter. Each
1203 * command uses one or more ADV_SG_BLOCK each with 15 scatter-gather
1204 * elements. Allow each command to have at least one ADV_SG_BLOCK structure.
1205 * This allows about 15 commands to have the maximum 17 ADV_SG_BLOCK
1206 * structures or 255 scatter-gather elements.
1209 #define ADV_TOT_SG_BLOCK ASC_DEF_MAX_HOST_QNG
1212 * Define Adv Library required maximum number of scatter-gather
1213 * elements per request.
1215 #define ADV_MAX_SG_LIST 255
1217 /* Number of SG blocks needed. */
1218 #define ADV_NUM_SG_BLOCK \
1219 ((ADV_MAX_SG_LIST + (NO_OF_SG_PER_BLOCK - 1))/NO_OF_SG_PER_BLOCK)
1221 /* Total contiguous memory needed for SG blocks. */
1222 #define ADV_SG_TOTAL_MEM_SIZE \
1223 (sizeof(ADV_SG_BLOCK) * ADV_NUM_SG_BLOCK)
1225 #define ADV_PAGE_SIZE PAGE_SIZE
1227 #define ADV_NUM_PAGE_CROSSING \
1228 ((ADV_SG_TOTAL_MEM_SIZE + (ADV_PAGE_SIZE - 1))/ADV_PAGE_SIZE)
1230 #define ADV_EEP_DVC_CFG_BEGIN (0x00)
1231 #define ADV_EEP_DVC_CFG_END (0x15)
1232 #define ADV_EEP_DVC_CTL_BEGIN (0x16) /* location of OEM name */
1233 #define ADV_EEP_MAX_WORD_ADDR (0x1E)
1235 #define ADV_EEP_DELAY_MS 100
1237 #define ADV_EEPROM_BIG_ENDIAN 0x8000 /* EEPROM Bit 15 */
1238 #define ADV_EEPROM_BIOS_ENABLE 0x4000 /* EEPROM Bit 14 */
1240 * For the ASC3550 Bit 13 is Termination Polarity control bit.
1241 * For later ICs Bit 13 controls whether the CIS (Card Information
1242 * Service Section) is loaded from EEPROM.
1244 #define ADV_EEPROM_TERM_POL 0x2000 /* EEPROM Bit 13 */
1245 #define ADV_EEPROM_CIS_LD 0x2000 /* EEPROM Bit 13 */
1249 * If EEPROM Bit 11 is 0 for Function 0, then Function 0 will specify
1250 * INT A in the PCI Configuration Space Int Pin field. If it is 1, then
1251 * Function 0 will specify INT B.
1253 * If EEPROM Bit 11 is 0 for Function 1, then Function 1 will specify
1254 * INT B in the PCI Configuration Space Int Pin field. If it is 1, then
1255 * Function 1 will specify INT A.
1257 #define ADV_EEPROM_INTAB 0x0800 /* EEPROM Bit 11 */
1259 typedef struct adveep_3550_config
{
1260 /* Word Offset, Description */
1262 ushort cfg_lsw
; /* 00 power up initialization */
1263 /* bit 13 set - Term Polarity Control */
1264 /* bit 14 set - BIOS Enable */
1265 /* bit 15 set - Big Endian Mode */
1266 ushort cfg_msw
; /* 01 unused */
1267 ushort disc_enable
; /* 02 disconnect enable */
1268 ushort wdtr_able
; /* 03 Wide DTR able */
1269 ushort sdtr_able
; /* 04 Synchronous DTR able */
1270 ushort start_motor
; /* 05 send start up motor */
1271 ushort tagqng_able
; /* 06 tag queuing able */
1272 ushort bios_scan
; /* 07 BIOS device control */
1273 ushort scam_tolerant
; /* 08 no scam */
1275 uchar adapter_scsi_id
; /* 09 Host Adapter ID */
1276 uchar bios_boot_delay
; /* power up wait */
1278 uchar scsi_reset_delay
; /* 10 reset delay */
1279 uchar bios_id_lun
; /* first boot device scsi id & lun */
1280 /* high nibble is lun */
1281 /* low nibble is scsi id */
1283 uchar termination
; /* 11 0 - automatic */
1284 /* 1 - low off / high off */
1285 /* 2 - low off / high on */
1286 /* 3 - low on / high on */
1287 /* There is no low on / high off */
1289 uchar reserved1
; /* reserved byte (not used) */
1291 ushort bios_ctrl
; /* 12 BIOS control bits */
1292 /* bit 0 BIOS don't act as initiator. */
1293 /* bit 1 BIOS > 1 GB support */
1294 /* bit 2 BIOS > 2 Disk Support */
1295 /* bit 3 BIOS don't support removables */
1296 /* bit 4 BIOS support bootable CD */
1297 /* bit 5 BIOS scan enabled */
1298 /* bit 6 BIOS support multiple LUNs */
1299 /* bit 7 BIOS display of message */
1300 /* bit 8 SCAM disabled */
1301 /* bit 9 Reset SCSI bus during init. */
1303 /* bit 11 No verbose initialization. */
1304 /* bit 12 SCSI parity enabled */
1308 ushort ultra_able
; /* 13 ULTRA speed able */
1309 ushort reserved2
; /* 14 reserved */
1310 uchar max_host_qng
; /* 15 maximum host queuing */
1311 uchar max_dvc_qng
; /* maximum per device queuing */
1312 ushort dvc_cntl
; /* 16 control bit for driver */
1313 ushort bug_fix
; /* 17 control bit for bug fix */
1314 ushort serial_number_word1
; /* 18 Board serial number word 1 */
1315 ushort serial_number_word2
; /* 19 Board serial number word 2 */
1316 ushort serial_number_word3
; /* 20 Board serial number word 3 */
1317 ushort check_sum
; /* 21 EEP check sum */
1318 uchar oem_name
[16]; /* 22 OEM name */
1319 ushort dvc_err_code
; /* 30 last device driver error code */
1320 ushort adv_err_code
; /* 31 last uc and Adv Lib error code */
1321 ushort adv_err_addr
; /* 32 last uc error address */
1322 ushort saved_dvc_err_code
; /* 33 saved last dev. driver error code */
1323 ushort saved_adv_err_code
; /* 34 saved last uc and Adv Lib error code */
1324 ushort saved_adv_err_addr
; /* 35 saved last uc error address */
1325 ushort num_of_err
; /* 36 number of error */
1326 } ADVEEP_3550_CONFIG
;
1328 typedef struct adveep_38C0800_config
{
1329 /* Word Offset, Description */
1331 ushort cfg_lsw
; /* 00 power up initialization */
1332 /* bit 13 set - Load CIS */
1333 /* bit 14 set - BIOS Enable */
1334 /* bit 15 set - Big Endian Mode */
1335 ushort cfg_msw
; /* 01 unused */
1336 ushort disc_enable
; /* 02 disconnect enable */
1337 ushort wdtr_able
; /* 03 Wide DTR able */
1338 ushort sdtr_speed1
; /* 04 SDTR Speed TID 0-3 */
1339 ushort start_motor
; /* 05 send start up motor */
1340 ushort tagqng_able
; /* 06 tag queuing able */
1341 ushort bios_scan
; /* 07 BIOS device control */
1342 ushort scam_tolerant
; /* 08 no scam */
1344 uchar adapter_scsi_id
; /* 09 Host Adapter ID */
1345 uchar bios_boot_delay
; /* power up wait */
1347 uchar scsi_reset_delay
; /* 10 reset delay */
1348 uchar bios_id_lun
; /* first boot device scsi id & lun */
1349 /* high nibble is lun */
1350 /* low nibble is scsi id */
1352 uchar termination_se
; /* 11 0 - automatic */
1353 /* 1 - low off / high off */
1354 /* 2 - low off / high on */
1355 /* 3 - low on / high on */
1356 /* There is no low on / high off */
1358 uchar termination_lvd
; /* 11 0 - automatic */
1359 /* 1 - low off / high off */
1360 /* 2 - low off / high on */
1361 /* 3 - low on / high on */
1362 /* There is no low on / high off */
1364 ushort bios_ctrl
; /* 12 BIOS control bits */
1365 /* bit 0 BIOS don't act as initiator. */
1366 /* bit 1 BIOS > 1 GB support */
1367 /* bit 2 BIOS > 2 Disk Support */
1368 /* bit 3 BIOS don't support removables */
1369 /* bit 4 BIOS support bootable CD */
1370 /* bit 5 BIOS scan enabled */
1371 /* bit 6 BIOS support multiple LUNs */
1372 /* bit 7 BIOS display of message */
1373 /* bit 8 SCAM disabled */
1374 /* bit 9 Reset SCSI bus during init. */
1376 /* bit 11 No verbose initialization. */
1377 /* bit 12 SCSI parity enabled */
1381 ushort sdtr_speed2
; /* 13 SDTR speed TID 4-7 */
1382 ushort sdtr_speed3
; /* 14 SDTR speed TID 8-11 */
1383 uchar max_host_qng
; /* 15 maximum host queueing */
1384 uchar max_dvc_qng
; /* maximum per device queuing */
1385 ushort dvc_cntl
; /* 16 control bit for driver */
1386 ushort sdtr_speed4
; /* 17 SDTR speed 4 TID 12-15 */
1387 ushort serial_number_word1
; /* 18 Board serial number word 1 */
1388 ushort serial_number_word2
; /* 19 Board serial number word 2 */
1389 ushort serial_number_word3
; /* 20 Board serial number word 3 */
1390 ushort check_sum
; /* 21 EEP check sum */
1391 uchar oem_name
[16]; /* 22 OEM name */
1392 ushort dvc_err_code
; /* 30 last device driver error code */
1393 ushort adv_err_code
; /* 31 last uc and Adv Lib error code */
1394 ushort adv_err_addr
; /* 32 last uc error address */
1395 ushort saved_dvc_err_code
; /* 33 saved last dev. driver error code */
1396 ushort saved_adv_err_code
; /* 34 saved last uc and Adv Lib error code */
1397 ushort saved_adv_err_addr
; /* 35 saved last uc error address */
1398 ushort reserved36
; /* 36 reserved */
1399 ushort reserved37
; /* 37 reserved */
1400 ushort reserved38
; /* 38 reserved */
1401 ushort reserved39
; /* 39 reserved */
1402 ushort reserved40
; /* 40 reserved */
1403 ushort reserved41
; /* 41 reserved */
1404 ushort reserved42
; /* 42 reserved */
1405 ushort reserved43
; /* 43 reserved */
1406 ushort reserved44
; /* 44 reserved */
1407 ushort reserved45
; /* 45 reserved */
1408 ushort reserved46
; /* 46 reserved */
1409 ushort reserved47
; /* 47 reserved */
1410 ushort reserved48
; /* 48 reserved */
1411 ushort reserved49
; /* 49 reserved */
1412 ushort reserved50
; /* 50 reserved */
1413 ushort reserved51
; /* 51 reserved */
1414 ushort reserved52
; /* 52 reserved */
1415 ushort reserved53
; /* 53 reserved */
1416 ushort reserved54
; /* 54 reserved */
1417 ushort reserved55
; /* 55 reserved */
1418 ushort cisptr_lsw
; /* 56 CIS PTR LSW */
1419 ushort cisprt_msw
; /* 57 CIS PTR MSW */
1420 ushort subsysvid
; /* 58 SubSystem Vendor ID */
1421 ushort subsysid
; /* 59 SubSystem ID */
1422 ushort reserved60
; /* 60 reserved */
1423 ushort reserved61
; /* 61 reserved */
1424 ushort reserved62
; /* 62 reserved */
1425 ushort reserved63
; /* 63 reserved */
1426 } ADVEEP_38C0800_CONFIG
;
1428 typedef struct adveep_38C1600_config
{
1429 /* Word Offset, Description */
1431 ushort cfg_lsw
; /* 00 power up initialization */
1432 /* bit 11 set - Func. 0 INTB, Func. 1 INTA */
1433 /* clear - Func. 0 INTA, Func. 1 INTB */
1434 /* bit 13 set - Load CIS */
1435 /* bit 14 set - BIOS Enable */
1436 /* bit 15 set - Big Endian Mode */
1437 ushort cfg_msw
; /* 01 unused */
1438 ushort disc_enable
; /* 02 disconnect enable */
1439 ushort wdtr_able
; /* 03 Wide DTR able */
1440 ushort sdtr_speed1
; /* 04 SDTR Speed TID 0-3 */
1441 ushort start_motor
; /* 05 send start up motor */
1442 ushort tagqng_able
; /* 06 tag queuing able */
1443 ushort bios_scan
; /* 07 BIOS device control */
1444 ushort scam_tolerant
; /* 08 no scam */
1446 uchar adapter_scsi_id
; /* 09 Host Adapter ID */
1447 uchar bios_boot_delay
; /* power up wait */
1449 uchar scsi_reset_delay
; /* 10 reset delay */
1450 uchar bios_id_lun
; /* first boot device scsi id & lun */
1451 /* high nibble is lun */
1452 /* low nibble is scsi id */
1454 uchar termination_se
; /* 11 0 - automatic */
1455 /* 1 - low off / high off */
1456 /* 2 - low off / high on */
1457 /* 3 - low on / high on */
1458 /* There is no low on / high off */
1460 uchar termination_lvd
; /* 11 0 - automatic */
1461 /* 1 - low off / high off */
1462 /* 2 - low off / high on */
1463 /* 3 - low on / high on */
1464 /* There is no low on / high off */
1466 ushort bios_ctrl
; /* 12 BIOS control bits */
1467 /* bit 0 BIOS don't act as initiator. */
1468 /* bit 1 BIOS > 1 GB support */
1469 /* bit 2 BIOS > 2 Disk Support */
1470 /* bit 3 BIOS don't support removables */
1471 /* bit 4 BIOS support bootable CD */
1472 /* bit 5 BIOS scan enabled */
1473 /* bit 6 BIOS support multiple LUNs */
1474 /* bit 7 BIOS display of message */
1475 /* bit 8 SCAM disabled */
1476 /* bit 9 Reset SCSI bus during init. */
1477 /* bit 10 Basic Integrity Checking disabled */
1478 /* bit 11 No verbose initialization. */
1479 /* bit 12 SCSI parity enabled */
1480 /* bit 13 AIPP (Asyn. Info. Ph. Prot.) dis. */
1483 ushort sdtr_speed2
; /* 13 SDTR speed TID 4-7 */
1484 ushort sdtr_speed3
; /* 14 SDTR speed TID 8-11 */
1485 uchar max_host_qng
; /* 15 maximum host queueing */
1486 uchar max_dvc_qng
; /* maximum per device queuing */
1487 ushort dvc_cntl
; /* 16 control bit for driver */
1488 ushort sdtr_speed4
; /* 17 SDTR speed 4 TID 12-15 */
1489 ushort serial_number_word1
; /* 18 Board serial number word 1 */
1490 ushort serial_number_word2
; /* 19 Board serial number word 2 */
1491 ushort serial_number_word3
; /* 20 Board serial number word 3 */
1492 ushort check_sum
; /* 21 EEP check sum */
1493 uchar oem_name
[16]; /* 22 OEM name */
1494 ushort dvc_err_code
; /* 30 last device driver error code */
1495 ushort adv_err_code
; /* 31 last uc and Adv Lib error code */
1496 ushort adv_err_addr
; /* 32 last uc error address */
1497 ushort saved_dvc_err_code
; /* 33 saved last dev. driver error code */
1498 ushort saved_adv_err_code
; /* 34 saved last uc and Adv Lib error code */
1499 ushort saved_adv_err_addr
; /* 35 saved last uc error address */
1500 ushort reserved36
; /* 36 reserved */
1501 ushort reserved37
; /* 37 reserved */
1502 ushort reserved38
; /* 38 reserved */
1503 ushort reserved39
; /* 39 reserved */
1504 ushort reserved40
; /* 40 reserved */
1505 ushort reserved41
; /* 41 reserved */
1506 ushort reserved42
; /* 42 reserved */
1507 ushort reserved43
; /* 43 reserved */
1508 ushort reserved44
; /* 44 reserved */
1509 ushort reserved45
; /* 45 reserved */
1510 ushort reserved46
; /* 46 reserved */
1511 ushort reserved47
; /* 47 reserved */
1512 ushort reserved48
; /* 48 reserved */
1513 ushort reserved49
; /* 49 reserved */
1514 ushort reserved50
; /* 50 reserved */
1515 ushort reserved51
; /* 51 reserved */
1516 ushort reserved52
; /* 52 reserved */
1517 ushort reserved53
; /* 53 reserved */
1518 ushort reserved54
; /* 54 reserved */
1519 ushort reserved55
; /* 55 reserved */
1520 ushort cisptr_lsw
; /* 56 CIS PTR LSW */
1521 ushort cisprt_msw
; /* 57 CIS PTR MSW */
1522 ushort subsysvid
; /* 58 SubSystem Vendor ID */
1523 ushort subsysid
; /* 59 SubSystem ID */
1524 ushort reserved60
; /* 60 reserved */
1525 ushort reserved61
; /* 61 reserved */
1526 ushort reserved62
; /* 62 reserved */
1527 ushort reserved63
; /* 63 reserved */
1528 } ADVEEP_38C1600_CONFIG
;
1533 #define ASC_EEP_CMD_DONE 0x0200
1534 #define ASC_EEP_CMD_DONE_ERR 0x0001
1537 #define EEP_CFG_WORD_BIG_ENDIAN 0x8000
1540 #define BIOS_CTRL_BIOS 0x0001
1541 #define BIOS_CTRL_EXTENDED_XLAT 0x0002
1542 #define BIOS_CTRL_GT_2_DISK 0x0004
1543 #define BIOS_CTRL_BIOS_REMOVABLE 0x0008
1544 #define BIOS_CTRL_BOOTABLE_CD 0x0010
1545 #define BIOS_CTRL_MULTIPLE_LUN 0x0040
1546 #define BIOS_CTRL_DISPLAY_MSG 0x0080
1547 #define BIOS_CTRL_NO_SCAM 0x0100
1548 #define BIOS_CTRL_RESET_SCSI_BUS 0x0200
1549 #define BIOS_CTRL_INIT_VERBOSE 0x0800
1550 #define BIOS_CTRL_SCSI_PARITY 0x1000
1551 #define BIOS_CTRL_AIPP_DIS 0x2000
1553 #define ADV_3550_MEMSIZE 0x2000 /* 8 KB Internal Memory */
1555 #define ADV_38C0800_MEMSIZE 0x4000 /* 16 KB Internal Memory */
1558 * XXX - Since ASC38C1600 Rev.3 has a local RAM failure issue, there is
1559 * a special 16K Adv Library and Microcode version. After the issue is
1560 * resolved, should restore 32K support.
1562 * #define ADV_38C1600_MEMSIZE 0x8000L * 32 KB Internal Memory *
1564 #define ADV_38C1600_MEMSIZE 0x4000 /* 16 KB Internal Memory */
1567 * Byte I/O register address from base of 'iop_base'.
1569 #define IOPB_INTR_STATUS_REG 0x00
1570 #define IOPB_CHIP_ID_1 0x01
1571 #define IOPB_INTR_ENABLES 0x02
1572 #define IOPB_CHIP_TYPE_REV 0x03
1573 #define IOPB_RES_ADDR_4 0x04
1574 #define IOPB_RES_ADDR_5 0x05
1575 #define IOPB_RAM_DATA 0x06
1576 #define IOPB_RES_ADDR_7 0x07
1577 #define IOPB_FLAG_REG 0x08
1578 #define IOPB_RES_ADDR_9 0x09
1579 #define IOPB_RISC_CSR 0x0A
1580 #define IOPB_RES_ADDR_B 0x0B
1581 #define IOPB_RES_ADDR_C 0x0C
1582 #define IOPB_RES_ADDR_D 0x0D
1583 #define IOPB_SOFT_OVER_WR 0x0E
1584 #define IOPB_RES_ADDR_F 0x0F
1585 #define IOPB_MEM_CFG 0x10
1586 #define IOPB_RES_ADDR_11 0x11
1587 #define IOPB_GPIO_DATA 0x12
1588 #define IOPB_RES_ADDR_13 0x13
1589 #define IOPB_FLASH_PAGE 0x14
1590 #define IOPB_RES_ADDR_15 0x15
1591 #define IOPB_GPIO_CNTL 0x16
1592 #define IOPB_RES_ADDR_17 0x17
1593 #define IOPB_FLASH_DATA 0x18
1594 #define IOPB_RES_ADDR_19 0x19
1595 #define IOPB_RES_ADDR_1A 0x1A
1596 #define IOPB_RES_ADDR_1B 0x1B
1597 #define IOPB_RES_ADDR_1C 0x1C
1598 #define IOPB_RES_ADDR_1D 0x1D
1599 #define IOPB_RES_ADDR_1E 0x1E
1600 #define IOPB_RES_ADDR_1F 0x1F
1601 #define IOPB_DMA_CFG0 0x20
1602 #define IOPB_DMA_CFG1 0x21
1603 #define IOPB_TICKLE 0x22
1604 #define IOPB_DMA_REG_WR 0x23
1605 #define IOPB_SDMA_STATUS 0x24
1606 #define IOPB_SCSI_BYTE_CNT 0x25
1607 #define IOPB_HOST_BYTE_CNT 0x26
1608 #define IOPB_BYTE_LEFT_TO_XFER 0x27
1609 #define IOPB_BYTE_TO_XFER_0 0x28
1610 #define IOPB_BYTE_TO_XFER_1 0x29
1611 #define IOPB_BYTE_TO_XFER_2 0x2A
1612 #define IOPB_BYTE_TO_XFER_3 0x2B
1613 #define IOPB_ACC_GRP 0x2C
1614 #define IOPB_RES_ADDR_2D 0x2D
1615 #define IOPB_DEV_ID 0x2E
1616 #define IOPB_RES_ADDR_2F 0x2F
1617 #define IOPB_SCSI_DATA 0x30
1618 #define IOPB_RES_ADDR_31 0x31
1619 #define IOPB_RES_ADDR_32 0x32
1620 #define IOPB_SCSI_DATA_HSHK 0x33
1621 #define IOPB_SCSI_CTRL 0x34
1622 #define IOPB_RES_ADDR_35 0x35
1623 #define IOPB_RES_ADDR_36 0x36
1624 #define IOPB_RES_ADDR_37 0x37
1625 #define IOPB_RAM_BIST 0x38
1626 #define IOPB_PLL_TEST 0x39
1627 #define IOPB_PCI_INT_CFG 0x3A
1628 #define IOPB_RES_ADDR_3B 0x3B
1629 #define IOPB_RFIFO_CNT 0x3C
1630 #define IOPB_RES_ADDR_3D 0x3D
1631 #define IOPB_RES_ADDR_3E 0x3E
1632 #define IOPB_RES_ADDR_3F 0x3F
1635 * Word I/O register address from base of 'iop_base'.
1637 #define IOPW_CHIP_ID_0 0x00 /* CID0 */
1638 #define IOPW_CTRL_REG 0x02 /* CC */
1639 #define IOPW_RAM_ADDR 0x04 /* LA */
1640 #define IOPW_RAM_DATA 0x06 /* LD */
1641 #define IOPW_RES_ADDR_08 0x08
1642 #define IOPW_RISC_CSR 0x0A /* CSR */
1643 #define IOPW_SCSI_CFG0 0x0C /* CFG0 */
1644 #define IOPW_SCSI_CFG1 0x0E /* CFG1 */
1645 #define IOPW_RES_ADDR_10 0x10
1646 #define IOPW_SEL_MASK 0x12 /* SM */
1647 #define IOPW_RES_ADDR_14 0x14
1648 #define IOPW_FLASH_ADDR 0x16 /* FA */
1649 #define IOPW_RES_ADDR_18 0x18
1650 #define IOPW_EE_CMD 0x1A /* EC */
1651 #define IOPW_EE_DATA 0x1C /* ED */
1652 #define IOPW_SFIFO_CNT 0x1E /* SFC */
1653 #define IOPW_RES_ADDR_20 0x20
1654 #define IOPW_Q_BASE 0x22 /* QB */
1655 #define IOPW_QP 0x24 /* QP */
1656 #define IOPW_IX 0x26 /* IX */
1657 #define IOPW_SP 0x28 /* SP */
1658 #define IOPW_PC 0x2A /* PC */
1659 #define IOPW_RES_ADDR_2C 0x2C
1660 #define IOPW_RES_ADDR_2E 0x2E
1661 #define IOPW_SCSI_DATA 0x30 /* SD */
1662 #define IOPW_SCSI_DATA_HSHK 0x32 /* SDH */
1663 #define IOPW_SCSI_CTRL 0x34 /* SC */
1664 #define IOPW_HSHK_CFG 0x36 /* HCFG */
1665 #define IOPW_SXFR_STATUS 0x36 /* SXS */
1666 #define IOPW_SXFR_CNTL 0x38 /* SXL */
1667 #define IOPW_SXFR_CNTH 0x3A /* SXH */
1668 #define IOPW_RES_ADDR_3C 0x3C
1669 #define IOPW_RFIFO_DATA 0x3E /* RFD */
1672 * Doubleword I/O register address from base of 'iop_base'.
1674 #define IOPDW_RES_ADDR_0 0x00
1675 #define IOPDW_RAM_DATA 0x04
1676 #define IOPDW_RES_ADDR_8 0x08
1677 #define IOPDW_RES_ADDR_C 0x0C
1678 #define IOPDW_RES_ADDR_10 0x10
1679 #define IOPDW_COMMA 0x14
1680 #define IOPDW_COMMB 0x18
1681 #define IOPDW_RES_ADDR_1C 0x1C
1682 #define IOPDW_SDMA_ADDR0 0x20
1683 #define IOPDW_SDMA_ADDR1 0x24
1684 #define IOPDW_SDMA_COUNT 0x28
1685 #define IOPDW_SDMA_ERROR 0x2C
1686 #define IOPDW_RDMA_ADDR0 0x30
1687 #define IOPDW_RDMA_ADDR1 0x34
1688 #define IOPDW_RDMA_COUNT 0x38
1689 #define IOPDW_RDMA_ERROR 0x3C
1691 #define ADV_CHIP_ID_BYTE 0x25
1692 #define ADV_CHIP_ID_WORD 0x04C1
1694 #define ADV_SC_SCSI_BUS_RESET 0x2000
1696 #define ADV_INTR_ENABLE_HOST_INTR 0x01
1697 #define ADV_INTR_ENABLE_SEL_INTR 0x02
1698 #define ADV_INTR_ENABLE_DPR_INTR 0x04
1699 #define ADV_INTR_ENABLE_RTA_INTR 0x08
1700 #define ADV_INTR_ENABLE_RMA_INTR 0x10
1701 #define ADV_INTR_ENABLE_RST_INTR 0x20
1702 #define ADV_INTR_ENABLE_DPE_INTR 0x40
1703 #define ADV_INTR_ENABLE_GLOBAL_INTR 0x80
1705 #define ADV_INTR_STATUS_INTRA 0x01
1706 #define ADV_INTR_STATUS_INTRB 0x02
1707 #define ADV_INTR_STATUS_INTRC 0x04
1709 #define ADV_RISC_CSR_STOP (0x0000)
1710 #define ADV_RISC_TEST_COND (0x2000)
1711 #define ADV_RISC_CSR_RUN (0x4000)
1712 #define ADV_RISC_CSR_SINGLE_STEP (0x8000)
1714 #define ADV_CTRL_REG_HOST_INTR 0x0100
1715 #define ADV_CTRL_REG_SEL_INTR 0x0200
1716 #define ADV_CTRL_REG_DPR_INTR 0x0400
1717 #define ADV_CTRL_REG_RTA_INTR 0x0800
1718 #define ADV_CTRL_REG_RMA_INTR 0x1000
1719 #define ADV_CTRL_REG_RES_BIT14 0x2000
1720 #define ADV_CTRL_REG_DPE_INTR 0x4000
1721 #define ADV_CTRL_REG_POWER_DONE 0x8000
1722 #define ADV_CTRL_REG_ANY_INTR 0xFF00
1724 #define ADV_CTRL_REG_CMD_RESET 0x00C6
1725 #define ADV_CTRL_REG_CMD_WR_IO_REG 0x00C5
1726 #define ADV_CTRL_REG_CMD_RD_IO_REG 0x00C4
1727 #define ADV_CTRL_REG_CMD_WR_PCI_CFG_SPACE 0x00C3
1728 #define ADV_CTRL_REG_CMD_RD_PCI_CFG_SPACE 0x00C2
1730 #define ADV_TICKLE_NOP 0x00
1731 #define ADV_TICKLE_A 0x01
1732 #define ADV_TICKLE_B 0x02
1733 #define ADV_TICKLE_C 0x03
1735 #define ADV_SCSI_CTRL_RSTOUT 0x2000
1737 #define AdvIsIntPending(port) \
1738 (AdvReadWordRegister(port, IOPW_CTRL_REG) & ADV_CTRL_REG_HOST_INTR)
1741 * SCSI_CFG0 Register bit definitions
1743 #define TIMER_MODEAB 0xC000 /* Watchdog, Second, and Select. Timer Ctrl. */
1744 #define PARITY_EN 0x2000 /* Enable SCSI Parity Error detection */
1745 #define EVEN_PARITY 0x1000 /* Select Even Parity */
1746 #define WD_LONG 0x0800 /* Watchdog Interval, 1: 57 min, 0: 13 sec */
1747 #define QUEUE_128 0x0400 /* Queue Size, 1: 128 byte, 0: 64 byte */
1748 #define PRIM_MODE 0x0100 /* Primitive SCSI mode */
1749 #define SCAM_EN 0x0080 /* Enable SCAM selection */
1750 #define SEL_TMO_LONG 0x0040 /* Sel/Resel Timeout, 1: 400 ms, 0: 1.6 ms */
1751 #define CFRM_ID 0x0020 /* SCAM id sel. confirm., 1: fast, 0: 6.4 ms */
1752 #define OUR_ID_EN 0x0010 /* Enable OUR_ID bits */
1753 #define OUR_ID 0x000F /* SCSI ID */
1756 * SCSI_CFG1 Register bit definitions
1758 #define BIG_ENDIAN 0x8000 /* Enable Big Endian Mode MIO:15, EEP:15 */
1759 #define TERM_POL 0x2000 /* Terminator Polarity Ctrl. MIO:13, EEP:13 */
1760 #define SLEW_RATE 0x1000 /* SCSI output buffer slew rate */
1761 #define FILTER_SEL 0x0C00 /* Filter Period Selection */
1762 #define FLTR_DISABLE 0x0000 /* Input Filtering Disabled */
1763 #define FLTR_11_TO_20NS 0x0800 /* Input Filtering 11ns to 20ns */
1764 #define FLTR_21_TO_39NS 0x0C00 /* Input Filtering 21ns to 39ns */
1765 #define ACTIVE_DBL 0x0200 /* Disable Active Negation */
1766 #define DIFF_MODE 0x0100 /* SCSI differential Mode (Read-Only) */
1767 #define DIFF_SENSE 0x0080 /* 1: No SE cables, 0: SE cable (Read-Only) */
1768 #define TERM_CTL_SEL 0x0040 /* Enable TERM_CTL_H and TERM_CTL_L */
1769 #define TERM_CTL 0x0030 /* External SCSI Termination Bits */
1770 #define TERM_CTL_H 0x0020 /* Enable External SCSI Upper Termination */
1771 #define TERM_CTL_L 0x0010 /* Enable External SCSI Lower Termination */
1772 #define CABLE_DETECT 0x000F /* External SCSI Cable Connection Status */
1775 * Addendum for ASC-38C0800 Chip
1777 * The ASC-38C1600 Chip uses the same definitions except that the
1778 * bus mode override bits [12:10] have been moved to byte register
1779 * offset 0xE (IOPB_SOFT_OVER_WR) bits [12:10]. The [12:10] bits in
1780 * SCSI_CFG1 are read-only and always available. Bit 14 (DIS_TERM_DRV)
1781 * is not needed. The [12:10] bits in IOPB_SOFT_OVER_WR are write-only.
1782 * Also each ASC-38C1600 function or channel uses only cable bits [5:4]
1783 * and [1:0]. Bits [14], [7:6], [3:2] are unused.
1785 #define DIS_TERM_DRV 0x4000 /* 1: Read c_det[3:0], 0: cannot read */
1786 #define HVD_LVD_SE 0x1C00 /* Device Detect Bits */
1787 #define HVD 0x1000 /* HVD Device Detect */
1788 #define LVD 0x0800 /* LVD Device Detect */
1789 #define SE 0x0400 /* SE Device Detect */
1790 #define TERM_LVD 0x00C0 /* LVD Termination Bits */
1791 #define TERM_LVD_HI 0x0080 /* Enable LVD Upper Termination */
1792 #define TERM_LVD_LO 0x0040 /* Enable LVD Lower Termination */
1793 #define TERM_SE 0x0030 /* SE Termination Bits */
1794 #define TERM_SE_HI 0x0020 /* Enable SE Upper Termination */
1795 #define TERM_SE_LO 0x0010 /* Enable SE Lower Termination */
1796 #define C_DET_LVD 0x000C /* LVD Cable Detect Bits */
1797 #define C_DET3 0x0008 /* Cable Detect for LVD External Wide */
1798 #define C_DET2 0x0004 /* Cable Detect for LVD Internal Wide */
1799 #define C_DET_SE 0x0003 /* SE Cable Detect Bits */
1800 #define C_DET1 0x0002 /* Cable Detect for SE Internal Wide */
1801 #define C_DET0 0x0001 /* Cable Detect for SE Internal Narrow */
1803 #define CABLE_ILLEGAL_A 0x7
1804 /* x 0 0 0 | on on | Illegal (all 3 connectors are used) */
1806 #define CABLE_ILLEGAL_B 0xB
1807 /* 0 x 0 0 | on on | Illegal (all 3 connectors are used) */
1810 * MEM_CFG Register bit definitions
1812 #define BIOS_EN 0x40 /* BIOS Enable MIO:14,EEP:14 */
1813 #define FAST_EE_CLK 0x20 /* Diagnostic Bit */
1814 #define RAM_SZ 0x1C /* Specify size of RAM to RISC */
1815 #define RAM_SZ_2KB 0x00 /* 2 KB */
1816 #define RAM_SZ_4KB 0x04 /* 4 KB */
1817 #define RAM_SZ_8KB 0x08 /* 8 KB */
1818 #define RAM_SZ_16KB 0x0C /* 16 KB */
1819 #define RAM_SZ_32KB 0x10 /* 32 KB */
1820 #define RAM_SZ_64KB 0x14 /* 64 KB */
1823 * DMA_CFG0 Register bit definitions
1825 * This register is only accessible to the host.
1827 #define BC_THRESH_ENB 0x80 /* PCI DMA Start Conditions */
1828 #define FIFO_THRESH 0x70 /* PCI DMA FIFO Threshold */
1829 #define FIFO_THRESH_16B 0x00 /* 16 bytes */
1830 #define FIFO_THRESH_32B 0x20 /* 32 bytes */
1831 #define FIFO_THRESH_48B 0x30 /* 48 bytes */
1832 #define FIFO_THRESH_64B 0x40 /* 64 bytes */
1833 #define FIFO_THRESH_80B 0x50 /* 80 bytes (default) */
1834 #define FIFO_THRESH_96B 0x60 /* 96 bytes */
1835 #define FIFO_THRESH_112B 0x70 /* 112 bytes */
1836 #define START_CTL 0x0C /* DMA start conditions */
1837 #define START_CTL_TH 0x00 /* Wait threshold level (default) */
1838 #define START_CTL_ID 0x04 /* Wait SDMA/SBUS idle */
1839 #define START_CTL_THID 0x08 /* Wait threshold and SDMA/SBUS idle */
1840 #define START_CTL_EMFU 0x0C /* Wait SDMA FIFO empty/full */
1841 #define READ_CMD 0x03 /* Memory Read Method */
1842 #define READ_CMD_MR 0x00 /* Memory Read */
1843 #define READ_CMD_MRL 0x02 /* Memory Read Long */
1844 #define READ_CMD_MRM 0x03 /* Memory Read Multiple (default) */
1847 * ASC-38C0800 RAM BIST Register bit definitions
1849 #define RAM_TEST_MODE 0x80
1850 #define PRE_TEST_MODE 0x40
1851 #define NORMAL_MODE 0x00
1852 #define RAM_TEST_DONE 0x10
1853 #define RAM_TEST_STATUS 0x0F
1854 #define RAM_TEST_HOST_ERROR 0x08
1855 #define RAM_TEST_INTRAM_ERROR 0x04
1856 #define RAM_TEST_RISC_ERROR 0x02
1857 #define RAM_TEST_SCSI_ERROR 0x01
1858 #define RAM_TEST_SUCCESS 0x00
1859 #define PRE_TEST_VALUE 0x05
1860 #define NORMAL_VALUE 0x00
1863 * ASC38C1600 Definitions
1865 * IOPB_PCI_INT_CFG Bit Field Definitions
1868 #define INTAB_LD 0x80 /* Value loaded from EEPROM Bit 11. */
1871 * Bit 1 can be set to change the interrupt for the Function to operate in
1872 * Totem Pole mode. By default Bit 1 is 0 and the interrupt operates in
1873 * Open Drain mode. Both functions of the ASC38C1600 must be set to the same
1874 * mode, otherwise the operating mode is undefined.
1876 #define TOTEMPOLE 0x02
1879 * Bit 0 can be used to change the Int Pin for the Function. The value is
1880 * 0 by default for both Functions with Function 0 using INT A and Function
1881 * B using INT B. For Function 0 if set, INT B is used. For Function 1 if set,
1884 * EEPROM Word 0 Bit 11 for each Function may change the initial Int Pin
1885 * value specified in the PCI Configuration Space.
1892 * Adv Library Status Definitions
1896 #define ADV_NOERROR 1
1897 #define ADV_SUCCESS 1
1899 #define ADV_ERROR (-1)
1902 * ADV_DVC_VAR 'warn_code' values
1904 #define ASC_WARN_BUSRESET_ERROR 0x0001 /* SCSI Bus Reset error */
1905 #define ASC_WARN_EEPROM_CHKSUM 0x0002 /* EEP check sum error */
1906 #define ASC_WARN_EEPROM_TERMINATION 0x0004 /* EEP termination bad field */
1907 #define ASC_WARN_SET_PCI_CONFIG_SPACE 0x0080 /* PCI config space set error */
1908 #define ASC_WARN_ERROR 0xFFFF /* ADV_ERROR return */
1910 #define ADV_MAX_TID 15 /* max. target identifier */
1911 #define ADV_MAX_LUN 7 /* max. logical unit number */
1914 * Error code values are set in ADV_DVC_VAR 'err_code'.
1916 #define ASC_IERR_WRITE_EEPROM 0x0001 /* write EEPROM error */
1917 #define ASC_IERR_MCODE_CHKSUM 0x0002 /* micro code check sum error */
1918 #define ASC_IERR_NO_CARRIER 0x0004 /* No more carrier memory. */
1919 #define ASC_IERR_START_STOP_CHIP 0x0008 /* start/stop chip failed */
1920 #define ASC_IERR_CHIP_VERSION 0x0040 /* wrong chip version */
1921 #define ASC_IERR_SET_SCSI_ID 0x0080 /* set SCSI ID failed */
1922 #define ASC_IERR_HVD_DEVICE 0x0100 /* HVD attached to LVD connector. */
1923 #define ASC_IERR_BAD_SIGNATURE 0x0200 /* signature not found */
1924 #define ASC_IERR_ILLEGAL_CONNECTION 0x0400 /* Illegal cable connection */
1925 #define ASC_IERR_SINGLE_END_DEVICE 0x0800 /* Single-end used w/differential */
1926 #define ASC_IERR_REVERSED_CABLE 0x1000 /* Narrow flat cable reversed */
1927 #define ASC_IERR_BIST_PRE_TEST 0x2000 /* BIST pre-test error */
1928 #define ASC_IERR_BIST_RAM_TEST 0x4000 /* BIST RAM test error */
1929 #define ASC_IERR_BAD_CHIPTYPE 0x8000 /* Invalid 'chip_type' setting. */
1932 * Fixed locations of microcode operating variables.
1934 #define ASC_MC_CODE_BEGIN_ADDR 0x0028 /* microcode start address */
1935 #define ASC_MC_CODE_END_ADDR 0x002A /* microcode end address */
1936 #define ASC_MC_CODE_CHK_SUM 0x002C /* microcode code checksum */
1937 #define ASC_MC_VERSION_DATE 0x0038 /* microcode version */
1938 #define ASC_MC_VERSION_NUM 0x003A /* microcode number */
1939 #define ASC_MC_BIOSMEM 0x0040 /* BIOS RISC Memory Start */
1940 #define ASC_MC_BIOSLEN 0x0050 /* BIOS RISC Memory Length */
1941 #define ASC_MC_BIOS_SIGNATURE 0x0058 /* BIOS Signature 0x55AA */
1942 #define ASC_MC_BIOS_VERSION 0x005A /* BIOS Version (2 bytes) */
1943 #define ASC_MC_SDTR_SPEED1 0x0090 /* SDTR Speed for TID 0-3 */
1944 #define ASC_MC_SDTR_SPEED2 0x0092 /* SDTR Speed for TID 4-7 */
1945 #define ASC_MC_SDTR_SPEED3 0x0094 /* SDTR Speed for TID 8-11 */
1946 #define ASC_MC_SDTR_SPEED4 0x0096 /* SDTR Speed for TID 12-15 */
1947 #define ASC_MC_CHIP_TYPE 0x009A
1948 #define ASC_MC_INTRB_CODE 0x009B
1949 #define ASC_MC_WDTR_ABLE 0x009C
1950 #define ASC_MC_SDTR_ABLE 0x009E
1951 #define ASC_MC_TAGQNG_ABLE 0x00A0
1952 #define ASC_MC_DISC_ENABLE 0x00A2
1953 #define ASC_MC_IDLE_CMD_STATUS 0x00A4
1954 #define ASC_MC_IDLE_CMD 0x00A6
1955 #define ASC_MC_IDLE_CMD_PARAMETER 0x00A8
1956 #define ASC_MC_DEFAULT_SCSI_CFG0 0x00AC
1957 #define ASC_MC_DEFAULT_SCSI_CFG1 0x00AE
1958 #define ASC_MC_DEFAULT_MEM_CFG 0x00B0
1959 #define ASC_MC_DEFAULT_SEL_MASK 0x00B2
1960 #define ASC_MC_SDTR_DONE 0x00B6
1961 #define ASC_MC_NUMBER_OF_QUEUED_CMD 0x00C0
1962 #define ASC_MC_NUMBER_OF_MAX_CMD 0x00D0
1963 #define ASC_MC_DEVICE_HSHK_CFG_TABLE 0x0100
1964 #define ASC_MC_CONTROL_FLAG 0x0122 /* Microcode control flag. */
1965 #define ASC_MC_WDTR_DONE 0x0124
1966 #define ASC_MC_CAM_MODE_MASK 0x015E /* CAM mode TID bitmask. */
1967 #define ASC_MC_ICQ 0x0160
1968 #define ASC_MC_IRQ 0x0164
1969 #define ASC_MC_PPR_ABLE 0x017A
1972 * BIOS LRAM variable absolute offsets.
1974 #define BIOS_CODESEG 0x54
1975 #define BIOS_CODELEN 0x56
1976 #define BIOS_SIGNATURE 0x58
1977 #define BIOS_VERSION 0x5A
1980 * Microcode Control Flags
1982 * Flags set by the Adv Library in RISC variable 'control_flag' (0x122)
1983 * and handled by the microcode.
1985 #define CONTROL_FLAG_IGNORE_PERR 0x0001 /* Ignore DMA Parity Errors */
1986 #define CONTROL_FLAG_ENABLE_AIPP 0x0002 /* Enabled AIPP checking. */
1989 * ASC_MC_DEVICE_HSHK_CFG_TABLE microcode table or HSHK_CFG register format
1991 #define HSHK_CFG_WIDE_XFR 0x8000
1992 #define HSHK_CFG_RATE 0x0F00
1993 #define HSHK_CFG_OFFSET 0x001F
1995 #define ASC_DEF_MAX_HOST_QNG 0xFD /* Max. number of host commands (253) */
1996 #define ASC_DEF_MIN_HOST_QNG 0x10 /* Min. number of host commands (16) */
1997 #define ASC_DEF_MAX_DVC_QNG 0x3F /* Max. number commands per device (63) */
1998 #define ASC_DEF_MIN_DVC_QNG 0x04 /* Min. number commands per device (4) */
2000 #define ASC_QC_DATA_CHECK 0x01 /* Require ASC_QC_DATA_OUT set or clear. */
2001 #define ASC_QC_DATA_OUT 0x02 /* Data out DMA transfer. */
2002 #define ASC_QC_START_MOTOR 0x04 /* Send auto-start motor before request. */
2003 #define ASC_QC_NO_OVERRUN 0x08 /* Don't report overrun. */
2004 #define ASC_QC_FREEZE_TIDQ 0x10 /* Freeze TID queue after request. XXX TBD */
2006 #define ASC_QSC_NO_DISC 0x01 /* Don't allow disconnect for request. */
2007 #define ASC_QSC_NO_TAGMSG 0x02 /* Don't allow tag queuing for request. */
2008 #define ASC_QSC_NO_SYNC 0x04 /* Don't use Synch. transfer on request. */
2009 #define ASC_QSC_NO_WIDE 0x08 /* Don't use Wide transfer on request. */
2010 #define ASC_QSC_REDO_DTR 0x10 /* Renegotiate WDTR/SDTR before request. */
2012 * Note: If a Tag Message is to be sent and neither ASC_QSC_HEAD_TAG or
2013 * ASC_QSC_ORDERED_TAG is set, then a Simple Tag Message (0x20) is used.
2015 #define ASC_QSC_HEAD_TAG 0x40 /* Use Head Tag Message (0x21). */
2016 #define ASC_QSC_ORDERED_TAG 0x80 /* Use Ordered Tag Message (0x22). */
2019 * All fields here are accessed by the board microcode and need to be
2022 typedef struct adv_carr_t
{
2023 ADV_VADDR carr_va
; /* Carrier Virtual Address */
2024 ADV_PADDR carr_pa
; /* Carrier Physical Address */
2025 ADV_VADDR areq_vpa
; /* ASC_SCSI_REQ_Q Virtual or Physical Address */
2027 * next_vpa [31:4] Carrier Virtual or Physical Next Pointer
2029 * next_vpa [3:1] Reserved Bits
2030 * next_vpa [0] Done Flag set in Response Queue.
2036 * Mask used to eliminate low 4 bits of carrier 'next_vpa' field.
2038 #define ASC_NEXT_VPA_MASK 0xFFFFFFF0
2040 #define ASC_RQ_DONE 0x00000001
2041 #define ASC_RQ_GOOD 0x00000002
2042 #define ASC_CQ_STOPPER 0x00000000
2044 #define ASC_GET_CARRP(carrp) ((carrp) & ASC_NEXT_VPA_MASK)
2046 #define ADV_CARRIER_NUM_PAGE_CROSSING \
2047 (((ADV_CARRIER_COUNT * sizeof(ADV_CARR_T)) + \
2048 (ADV_PAGE_SIZE - 1))/ADV_PAGE_SIZE)
2050 #define ADV_CARRIER_BUFSIZE \
2051 ((ADV_CARRIER_COUNT + ADV_CARRIER_NUM_PAGE_CROSSING) * sizeof(ADV_CARR_T))
2054 * ASC_SCSI_REQ_Q 'a_flag' definitions
2056 * The Adv Library should limit use to the lower nibble (4 bits) of
2057 * a_flag. Drivers are free to use the upper nibble (4 bits) of a_flag.
2059 #define ADV_POLL_REQUEST 0x01 /* poll for request completion */
2060 #define ADV_SCSIQ_DONE 0x02 /* request done */
2061 #define ADV_DONT_RETRY 0x08 /* don't do retry */
2063 #define ADV_CHIP_ASC3550 0x01 /* Ultra-Wide IC */
2064 #define ADV_CHIP_ASC38C0800 0x02 /* Ultra2-Wide/LVD IC */
2065 #define ADV_CHIP_ASC38C1600 0x03 /* Ultra3-Wide/LVD2 IC */
2068 * Adapter temporary configuration structure
2070 * This structure can be discarded after initialization. Don't add
2071 * fields here needed after initialization.
2073 * Field naming convention:
2075 * *_enable indicates the field enables or disables a feature. The
2076 * value of the field is never reset.
2078 typedef struct adv_dvc_cfg
{
2079 ushort disc_enable
; /* enable disconnection */
2080 uchar chip_version
; /* chip version */
2081 uchar termination
; /* Term. Ctrl. bits 6-5 of SCSI_CFG1 register */
2082 ushort lib_version
; /* Adv Library version number */
2083 ushort control_flag
; /* Microcode Control Flag */
2084 ushort mcode_date
; /* Microcode date */
2085 ushort mcode_version
; /* Microcode version */
2086 ushort serial1
; /* EEPROM serial number word 1 */
2087 ushort serial2
; /* EEPROM serial number word 2 */
2088 ushort serial3
; /* EEPROM serial number word 3 */
2092 struct adv_scsi_req_q
;
2095 * Adapter operation variable structure.
2097 * One structure is required per host adapter.
2099 * Field naming convention:
2101 * *_able indicates both whether a feature should be enabled or disabled
2102 * and whether a device isi capable of the feature. At initialization
2103 * this field may be set, but later if a device is found to be incapable
2104 * of the feature, the field is cleared.
2106 typedef struct adv_dvc_var
{
2107 AdvPortAddr iop_base
; /* I/O port address */
2108 ushort err_code
; /* fatal error code */
2109 ushort bios_ctrl
; /* BIOS control word, EEPROM word 12 */
2110 ushort wdtr_able
; /* try WDTR for a device */
2111 ushort sdtr_able
; /* try SDTR for a device */
2112 ushort ultra_able
; /* try SDTR Ultra speed for a device */
2113 ushort sdtr_speed1
; /* EEPROM SDTR Speed for TID 0-3 */
2114 ushort sdtr_speed2
; /* EEPROM SDTR Speed for TID 4-7 */
2115 ushort sdtr_speed3
; /* EEPROM SDTR Speed for TID 8-11 */
2116 ushort sdtr_speed4
; /* EEPROM SDTR Speed for TID 12-15 */
2117 ushort tagqng_able
; /* try tagged queuing with a device */
2118 ushort ppr_able
; /* PPR message capable per TID bitmask. */
2119 uchar max_dvc_qng
; /* maximum number of tagged commands per device */
2120 ushort start_motor
; /* start motor command allowed */
2121 uchar scsi_reset_wait
; /* delay in seconds after scsi bus reset */
2122 uchar chip_no
; /* should be assigned by caller */
2123 uchar max_host_qng
; /* maximum number of Q'ed command allowed */
2124 uchar irq_no
; /* IRQ number */
2125 ushort no_scam
; /* scam_tolerant of EEPROM */
2126 struct asc_board
*drv_ptr
; /* driver pointer to private structure */
2127 uchar chip_scsi_id
; /* chip SCSI target ID */
2129 uchar bist_err_code
;
2130 ADV_CARR_T
*carrier_buf
;
2131 ADV_CARR_T
*carr_freelist
; /* Carrier free list. */
2132 ADV_CARR_T
*icq_sp
; /* Initiator command queue stopper pointer. */
2133 ADV_CARR_T
*irq_sp
; /* Initiator response queue stopper pointer. */
2134 ushort carr_pending_cnt
; /* Count of pending carriers. */
2136 * Note: The following fields will not be used after initialization. The
2137 * driver may discard the buffer after initialization is done.
2139 ADV_DVC_CFG
*cfg
; /* temporary configuration structure */
2142 #define NO_OF_SG_PER_BLOCK 15
2144 typedef struct asc_sg_block
{
2148 uchar sg_cnt
; /* Valid entries in block. */
2149 ADV_PADDR sg_ptr
; /* Pointer to next sg block. */
2151 ADV_PADDR sg_addr
; /* SG element address. */
2152 ADV_DCNT sg_count
; /* SG element count. */
2153 } sg_list
[NO_OF_SG_PER_BLOCK
];
2157 * ADV_SCSI_REQ_Q - microcode request structure
2159 * All fields in this structure up to byte 60 are used by the microcode.
2160 * The microcode makes assumptions about the size and ordering of fields
2161 * in this structure. Do not change the structure definition here without
2162 * coordinating the change with the microcode.
2164 * All fields accessed by microcode must be maintained in little_endian
2167 typedef struct adv_scsi_req_q
{
2168 uchar cntl
; /* Ucode flags and state (ASC_MC_QC_*). */
2170 uchar target_id
; /* Device target identifier. */
2171 uchar target_lun
; /* Device target logical unit number. */
2172 ADV_PADDR data_addr
; /* Data buffer physical address. */
2173 ADV_DCNT data_cnt
; /* Data count. Ucode sets to residual. */
2174 ADV_PADDR sense_addr
;
2178 uchar cdb_len
; /* SCSI CDB length. Must <= 16 bytes. */
2180 uchar done_status
; /* Completion status. */
2181 uchar scsi_status
; /* SCSI status byte. */
2182 uchar host_status
; /* Ucode host status. */
2183 uchar sg_working_ix
;
2184 uchar cdb
[12]; /* SCSI CDB bytes 0-11. */
2185 ADV_PADDR sg_real_addr
; /* SG list physical address. */
2186 ADV_PADDR scsiq_rptr
;
2187 uchar cdb16
[4]; /* SCSI CDB bytes 12-15. */
2188 ADV_VADDR scsiq_ptr
;
2191 * End of microcode structure - 60 bytes. The rest of the structure
2192 * is used by the Adv Library and ignored by the microcode.
2195 ADV_SG_BLOCK
*sg_list_ptr
; /* SG list virtual address. */
2196 char *vdata_addr
; /* Data buffer virtual address. */
2198 uchar pad
[2]; /* Pad out to a word boundary. */
2202 * Microcode idle loop commands
2204 #define IDLE_CMD_COMPLETED 0
2205 #define IDLE_CMD_STOP_CHIP 0x0001
2206 #define IDLE_CMD_STOP_CHIP_SEND_INT 0x0002
2207 #define IDLE_CMD_SEND_INT 0x0004
2208 #define IDLE_CMD_ABORT 0x0008
2209 #define IDLE_CMD_DEVICE_RESET 0x0010
2210 #define IDLE_CMD_SCSI_RESET_START 0x0020 /* Assert SCSI Bus Reset */
2211 #define IDLE_CMD_SCSI_RESET_END 0x0040 /* Deassert SCSI Bus Reset */
2212 #define IDLE_CMD_SCSIREQ 0x0080
2214 #define IDLE_CMD_STATUS_SUCCESS 0x0001
2215 #define IDLE_CMD_STATUS_FAILURE 0x0002
2218 * AdvSendIdleCmd() flag definitions.
2220 #define ADV_NOWAIT 0x01
2223 * Wait loop time out values.
2225 #define SCSI_WAIT_10_SEC 10UL /* 10 seconds */
2226 #define SCSI_WAIT_100_MSEC 100UL /* 100 milliseconds */
2227 #define SCSI_US_PER_MSEC 1000 /* microseconds per millisecond */
2228 #define SCSI_MS_PER_SEC 1000UL /* milliseconds per second */
2229 #define SCSI_MAX_RETRY 10 /* retry count */
2231 #define ADV_ASYNC_RDMA_FAILURE 0x01 /* Fatal RDMA failure. */
2232 #define ADV_ASYNC_SCSI_BUS_RESET_DET 0x02 /* Detected SCSI Bus Reset. */
2233 #define ADV_ASYNC_CARRIER_READY_FAILURE 0x03 /* Carrier Ready failure. */
2234 #define ADV_RDMA_IN_CARR_AND_Q_INVALID 0x04 /* RDMAed-in data invalid. */
2236 #define ADV_HOST_SCSI_BUS_RESET 0x80 /* Host Initiated SCSI Bus Reset. */
2239 * Device drivers must define the following functions.
2241 static inline ulong
DvcEnterCritical(void);
2242 static inline void DvcLeaveCritical(ulong
);
2243 static void DvcSleepMilliSecond(ADV_DCNT
);
2244 static ADV_PADDR
DvcGetPhyAddr(ADV_DVC_VAR
*, ADV_SCSI_REQ_Q
*,
2245 uchar
*, ASC_SDCNT
*, int);
2246 static void DvcDelayMicroSecond(ADV_DVC_VAR
*, ushort
);
2249 * Adv Library functions available to drivers.
2251 static int AdvExeScsiQueue(ADV_DVC_VAR
*, ADV_SCSI_REQ_Q
*);
2252 static int AdvISR(ADV_DVC_VAR
*);
2253 static int AdvInitAsc3550Driver(ADV_DVC_VAR
*);
2254 static int AdvInitAsc38C0800Driver(ADV_DVC_VAR
*);
2255 static int AdvInitAsc38C1600Driver(ADV_DVC_VAR
*);
2256 static int AdvResetChipAndSB(ADV_DVC_VAR
*);
2257 static int AdvResetSB(ADV_DVC_VAR
*asc_dvc
);
2260 * Internal Adv Library functions.
2262 static int AdvSendIdleCmd(ADV_DVC_VAR
*, ushort
, ADV_DCNT
);
2263 static int AdvInitFrom3550EEP(ADV_DVC_VAR
*);
2264 static int AdvInitFrom38C0800EEP(ADV_DVC_VAR
*);
2265 static int AdvInitFrom38C1600EEP(ADV_DVC_VAR
*);
2266 static ushort
AdvGet3550EEPConfig(AdvPortAddr
, ADVEEP_3550_CONFIG
*);
2267 static void AdvSet3550EEPConfig(AdvPortAddr
, ADVEEP_3550_CONFIG
*);
2268 static ushort
AdvGet38C0800EEPConfig(AdvPortAddr
, ADVEEP_38C0800_CONFIG
*);
2269 static void AdvSet38C0800EEPConfig(AdvPortAddr
, ADVEEP_38C0800_CONFIG
*);
2270 static ushort
AdvGet38C1600EEPConfig(AdvPortAddr
, ADVEEP_38C1600_CONFIG
*);
2271 static void AdvSet38C1600EEPConfig(AdvPortAddr
, ADVEEP_38C1600_CONFIG
*);
2272 static void AdvWaitEEPCmd(AdvPortAddr
);
2273 static ushort
AdvReadEEPWord(AdvPortAddr
, int);
2275 /* Read byte from a register. */
2276 #define AdvReadByteRegister(iop_base, reg_off) \
2277 (ADV_MEM_READB((iop_base) + (reg_off)))
2279 /* Write byte to a register. */
2280 #define AdvWriteByteRegister(iop_base, reg_off, byte) \
2281 (ADV_MEM_WRITEB((iop_base) + (reg_off), (byte)))
2283 /* Read word (2 bytes) from a register. */
2284 #define AdvReadWordRegister(iop_base, reg_off) \
2285 (ADV_MEM_READW((iop_base) + (reg_off)))
2287 /* Write word (2 bytes) to a register. */
2288 #define AdvWriteWordRegister(iop_base, reg_off, word) \
2289 (ADV_MEM_WRITEW((iop_base) + (reg_off), (word)))
2291 /* Write dword (4 bytes) to a register. */
2292 #define AdvWriteDWordRegister(iop_base, reg_off, dword) \
2293 (ADV_MEM_WRITEDW((iop_base) + (reg_off), (dword)))
2295 /* Read byte from LRAM. */
2296 #define AdvReadByteLram(iop_base, addr, byte) \
2298 ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)); \
2299 (byte) = ADV_MEM_READB((iop_base) + IOPB_RAM_DATA); \
2302 /* Write byte to LRAM. */
2303 #define AdvWriteByteLram(iop_base, addr, byte) \
2304 (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)), \
2305 ADV_MEM_WRITEB((iop_base) + IOPB_RAM_DATA, (byte)))
2307 /* Read word (2 bytes) from LRAM. */
2308 #define AdvReadWordLram(iop_base, addr, word) \
2310 ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)); \
2311 (word) = (ADV_MEM_READW((iop_base) + IOPW_RAM_DATA)); \
2314 /* Write word (2 bytes) to LRAM. */
2315 #define AdvWriteWordLram(iop_base, addr, word) \
2316 (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)), \
2317 ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, (word)))
2319 /* Write little-endian double word (4 bytes) to LRAM */
2320 /* Because of unspecified C language ordering don't use auto-increment. */
2321 #define AdvWriteDWordLramNoSwap(iop_base, addr, dword) \
2322 ((ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)), \
2323 ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, \
2324 cpu_to_le16((ushort) ((dword) & 0xFFFF)))), \
2325 (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr) + 2), \
2326 ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, \
2327 cpu_to_le16((ushort) ((dword >> 16) & 0xFFFF)))))
2329 /* Read word (2 bytes) from LRAM assuming that the address is already set. */
2330 #define AdvReadWordAutoIncLram(iop_base) \
2331 (ADV_MEM_READW((iop_base) + IOPW_RAM_DATA))
2333 /* Write word (2 bytes) to LRAM assuming that the address is already set. */
2334 #define AdvWriteWordAutoIncLram(iop_base, word) \
2335 (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, (word)))
2338 * Define macro to check for Condor signature.
2340 * Evaluate to ADV_TRUE if a Condor chip is found the specified port
2341 * address 'iop_base'. Otherwise evalue to ADV_FALSE.
2343 #define AdvFindSignature(iop_base) \
2344 (((AdvReadByteRegister((iop_base), IOPB_CHIP_ID_1) == \
2345 ADV_CHIP_ID_BYTE) && \
2346 (AdvReadWordRegister((iop_base), IOPW_CHIP_ID_0) == \
2347 ADV_CHIP_ID_WORD)) ? ADV_TRUE : ADV_FALSE)
2350 * Define macro to Return the version number of the chip at 'iop_base'.
2352 * The second parameter 'bus_type' is currently unused.
2354 #define AdvGetChipVersion(iop_base, bus_type) \
2355 AdvReadByteRegister((iop_base), IOPB_CHIP_TYPE_REV)
2358 * Abort an SRB in the chip's RISC Memory. The 'srb_ptr' argument must
2359 * match the ASC_SCSI_REQ_Q 'srb_ptr' field.
2361 * If the request has not yet been sent to the device it will simply be
2362 * aborted from RISC memory. If the request is disconnected it will be
2363 * aborted on reselection by sending an Abort Message to the target ID.
2366 * ADV_TRUE(1) - Queue was successfully aborted.
2367 * ADV_FALSE(0) - Queue was not found on the active queue list.
2369 #define AdvAbortQueue(asc_dvc, scsiq) \
2370 AdvSendIdleCmd((asc_dvc), (ushort) IDLE_CMD_ABORT, \
2374 * Send a Bus Device Reset Message to the specified target ID.
2376 * All outstanding commands will be purged if sending the
2377 * Bus Device Reset Message is successful.
2380 * ADV_TRUE(1) - All requests on the target are purged.
2381 * ADV_FALSE(0) - Couldn't issue Bus Device Reset Message; Requests
2384 #define AdvResetDevice(asc_dvc, target_id) \
2385 AdvSendIdleCmd((asc_dvc), (ushort) IDLE_CMD_DEVICE_RESET, \
2386 (ADV_DCNT) (target_id))
2389 * SCSI Wide Type definition.
2391 #define ADV_SCSI_BIT_ID_TYPE ushort
2394 * AdvInitScsiTarget() 'cntl_flag' options.
2396 #define ADV_SCAN_LUN 0x01
2397 #define ADV_CAPINFO_NOLUN 0x02
2400 * Convert target id to target id bit mask.
2402 #define ADV_TID_TO_TIDMASK(tid) (0x01 << ((tid) & ADV_MAX_TID))
2405 * ASC_SCSI_REQ_Q 'done_status' and 'host_status' return values.
2408 #define QD_NO_STATUS 0x00 /* Request not completed yet. */
2409 #define QD_NO_ERROR 0x01
2410 #define QD_ABORTED_BY_HOST 0x02
2411 #define QD_WITH_ERROR 0x04
2413 #define QHSTA_NO_ERROR 0x00
2414 #define QHSTA_M_SEL_TIMEOUT 0x11
2415 #define QHSTA_M_DATA_OVER_RUN 0x12
2416 #define QHSTA_M_UNEXPECTED_BUS_FREE 0x13
2417 #define QHSTA_M_QUEUE_ABORTED 0x15
2418 #define QHSTA_M_SXFR_SDMA_ERR 0x16 /* SXFR_STATUS SCSI DMA Error */
2419 #define QHSTA_M_SXFR_SXFR_PERR 0x17 /* SXFR_STATUS SCSI Bus Parity Error */
2420 #define QHSTA_M_RDMA_PERR 0x18 /* RISC PCI DMA parity error */
2421 #define QHSTA_M_SXFR_OFF_UFLW 0x19 /* SXFR_STATUS Offset Underflow */
2422 #define QHSTA_M_SXFR_OFF_OFLW 0x20 /* SXFR_STATUS Offset Overflow */
2423 #define QHSTA_M_SXFR_WD_TMO 0x21 /* SXFR_STATUS Watchdog Timeout */
2424 #define QHSTA_M_SXFR_DESELECTED 0x22 /* SXFR_STATUS Deselected */
2425 /* Note: QHSTA_M_SXFR_XFR_OFLW is identical to QHSTA_M_DATA_OVER_RUN. */
2426 #define QHSTA_M_SXFR_XFR_OFLW 0x12 /* SXFR_STATUS Transfer Overflow */
2427 #define QHSTA_M_SXFR_XFR_PH_ERR 0x24 /* SXFR_STATUS Transfer Phase Error */
2428 #define QHSTA_M_SXFR_UNKNOWN_ERROR 0x25 /* SXFR_STATUS Unknown Error */
2429 #define QHSTA_M_SCSI_BUS_RESET 0x30 /* Request aborted from SBR */
2430 #define QHSTA_M_SCSI_BUS_RESET_UNSOL 0x31 /* Request aborted from unsol. SBR */
2431 #define QHSTA_M_BUS_DEVICE_RESET 0x32 /* Request aborted from BDR */
2432 #define QHSTA_M_DIRECTION_ERR 0x35 /* Data Phase mismatch */
2433 #define QHSTA_M_DIRECTION_ERR_HUNG 0x36 /* Data Phase mismatch and bus hang */
2434 #define QHSTA_M_WTM_TIMEOUT 0x41
2435 #define QHSTA_M_BAD_CMPL_STATUS_IN 0x42
2436 #define QHSTA_M_NO_AUTO_REQ_SENSE 0x43
2437 #define QHSTA_M_AUTO_REQ_SENSE_FAIL 0x44
2438 #define QHSTA_M_INVALID_DEVICE 0x45 /* Bad target ID */
2439 #define QHSTA_M_FROZEN_TIDQ 0x46 /* TID Queue frozen. */
2440 #define QHSTA_M_SGBACKUP_ERROR 0x47 /* Scatter-Gather backup error */
2443 * DvcGetPhyAddr() flag arguments
2445 #define ADV_IS_SCSIQ_FLAG 0x01 /* 'addr' is ASC_SCSI_REQ_Q pointer */
2446 #define ADV_ASCGETSGLIST_VADDR 0x02 /* 'addr' is AscGetSGList() virtual addr */
2447 #define ADV_IS_SENSE_FLAG 0x04 /* 'addr' is sense virtual pointer */
2448 #define ADV_IS_DATA_FLAG 0x08 /* 'addr' is data virtual pointer */
2449 #define ADV_IS_SGLIST_FLAG 0x10 /* 'addr' is sglist virtual pointer */
2450 #define ADV_IS_CARRIER_FLAG 0x20 /* 'addr' is ADV_CARR_T pointer */
2452 /* Return the address that is aligned at the next doubleword >= to 'addr'. */
2453 #define ADV_8BALIGN(addr) (((ulong) (addr) + 0x7) & ~0x7)
2454 #define ADV_16BALIGN(addr) (((ulong) (addr) + 0xF) & ~0xF)
2455 #define ADV_32BALIGN(addr) (((ulong) (addr) + 0x1F) & ~0x1F)
2458 * Total contiguous memory needed for driver SG blocks.
2460 * ADV_MAX_SG_LIST must be defined by a driver. It is the maximum
2461 * number of scatter-gather elements the driver supports in a
2465 #define ADV_SG_LIST_MAX_BYTE_SIZE \
2466 (sizeof(ADV_SG_BLOCK) * \
2467 ((ADV_MAX_SG_LIST + (NO_OF_SG_PER_BLOCK - 1))/NO_OF_SG_PER_BLOCK))
2470 * --- Driver Constants and Macros
2473 /* Reference Scsi_Host hostdata */
2474 #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata))
2476 /* asc_board_t flags */
2477 #define ASC_HOST_IN_RESET 0x01
2478 #define ASC_IS_WIDE_BOARD 0x04 /* AdvanSys Wide Board */
2479 #define ASC_SELECT_QUEUE_DEPTHS 0x08
2481 #define ASC_NARROW_BOARD(boardp) (((boardp)->flags & ASC_IS_WIDE_BOARD) == 0)
2482 #define ASC_WIDE_BOARD(boardp) ((boardp)->flags & ASC_IS_WIDE_BOARD)
2484 #define NO_ISA_DMA 0xff /* No ISA DMA Channel Used */
2486 #define ASC_INFO_SIZE 128 /* advansys_info() line size */
2488 #ifdef CONFIG_PROC_FS
2489 /* /proc/scsi/advansys/[0...] related definitions */
2490 #define ASC_PRTBUF_SIZE 2048
2491 #define ASC_PRTLINE_SIZE 160
2493 #define ASC_PRT_NEXT() \
2497 if (leftlen == 0) { \
2502 #endif /* CONFIG_PROC_FS */
2504 /* Asc Library return codes */
2507 #define ASC_NOERROR 1
2509 #define ASC_ERROR (-1)
2511 /* struct scsi_cmnd function return codes */
2512 #define STATUS_BYTE(byte) (byte)
2513 #define MSG_BYTE(byte) ((byte) << 8)
2514 #define HOST_BYTE(byte) ((byte) << 16)
2515 #define DRIVER_BYTE(byte) ((byte) << 24)
2518 * The following definitions and macros are OS independent interfaces to
2519 * the queue functions:
2520 * REQ - SCSI request structure
2521 * REQP - pointer to SCSI request structure
2522 * REQPTID(reqp) - reqp's target id
2523 * REQPNEXT(reqp) - reqp's next pointer
2524 * REQPNEXTP(reqp) - pointer to reqp's next pointer
2525 * REQPTIME(reqp) - reqp's time stamp value
2526 * REQTIMESTAMP() - system time stamp value
2528 typedef struct scsi_cmnd REQ
, *REQP
;
2529 #define REQPNEXT(reqp) ((REQP) ((reqp)->host_scribble))
2530 #define REQPNEXTP(reqp) ((REQP *) &((reqp)->host_scribble))
2531 #define REQPTID(reqp) ((reqp)->device->id)
2532 #define REQPTIME(reqp) ((reqp)->SCp.this_residual)
2533 #define REQTIMESTAMP() (jiffies)
2535 #define REQTIMESTAT(function, ascq, reqp, tid) \
2538 * If the request time stamp is less than the system time stamp, then \
2539 * maybe the system time stamp wrapped. Set the request time to zero.\
2541 if (REQPTIME(reqp) <= REQTIMESTAMP()) { \
2542 REQPTIME(reqp) = REQTIMESTAMP() - REQPTIME(reqp); \
2544 /* Indicate an error occurred with the assertion. */ \
2545 ASC_ASSERT(REQPTIME(reqp) <= REQTIMESTAMP()); \
2546 REQPTIME(reqp) = 0; \
2548 /* Handle first minimum time case without external initialization. */ \
2549 if (((ascq)->q_tot_cnt[tid] == 1) || \
2550 (REQPTIME(reqp) < (ascq)->q_min_tim[tid])) { \
2551 (ascq)->q_min_tim[tid] = REQPTIME(reqp); \
2552 ASC_DBG3(1, "%s: new q_min_tim[%d] %u\n", \
2553 (function), (tid), (ascq)->q_min_tim[tid]); \
2555 if (REQPTIME(reqp) > (ascq)->q_max_tim[tid]) { \
2556 (ascq)->q_max_tim[tid] = REQPTIME(reqp); \
2557 ASC_DBG3(1, "%s: new q_max_tim[%d] %u\n", \
2558 (function), tid, (ascq)->q_max_tim[tid]); \
2560 (ascq)->q_tot_tim[tid] += REQPTIME(reqp); \
2561 /* Reset the time stamp field. */ \
2562 REQPTIME(reqp) = 0; \
2565 /* asc_enqueue() flags */
2569 /* asc_dequeue_list() argument */
2570 #define ASC_TID_ALL (-1)
2572 /* Return non-zero, if the queue is empty. */
2573 #define ASC_QUEUE_EMPTY(ascq) ((ascq)->q_tidmask == 0)
2575 #ifndef ADVANSYS_STATS
2576 #define ASC_STATS(shost, counter)
2577 #define ASC_STATS_ADD(shost, counter, count)
2578 #else /* ADVANSYS_STATS */
2579 #define ASC_STATS(shost, counter) \
2580 (ASC_BOARDP(shost)->asc_stats.counter++)
2582 #define ASC_STATS_ADD(shost, counter, count) \
2583 (ASC_BOARDP(shost)->asc_stats.counter += (count))
2584 #endif /* ADVANSYS_STATS */
2586 #define ASC_CEILING(val, unit) (((val) + ((unit) - 1))/(unit))
2588 /* If the result wraps when calculating tenths, return 0. */
2589 #define ASC_TENTHS(num, den) \
2590 (((10 * ((num)/(den))) > (((num) * 10)/(den))) ? \
2591 0 : ((((num) * 10)/(den)) - (10 * ((num)/(den)))))
2594 * Display a message to the console.
2596 #define ASC_PRINT(s) \
2598 printk("advansys: "); \
2602 #define ASC_PRINT1(s, a1) \
2604 printk("advansys: "); \
2605 printk((s), (a1)); \
2608 #define ASC_PRINT2(s, a1, a2) \
2610 printk("advansys: "); \
2611 printk((s), (a1), (a2)); \
2614 #define ASC_PRINT3(s, a1, a2, a3) \
2616 printk("advansys: "); \
2617 printk((s), (a1), (a2), (a3)); \
2620 #define ASC_PRINT4(s, a1, a2, a3, a4) \
2622 printk("advansys: "); \
2623 printk((s), (a1), (a2), (a3), (a4)); \
2626 #ifndef ADVANSYS_DEBUG
2628 #define ASC_DBG(lvl, s)
2629 #define ASC_DBG1(lvl, s, a1)
2630 #define ASC_DBG2(lvl, s, a1, a2)
2631 #define ASC_DBG3(lvl, s, a1, a2, a3)
2632 #define ASC_DBG4(lvl, s, a1, a2, a3, a4)
2633 #define ASC_DBG_PRT_SCSI_HOST(lvl, s)
2634 #define ASC_DBG_PRT_SCSI_CMND(lvl, s)
2635 #define ASC_DBG_PRT_ASC_SCSI_Q(lvl, scsiqp)
2636 #define ASC_DBG_PRT_ADV_SCSI_REQ_Q(lvl, scsiqp)
2637 #define ASC_DBG_PRT_ASC_QDONE_INFO(lvl, qdone)
2638 #define ADV_DBG_PRT_ADV_SCSI_REQ_Q(lvl, scsiqp)
2639 #define ASC_DBG_PRT_HEX(lvl, name, start, length)
2640 #define ASC_DBG_PRT_CDB(lvl, cdb, len)
2641 #define ASC_DBG_PRT_SENSE(lvl, sense, len)
2642 #define ASC_DBG_PRT_INQUIRY(lvl, inq, len)
2644 #else /* ADVANSYS_DEBUG */
2647 * Debugging Message Levels:
2649 * 1: High-Level Tracing
2650 * 2-N: Verbose Tracing
2653 #define ASC_DBG(lvl, s) \
2655 if (asc_dbglvl >= (lvl)) { \
2660 #define ASC_DBG1(lvl, s, a1) \
2662 if (asc_dbglvl >= (lvl)) { \
2663 printk((s), (a1)); \
2667 #define ASC_DBG2(lvl, s, a1, a2) \
2669 if (asc_dbglvl >= (lvl)) { \
2670 printk((s), (a1), (a2)); \
2674 #define ASC_DBG3(lvl, s, a1, a2, a3) \
2676 if (asc_dbglvl >= (lvl)) { \
2677 printk((s), (a1), (a2), (a3)); \
2681 #define ASC_DBG4(lvl, s, a1, a2, a3, a4) \
2683 if (asc_dbglvl >= (lvl)) { \
2684 printk((s), (a1), (a2), (a3), (a4)); \
2688 #define ASC_DBG_PRT_SCSI_HOST(lvl, s) \
2690 if (asc_dbglvl >= (lvl)) { \
2691 asc_prt_scsi_host(s); \
2695 #define ASC_DBG_PRT_SCSI_CMND(lvl, s) \
2697 if (asc_dbglvl >= (lvl)) { \
2698 asc_prt_scsi_cmnd(s); \
2702 #define ASC_DBG_PRT_ASC_SCSI_Q(lvl, scsiqp) \
2704 if (asc_dbglvl >= (lvl)) { \
2705 asc_prt_asc_scsi_q(scsiqp); \
2709 #define ASC_DBG_PRT_ASC_QDONE_INFO(lvl, qdone) \
2711 if (asc_dbglvl >= (lvl)) { \
2712 asc_prt_asc_qdone_info(qdone); \
2716 #define ASC_DBG_PRT_ADV_SCSI_REQ_Q(lvl, scsiqp) \
2718 if (asc_dbglvl >= (lvl)) { \
2719 asc_prt_adv_scsi_req_q(scsiqp); \
2723 #define ASC_DBG_PRT_HEX(lvl, name, start, length) \
2725 if (asc_dbglvl >= (lvl)) { \
2726 asc_prt_hex((name), (start), (length)); \
2730 #define ASC_DBG_PRT_CDB(lvl, cdb, len) \
2731 ASC_DBG_PRT_HEX((lvl), "CDB", (uchar *) (cdb), (len));
2733 #define ASC_DBG_PRT_SENSE(lvl, sense, len) \
2734 ASC_DBG_PRT_HEX((lvl), "SENSE", (uchar *) (sense), (len));
2736 #define ASC_DBG_PRT_INQUIRY(lvl, inq, len) \
2737 ASC_DBG_PRT_HEX((lvl), "INQUIRY", (uchar *) (inq), (len));
2738 #endif /* ADVANSYS_DEBUG */
2740 #ifndef ADVANSYS_ASSERT
2741 #define ASC_ASSERT(a)
2742 #else /* ADVANSYS_ASSERT */
2744 #define ASC_ASSERT(a) \
2747 printk("ASC_ASSERT() Failure: file %s, line %d\n", \
2748 __FILE__, __LINE__); \
2752 #endif /* ADVANSYS_ASSERT */
2755 * --- Driver Structures
2758 #ifdef ADVANSYS_STATS
2760 /* Per board statistics structure */
2762 /* Driver Entrypoint Statistics */
2763 ADV_DCNT queuecommand
; /* # calls to advansys_queuecommand() */
2764 ADV_DCNT reset
; /* # calls to advansys_eh_bus_reset() */
2765 ADV_DCNT biosparam
; /* # calls to advansys_biosparam() */
2766 ADV_DCNT interrupt
; /* # advansys_interrupt() calls */
2767 ADV_DCNT callback
; /* # calls to asc/adv_isr_callback() */
2768 ADV_DCNT done
; /* # calls to request's scsi_done function */
2769 ADV_DCNT build_error
; /* # asc/adv_build_req() ASC_ERROR returns. */
2770 ADV_DCNT adv_build_noreq
; /* # adv_build_req() adv_req_t alloc. fail. */
2771 ADV_DCNT adv_build_nosg
; /* # adv_build_req() adv_sgblk_t alloc. fail. */
2772 /* AscExeScsiQueue()/AdvExeScsiQueue() Statistics */
2773 ADV_DCNT exe_noerror
; /* # ASC_NOERROR returns. */
2774 ADV_DCNT exe_busy
; /* # ASC_BUSY returns. */
2775 ADV_DCNT exe_error
; /* # ASC_ERROR returns. */
2776 ADV_DCNT exe_unknown
; /* # unknown returns. */
2777 /* Data Transfer Statistics */
2778 ADV_DCNT cont_cnt
; /* # non-scatter-gather I/O requests received */
2779 ADV_DCNT cont_xfer
; /* # contiguous transfer 512-bytes */
2780 ADV_DCNT sg_cnt
; /* # scatter-gather I/O requests received */
2781 ADV_DCNT sg_elem
; /* # scatter-gather elements */
2782 ADV_DCNT sg_xfer
; /* # scatter-gather transfer 512-bytes */
2784 #endif /* ADVANSYS_STATS */
2787 * Request queuing structure
2789 typedef struct asc_queue
{
2790 ADV_SCSI_BIT_ID_TYPE q_tidmask
; /* queue mask */
2791 REQP q_first
[ADV_MAX_TID
+ 1]; /* first queued request */
2792 REQP q_last
[ADV_MAX_TID
+ 1]; /* last queued request */
2793 #ifdef ADVANSYS_STATS
2794 short q_cur_cnt
[ADV_MAX_TID
+ 1]; /* current queue count */
2795 short q_max_cnt
[ADV_MAX_TID
+ 1]; /* maximum queue count */
2796 ADV_DCNT q_tot_cnt
[ADV_MAX_TID
+ 1]; /* total enqueue count */
2797 ADV_DCNT q_tot_tim
[ADV_MAX_TID
+ 1]; /* total time queued */
2798 ushort q_max_tim
[ADV_MAX_TID
+ 1]; /* maximum time queued */
2799 ushort q_min_tim
[ADV_MAX_TID
+ 1]; /* minimum time queued */
2800 #endif /* ADVANSYS_STATS */
2804 * Adv Library Request Structures
2806 * The following two structures are used to process Wide Board requests.
2808 * The ADV_SCSI_REQ_Q structure in adv_req_t is passed to the Adv Library
2809 * and microcode with the ADV_SCSI_REQ_Q field 'srb_ptr' pointing to the
2810 * adv_req_t. The adv_req_t structure 'cmndp' field in turn points to the
2811 * Mid-Level SCSI request structure.
2813 * Zero or more ADV_SG_BLOCK are used with each ADV_SCSI_REQ_Q. Each
2814 * ADV_SG_BLOCK structure holds 15 scatter-gather elements. Under Linux
2815 * up to 255 scatter-gather elements may be used per request or
2818 * Both structures must be 32 byte aligned.
2820 typedef struct adv_sgblk
{
2821 ADV_SG_BLOCK sg_block
; /* Sgblock structure. */
2822 uchar align
[32]; /* Sgblock structure padding. */
2823 struct adv_sgblk
*next_sgblkp
; /* Next scatter-gather structure. */
2826 typedef struct adv_req
{
2827 ADV_SCSI_REQ_Q scsi_req_q
; /* Adv Library request structure. */
2828 uchar align
[32]; /* Request structure padding. */
2829 struct scsi_cmnd
*cmndp
; /* Mid-Level SCSI command pointer. */
2830 adv_sgblk_t
*sgblkp
; /* Adv Library scatter-gather pointer. */
2831 struct adv_req
*next_reqp
; /* Next Request Structure. */
2835 * Structure allocated for each board.
2837 * This structure is allocated by scsi_host_alloc() at the end
2838 * of the 'Scsi_Host' structure starting at the 'hostdata'
2839 * field. It is guaranteed to be allocated from DMA-able memory.
2841 typedef struct asc_board
{
2843 int id
; /* Board Id */
2844 uint flags
; /* Board flags */
2846 ASC_DVC_VAR asc_dvc_var
; /* Narrow board */
2847 ADV_DVC_VAR adv_dvc_var
; /* Wide board */
2850 ASC_DVC_CFG asc_dvc_cfg
; /* Narrow board */
2851 ADV_DVC_CFG adv_dvc_cfg
; /* Wide board */
2853 ushort asc_n_io_port
; /* Number I/O ports. */
2854 asc_queue_t active
; /* Active command queue */
2855 asc_queue_t waiting
; /* Waiting command queue */
2856 asc_queue_t done
; /* Done command queue */
2857 ADV_SCSI_BIT_ID_TYPE init_tidmask
; /* Target init./valid mask */
2858 struct scsi_device
*device
[ADV_MAX_TID
+ 1]; /* Mid-Level Scsi Device */
2859 ushort reqcnt
[ADV_MAX_TID
+ 1]; /* Starvation request count */
2860 ADV_SCSI_BIT_ID_TYPE queue_full
; /* Queue full mask */
2861 ushort queue_full_cnt
[ADV_MAX_TID
+ 1]; /* Queue full count */
2863 ASCEEP_CONFIG asc_eep
; /* Narrow EEPROM config. */
2864 ADVEEP_3550_CONFIG adv_3550_eep
; /* 3550 EEPROM config. */
2865 ADVEEP_38C0800_CONFIG adv_38C0800_eep
; /* 38C0800 EEPROM config. */
2866 ADVEEP_38C1600_CONFIG adv_38C1600_eep
; /* 38C1600 EEPROM config. */
2868 ulong last_reset
; /* Saved last reset time */
2869 spinlock_t lock
; /* Board spinlock */
2870 /* /proc/scsi/advansys/[0...] */
2871 char *prtbuf
; /* /proc print buffer */
2872 #ifdef ADVANSYS_STATS
2873 struct asc_stats asc_stats
; /* Board statistics */
2874 #endif /* ADVANSYS_STATS */
2876 * The following fields are used only for Narrow Boards.
2878 uchar sdtr_data
[ASC_MAX_TID
+ 1]; /* SDTR information */
2880 * The following fields are used only for Wide Boards.
2882 void __iomem
*ioremap_addr
; /* I/O Memory remap address. */
2883 ushort ioport
; /* I/O Port address. */
2884 ADV_CARR_T
*carrp
; /* ADV_CARR_T memory block. */
2885 adv_req_t
*orig_reqp
; /* adv_req_t memory block. */
2886 adv_req_t
*adv_reqp
; /* Request structures. */
2887 adv_sgblk_t
*adv_sgblkp
; /* Scatter-gather structures. */
2888 ushort bios_signature
; /* BIOS Signature. */
2889 ushort bios_version
; /* BIOS Version. */
2890 ushort bios_codeseg
; /* BIOS Code Segment. */
2891 ushort bios_codelen
; /* BIOS Code Segment Length. */
2894 #define adv_dvc_to_board(adv_dvc) container_of(adv_dvc, struct asc_board, \
2895 dvc_var.adv_dvc_var)
2896 #define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev)
2898 /* Number of boards detected in system. */
2899 static int asc_board_count
;
2901 /* Overrun buffer used by all narrow boards. */
2902 static uchar overrun_buf
[ASC_OVERRUN_BSIZE
] = { 0 };
2905 * Global structures required to issue a command.
2907 static ASC_SCSI_Q asc_scsi_q
= { {0} };
2908 static ASC_SG_HEAD asc_sg_head
= { 0 };
2910 #ifdef ADVANSYS_DEBUG
2911 static int asc_dbglvl
= 3;
2912 #endif /* ADVANSYS_DEBUG */
2915 * --- Driver Function Prototypes
2918 static int advansys_slave_configure(struct scsi_device
*);
2919 static void asc_scsi_done_list(struct scsi_cmnd
*);
2920 static int asc_execute_scsi_cmnd(struct scsi_cmnd
*);
2921 static int asc_build_req(asc_board_t
*, struct scsi_cmnd
*);
2922 static int adv_build_req(asc_board_t
*, struct scsi_cmnd
*, ADV_SCSI_REQ_Q
**);
2923 static int adv_get_sglist(asc_board_t
*, adv_req_t
*, struct scsi_cmnd
*, int);
2924 static void asc_enqueue(asc_queue_t
*, REQP
, int);
2925 static REQP
asc_dequeue(asc_queue_t
*, int);
2926 static REQP
asc_dequeue_list(asc_queue_t
*, REQP
*, int);
2927 static int asc_rmqueue(asc_queue_t
*, REQP
);
2928 static void asc_execute_queue(asc_queue_t
*);
2929 #ifdef CONFIG_PROC_FS
2930 static int asc_proc_copy(off_t
, off_t
, char *, int, char *, int);
2931 static int asc_prt_board_devices(struct Scsi_Host
*, char *, int);
2932 static int asc_prt_adv_bios(struct Scsi_Host
*, char *, int);
2933 static int asc_get_eeprom_string(ushort
*serialnum
, uchar
*cp
);
2934 static int asc_prt_asc_board_eeprom(struct Scsi_Host
*, char *, int);
2935 static int asc_prt_adv_board_eeprom(struct Scsi_Host
*, char *, int);
2936 static int asc_prt_driver_conf(struct Scsi_Host
*, char *, int);
2937 static int asc_prt_asc_board_info(struct Scsi_Host
*, char *, int);
2938 static int asc_prt_adv_board_info(struct Scsi_Host
*, char *, int);
2939 static int asc_prt_line(char *, int, char *fmt
, ...);
2940 #endif /* CONFIG_PROC_FS */
2942 /* Statistics function prototypes. */
2943 #ifdef ADVANSYS_STATS
2944 #ifdef CONFIG_PROC_FS
2945 static int asc_prt_board_stats(struct Scsi_Host
*, char *, int);
2946 static int asc_prt_target_stats(struct Scsi_Host
*, int, char *, int);
2947 #endif /* CONFIG_PROC_FS */
2948 #endif /* ADVANSYS_STATS */
2950 /* Debug function prototypes. */
2951 #ifdef ADVANSYS_DEBUG
2952 static void asc_prt_scsi_host(struct Scsi_Host
*);
2953 static void asc_prt_scsi_cmnd(struct scsi_cmnd
*);
2954 static void asc_prt_asc_dvc_cfg(ASC_DVC_CFG
*);
2955 static void asc_prt_asc_dvc_var(ASC_DVC_VAR
*);
2956 static void asc_prt_asc_scsi_q(ASC_SCSI_Q
*);
2957 static void asc_prt_asc_qdone_info(ASC_QDONE_INFO
*);
2958 static void asc_prt_adv_dvc_cfg(ADV_DVC_CFG
*);
2959 static void asc_prt_adv_dvc_var(ADV_DVC_VAR
*);
2960 static void asc_prt_adv_scsi_req_q(ADV_SCSI_REQ_Q
*);
2961 static void asc_prt_adv_sgblock(int, ADV_SG_BLOCK
*);
2962 static void asc_prt_hex(char *f
, uchar
*, int);
2963 #endif /* ADVANSYS_DEBUG */
2965 #ifdef CONFIG_PROC_FS
2967 * advansys_proc_info() - /proc/scsi/advansys/{0,1,2,3,...}
2969 * *buffer: I/O buffer
2970 * **start: if inout == FALSE pointer into buffer where user read should start
2971 * offset: current offset into a /proc/scsi/advansys/[0...] file
2972 * length: length of buffer
2973 * hostno: Scsi_Host host_no
2974 * inout: TRUE - user is writing; FALSE - user is reading
2976 * Return the number of bytes read from or written to a
2977 * /proc/scsi/advansys/[0...] file.
2979 * Note: This function uses the per board buffer 'prtbuf' which is
2980 * allocated when the board is initialized in advansys_detect(). The
2981 * buffer is ASC_PRTBUF_SIZE bytes. The function asc_proc_copy() is
2982 * used to write to the buffer. The way asc_proc_copy() is written
2983 * if 'prtbuf' is too small it will not be overwritten. Instead the
2984 * user just won't get all the available statistics.
2987 advansys_proc_info(struct Scsi_Host
*shost
, char *buffer
, char **start
,
2988 off_t offset
, int length
, int inout
)
2990 asc_board_t
*boardp
;
2998 #ifdef ADVANSYS_STATS
3000 #endif /* ADVANSYS_STATS */
3002 ASC_DBG(1, "advansys_proc_info: begin\n");
3005 * User write not supported.
3007 if (inout
== TRUE
) {
3012 * User read of /proc/scsi/advansys/[0...] file.
3015 boardp
= ASC_BOARDP(shost
);
3017 /* Copy read data starting at the beginning of the buffer. */
3025 * Get board configuration information.
3027 * advansys_info() returns the board string from its own static buffer.
3029 cp
= (char *)advansys_info(shost
);
3032 /* Copy board information. */
3033 cnt
= asc_proc_copy(advoffset
, offset
, curbuf
, leftlen
, cp
, cplen
);
3037 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt
);
3044 * Display Wide Board BIOS Information.
3046 if (ASC_WIDE_BOARD(boardp
)) {
3047 cp
= boardp
->prtbuf
;
3048 cplen
= asc_prt_adv_bios(shost
, cp
, ASC_PRTBUF_SIZE
);
3049 ASC_ASSERT(cplen
< ASC_PRTBUF_SIZE
);
3050 cnt
= asc_proc_copy(advoffset
, offset
, curbuf
, leftlen
, cp
,
3055 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt
);
3063 * Display driver information for each device attached to the board.
3065 cp
= boardp
->prtbuf
;
3066 cplen
= asc_prt_board_devices(shost
, cp
, ASC_PRTBUF_SIZE
);
3067 ASC_ASSERT(cplen
< ASC_PRTBUF_SIZE
);
3068 cnt
= asc_proc_copy(advoffset
, offset
, curbuf
, leftlen
, cp
, cplen
);
3072 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt
);
3079 * Display EEPROM configuration for the board.
3081 cp
= boardp
->prtbuf
;
3082 if (ASC_NARROW_BOARD(boardp
)) {
3083 cplen
= asc_prt_asc_board_eeprom(shost
, cp
, ASC_PRTBUF_SIZE
);
3085 cplen
= asc_prt_adv_board_eeprom(shost
, cp
, ASC_PRTBUF_SIZE
);
3087 ASC_ASSERT(cplen
< ASC_PRTBUF_SIZE
);
3088 cnt
= asc_proc_copy(advoffset
, offset
, curbuf
, leftlen
, cp
, cplen
);
3092 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt
);
3099 * Display driver configuration and information for the board.
3101 cp
= boardp
->prtbuf
;
3102 cplen
= asc_prt_driver_conf(shost
, cp
, ASC_PRTBUF_SIZE
);
3103 ASC_ASSERT(cplen
< ASC_PRTBUF_SIZE
);
3104 cnt
= asc_proc_copy(advoffset
, offset
, curbuf
, leftlen
, cp
, cplen
);
3108 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt
);
3114 #ifdef ADVANSYS_STATS
3116 * Display driver statistics for the board.
3118 cp
= boardp
->prtbuf
;
3119 cplen
= asc_prt_board_stats(shost
, cp
, ASC_PRTBUF_SIZE
);
3120 ASC_ASSERT(cplen
<= ASC_PRTBUF_SIZE
);
3121 cnt
= asc_proc_copy(advoffset
, offset
, curbuf
, leftlen
, cp
, cplen
);
3125 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt
);
3132 * Display driver statistics for each target.
3134 for (tgt_id
= 0; tgt_id
<= ADV_MAX_TID
; tgt_id
++) {
3135 cp
= boardp
->prtbuf
;
3136 cplen
= asc_prt_target_stats(shost
, tgt_id
, cp
,
3138 ASC_ASSERT(cplen
<= ASC_PRTBUF_SIZE
);
3139 cnt
= asc_proc_copy(advoffset
, offset
, curbuf
, leftlen
, cp
,
3144 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt
);
3150 #endif /* ADVANSYS_STATS */
3153 * Display Asc Library dynamic configuration information
3156 cp
= boardp
->prtbuf
;
3157 if (ASC_NARROW_BOARD(boardp
)) {
3158 cplen
= asc_prt_asc_board_info(shost
, cp
, ASC_PRTBUF_SIZE
);
3160 cplen
= asc_prt_adv_board_info(shost
, cp
, ASC_PRTBUF_SIZE
);
3162 ASC_ASSERT(cplen
< ASC_PRTBUF_SIZE
);
3163 cnt
= asc_proc_copy(advoffset
, offset
, curbuf
, leftlen
, cp
, cplen
);
3167 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt
);
3173 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt
);
3177 #endif /* CONFIG_PROC_FS */
3182 * Return suitable for printing on the console with the argument
3183 * adapter's configuration information.
3185 * Note: The information line should not exceed ASC_INFO_SIZE bytes,
3186 * otherwise the static 'info' array will be overrun.
3188 static const char *advansys_info(struct Scsi_Host
*shost
)
3190 static char info
[ASC_INFO_SIZE
];
3191 asc_board_t
*boardp
;
3192 ASC_DVC_VAR
*asc_dvc_varp
;
3193 ADV_DVC_VAR
*adv_dvc_varp
;
3195 char *widename
= NULL
;
3197 boardp
= ASC_BOARDP(shost
);
3198 if (ASC_NARROW_BOARD(boardp
)) {
3199 asc_dvc_varp
= &boardp
->dvc_var
.asc_dvc_var
;
3200 ASC_DBG(1, "advansys_info: begin\n");
3201 if (asc_dvc_varp
->bus_type
& ASC_IS_ISA
) {
3202 if ((asc_dvc_varp
->bus_type
& ASC_IS_ISAPNP
) ==
3204 busname
= "ISA PnP";
3209 "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X, DMA 0x%X",
3210 ASC_VERSION
, busname
,
3211 (ulong
)shost
->io_port
,
3212 (ulong
)shost
->io_port
+ ASC_IOADR_GAP
- 1,
3213 shost
->irq
, shost
->dma_channel
);
3215 if (asc_dvc_varp
->bus_type
& ASC_IS_VL
) {
3217 } else if (asc_dvc_varp
->bus_type
& ASC_IS_EISA
) {
3219 } else if (asc_dvc_varp
->bus_type
& ASC_IS_PCI
) {
3220 if ((asc_dvc_varp
->bus_type
& ASC_IS_PCI_ULTRA
)
3221 == ASC_IS_PCI_ULTRA
) {
3222 busname
= "PCI Ultra";
3228 ASC_PRINT2("advansys_info: board %d: unknown "
3229 "bus type %d\n", boardp
->id
,
3230 asc_dvc_varp
->bus_type
);
3233 "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X",
3234 ASC_VERSION
, busname
, (ulong
)shost
->io_port
,
3235 (ulong
)shost
->io_port
+ ASC_IOADR_GAP
- 1,
3240 * Wide Adapter Information
3242 * Memory-mapped I/O is used instead of I/O space to access
3243 * the adapter, but display the I/O Port range. The Memory
3244 * I/O address is displayed through the driver /proc file.
3246 adv_dvc_varp
= &boardp
->dvc_var
.adv_dvc_var
;
3247 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
3248 widename
= "Ultra-Wide";
3249 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
3250 widename
= "Ultra2-Wide";
3252 widename
= "Ultra3-Wide";
3255 "AdvanSys SCSI %s: PCI %s: PCIMEM 0x%lX-0x%lX, IRQ 0x%X",
3256 ASC_VERSION
, widename
, (ulong
)adv_dvc_varp
->iop_base
,
3257 (ulong
)adv_dvc_varp
->iop_base
+ boardp
->asc_n_io_port
- 1, shost
->irq
);
3259 ASC_ASSERT(strlen(info
) < ASC_INFO_SIZE
);
3260 ASC_DBG(1, "advansys_info: end\n");
3265 * advansys_queuecommand() - interrupt-driven I/O entrypoint.
3267 * This function always returns 0. Command return status is saved
3268 * in the 'scp' result field.
3271 advansys_queuecommand(struct scsi_cmnd
*scp
, void (*done
) (struct scsi_cmnd
*))
3273 struct Scsi_Host
*shost
;
3274 asc_board_t
*boardp
;
3276 struct scsi_cmnd
*done_scp
;
3278 shost
= scp
->device
->host
;
3279 boardp
= ASC_BOARDP(shost
);
3280 ASC_STATS(shost
, queuecommand
);
3282 /* host_lock taken by mid-level prior to call but need to protect */
3283 /* against own ISR */
3284 spin_lock_irqsave(&boardp
->lock
, flags
);
3287 * Block new commands while handling a reset or abort request.
3289 if (boardp
->flags
& ASC_HOST_IN_RESET
) {
3291 "advansys_queuecommand: scp 0x%lx blocked for reset request\n",
3293 scp
->result
= HOST_BYTE(DID_RESET
);
3296 * Add blocked requests to the board's 'done' queue. The queued
3297 * requests will be completed at the end of the abort or reset
3300 asc_enqueue(&boardp
->done
, scp
, ASC_BACK
);
3301 spin_unlock_irqrestore(&boardp
->lock
, flags
);
3306 * Attempt to execute any waiting commands for the board.
3308 if (!ASC_QUEUE_EMPTY(&boardp
->waiting
)) {
3310 "advansys_queuecommand: before asc_execute_queue() waiting\n");
3311 asc_execute_queue(&boardp
->waiting
);
3315 * Save the function pointer to Linux mid-level 'done' function
3316 * and attempt to execute the command.
3318 * If ASC_NOERROR is returned the request has been added to the
3319 * board's 'active' queue and will be completed by the interrupt
3322 * If ASC_BUSY is returned add the request to the board's per
3323 * target waiting list. This is the first time the request has
3324 * been tried. Add it to the back of the waiting list. It will be
3327 * If an error occurred, the request will have been placed on the
3328 * board's 'done' queue and must be completed before returning.
3330 scp
->scsi_done
= done
;
3331 switch (asc_execute_scsi_cmnd(scp
)) {
3335 asc_enqueue(&boardp
->waiting
, scp
, ASC_BACK
);
3339 done_scp
= asc_dequeue_list(&boardp
->done
, NULL
, ASC_TID_ALL
);
3340 /* Interrupts could be enabled here. */
3341 asc_scsi_done_list(done_scp
);
3344 spin_unlock_irqrestore(&boardp
->lock
, flags
);
3352 * Reset the bus associated with the command 'scp'.
3354 * This function runs its own thread. Interrupts must be blocked but
3355 * sleeping is allowed and no locking other than for host structures is
3356 * required. Returns SUCCESS or FAILED.
3358 static int advansys_reset(struct scsi_cmnd
*scp
)
3360 struct Scsi_Host
*shost
;
3361 asc_board_t
*boardp
;
3362 ASC_DVC_VAR
*asc_dvc_varp
;
3363 ADV_DVC_VAR
*adv_dvc_varp
;
3365 struct scsi_cmnd
*done_scp
= NULL
, *last_scp
= NULL
;
3366 struct scsi_cmnd
*tscp
, *new_last_scp
;
3370 ASC_DBG1(1, "advansys_reset: 0x%lx\n", (ulong
)scp
);
3372 #ifdef ADVANSYS_STATS
3373 if (scp
->device
->host
!= NULL
) {
3374 ASC_STATS(scp
->device
->host
, reset
);
3376 #endif /* ADVANSYS_STATS */
3378 if ((shost
= scp
->device
->host
) == NULL
) {
3379 scp
->result
= HOST_BYTE(DID_ERROR
);
3383 boardp
= ASC_BOARDP(shost
);
3385 ASC_PRINT1("advansys_reset: board %d: SCSI bus reset started...\n",
3388 * Check for re-entrancy.
3390 spin_lock_irqsave(&boardp
->lock
, flags
);
3391 if (boardp
->flags
& ASC_HOST_IN_RESET
) {
3392 spin_unlock_irqrestore(&boardp
->lock
, flags
);
3395 boardp
->flags
|= ASC_HOST_IN_RESET
;
3396 spin_unlock_irqrestore(&boardp
->lock
, flags
);
3398 if (ASC_NARROW_BOARD(boardp
)) {
3402 asc_dvc_varp
= &boardp
->dvc_var
.asc_dvc_var
;
3405 * Reset the chip and SCSI bus.
3407 ASC_DBG(1, "advansys_reset: before AscInitAsc1000Driver()\n");
3408 status
= AscInitAsc1000Driver(asc_dvc_varp
);
3410 /* Refer to ASC_IERR_* defintions for meaning of 'err_code'. */
3411 if (asc_dvc_varp
->err_code
) {
3412 ASC_PRINT2("advansys_reset: board %d: SCSI bus reset "
3413 "error: 0x%x\n", boardp
->id
,
3414 asc_dvc_varp
->err_code
);
3416 } else if (status
) {
3417 ASC_PRINT2("advansys_reset: board %d: SCSI bus reset "
3418 "warning: 0x%x\n", boardp
->id
, status
);
3420 ASC_PRINT1("advansys_reset: board %d: SCSI bus reset "
3421 "successful.\n", boardp
->id
);
3424 ASC_DBG(1, "advansys_reset: after AscInitAsc1000Driver()\n");
3425 spin_lock_irqsave(&boardp
->lock
, flags
);
3431 * If the suggest reset bus flags are set, then reset the bus.
3432 * Otherwise only reset the device.
3434 adv_dvc_varp
= &boardp
->dvc_var
.adv_dvc_var
;
3437 * Reset the target's SCSI bus.
3439 ASC_DBG(1, "advansys_reset: before AdvResetChipAndSB()\n");
3440 switch (AdvResetChipAndSB(adv_dvc_varp
)) {
3442 ASC_PRINT1("advansys_reset: board %d: SCSI bus reset "
3443 "successful.\n", boardp
->id
);
3447 ASC_PRINT1("advansys_reset: board %d: SCSI bus reset "
3448 "error.\n", boardp
->id
);
3452 spin_lock_irqsave(&boardp
->lock
, flags
);
3453 (void)AdvISR(adv_dvc_varp
);
3455 /* Board lock is held. */
3458 * Dequeue all board 'done' requests. A pointer to the last request
3459 * is returned in 'last_scp'.
3461 done_scp
= asc_dequeue_list(&boardp
->done
, &last_scp
, ASC_TID_ALL
);
3464 * Dequeue all board 'active' requests for all devices and set
3465 * the request status to DID_RESET. A pointer to the last request
3466 * is returned in 'last_scp'.
3468 if (done_scp
== NULL
) {
3469 done_scp
= asc_dequeue_list(&boardp
->active
, &last_scp
,
3471 for (tscp
= done_scp
; tscp
; tscp
= REQPNEXT(tscp
)) {
3472 tscp
->result
= HOST_BYTE(DID_RESET
);
3475 /* Append to 'done_scp' at the end with 'last_scp'. */
3476 ASC_ASSERT(last_scp
!= NULL
);
3477 last_scp
->host_scribble
=
3478 (unsigned char *)asc_dequeue_list(&boardp
->active
,
3481 if (new_last_scp
!= NULL
) {
3482 ASC_ASSERT(REQPNEXT(last_scp
) != NULL
);
3483 for (tscp
= REQPNEXT(last_scp
); tscp
;
3484 tscp
= REQPNEXT(tscp
)) {
3485 tscp
->result
= HOST_BYTE(DID_RESET
);
3487 last_scp
= new_last_scp
;
3492 * Dequeue all 'waiting' requests and set the request status
3495 if (done_scp
== NULL
) {
3496 done_scp
= asc_dequeue_list(&boardp
->waiting
, &last_scp
,
3498 for (tscp
= done_scp
; tscp
; tscp
= REQPNEXT(tscp
)) {
3499 tscp
->result
= HOST_BYTE(DID_RESET
);
3502 /* Append to 'done_scp' at the end with 'last_scp'. */
3503 ASC_ASSERT(last_scp
!= NULL
);
3504 last_scp
->host_scribble
=
3505 (unsigned char *)asc_dequeue_list(&boardp
->waiting
,
3508 if (new_last_scp
!= NULL
) {
3509 ASC_ASSERT(REQPNEXT(last_scp
) != NULL
);
3510 for (tscp
= REQPNEXT(last_scp
); tscp
;
3511 tscp
= REQPNEXT(tscp
)) {
3512 tscp
->result
= HOST_BYTE(DID_RESET
);
3514 last_scp
= new_last_scp
;
3518 /* Save the time of the most recently completed reset. */
3519 boardp
->last_reset
= jiffies
;
3521 /* Clear reset flag. */
3522 boardp
->flags
&= ~ASC_HOST_IN_RESET
;
3523 spin_unlock_irqrestore(&boardp
->lock
, flags
);
3526 * Complete all the 'done_scp' requests.
3529 asc_scsi_done_list(done_scp
);
3531 ASC_DBG1(1, "advansys_reset: ret %d\n", ret
);
3537 * advansys_biosparam()
3539 * Translate disk drive geometry if the "BIOS greater than 1 GB"
3540 * support is enabled for a drive.
3542 * ip (information pointer) is an int array with the following definition:
3548 advansys_biosparam(struct scsi_device
*sdev
, struct block_device
*bdev
,
3549 sector_t capacity
, int ip
[])
3551 asc_board_t
*boardp
;
3553 ASC_DBG(1, "advansys_biosparam: begin\n");
3554 ASC_STATS(sdev
->host
, biosparam
);
3555 boardp
= ASC_BOARDP(sdev
->host
);
3556 if (ASC_NARROW_BOARD(boardp
)) {
3557 if ((boardp
->dvc_var
.asc_dvc_var
.dvc_cntl
&
3558 ASC_CNTL_BIOS_GT_1GB
) && capacity
> 0x200000) {
3566 if ((boardp
->dvc_var
.adv_dvc_var
.bios_ctrl
&
3567 BIOS_CTRL_EXTENDED_XLAT
) && capacity
> 0x200000) {
3575 ip
[2] = (unsigned long)capacity
/ (ip
[0] * ip
[1]);
3576 ASC_DBG(1, "advansys_biosparam: end\n");
3580 static struct scsi_host_template advansys_template
= {
3581 .proc_name
= "advansys",
3582 #ifdef CONFIG_PROC_FS
3583 .proc_info
= advansys_proc_info
,
3586 .info
= advansys_info
,
3587 .queuecommand
= advansys_queuecommand
,
3588 .eh_bus_reset_handler
= advansys_reset
,
3589 .bios_param
= advansys_biosparam
,
3590 .slave_configure
= advansys_slave_configure
,
3592 * Because the driver may control an ISA adapter 'unchecked_isa_dma'
3593 * must be set. The flag will be cleared in advansys_board_found
3594 * for non-ISA adapters.
3596 .unchecked_isa_dma
= 1,
3598 * All adapters controlled by this driver are capable of large
3599 * scatter-gather lists. According to the mid-level SCSI documentation
3600 * this obviates any performance gain provided by setting
3601 * 'use_clustering'. But empirically while CPU utilization is increased
3602 * by enabling clustering, I/O throughput increases as well.
3604 .use_clustering
= ENABLE_CLUSTERING
,
3608 * --- Miscellaneous Driver Functions
3612 * First-level interrupt handler.
3614 * 'dev_id' is a pointer to the interrupting adapter's asc_board_t. Because
3615 * all boards are currently checked for interrupts on each interrupt, 'dev_id'
3616 * is not referenced. 'dev_id' could be used to identify an interrupt passed
3617 * to the AdvanSys driver which is for a device sharing an interrupt with
3618 * an AdvanSys adapter.
3620 static irqreturn_t
advansys_interrupt(int irq
, void *dev_id
)
3622 unsigned long flags
;
3623 struct scsi_cmnd
*done_scp
= NULL
, *last_scp
= NULL
;
3624 struct scsi_cmnd
*new_last_scp
;
3625 struct Scsi_Host
*shost
= dev_id
;
3626 asc_board_t
*boardp
= ASC_BOARDP(shost
);
3627 irqreturn_t result
= IRQ_NONE
;
3629 ASC_DBG1(2, "advansys_interrupt: boardp 0x%p\n", boardp
);
3630 spin_lock_irqsave(&boardp
->lock
, flags
);
3631 if (ASC_NARROW_BOARD(boardp
)) {
3635 if (AscIsIntPending(shost
->io_port
)) {
3636 result
= IRQ_HANDLED
;
3637 ASC_STATS(shost
, interrupt
);
3638 ASC_DBG(1, "advansys_interrupt: before AscISR()\n");
3639 AscISR(&boardp
->dvc_var
.asc_dvc_var
);
3645 ASC_DBG(1, "advansys_interrupt: before AdvISR()\n");
3646 if (AdvISR(&boardp
->dvc_var
.adv_dvc_var
)) {
3647 result
= IRQ_HANDLED
;
3648 ASC_STATS(shost
, interrupt
);
3653 * Start waiting requests and create a list of completed requests.
3655 * If a reset request is being performed for the board, the reset
3656 * handler will complete pending requests after it has completed.
3658 if ((boardp
->flags
& ASC_HOST_IN_RESET
) == 0) {
3659 ASC_DBG2(1, "advansys_interrupt: done_scp 0x%p, "
3660 "last_scp 0x%p\n", done_scp
, last_scp
);
3662 /* Start any waiting commands for the board. */
3663 if (!ASC_QUEUE_EMPTY(&boardp
->waiting
)) {
3664 ASC_DBG(1, "advansys_interrupt: before "
3665 "asc_execute_queue()\n");
3666 asc_execute_queue(&boardp
->waiting
);
3670 * Add to the list of requests that must be completed.
3672 * 'done_scp' will always be NULL on the first iteration of
3673 * this loop. 'last_scp' is set at the same time as 'done_scp'.
3675 if (done_scp
== NULL
) {
3676 done_scp
= asc_dequeue_list(&boardp
->done
,
3677 &last_scp
, ASC_TID_ALL
);
3679 ASC_ASSERT(last_scp
!= NULL
);
3680 last_scp
->host_scribble
=
3681 (unsigned char *)asc_dequeue_list(&boardp
->
3685 if (new_last_scp
!= NULL
) {
3686 ASC_ASSERT(REQPNEXT(last_scp
) != NULL
);
3687 last_scp
= new_last_scp
;
3691 spin_unlock_irqrestore(&boardp
->lock
, flags
);
3694 * If interrupts were enabled on entry, then they
3695 * are now enabled here.
3697 * Complete all requests on the done list.
3700 asc_scsi_done_list(done_scp
);
3702 ASC_DBG(1, "advansys_interrupt: end\n");
3707 advansys_narrow_slave_configure(struct scsi_device
*sdev
, ASC_DVC_VAR
*asc_dvc
)
3709 ASC_SCSI_BIT_ID_TYPE tid_bit
= 1 << sdev
->id
;
3710 ASC_SCSI_BIT_ID_TYPE orig_use_tagged_qng
= asc_dvc
->use_tagged_qng
;
3712 if (sdev
->lun
== 0) {
3713 ASC_SCSI_BIT_ID_TYPE orig_init_sdtr
= asc_dvc
->init_sdtr
;
3714 if ((asc_dvc
->cfg
->sdtr_enable
& tid_bit
) && sdev
->sdtr
) {
3715 asc_dvc
->init_sdtr
|= tid_bit
;
3717 asc_dvc
->init_sdtr
&= ~tid_bit
;
3720 if (orig_init_sdtr
!= asc_dvc
->init_sdtr
)
3721 AscAsyncFix(asc_dvc
, sdev
);
3724 if (sdev
->tagged_supported
) {
3725 if (asc_dvc
->cfg
->cmd_qng_enabled
& tid_bit
) {
3726 if (sdev
->lun
== 0) {
3727 asc_dvc
->cfg
->can_tagged_qng
|= tid_bit
;
3728 asc_dvc
->use_tagged_qng
|= tid_bit
;
3730 scsi_adjust_queue_depth(sdev
, MSG_ORDERED_TAG
,
3731 asc_dvc
->max_dvc_qng
[sdev
->id
]);
3734 if (sdev
->lun
== 0) {
3735 asc_dvc
->cfg
->can_tagged_qng
&= ~tid_bit
;
3736 asc_dvc
->use_tagged_qng
&= ~tid_bit
;
3738 scsi_adjust_queue_depth(sdev
, 0, sdev
->host
->cmd_per_lun
);
3741 if ((sdev
->lun
== 0) &&
3742 (orig_use_tagged_qng
!= asc_dvc
->use_tagged_qng
)) {
3743 AscWriteLramByte(asc_dvc
->iop_base
, ASCV_DISC_ENABLE_B
,
3744 asc_dvc
->cfg
->disc_enable
);
3745 AscWriteLramByte(asc_dvc
->iop_base
, ASCV_USE_TAGGED_QNG_B
,
3746 asc_dvc
->use_tagged_qng
);
3747 AscWriteLramByte(asc_dvc
->iop_base
, ASCV_CAN_TAGGED_QNG_B
,
3748 asc_dvc
->cfg
->can_tagged_qng
);
3750 asc_dvc
->max_dvc_qng
[sdev
->id
] =
3751 asc_dvc
->cfg
->max_tag_qng
[sdev
->id
];
3752 AscWriteLramByte(asc_dvc
->iop_base
,
3753 (ushort
)(ASCV_MAX_DVC_QNG_BEG
+ sdev
->id
),
3754 asc_dvc
->max_dvc_qng
[sdev
->id
]);
3761 * If the EEPROM enabled WDTR for the device and the device supports wide
3762 * bus (16 bit) transfers, then turn on the device's 'wdtr_able' bit and
3763 * write the new value to the microcode.
3766 advansys_wide_enable_wdtr(AdvPortAddr iop_base
, unsigned short tidmask
)
3768 unsigned short cfg_word
;
3769 AdvReadWordLram(iop_base
, ASC_MC_WDTR_ABLE
, cfg_word
);
3770 if ((cfg_word
& tidmask
) != 0)
3773 cfg_word
|= tidmask
;
3774 AdvWriteWordLram(iop_base
, ASC_MC_WDTR_ABLE
, cfg_word
);
3777 * Clear the microcode SDTR and WDTR negotiation done indicators for
3778 * the target to cause it to negotiate with the new setting set above.
3779 * WDTR when accepted causes the target to enter asynchronous mode, so
3780 * SDTR must be negotiated.
3782 AdvReadWordLram(iop_base
, ASC_MC_SDTR_DONE
, cfg_word
);
3783 cfg_word
&= ~tidmask
;
3784 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_DONE
, cfg_word
);
3785 AdvReadWordLram(iop_base
, ASC_MC_WDTR_DONE
, cfg_word
);
3786 cfg_word
&= ~tidmask
;
3787 AdvWriteWordLram(iop_base
, ASC_MC_WDTR_DONE
, cfg_word
);
3791 * Synchronous Transfers
3793 * If the EEPROM enabled SDTR for the device and the device
3794 * supports synchronous transfers, then turn on the device's
3795 * 'sdtr_able' bit. Write the new value to the microcode.
3798 advansys_wide_enable_sdtr(AdvPortAddr iop_base
, unsigned short tidmask
)
3800 unsigned short cfg_word
;
3801 AdvReadWordLram(iop_base
, ASC_MC_SDTR_ABLE
, cfg_word
);
3802 if ((cfg_word
& tidmask
) != 0)
3805 cfg_word
|= tidmask
;
3806 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_ABLE
, cfg_word
);
3809 * Clear the microcode "SDTR negotiation" done indicator for the
3810 * target to cause it to negotiate with the new setting set above.
3812 AdvReadWordLram(iop_base
, ASC_MC_SDTR_DONE
, cfg_word
);
3813 cfg_word
&= ~tidmask
;
3814 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_DONE
, cfg_word
);
3818 * PPR (Parallel Protocol Request) Capable
3820 * If the device supports DT mode, then it must be PPR capable.
3821 * The PPR message will be used in place of the SDTR and WDTR
3822 * messages to negotiate synchronous speed and offset, transfer
3823 * width, and protocol options.
3825 static void advansys_wide_enable_ppr(ADV_DVC_VAR
*adv_dvc
,
3826 AdvPortAddr iop_base
, unsigned short tidmask
)
3828 AdvReadWordLram(iop_base
, ASC_MC_PPR_ABLE
, adv_dvc
->ppr_able
);
3829 adv_dvc
->ppr_able
|= tidmask
;
3830 AdvWriteWordLram(iop_base
, ASC_MC_PPR_ABLE
, adv_dvc
->ppr_able
);
3834 advansys_wide_slave_configure(struct scsi_device
*sdev
, ADV_DVC_VAR
*adv_dvc
)
3836 AdvPortAddr iop_base
= adv_dvc
->iop_base
;
3837 unsigned short tidmask
= 1 << sdev
->id
;
3839 if (sdev
->lun
== 0) {
3841 * Handle WDTR, SDTR, and Tag Queuing. If the feature
3842 * is enabled in the EEPROM and the device supports the
3843 * feature, then enable it in the microcode.
3846 if ((adv_dvc
->wdtr_able
& tidmask
) && sdev
->wdtr
)
3847 advansys_wide_enable_wdtr(iop_base
, tidmask
);
3848 if ((adv_dvc
->sdtr_able
& tidmask
) && sdev
->sdtr
)
3849 advansys_wide_enable_sdtr(iop_base
, tidmask
);
3850 if (adv_dvc
->chip_type
== ADV_CHIP_ASC38C1600
&& sdev
->ppr
)
3851 advansys_wide_enable_ppr(adv_dvc
, iop_base
, tidmask
);
3854 * Tag Queuing is disabled for the BIOS which runs in polled
3855 * mode and would see no benefit from Tag Queuing. Also by
3856 * disabling Tag Queuing in the BIOS devices with Tag Queuing
3857 * bugs will at least work with the BIOS.
3859 if ((adv_dvc
->tagqng_able
& tidmask
) &&
3860 sdev
->tagged_supported
) {
3861 unsigned short cfg_word
;
3862 AdvReadWordLram(iop_base
, ASC_MC_TAGQNG_ABLE
, cfg_word
);
3863 cfg_word
|= tidmask
;
3864 AdvWriteWordLram(iop_base
, ASC_MC_TAGQNG_ABLE
,
3866 AdvWriteByteLram(iop_base
,
3867 ASC_MC_NUMBER_OF_MAX_CMD
+ sdev
->id
,
3868 adv_dvc
->max_dvc_qng
);
3872 if ((adv_dvc
->tagqng_able
& tidmask
) && sdev
->tagged_supported
) {
3873 scsi_adjust_queue_depth(sdev
, MSG_ORDERED_TAG
,
3874 adv_dvc
->max_dvc_qng
);
3876 scsi_adjust_queue_depth(sdev
, 0, sdev
->host
->cmd_per_lun
);
3881 * Set the number of commands to queue per device for the
3882 * specified host adapter.
3884 static int advansys_slave_configure(struct scsi_device
*sdev
)
3886 asc_board_t
*boardp
= ASC_BOARDP(sdev
->host
);
3887 boardp
->flags
|= ASC_SELECT_QUEUE_DEPTHS
;
3890 * Save a pointer to the sdev and set its initial/maximum
3891 * queue depth. Only save the pointer for a lun0 dev though.
3894 boardp
->device
[sdev
->id
] = sdev
;
3896 if (ASC_NARROW_BOARD(boardp
))
3897 advansys_narrow_slave_configure(sdev
,
3898 &boardp
->dvc_var
.asc_dvc_var
);
3900 advansys_wide_slave_configure(sdev
,
3901 &boardp
->dvc_var
.adv_dvc_var
);
3907 * Complete all requests on the singly linked list pointed
3910 * Interrupts can be enabled on entry.
3912 static void asc_scsi_done_list(struct scsi_cmnd
*scp
)
3914 struct scsi_cmnd
*tscp
;
3916 ASC_DBG(2, "asc_scsi_done_list: begin\n");
3917 while (scp
!= NULL
) {
3918 asc_board_t
*boardp
;
3920 ASC_DBG1(3, "asc_scsi_done_list: scp 0x%lx\n", (ulong
)scp
);
3921 tscp
= REQPNEXT(scp
);
3922 scp
->host_scribble
= NULL
;
3924 boardp
= ASC_BOARDP(scp
->device
->host
);
3927 dma_unmap_sg(boardp
->dev
,
3928 (struct scatterlist
*)scp
->request_buffer
,
3929 scp
->use_sg
, scp
->sc_data_direction
);
3930 else if (scp
->request_bufflen
)
3931 dma_unmap_single(boardp
->dev
, scp
->SCp
.dma_handle
,
3932 scp
->request_bufflen
,
3933 scp
->sc_data_direction
);
3935 ASC_STATS(scp
->device
->host
, done
);
3936 ASC_ASSERT(scp
->scsi_done
!= NULL
);
3938 scp
->scsi_done(scp
);
3942 ASC_DBG(2, "asc_scsi_done_list: done\n");
3947 * Execute a single 'Scsi_Cmnd'.
3949 * The function 'done' is called when the request has been completed.
3953 * host - board controlling device
3954 * device - device to send command
3955 * target - target of device
3956 * lun - lun of device
3957 * cmd_len - length of SCSI CDB
3958 * cmnd - buffer for SCSI 8, 10, or 12 byte CDB
3959 * use_sg - if non-zero indicates scatter-gather request with use_sg elements
3961 * if (use_sg == 0) {
3962 * request_buffer - buffer address for request
3963 * request_bufflen - length of request buffer
3965 * request_buffer - pointer to scatterlist structure
3968 * sense_buffer - sense command buffer
3970 * result (4 bytes of an int):
3972 * 0 SCSI Status Byte Code
3973 * 1 SCSI One Byte Message Code
3975 * 3 Mid-Level Error Code
3977 * host driver fields:
3978 * SCp - Scsi_Pointer used for command processing status
3979 * scsi_done - used to save caller's done function
3980 * host_scribble - used for pointer to another struct scsi_cmnd
3982 * If this function returns ASC_NOERROR the request has been enqueued
3983 * on the board's 'active' queue and will be completed from the
3984 * interrupt handler.
3986 * If this function returns ASC_NOERROR the request has been enqueued
3987 * on the board's 'done' queue and must be completed by the caller.
3989 * If ASC_BUSY is returned the request will be enqueued by the
3990 * caller on the target's waiting queue and re-tried later.
3992 static int asc_execute_scsi_cmnd(struct scsi_cmnd
*scp
)
3994 asc_board_t
*boardp
;
3995 ASC_DVC_VAR
*asc_dvc_varp
;
3996 ADV_DVC_VAR
*adv_dvc_varp
;
3997 ADV_SCSI_REQ_Q
*adv_scsiqp
;
3998 struct scsi_device
*device
;
4001 ASC_DBG2(1, "asc_execute_scsi_cmnd: scp 0x%lx, done 0x%lx\n",
4002 (ulong
)scp
, (ulong
)scp
->scsi_done
);
4004 boardp
= ASC_BOARDP(scp
->device
->host
);
4005 device
= boardp
->device
[scp
->device
->id
];
4007 if (ASC_NARROW_BOARD(boardp
)) {
4009 * Build and execute Narrow Board request.
4012 asc_dvc_varp
= &boardp
->dvc_var
.asc_dvc_var
;
4015 * Build Asc Library request structure using the
4016 * global structures 'asc_scsi_req' and 'asc_sg_head'.
4018 * If an error is returned, then the request has been
4019 * queued on the board done queue. It will be completed
4022 * asc_build_req() can not return ASC_BUSY.
4024 if (asc_build_req(boardp
, scp
) == ASC_ERROR
) {
4025 ASC_STATS(scp
->device
->host
, build_error
);
4030 * Execute the command. If there is no error, add the command
4031 * to the active queue.
4033 switch (ret
= AscExeScsiQueue(asc_dvc_varp
, &asc_scsi_q
)) {
4035 ASC_STATS(scp
->device
->host
, exe_noerror
);
4037 * Increment monotonically increasing per device
4038 * successful request counter. Wrapping doesn't matter.
4040 boardp
->reqcnt
[scp
->device
->id
]++;
4041 asc_enqueue(&boardp
->active
, scp
, ASC_BACK
);
4042 ASC_DBG(1, "asc_execute_scsi_cmnd: AscExeScsiQueue(), "
4047 * Caller will enqueue request on the target's waiting
4048 * queue and retry later.
4050 ASC_STATS(scp
->device
->host
, exe_busy
);
4053 ASC_PRINT2("asc_execute_scsi_cmnd: board %d: "
4054 "AscExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
4055 boardp
->id
, asc_dvc_varp
->err_code
);
4056 ASC_STATS(scp
->device
->host
, exe_error
);
4057 scp
->result
= HOST_BYTE(DID_ERROR
);
4058 asc_enqueue(&boardp
->done
, scp
, ASC_BACK
);
4061 ASC_PRINT2("asc_execute_scsi_cmnd: board %d: "
4062 "AscExeScsiQueue() unknown, err_code 0x%x\n",
4063 boardp
->id
, asc_dvc_varp
->err_code
);
4064 ASC_STATS(scp
->device
->host
, exe_unknown
);
4065 scp
->result
= HOST_BYTE(DID_ERROR
);
4066 asc_enqueue(&boardp
->done
, scp
, ASC_BACK
);
4071 * Build and execute Wide Board request.
4073 adv_dvc_varp
= &boardp
->dvc_var
.adv_dvc_var
;
4076 * Build and get a pointer to an Adv Library request structure.
4078 * If the request is successfully built then send it below,
4079 * otherwise return with an error.
4081 switch (adv_build_req(boardp
, scp
, &adv_scsiqp
)) {
4083 ASC_DBG(3, "asc_execute_scsi_cmnd: adv_build_req "
4087 ASC_DBG(1, "asc_execute_scsi_cmnd: adv_build_req "
4090 * If busy is returned the request has not been
4091 * enqueued. It will be enqueued by the caller on the
4092 * target's waiting queue and retried later.
4094 * The asc_stats fields 'adv_build_noreq' and
4095 * 'adv_build_nosg' count wide board busy conditions.
4096 * They are updated in adv_build_req and
4097 * adv_get_sglist, respectively.
4102 * If an error is returned, then the request has been
4103 * queued on the board done queue. It will be completed
4107 ASC_DBG(1, "asc_execute_scsi_cmnd: adv_build_req "
4109 ASC_STATS(scp
->device
->host
, build_error
);
4114 * Execute the command. If there is no error, add the command
4115 * to the active queue.
4117 switch (ret
= AdvExeScsiQueue(adv_dvc_varp
, adv_scsiqp
)) {
4119 ASC_STATS(scp
->device
->host
, exe_noerror
);
4121 * Increment monotonically increasing per device
4122 * successful request counter. Wrapping doesn't matter.
4124 boardp
->reqcnt
[scp
->device
->id
]++;
4125 asc_enqueue(&boardp
->active
, scp
, ASC_BACK
);
4126 ASC_DBG(1, "asc_execute_scsi_cmnd: AdvExeScsiQueue(), "
4131 * Caller will enqueue request on the target's waiting
4132 * queue and retry later.
4134 ASC_STATS(scp
->device
->host
, exe_busy
);
4137 ASC_PRINT2("asc_execute_scsi_cmnd: board %d: "
4138 "AdvExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
4139 boardp
->id
, adv_dvc_varp
->err_code
);
4140 ASC_STATS(scp
->device
->host
, exe_error
);
4141 scp
->result
= HOST_BYTE(DID_ERROR
);
4142 asc_enqueue(&boardp
->done
, scp
, ASC_BACK
);
4145 ASC_PRINT2("asc_execute_scsi_cmnd: board %d: "
4146 "AdvExeScsiQueue() unknown, err_code 0x%x\n",
4147 boardp
->id
, adv_dvc_varp
->err_code
);
4148 ASC_STATS(scp
->device
->host
, exe_unknown
);
4149 scp
->result
= HOST_BYTE(DID_ERROR
);
4150 asc_enqueue(&boardp
->done
, scp
, ASC_BACK
);
4155 ASC_DBG(1, "asc_execute_scsi_cmnd: end\n");
4160 * Build a request structure for the Asc Library (Narrow Board).
4162 * The global structures 'asc_scsi_q' and 'asc_sg_head' are
4163 * used to build the request.
4165 * If an error occurs, then queue the request on the board done
4166 * queue and return ASC_ERROR.
4168 static int asc_build_req(asc_board_t
*boardp
, struct scsi_cmnd
*scp
)
4171 * Mutually exclusive access is required to 'asc_scsi_q' and
4172 * 'asc_sg_head' until after the request is started.
4174 memset(&asc_scsi_q
, 0, sizeof(ASC_SCSI_Q
));
4177 * Point the ASC_SCSI_Q to the 'struct scsi_cmnd'.
4179 asc_scsi_q
.q2
.srb_ptr
= ASC_VADDR_TO_U32(scp
);
4182 * Build the ASC_SCSI_Q request.
4184 * For narrow boards a CDB length maximum of 12 bytes
4187 if (scp
->cmd_len
> ASC_MAX_CDB_LEN
) {
4188 ASC_PRINT3("asc_build_req: board %d: cmd_len %d > "
4189 "ASC_MAX_CDB_LEN %d\n", boardp
->id
, scp
->cmd_len
,
4191 scp
->result
= HOST_BYTE(DID_ERROR
);
4192 asc_enqueue(&boardp
->done
, scp
, ASC_BACK
);
4195 asc_scsi_q
.cdbptr
= &scp
->cmnd
[0];
4196 asc_scsi_q
.q2
.cdb_len
= scp
->cmd_len
;
4197 asc_scsi_q
.q1
.target_id
= ASC_TID_TO_TARGET_ID(scp
->device
->id
);
4198 asc_scsi_q
.q1
.target_lun
= scp
->device
->lun
;
4199 asc_scsi_q
.q2
.target_ix
=
4200 ASC_TIDLUN_TO_IX(scp
->device
->id
, scp
->device
->lun
);
4201 asc_scsi_q
.q1
.sense_addr
=
4202 cpu_to_le32(virt_to_bus(&scp
->sense_buffer
[0]));
4203 asc_scsi_q
.q1
.sense_len
= sizeof(scp
->sense_buffer
);
4206 * If there are any outstanding requests for the current target,
4207 * then every 255th request send an ORDERED request. This heuristic
4208 * tries to retain the benefit of request sorting while preventing
4209 * request starvation. 255 is the max number of tags or pending commands
4210 * a device may have outstanding.
4212 * The request count is incremented below for every successfully
4216 if ((boardp
->dvc_var
.asc_dvc_var
.cur_dvc_qng
[scp
->device
->id
] > 0) &&
4217 (boardp
->reqcnt
[scp
->device
->id
] % 255) == 0) {
4218 asc_scsi_q
.q2
.tag_code
= MSG_ORDERED_TAG
;
4220 asc_scsi_q
.q2
.tag_code
= MSG_SIMPLE_TAG
;
4224 * Build ASC_SCSI_Q for a contiguous buffer or a scatter-gather
4227 if (scp
->use_sg
== 0) {
4229 * CDB request of single contiguous buffer.
4231 ASC_STATS(scp
->device
->host
, cont_cnt
);
4232 scp
->SCp
.dma_handle
= scp
->request_bufflen
?
4233 dma_map_single(boardp
->dev
, scp
->request_buffer
,
4234 scp
->request_bufflen
,
4235 scp
->sc_data_direction
) : 0;
4236 asc_scsi_q
.q1
.data_addr
= cpu_to_le32(scp
->SCp
.dma_handle
);
4237 asc_scsi_q
.q1
.data_cnt
= cpu_to_le32(scp
->request_bufflen
);
4238 ASC_STATS_ADD(scp
->device
->host
, cont_xfer
,
4239 ASC_CEILING(scp
->request_bufflen
, 512));
4240 asc_scsi_q
.q1
.sg_queue_cnt
= 0;
4241 asc_scsi_q
.sg_head
= NULL
;
4244 * CDB scatter-gather request list.
4248 struct scatterlist
*slp
;
4250 slp
= (struct scatterlist
*)scp
->request_buffer
;
4251 use_sg
= dma_map_sg(boardp
->dev
, slp
, scp
->use_sg
,
4252 scp
->sc_data_direction
);
4254 if (use_sg
> scp
->device
->host
->sg_tablesize
) {
4255 ASC_PRINT3("asc_build_req: board %d: use_sg %d > "
4256 "sg_tablesize %d\n", boardp
->id
, use_sg
,
4257 scp
->device
->host
->sg_tablesize
);
4258 dma_unmap_sg(boardp
->dev
, slp
, scp
->use_sg
,
4259 scp
->sc_data_direction
);
4260 scp
->result
= HOST_BYTE(DID_ERROR
);
4261 asc_enqueue(&boardp
->done
, scp
, ASC_BACK
);
4265 ASC_STATS(scp
->device
->host
, sg_cnt
);
4268 * Use global ASC_SG_HEAD structure and set the ASC_SCSI_Q
4269 * structure to point to it.
4271 memset(&asc_sg_head
, 0, sizeof(ASC_SG_HEAD
));
4273 asc_scsi_q
.q1
.cntl
|= QC_SG_HEAD
;
4274 asc_scsi_q
.sg_head
= &asc_sg_head
;
4275 asc_scsi_q
.q1
.data_cnt
= 0;
4276 asc_scsi_q
.q1
.data_addr
= 0;
4277 /* This is a byte value, otherwise it would need to be swapped. */
4278 asc_sg_head
.entry_cnt
= asc_scsi_q
.q1
.sg_queue_cnt
= use_sg
;
4279 ASC_STATS_ADD(scp
->device
->host
, sg_elem
,
4280 asc_sg_head
.entry_cnt
);
4283 * Convert scatter-gather list into ASC_SG_HEAD list.
4285 for (sgcnt
= 0; sgcnt
< use_sg
; sgcnt
++, slp
++) {
4286 asc_sg_head
.sg_list
[sgcnt
].addr
=
4287 cpu_to_le32(sg_dma_address(slp
));
4288 asc_sg_head
.sg_list
[sgcnt
].bytes
=
4289 cpu_to_le32(sg_dma_len(slp
));
4290 ASC_STATS_ADD(scp
->device
->host
, sg_xfer
,
4291 ASC_CEILING(sg_dma_len(slp
), 512));
4295 ASC_DBG_PRT_ASC_SCSI_Q(2, &asc_scsi_q
);
4296 ASC_DBG_PRT_CDB(1, scp
->cmnd
, scp
->cmd_len
);
4302 * Build a request structure for the Adv Library (Wide Board).
4304 * If an adv_req_t can not be allocated to issue the request,
4305 * then return ASC_BUSY. If an error occurs, then return ASC_ERROR.
4307 * Multi-byte fields in the ASC_SCSI_REQ_Q that are used by the
4308 * microcode for DMA addresses or math operations are byte swapped
4309 * to little-endian order.
4312 adv_build_req(asc_board_t
*boardp
, struct scsi_cmnd
*scp
,
4313 ADV_SCSI_REQ_Q
**adv_scsiqpp
)
4316 ADV_SCSI_REQ_Q
*scsiqp
;
4321 * Allocate an adv_req_t structure from the board to execute
4324 if (boardp
->adv_reqp
== NULL
) {
4325 ASC_DBG(1, "adv_build_req: no free adv_req_t\n");
4326 ASC_STATS(scp
->device
->host
, adv_build_noreq
);
4329 reqp
= boardp
->adv_reqp
;
4330 boardp
->adv_reqp
= reqp
->next_reqp
;
4331 reqp
->next_reqp
= NULL
;
4335 * Get 32-byte aligned ADV_SCSI_REQ_Q and ADV_SG_BLOCK pointers.
4337 scsiqp
= (ADV_SCSI_REQ_Q
*)ADV_32BALIGN(&reqp
->scsi_req_q
);
4340 * Initialize the structure.
4342 scsiqp
->cntl
= scsiqp
->scsi_cntl
= scsiqp
->done_status
= 0;
4345 * Set the ADV_SCSI_REQ_Q 'srb_ptr' to point to the adv_req_t structure.
4347 scsiqp
->srb_ptr
= ASC_VADDR_TO_U32(reqp
);
4350 * Set the adv_req_t 'cmndp' to point to the struct scsi_cmnd structure.
4355 * Build the ADV_SCSI_REQ_Q request.
4359 * Set CDB length and copy it to the request structure.
4360 * For wide boards a CDB length maximum of 16 bytes
4363 if (scp
->cmd_len
> ADV_MAX_CDB_LEN
) {
4365 ("adv_build_req: board %d: cmd_len %d > ADV_MAX_CDB_LEN %d\n",
4366 boardp
->id
, scp
->cmd_len
, ADV_MAX_CDB_LEN
);
4367 scp
->result
= HOST_BYTE(DID_ERROR
);
4368 asc_enqueue(&boardp
->done
, scp
, ASC_BACK
);
4371 scsiqp
->cdb_len
= scp
->cmd_len
;
4372 /* Copy first 12 CDB bytes to cdb[]. */
4373 for (i
= 0; i
< scp
->cmd_len
&& i
< 12; i
++) {
4374 scsiqp
->cdb
[i
] = scp
->cmnd
[i
];
4376 /* Copy last 4 CDB bytes, if present, to cdb16[]. */
4377 for (; i
< scp
->cmd_len
; i
++) {
4378 scsiqp
->cdb16
[i
- 12] = scp
->cmnd
[i
];
4381 scsiqp
->target_id
= scp
->device
->id
;
4382 scsiqp
->target_lun
= scp
->device
->lun
;
4384 scsiqp
->sense_addr
= cpu_to_le32(virt_to_bus(&scp
->sense_buffer
[0]));
4385 scsiqp
->sense_len
= sizeof(scp
->sense_buffer
);
4388 * Build ADV_SCSI_REQ_Q for a contiguous buffer or a scatter-gather
4392 scsiqp
->data_cnt
= cpu_to_le32(scp
->request_bufflen
);
4393 scsiqp
->vdata_addr
= scp
->request_buffer
;
4394 scsiqp
->data_addr
= cpu_to_le32(virt_to_bus(scp
->request_buffer
));
4396 if (scp
->use_sg
== 0) {
4398 * CDB request of single contiguous buffer.
4400 reqp
->sgblkp
= NULL
;
4401 scsiqp
->data_cnt
= cpu_to_le32(scp
->request_bufflen
);
4402 if (scp
->request_bufflen
) {
4403 scsiqp
->vdata_addr
= scp
->request_buffer
;
4404 scp
->SCp
.dma_handle
=
4405 dma_map_single(boardp
->dev
, scp
->request_buffer
,
4406 scp
->request_bufflen
,
4407 scp
->sc_data_direction
);
4409 scsiqp
->vdata_addr
= NULL
;
4410 scp
->SCp
.dma_handle
= 0;
4412 scsiqp
->data_addr
= cpu_to_le32(scp
->SCp
.dma_handle
);
4413 scsiqp
->sg_list_ptr
= NULL
;
4414 scsiqp
->sg_real_addr
= 0;
4415 ASC_STATS(scp
->device
->host
, cont_cnt
);
4416 ASC_STATS_ADD(scp
->device
->host
, cont_xfer
,
4417 ASC_CEILING(scp
->request_bufflen
, 512));
4420 * CDB scatter-gather request list.
4422 struct scatterlist
*slp
;
4425 slp
= (struct scatterlist
*)scp
->request_buffer
;
4426 use_sg
= dma_map_sg(boardp
->dev
, slp
, scp
->use_sg
,
4427 scp
->sc_data_direction
);
4429 if (use_sg
> ADV_MAX_SG_LIST
) {
4430 ASC_PRINT3("adv_build_req: board %d: use_sg %d > "
4431 "ADV_MAX_SG_LIST %d\n", boardp
->id
, use_sg
,
4432 scp
->device
->host
->sg_tablesize
);
4433 dma_unmap_sg(boardp
->dev
, slp
, scp
->use_sg
,
4434 scp
->sc_data_direction
);
4435 scp
->result
= HOST_BYTE(DID_ERROR
);
4436 asc_enqueue(&boardp
->done
, scp
, ASC_BACK
);
4439 * Free the 'adv_req_t' structure by adding it back
4440 * to the board free list.
4442 reqp
->next_reqp
= boardp
->adv_reqp
;
4443 boardp
->adv_reqp
= reqp
;
4448 ret
= adv_get_sglist(boardp
, reqp
, scp
, use_sg
);
4449 if (ret
!= ADV_SUCCESS
) {
4451 * Free the adv_req_t structure by adding it back to
4452 * the board free list.
4454 reqp
->next_reqp
= boardp
->adv_reqp
;
4455 boardp
->adv_reqp
= reqp
;
4460 ASC_STATS(scp
->device
->host
, sg_cnt
);
4461 ASC_STATS_ADD(scp
->device
->host
, sg_elem
, use_sg
);
4464 ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp
);
4465 ASC_DBG_PRT_CDB(1, scp
->cmnd
, scp
->cmd_len
);
4467 *adv_scsiqpp
= scsiqp
;
4473 * Build scatter-gather list for Adv Library (Wide Board).
4475 * Additional ADV_SG_BLOCK structures will need to be allocated
4476 * if the total number of scatter-gather elements exceeds
4477 * NO_OF_SG_PER_BLOCK (15). The ADV_SG_BLOCK structures are
4478 * assumed to be physically contiguous.
4481 * ADV_SUCCESS(1) - SG List successfully created
4482 * ADV_ERROR(-1) - SG List creation failed
4485 adv_get_sglist(asc_board_t
*boardp
, adv_req_t
*reqp
, struct scsi_cmnd
*scp
,
4488 adv_sgblk_t
*sgblkp
;
4489 ADV_SCSI_REQ_Q
*scsiqp
;
4490 struct scatterlist
*slp
;
4492 ADV_SG_BLOCK
*sg_block
, *prev_sg_block
;
4493 ADV_PADDR sg_block_paddr
;
4496 scsiqp
= (ADV_SCSI_REQ_Q
*)ADV_32BALIGN(&reqp
->scsi_req_q
);
4497 slp
= (struct scatterlist
*)scp
->request_buffer
;
4498 sg_elem_cnt
= use_sg
;
4499 prev_sg_block
= NULL
;
4500 reqp
->sgblkp
= NULL
;
4504 * Allocate a 'adv_sgblk_t' structure from the board free
4505 * list. One 'adv_sgblk_t' structure holds NO_OF_SG_PER_BLOCK
4506 * (15) scatter-gather elements.
4508 if ((sgblkp
= boardp
->adv_sgblkp
) == NULL
) {
4509 ASC_DBG(1, "adv_get_sglist: no free adv_sgblk_t\n");
4510 ASC_STATS(scp
->device
->host
, adv_build_nosg
);
4513 * Allocation failed. Free 'adv_sgblk_t' structures already
4514 * allocated for the request.
4516 while ((sgblkp
= reqp
->sgblkp
) != NULL
) {
4517 /* Remove 'sgblkp' from the request list. */
4518 reqp
->sgblkp
= sgblkp
->next_sgblkp
;
4520 /* Add 'sgblkp' to the board free list. */
4521 sgblkp
->next_sgblkp
= boardp
->adv_sgblkp
;
4522 boardp
->adv_sgblkp
= sgblkp
;
4526 /* Complete 'adv_sgblk_t' board allocation. */
4527 boardp
->adv_sgblkp
= sgblkp
->next_sgblkp
;
4528 sgblkp
->next_sgblkp
= NULL
;
4531 * Get 8 byte aligned virtual and physical addresses for
4532 * the allocated ADV_SG_BLOCK structure.
4535 (ADV_SG_BLOCK
*)ADV_8BALIGN(&sgblkp
->sg_block
);
4536 sg_block_paddr
= virt_to_bus(sg_block
);
4539 * Check if this is the first 'adv_sgblk_t' for the request.
4541 if (reqp
->sgblkp
== NULL
) {
4542 /* Request's first scatter-gather block. */
4543 reqp
->sgblkp
= sgblkp
;
4546 * Set ADV_SCSI_REQ_T ADV_SG_BLOCK virtual and physical
4549 scsiqp
->sg_list_ptr
= sg_block
;
4550 scsiqp
->sg_real_addr
=
4551 cpu_to_le32(sg_block_paddr
);
4553 /* Request's second or later scatter-gather block. */
4554 sgblkp
->next_sgblkp
= reqp
->sgblkp
;
4555 reqp
->sgblkp
= sgblkp
;
4558 * Point the previous ADV_SG_BLOCK structure to
4559 * the newly allocated ADV_SG_BLOCK structure.
4561 ASC_ASSERT(prev_sg_block
!= NULL
);
4562 prev_sg_block
->sg_ptr
=
4563 cpu_to_le32(sg_block_paddr
);
4567 for (i
= 0; i
< NO_OF_SG_PER_BLOCK
; i
++) {
4568 sg_block
->sg_list
[i
].sg_addr
=
4569 cpu_to_le32(sg_dma_address(slp
));
4570 sg_block
->sg_list
[i
].sg_count
=
4571 cpu_to_le32(sg_dma_len(slp
));
4572 ASC_STATS_ADD(scp
->device
->host
, sg_xfer
,
4573 ASC_CEILING(sg_dma_len(slp
), 512));
4575 if (--sg_elem_cnt
== 0) { /* Last ADV_SG_BLOCK and scatter-gather entry. */
4576 sg_block
->sg_cnt
= i
+ 1;
4577 sg_block
->sg_ptr
= 0L; /* Last ADV_SG_BLOCK in list. */
4582 sg_block
->sg_cnt
= NO_OF_SG_PER_BLOCK
;
4583 prev_sg_block
= sg_block
;
4590 * asc_isr_callback() - Second Level Interrupt Handler called by AscISR().
4592 * Interrupt callback function for the Narrow SCSI Asc Library.
4594 static void asc_isr_callback(ASC_DVC_VAR
*asc_dvc_varp
, ASC_QDONE_INFO
*qdonep
)
4596 asc_board_t
*boardp
;
4597 struct scsi_cmnd
*scp
;
4598 struct Scsi_Host
*shost
;
4600 ASC_DBG2(1, "asc_isr_callback: asc_dvc_varp 0x%lx, qdonep 0x%lx\n",
4601 (ulong
)asc_dvc_varp
, (ulong
)qdonep
);
4602 ASC_DBG_PRT_ASC_QDONE_INFO(2, qdonep
);
4605 * Get the struct scsi_cmnd structure and Scsi_Host structure for the
4606 * command that has been completed.
4608 scp
= (struct scsi_cmnd
*)ASC_U32_TO_VADDR(qdonep
->d2
.srb_ptr
);
4609 ASC_DBG1(1, "asc_isr_callback: scp 0x%lx\n", (ulong
)scp
);
4612 ASC_PRINT("asc_isr_callback: scp is NULL\n");
4615 ASC_DBG_PRT_CDB(2, scp
->cmnd
, scp
->cmd_len
);
4617 shost
= scp
->device
->host
;
4618 ASC_STATS(shost
, callback
);
4619 ASC_DBG1(1, "asc_isr_callback: shost 0x%lx\n", (ulong
)shost
);
4622 * If the request isn't found on the active queue, it may
4623 * have been removed to handle a reset request.
4624 * Display a message and return.
4626 boardp
= ASC_BOARDP(shost
);
4627 ASC_ASSERT(asc_dvc_varp
== &boardp
->dvc_var
.asc_dvc_var
);
4628 if (asc_rmqueue(&boardp
->active
, scp
) == ASC_FALSE
) {
4630 ("asc_isr_callback: board %d: scp 0x%lx not on active queue\n",
4631 boardp
->id
, (ulong
)scp
);
4636 * 'qdonep' contains the command's ending status.
4638 switch (qdonep
->d3
.done_stat
) {
4640 ASC_DBG(2, "asc_isr_callback: QD_NO_ERROR\n");
4644 * Check for an underrun condition.
4646 * If there was no error and an underrun condition, then
4647 * return the number of underrun bytes.
4649 if (scp
->request_bufflen
!= 0 && qdonep
->remain_bytes
!= 0 &&
4650 qdonep
->remain_bytes
<= scp
->request_bufflen
) {
4652 "asc_isr_callback: underrun condition %u bytes\n",
4653 (unsigned)qdonep
->remain_bytes
);
4654 scp
->resid
= qdonep
->remain_bytes
;
4659 ASC_DBG(2, "asc_isr_callback: QD_WITH_ERROR\n");
4660 switch (qdonep
->d3
.host_stat
) {
4661 case QHSTA_NO_ERROR
:
4662 if (qdonep
->d3
.scsi_stat
== SAM_STAT_CHECK_CONDITION
) {
4664 "asc_isr_callback: SAM_STAT_CHECK_CONDITION\n");
4665 ASC_DBG_PRT_SENSE(2, scp
->sense_buffer
,
4666 sizeof(scp
->sense_buffer
));
4668 * Note: The 'status_byte()' macro used by target drivers
4669 * defined in scsi.h shifts the status byte returned by
4670 * host drivers right by 1 bit. This is why target drivers
4671 * also use right shifted status byte definitions. For
4672 * instance target drivers use CHECK_CONDITION, defined to
4673 * 0x1, instead of the SCSI defined check condition value
4674 * of 0x2. Host drivers are supposed to return the status
4675 * byte as it is defined by SCSI.
4677 scp
->result
= DRIVER_BYTE(DRIVER_SENSE
) |
4678 STATUS_BYTE(qdonep
->d3
.scsi_stat
);
4680 scp
->result
= STATUS_BYTE(qdonep
->d3
.scsi_stat
);
4685 /* QHSTA error occurred */
4686 ASC_DBG1(1, "asc_isr_callback: host_stat 0x%x\n",
4687 qdonep
->d3
.host_stat
);
4688 scp
->result
= HOST_BYTE(DID_BAD_TARGET
);
4693 case QD_ABORTED_BY_HOST
:
4694 ASC_DBG(1, "asc_isr_callback: QD_ABORTED_BY_HOST\n");
4696 HOST_BYTE(DID_ABORT
) | MSG_BYTE(qdonep
->d3
.
4698 STATUS_BYTE(qdonep
->d3
.scsi_stat
);
4702 ASC_DBG1(1, "asc_isr_callback: done_stat 0x%x\n",
4703 qdonep
->d3
.done_stat
);
4705 HOST_BYTE(DID_ERROR
) | MSG_BYTE(qdonep
->d3
.
4707 STATUS_BYTE(qdonep
->d3
.scsi_stat
);
4712 * If the 'init_tidmask' bit isn't already set for the target and the
4713 * current request finished normally, then set the bit for the target
4714 * to indicate that a device is present.
4716 if ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(scp
->device
->id
)) == 0 &&
4717 qdonep
->d3
.done_stat
== QD_NO_ERROR
&&
4718 qdonep
->d3
.host_stat
== QHSTA_NO_ERROR
) {
4719 boardp
->init_tidmask
|= ADV_TID_TO_TIDMASK(scp
->device
->id
);
4723 * Because interrupts may be enabled by the 'struct scsi_cmnd' done
4724 * function, add the command to the end of the board's done queue.
4725 * The done function for the command will be called from
4726 * advansys_interrupt().
4728 asc_enqueue(&boardp
->done
, scp
, ASC_BACK
);
4734 * adv_isr_callback() - Second Level Interrupt Handler called by AdvISR().
4736 * Callback function for the Wide SCSI Adv Library.
4738 static void adv_isr_callback(ADV_DVC_VAR
*adv_dvc_varp
, ADV_SCSI_REQ_Q
*scsiqp
)
4740 asc_board_t
*boardp
;
4742 adv_sgblk_t
*sgblkp
;
4743 struct scsi_cmnd
*scp
;
4744 struct Scsi_Host
*shost
;
4747 ASC_DBG2(1, "adv_isr_callback: adv_dvc_varp 0x%lx, scsiqp 0x%lx\n",
4748 (ulong
)adv_dvc_varp
, (ulong
)scsiqp
);
4749 ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp
);
4752 * Get the adv_req_t structure for the command that has been
4753 * completed. The adv_req_t structure actually contains the
4754 * completed ADV_SCSI_REQ_Q structure.
4756 reqp
= (adv_req_t
*)ADV_U32_TO_VADDR(scsiqp
->srb_ptr
);
4757 ASC_DBG1(1, "adv_isr_callback: reqp 0x%lx\n", (ulong
)reqp
);
4759 ASC_PRINT("adv_isr_callback: reqp is NULL\n");
4764 * Get the struct scsi_cmnd structure and Scsi_Host structure for the
4765 * command that has been completed.
4767 * Note: The adv_req_t request structure and adv_sgblk_t structure,
4768 * if any, are dropped, because a board structure pointer can not be
4772 ASC_DBG1(1, "adv_isr_callback: scp 0x%lx\n", (ulong
)scp
);
4775 ("adv_isr_callback: scp is NULL; adv_req_t dropped.\n");
4778 ASC_DBG_PRT_CDB(2, scp
->cmnd
, scp
->cmd_len
);
4780 shost
= scp
->device
->host
;
4781 ASC_STATS(shost
, callback
);
4782 ASC_DBG1(1, "adv_isr_callback: shost 0x%lx\n", (ulong
)shost
);
4785 * If the request isn't found on the active queue, it may have been
4786 * removed to handle a reset request. Display a message and return.
4788 * Note: Because the structure may still be in use don't attempt
4789 * to free the adv_req_t and adv_sgblk_t, if any, structures.
4791 boardp
= ASC_BOARDP(shost
);
4792 ASC_ASSERT(adv_dvc_varp
== &boardp
->dvc_var
.adv_dvc_var
);
4793 if (asc_rmqueue(&boardp
->active
, scp
) == ASC_FALSE
) {
4795 ("adv_isr_callback: board %d: scp 0x%lx not on active queue\n",
4796 boardp
->id
, (ulong
)scp
);
4801 * 'done_status' contains the command's ending status.
4803 switch (scsiqp
->done_status
) {
4805 ASC_DBG(2, "adv_isr_callback: QD_NO_ERROR\n");
4809 * Check for an underrun condition.
4811 * If there was no error and an underrun condition, then
4812 * then return the number of underrun bytes.
4814 resid_cnt
= le32_to_cpu(scsiqp
->data_cnt
);
4815 if (scp
->request_bufflen
!= 0 && resid_cnt
!= 0 &&
4816 resid_cnt
<= scp
->request_bufflen
) {
4818 "adv_isr_callback: underrun condition %lu bytes\n",
4820 scp
->resid
= resid_cnt
;
4825 ASC_DBG(2, "adv_isr_callback: QD_WITH_ERROR\n");
4826 switch (scsiqp
->host_status
) {
4827 case QHSTA_NO_ERROR
:
4828 if (scsiqp
->scsi_status
== SAM_STAT_CHECK_CONDITION
) {
4830 "adv_isr_callback: SAM_STAT_CHECK_CONDITION\n");
4831 ASC_DBG_PRT_SENSE(2, scp
->sense_buffer
,
4832 sizeof(scp
->sense_buffer
));
4834 * Note: The 'status_byte()' macro used by target drivers
4835 * defined in scsi.h shifts the status byte returned by
4836 * host drivers right by 1 bit. This is why target drivers
4837 * also use right shifted status byte definitions. For
4838 * instance target drivers use CHECK_CONDITION, defined to
4839 * 0x1, instead of the SCSI defined check condition value
4840 * of 0x2. Host drivers are supposed to return the status
4841 * byte as it is defined by SCSI.
4843 scp
->result
= DRIVER_BYTE(DRIVER_SENSE
) |
4844 STATUS_BYTE(scsiqp
->scsi_status
);
4846 scp
->result
= STATUS_BYTE(scsiqp
->scsi_status
);
4851 /* Some other QHSTA error occurred. */
4852 ASC_DBG1(1, "adv_isr_callback: host_status 0x%x\n",
4853 scsiqp
->host_status
);
4854 scp
->result
= HOST_BYTE(DID_BAD_TARGET
);
4859 case QD_ABORTED_BY_HOST
:
4860 ASC_DBG(1, "adv_isr_callback: QD_ABORTED_BY_HOST\n");
4862 HOST_BYTE(DID_ABORT
) | STATUS_BYTE(scsiqp
->scsi_status
);
4866 ASC_DBG1(1, "adv_isr_callback: done_status 0x%x\n",
4867 scsiqp
->done_status
);
4869 HOST_BYTE(DID_ERROR
) | STATUS_BYTE(scsiqp
->scsi_status
);
4874 * If the 'init_tidmask' bit isn't already set for the target and the
4875 * current request finished normally, then set the bit for the target
4876 * to indicate that a device is present.
4878 if ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(scp
->device
->id
)) == 0 &&
4879 scsiqp
->done_status
== QD_NO_ERROR
&&
4880 scsiqp
->host_status
== QHSTA_NO_ERROR
) {
4881 boardp
->init_tidmask
|= ADV_TID_TO_TIDMASK(scp
->device
->id
);
4885 * Because interrupts may be enabled by the 'struct scsi_cmnd' done
4886 * function, add the command to the end of the board's done queue.
4887 * The done function for the command will be called from
4888 * advansys_interrupt().
4890 asc_enqueue(&boardp
->done
, scp
, ASC_BACK
);
4893 * Free all 'adv_sgblk_t' structures allocated for the request.
4895 while ((sgblkp
= reqp
->sgblkp
) != NULL
) {
4896 /* Remove 'sgblkp' from the request list. */
4897 reqp
->sgblkp
= sgblkp
->next_sgblkp
;
4899 /* Add 'sgblkp' to the board free list. */
4900 sgblkp
->next_sgblkp
= boardp
->adv_sgblkp
;
4901 boardp
->adv_sgblkp
= sgblkp
;
4905 * Free the adv_req_t structure used with the command by adding
4906 * it back to the board free list.
4908 reqp
->next_reqp
= boardp
->adv_reqp
;
4909 boardp
->adv_reqp
= reqp
;
4911 ASC_DBG(1, "adv_isr_callback: done\n");
4917 * adv_async_callback() - Adv Library asynchronous event callback function.
4919 static void adv_async_callback(ADV_DVC_VAR
*adv_dvc_varp
, uchar code
)
4922 case ADV_ASYNC_SCSI_BUS_RESET_DET
:
4924 * The firmware detected a SCSI Bus reset.
4927 "adv_async_callback: ADV_ASYNC_SCSI_BUS_RESET_DET\n");
4930 case ADV_ASYNC_RDMA_FAILURE
:
4932 * Handle RDMA failure by resetting the SCSI Bus and
4933 * possibly the chip if it is unresponsive. Log the error
4934 * with a unique code.
4936 ASC_DBG(0, "adv_async_callback: ADV_ASYNC_RDMA_FAILURE\n");
4937 AdvResetChipAndSB(adv_dvc_varp
);
4940 case ADV_HOST_SCSI_BUS_RESET
:
4942 * Host generated SCSI bus reset occurred.
4944 ASC_DBG(0, "adv_async_callback: ADV_HOST_SCSI_BUS_RESET\n");
4948 ASC_DBG1(0, "DvcAsyncCallBack: unknown code 0x%x\n", code
);
4954 * Add a 'REQP' to the end of specified queue. Set 'tidmask'
4955 * to indicate a command is queued for the device.
4957 * 'flag' may be either ASC_FRONT or ASC_BACK.
4959 * 'REQPNEXT(reqp)' returns reqp's next pointer.
4961 static void asc_enqueue(asc_queue_t
*ascq
, REQP reqp
, int flag
)
4965 ASC_DBG3(3, "asc_enqueue: ascq 0x%lx, reqp 0x%lx, flag %d\n",
4966 (ulong
)ascq
, (ulong
)reqp
, flag
);
4967 ASC_ASSERT(reqp
!= NULL
);
4968 ASC_ASSERT(flag
== ASC_FRONT
|| flag
== ASC_BACK
);
4969 tid
= REQPTID(reqp
);
4970 ASC_ASSERT(tid
>= 0 && tid
<= ADV_MAX_TID
);
4971 if (flag
== ASC_FRONT
) {
4972 reqp
->host_scribble
= (unsigned char *)ascq
->q_first
[tid
];
4973 ascq
->q_first
[tid
] = reqp
;
4974 /* If the queue was empty, set the last pointer. */
4975 if (ascq
->q_last
[tid
] == NULL
) {
4976 ascq
->q_last
[tid
] = reqp
;
4978 } else { /* ASC_BACK */
4979 if (ascq
->q_last
[tid
] != NULL
) {
4980 ascq
->q_last
[tid
]->host_scribble
=
4981 (unsigned char *)reqp
;
4983 ascq
->q_last
[tid
] = reqp
;
4984 reqp
->host_scribble
= NULL
;
4985 /* If the queue was empty, set the first pointer. */
4986 if (ascq
->q_first
[tid
] == NULL
) {
4987 ascq
->q_first
[tid
] = reqp
;
4990 /* The queue has at least one entry, set its bit. */
4991 ascq
->q_tidmask
|= ADV_TID_TO_TIDMASK(tid
);
4992 #ifdef ADVANSYS_STATS
4993 /* Maintain request queue statistics. */
4994 ascq
->q_tot_cnt
[tid
]++;
4995 ascq
->q_cur_cnt
[tid
]++;
4996 if (ascq
->q_cur_cnt
[tid
] > ascq
->q_max_cnt
[tid
]) {
4997 ascq
->q_max_cnt
[tid
] = ascq
->q_cur_cnt
[tid
];
4998 ASC_DBG2(2, "asc_enqueue: new q_max_cnt[%d] %d\n",
4999 tid
, ascq
->q_max_cnt
[tid
]);
5001 REQPTIME(reqp
) = REQTIMESTAMP();
5002 #endif /* ADVANSYS_STATS */
5003 ASC_DBG1(3, "asc_enqueue: reqp 0x%lx\n", (ulong
)reqp
);
5008 * Return first queued 'REQP' on the specified queue for
5009 * the specified target device. Clear the 'tidmask' bit for
5010 * the device if no more commands are left queued for it.
5012 * 'REQPNEXT(reqp)' returns reqp's next pointer.
5014 static REQP
asc_dequeue(asc_queue_t
*ascq
, int tid
)
5018 ASC_DBG2(3, "asc_dequeue: ascq 0x%lx, tid %d\n", (ulong
)ascq
, tid
);
5019 ASC_ASSERT(tid
>= 0 && tid
<= ADV_MAX_TID
);
5020 if ((reqp
= ascq
->q_first
[tid
]) != NULL
) {
5021 ASC_ASSERT(ascq
->q_tidmask
& ADV_TID_TO_TIDMASK(tid
));
5022 ascq
->q_first
[tid
] = REQPNEXT(reqp
);
5023 /* If the queue is empty, clear its bit and the last pointer. */
5024 if (ascq
->q_first
[tid
] == NULL
) {
5025 ascq
->q_tidmask
&= ~ADV_TID_TO_TIDMASK(tid
);
5026 ASC_ASSERT(ascq
->q_last
[tid
] == reqp
);
5027 ascq
->q_last
[tid
] = NULL
;
5029 #ifdef ADVANSYS_STATS
5030 /* Maintain request queue statistics. */
5031 ascq
->q_cur_cnt
[tid
]--;
5032 ASC_ASSERT(ascq
->q_cur_cnt
[tid
] >= 0);
5033 REQTIMESTAT("asc_dequeue", ascq
, reqp
, tid
);
5034 #endif /* ADVANSYS_STATS */
5036 ASC_DBG1(3, "asc_dequeue: reqp 0x%lx\n", (ulong
)reqp
);
5041 * Return a pointer to a singly linked list of all the requests queued
5042 * for 'tid' on the 'asc_queue_t' pointed to by 'ascq'.
5044 * If 'lastpp' is not NULL, '*lastpp' will be set to point to the
5045 * the last request returned in the singly linked list.
5047 * 'tid' should either be a valid target id or if it is ASC_TID_ALL,
5048 * then all queued requests are concatenated into one list and
5051 * Note: If 'lastpp' is used to append a new list to the end of
5052 * an old list, only change the old list last pointer if '*lastpp'
5053 * (or the function return value) is not NULL, i.e. use a temporary
5054 * variable for 'lastpp' and check its value after the function return
5055 * before assigning it to the list last pointer.
5057 * Unfortunately collecting queuing time statistics adds overhead to
5058 * the function that isn't inherent to the function's algorithm.
5060 static REQP
asc_dequeue_list(asc_queue_t
*ascq
, REQP
*lastpp
, int tid
)
5065 ASC_DBG2(3, "asc_dequeue_list: ascq 0x%lx, tid %d\n", (ulong
)ascq
, tid
);
5066 ASC_ASSERT((tid
== ASC_TID_ALL
) || (tid
>= 0 && tid
<= ADV_MAX_TID
));
5069 * If 'tid' is not ASC_TID_ALL, return requests only for
5070 * the specified 'tid'. If 'tid' is ASC_TID_ALL, return all
5071 * requests for all tids.
5073 if (tid
!= ASC_TID_ALL
) {
5074 /* Return all requests for the specified 'tid'. */
5075 if ((ascq
->q_tidmask
& ADV_TID_TO_TIDMASK(tid
)) == 0) {
5076 /* List is empty; Set first and last return pointers to NULL. */
5077 firstp
= lastp
= NULL
;
5079 firstp
= ascq
->q_first
[tid
];
5080 lastp
= ascq
->q_last
[tid
];
5081 ascq
->q_first
[tid
] = ascq
->q_last
[tid
] = NULL
;
5082 ascq
->q_tidmask
&= ~ADV_TID_TO_TIDMASK(tid
);
5083 #ifdef ADVANSYS_STATS
5086 ascq
->q_cur_cnt
[tid
] = 0;
5087 for (reqp
= firstp
; reqp
; reqp
= REQPNEXT(reqp
)) {
5088 REQTIMESTAT("asc_dequeue_list", ascq
,
5092 #endif /* ADVANSYS_STATS */
5095 /* Return all requests for all tids. */
5096 firstp
= lastp
= NULL
;
5097 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
5098 if (ascq
->q_tidmask
& ADV_TID_TO_TIDMASK(i
)) {
5099 if (firstp
== NULL
) {
5100 firstp
= ascq
->q_first
[i
];
5101 lastp
= ascq
->q_last
[i
];
5103 ASC_ASSERT(lastp
!= NULL
);
5104 lastp
->host_scribble
=
5105 (unsigned char *)ascq
->q_first
[i
];
5106 lastp
= ascq
->q_last
[i
];
5108 ascq
->q_first
[i
] = ascq
->q_last
[i
] = NULL
;
5109 ascq
->q_tidmask
&= ~ADV_TID_TO_TIDMASK(i
);
5110 #ifdef ADVANSYS_STATS
5111 ascq
->q_cur_cnt
[i
] = 0;
5112 #endif /* ADVANSYS_STATS */
5115 #ifdef ADVANSYS_STATS
5118 for (reqp
= firstp
; reqp
; reqp
= REQPNEXT(reqp
)) {
5119 REQTIMESTAT("asc_dequeue_list", ascq
, reqp
,
5123 #endif /* ADVANSYS_STATS */
5128 ASC_DBG1(3, "asc_dequeue_list: firstp 0x%lx\n", (ulong
)firstp
);
5133 * Remove the specified 'REQP' from the specified queue for
5134 * the specified target device. Clear the 'tidmask' bit for the
5135 * device if no more commands are left queued for it.
5137 * 'REQPNEXT(reqp)' returns reqp's the next pointer.
5139 * Return ASC_TRUE if the command was found and removed,
5140 * otherwise return ASC_FALSE.
5142 static int asc_rmqueue(asc_queue_t
*ascq
, REQP reqp
)
5146 int ret
= ASC_FALSE
;
5148 ASC_DBG2(3, "asc_rmqueue: ascq 0x%lx, reqp 0x%lx\n",
5149 (ulong
)ascq
, (ulong
)reqp
);
5150 ASC_ASSERT(reqp
!= NULL
);
5152 tid
= REQPTID(reqp
);
5153 ASC_ASSERT(tid
>= 0 && tid
<= ADV_MAX_TID
);
5156 * Handle the common case of 'reqp' being the first
5157 * entry on the queue.
5159 if (reqp
== ascq
->q_first
[tid
]) {
5161 ascq
->q_first
[tid
] = REQPNEXT(reqp
);
5162 /* If the queue is now empty, clear its bit and the last pointer. */
5163 if (ascq
->q_first
[tid
] == NULL
) {
5164 ascq
->q_tidmask
&= ~ADV_TID_TO_TIDMASK(tid
);
5165 ASC_ASSERT(ascq
->q_last
[tid
] == reqp
);
5166 ascq
->q_last
[tid
] = NULL
;
5168 } else if (ascq
->q_first
[tid
] != NULL
) {
5169 ASC_ASSERT(ascq
->q_last
[tid
] != NULL
);
5171 * Because the case of 'reqp' being the first entry has been
5172 * handled above and it is known the queue is not empty, if
5173 * 'reqp' is found on the queue it is guaranteed the queue will
5174 * not become empty and that 'q_first[tid]' will not be changed.
5176 * Set 'prevp' to the first entry, 'currp' to the second entry,
5177 * and search for 'reqp'.
5179 for (prevp
= ascq
->q_first
[tid
], currp
= REQPNEXT(prevp
);
5180 currp
; prevp
= currp
, currp
= REQPNEXT(currp
)) {
5181 if (currp
== reqp
) {
5183 prevp
->host_scribble
=
5184 (unsigned char *)REQPNEXT(currp
);
5185 reqp
->host_scribble
= NULL
;
5186 if (ascq
->q_last
[tid
] == reqp
) {
5187 ascq
->q_last
[tid
] = prevp
;
5193 #ifdef ADVANSYS_STATS
5194 /* Maintain request queue statistics. */
5195 if (ret
== ASC_TRUE
) {
5196 ascq
->q_cur_cnt
[tid
]--;
5197 REQTIMESTAT("asc_rmqueue", ascq
, reqp
, tid
);
5199 ASC_ASSERT(ascq
->q_cur_cnt
[tid
] >= 0);
5200 #endif /* ADVANSYS_STATS */
5201 ASC_DBG2(3, "asc_rmqueue: reqp 0x%lx, ret %d\n", (ulong
)reqp
, ret
);
5206 * Execute as many queued requests as possible for the specified queue.
5208 * Calls asc_execute_scsi_cmnd() to execute a REQP/struct scsi_cmnd.
5210 static void asc_execute_queue(asc_queue_t
*ascq
)
5212 ADV_SCSI_BIT_ID_TYPE scan_tidmask
;
5216 ASC_DBG1(1, "asc_execute_queue: ascq 0x%lx\n", (ulong
)ascq
);
5218 * Execute queued commands for devices attached to
5219 * the current board in round-robin fashion.
5221 scan_tidmask
= ascq
->q_tidmask
;
5223 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
5224 if (scan_tidmask
& ADV_TID_TO_TIDMASK(i
)) {
5225 if ((reqp
= asc_dequeue(ascq
, i
)) == NULL
) {
5226 scan_tidmask
&= ~ADV_TID_TO_TIDMASK(i
);
5228 if (asc_execute_scsi_cmnd
5229 ((struct scsi_cmnd
*)reqp
)
5231 scan_tidmask
&= ~ADV_TID_TO_TIDMASK(i
);
5233 * The request returned ASC_BUSY. Enqueue at the front of
5234 * target's waiting list to maintain correct ordering.
5236 asc_enqueue(ascq
, reqp
, ASC_FRONT
);
5240 } while (scan_tidmask
);
5244 #ifdef CONFIG_PROC_FS
5246 * asc_prt_board_devices()
5248 * Print driver information for devices attached to the board.
5250 * Note: no single line should be greater than ASC_PRTLINE_SIZE,
5251 * cf. asc_prt_line().
5253 * Return the number of characters copied into 'cp'. No more than
5254 * 'cplen' characters will be copied to 'cp'.
5256 static int asc_prt_board_devices(struct Scsi_Host
*shost
, char *cp
, int cplen
)
5258 asc_board_t
*boardp
;
5265 boardp
= ASC_BOARDP(shost
);
5269 len
= asc_prt_line(cp
, leftlen
,
5270 "\nDevice Information for AdvanSys SCSI Host %d:\n",
5274 if (ASC_NARROW_BOARD(boardp
)) {
5275 chip_scsi_id
= boardp
->dvc_cfg
.asc_dvc_cfg
.chip_scsi_id
;
5277 chip_scsi_id
= boardp
->dvc_var
.adv_dvc_var
.chip_scsi_id
;
5280 len
= asc_prt_line(cp
, leftlen
, "Target IDs Detected:");
5282 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
5283 if (boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) {
5284 len
= asc_prt_line(cp
, leftlen
, " %X,", i
);
5288 len
= asc_prt_line(cp
, leftlen
, " (%X=Host Adapter)\n", chip_scsi_id
);
5295 * Display Wide Board BIOS Information.
5297 static int asc_prt_adv_bios(struct Scsi_Host
*shost
, char *cp
, int cplen
)
5299 asc_board_t
*boardp
;
5303 ushort major
, minor
, letter
;
5305 boardp
= ASC_BOARDP(shost
);
5309 len
= asc_prt_line(cp
, leftlen
, "\nROM BIOS Version: ");
5313 * If the BIOS saved a valid signature, then fill in
5314 * the BIOS code segment base address.
5316 if (boardp
->bios_signature
!= 0x55AA) {
5317 len
= asc_prt_line(cp
, leftlen
, "Disabled or Pre-3.1\n");
5319 len
= asc_prt_line(cp
, leftlen
,
5320 "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
5322 len
= asc_prt_line(cp
, leftlen
,
5323 "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
5326 major
= (boardp
->bios_version
>> 12) & 0xF;
5327 minor
= (boardp
->bios_version
>> 8) & 0xF;
5328 letter
= (boardp
->bios_version
& 0xFF);
5330 len
= asc_prt_line(cp
, leftlen
, "%d.%d%c\n",
5332 letter
>= 26 ? '?' : letter
+ 'A');
5336 * Current available ROM BIOS release is 3.1I for UW
5337 * and 3.2I for U2W. This code doesn't differentiate
5338 * UW and U2W boards.
5340 if (major
< 3 || (major
<= 3 && minor
< 1) ||
5341 (major
<= 3 && minor
<= 1 && letter
< ('I' - 'A'))) {
5342 len
= asc_prt_line(cp
, leftlen
,
5343 "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
5345 len
= asc_prt_line(cp
, leftlen
,
5346 "ftp://ftp.connectcom.net/pub\n");
5355 * Add serial number to information bar if signature AAh
5356 * is found in at bit 15-9 (7 bits) of word 1.
5358 * Serial Number consists fo 12 alpha-numeric digits.
5360 * 1 - Product type (A,B,C,D..) Word0: 15-13 (3 bits)
5361 * 2 - MFG Location (A,B,C,D..) Word0: 12-10 (3 bits)
5362 * 3-4 - Product ID (0-99) Word0: 9-0 (10 bits)
5363 * 5 - Product revision (A-J) Word0: " "
5365 * Signature Word1: 15-9 (7 bits)
5366 * 6 - Year (0-9) Word1: 8-6 (3 bits) & Word2: 15 (1 bit)
5367 * 7-8 - Week of the year (1-52) Word1: 5-0 (6 bits)
5369 * 9-12 - Serial Number (A001-Z999) Word2: 14-0 (15 bits)
5371 * Note 1: Only production cards will have a serial number.
5373 * Note 2: Signature is most significant 7 bits (0xFE).
5375 * Returns ASC_TRUE if serial number found, otherwise returns ASC_FALSE.
5377 static int asc_get_eeprom_string(ushort
*serialnum
, uchar
*cp
)
5381 if ((serialnum
[1] & 0xFE00) != ((ushort
)0xAA << 8)) {
5385 * First word - 6 digits.
5389 /* Product type - 1st digit. */
5390 if ((*cp
= 'A' + ((w
& 0xE000) >> 13)) == 'H') {
5391 /* Product type is P=Prototype */
5396 /* Manufacturing location - 2nd digit. */
5397 *cp
++ = 'A' + ((w
& 0x1C00) >> 10);
5399 /* Product ID - 3rd, 4th digits. */
5401 *cp
++ = '0' + (num
/ 100);
5403 *cp
++ = '0' + (num
/ 10);
5405 /* Product revision - 5th digit. */
5406 *cp
++ = 'A' + (num
% 10);
5416 * If bit 15 of third word is set, then the
5417 * last digit of the year is greater than 7.
5419 if (serialnum
[2] & 0x8000) {
5420 *cp
++ = '8' + ((w
& 0x1C0) >> 6);
5422 *cp
++ = '0' + ((w
& 0x1C0) >> 6);
5425 /* Week of year - 7th, 8th digits. */
5427 *cp
++ = '0' + num
/ 10;
5434 w
= serialnum
[2] & 0x7FFF;
5436 /* Serial number - 9th digit. */
5437 *cp
++ = 'A' + (w
/ 1000);
5439 /* 10th, 11th, 12th digits. */
5441 *cp
++ = '0' + num
/ 100;
5443 *cp
++ = '0' + num
/ 10;
5447 *cp
= '\0'; /* Null Terminate the string. */
5453 * asc_prt_asc_board_eeprom()
5455 * Print board EEPROM configuration.
5457 * Note: no single line should be greater than ASC_PRTLINE_SIZE,
5458 * cf. asc_prt_line().
5460 * Return the number of characters copied into 'cp'. No more than
5461 * 'cplen' characters will be copied to 'cp'.
5463 static int asc_prt_asc_board_eeprom(struct Scsi_Host
*shost
, char *cp
, int cplen
)
5465 asc_board_t
*boardp
;
5466 ASC_DVC_VAR
*asc_dvc_varp
;
5473 int isa_dma_speed
[] = { 10, 8, 7, 6, 5, 4, 3, 2 };
5474 #endif /* CONFIG_ISA */
5475 uchar serialstr
[13];
5477 boardp
= ASC_BOARDP(shost
);
5478 asc_dvc_varp
= &boardp
->dvc_var
.asc_dvc_var
;
5479 ep
= &boardp
->eep_config
.asc_eep
;
5484 len
= asc_prt_line(cp
, leftlen
,
5485 "\nEEPROM Settings for AdvanSys SCSI Host %d:\n",
5489 if (asc_get_eeprom_string((ushort
*)&ep
->adapter_info
[0], serialstr
)
5492 asc_prt_line(cp
, leftlen
, " Serial Number: %s\n",
5496 if (ep
->adapter_info
[5] == 0xBB) {
5497 len
= asc_prt_line(cp
, leftlen
,
5498 " Default Settings Used for EEPROM-less Adapter.\n");
5501 len
= asc_prt_line(cp
, leftlen
,
5502 " Serial Number Signature Not Present.\n");
5507 len
= asc_prt_line(cp
, leftlen
,
5508 " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
5509 ASC_EEP_GET_CHIP_ID(ep
), ep
->max_total_qng
,
5513 len
= asc_prt_line(cp
, leftlen
,
5514 " cntl 0x%x, no_scam 0x%x\n", ep
->cntl
, ep
->no_scam
);
5517 len
= asc_prt_line(cp
, leftlen
, " Target ID: ");
5519 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
5520 len
= asc_prt_line(cp
, leftlen
, " %d", i
);
5523 len
= asc_prt_line(cp
, leftlen
, "\n");
5526 len
= asc_prt_line(cp
, leftlen
, " Disconnects: ");
5528 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
5529 len
= asc_prt_line(cp
, leftlen
, " %c",
5531 disc_enable
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' :
5535 len
= asc_prt_line(cp
, leftlen
, "\n");
5538 len
= asc_prt_line(cp
, leftlen
, " Command Queuing: ");
5540 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
5541 len
= asc_prt_line(cp
, leftlen
, " %c",
5543 use_cmd_qng
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' :
5547 len
= asc_prt_line(cp
, leftlen
, "\n");
5550 len
= asc_prt_line(cp
, leftlen
, " Start Motor: ");
5552 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
5553 len
= asc_prt_line(cp
, leftlen
, " %c",
5555 start_motor
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' :
5559 len
= asc_prt_line(cp
, leftlen
, "\n");
5562 len
= asc_prt_line(cp
, leftlen
, " Synchronous Transfer:");
5564 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
5565 len
= asc_prt_line(cp
, leftlen
, " %c",
5567 init_sdtr
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' :
5571 len
= asc_prt_line(cp
, leftlen
, "\n");
5575 if (asc_dvc_varp
->bus_type
& ASC_IS_ISA
) {
5576 len
= asc_prt_line(cp
, leftlen
,
5577 " Host ISA DMA speed: %d MB/S\n",
5578 isa_dma_speed
[ASC_EEP_GET_DMA_SPD(ep
)]);
5581 #endif /* CONFIG_ISA */
5587 * asc_prt_adv_board_eeprom()
5589 * Print board EEPROM configuration.
5591 * Note: no single line should be greater than ASC_PRTLINE_SIZE,
5592 * cf. asc_prt_line().
5594 * Return the number of characters copied into 'cp'. No more than
5595 * 'cplen' characters will be copied to 'cp'.
5597 static int asc_prt_adv_board_eeprom(struct Scsi_Host
*shost
, char *cp
, int cplen
)
5599 asc_board_t
*boardp
;
5600 ADV_DVC_VAR
*adv_dvc_varp
;
5606 uchar serialstr
[13];
5607 ADVEEP_3550_CONFIG
*ep_3550
= NULL
;
5608 ADVEEP_38C0800_CONFIG
*ep_38C0800
= NULL
;
5609 ADVEEP_38C1600_CONFIG
*ep_38C1600
= NULL
;
5612 ushort sdtr_speed
= 0;
5614 boardp
= ASC_BOARDP(shost
);
5615 adv_dvc_varp
= &boardp
->dvc_var
.adv_dvc_var
;
5616 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
5617 ep_3550
= &boardp
->eep_config
.adv_3550_eep
;
5618 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
5619 ep_38C0800
= &boardp
->eep_config
.adv_38C0800_eep
;
5621 ep_38C1600
= &boardp
->eep_config
.adv_38C1600_eep
;
5627 len
= asc_prt_line(cp
, leftlen
,
5628 "\nEEPROM Settings for AdvanSys SCSI Host %d:\n",
5632 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
5633 wordp
= &ep_3550
->serial_number_word1
;
5634 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
5635 wordp
= &ep_38C0800
->serial_number_word1
;
5637 wordp
= &ep_38C1600
->serial_number_word1
;
5640 if (asc_get_eeprom_string(wordp
, serialstr
) == ASC_TRUE
) {
5642 asc_prt_line(cp
, leftlen
, " Serial Number: %s\n",
5646 len
= asc_prt_line(cp
, leftlen
,
5647 " Serial Number Signature Not Present.\n");
5651 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
5652 len
= asc_prt_line(cp
, leftlen
,
5653 " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
5654 ep_3550
->adapter_scsi_id
,
5655 ep_3550
->max_host_qng
, ep_3550
->max_dvc_qng
);
5657 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
5658 len
= asc_prt_line(cp
, leftlen
,
5659 " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
5660 ep_38C0800
->adapter_scsi_id
,
5661 ep_38C0800
->max_host_qng
,
5662 ep_38C0800
->max_dvc_qng
);
5665 len
= asc_prt_line(cp
, leftlen
,
5666 " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
5667 ep_38C1600
->adapter_scsi_id
,
5668 ep_38C1600
->max_host_qng
,
5669 ep_38C1600
->max_dvc_qng
);
5672 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
5673 word
= ep_3550
->termination
;
5674 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
5675 word
= ep_38C0800
->termination_lvd
;
5677 word
= ep_38C1600
->termination_lvd
;
5681 termstr
= "Low Off/High Off";
5684 termstr
= "Low Off/High On";
5687 termstr
= "Low On/High On";
5691 termstr
= "Automatic";
5695 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
5696 len
= asc_prt_line(cp
, leftlen
,
5697 " termination: %u (%s), bios_ctrl: 0x%x\n",
5698 ep_3550
->termination
, termstr
,
5699 ep_3550
->bios_ctrl
);
5701 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
5702 len
= asc_prt_line(cp
, leftlen
,
5703 " termination: %u (%s), bios_ctrl: 0x%x\n",
5704 ep_38C0800
->termination_lvd
, termstr
,
5705 ep_38C0800
->bios_ctrl
);
5708 len
= asc_prt_line(cp
, leftlen
,
5709 " termination: %u (%s), bios_ctrl: 0x%x\n",
5710 ep_38C1600
->termination_lvd
, termstr
,
5711 ep_38C1600
->bios_ctrl
);
5715 len
= asc_prt_line(cp
, leftlen
, " Target ID: ");
5717 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
5718 len
= asc_prt_line(cp
, leftlen
, " %X", i
);
5721 len
= asc_prt_line(cp
, leftlen
, "\n");
5724 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
5725 word
= ep_3550
->disc_enable
;
5726 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
5727 word
= ep_38C0800
->disc_enable
;
5729 word
= ep_38C1600
->disc_enable
;
5731 len
= asc_prt_line(cp
, leftlen
, " Disconnects: ");
5733 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
5734 len
= asc_prt_line(cp
, leftlen
, " %c",
5735 (word
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' : 'N');
5738 len
= asc_prt_line(cp
, leftlen
, "\n");
5741 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
5742 word
= ep_3550
->tagqng_able
;
5743 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
5744 word
= ep_38C0800
->tagqng_able
;
5746 word
= ep_38C1600
->tagqng_able
;
5748 len
= asc_prt_line(cp
, leftlen
, " Command Queuing: ");
5750 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
5751 len
= asc_prt_line(cp
, leftlen
, " %c",
5752 (word
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' : 'N');
5755 len
= asc_prt_line(cp
, leftlen
, "\n");
5758 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
5759 word
= ep_3550
->start_motor
;
5760 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
5761 word
= ep_38C0800
->start_motor
;
5763 word
= ep_38C1600
->start_motor
;
5765 len
= asc_prt_line(cp
, leftlen
, " Start Motor: ");
5767 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
5768 len
= asc_prt_line(cp
, leftlen
, " %c",
5769 (word
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' : 'N');
5772 len
= asc_prt_line(cp
, leftlen
, "\n");
5775 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
5776 len
= asc_prt_line(cp
, leftlen
, " Synchronous Transfer:");
5778 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
5779 len
= asc_prt_line(cp
, leftlen
, " %c",
5781 sdtr_able
& ADV_TID_TO_TIDMASK(i
)) ?
5785 len
= asc_prt_line(cp
, leftlen
, "\n");
5789 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
5790 len
= asc_prt_line(cp
, leftlen
, " Ultra Transfer: ");
5792 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
5793 len
= asc_prt_line(cp
, leftlen
, " %c",
5795 ultra_able
& ADV_TID_TO_TIDMASK(i
))
5799 len
= asc_prt_line(cp
, leftlen
, "\n");
5803 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
5804 word
= ep_3550
->wdtr_able
;
5805 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
5806 word
= ep_38C0800
->wdtr_able
;
5808 word
= ep_38C1600
->wdtr_able
;
5810 len
= asc_prt_line(cp
, leftlen
, " Wide Transfer: ");
5812 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
5813 len
= asc_prt_line(cp
, leftlen
, " %c",
5814 (word
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' : 'N');
5817 len
= asc_prt_line(cp
, leftlen
, "\n");
5820 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
||
5821 adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C1600
) {
5822 len
= asc_prt_line(cp
, leftlen
,
5823 " Synchronous Transfer Speed (Mhz):\n ");
5825 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
5829 sdtr_speed
= adv_dvc_varp
->sdtr_speed1
;
5830 } else if (i
== 4) {
5831 sdtr_speed
= adv_dvc_varp
->sdtr_speed2
;
5832 } else if (i
== 8) {
5833 sdtr_speed
= adv_dvc_varp
->sdtr_speed3
;
5834 } else if (i
== 12) {
5835 sdtr_speed
= adv_dvc_varp
->sdtr_speed4
;
5837 switch (sdtr_speed
& ADV_MAX_TID
) {
5860 len
= asc_prt_line(cp
, leftlen
, "%X:%s ", i
, speed_str
);
5863 len
= asc_prt_line(cp
, leftlen
, "\n ");
5868 len
= asc_prt_line(cp
, leftlen
, "\n");
5876 * asc_prt_driver_conf()
5878 * Note: no single line should be greater than ASC_PRTLINE_SIZE,
5879 * cf. asc_prt_line().
5881 * Return the number of characters copied into 'cp'. No more than
5882 * 'cplen' characters will be copied to 'cp'.
5884 static int asc_prt_driver_conf(struct Scsi_Host
*shost
, char *cp
, int cplen
)
5886 asc_board_t
*boardp
;
5892 boardp
= ASC_BOARDP(shost
);
5897 len
= asc_prt_line(cp
, leftlen
,
5898 "\nLinux Driver Configuration and Information for AdvanSys SCSI Host %d:\n",
5902 len
= asc_prt_line(cp
, leftlen
,
5903 " host_busy %u, last_reset %u, max_id %u, max_lun %u, max_channel %u\n",
5904 shost
->host_busy
, shost
->last_reset
, shost
->max_id
,
5905 shost
->max_lun
, shost
->max_channel
);
5908 len
= asc_prt_line(cp
, leftlen
,
5909 " unique_id %d, can_queue %d, this_id %d, sg_tablesize %u, cmd_per_lun %u\n",
5910 shost
->unique_id
, shost
->can_queue
, shost
->this_id
,
5911 shost
->sg_tablesize
, shost
->cmd_per_lun
);
5914 len
= asc_prt_line(cp
, leftlen
,
5915 " unchecked_isa_dma %d, use_clustering %d\n",
5916 shost
->unchecked_isa_dma
, shost
->use_clustering
);
5919 len
= asc_prt_line(cp
, leftlen
,
5920 " flags 0x%x, last_reset 0x%x, jiffies 0x%x, asc_n_io_port 0x%x\n",
5921 boardp
->flags
, boardp
->last_reset
, jiffies
,
5922 boardp
->asc_n_io_port
);
5925 len
= asc_prt_line(cp
, leftlen
, " io_port 0x%x\n", shost
->io_port
);
5928 if (ASC_NARROW_BOARD(boardp
)) {
5929 chip_scsi_id
= boardp
->dvc_cfg
.asc_dvc_cfg
.chip_scsi_id
;
5931 chip_scsi_id
= boardp
->dvc_var
.adv_dvc_var
.chip_scsi_id
;
5938 * asc_prt_asc_board_info()
5940 * Print dynamic board configuration information.
5942 * Note: no single line should be greater than ASC_PRTLINE_SIZE,
5943 * cf. asc_prt_line().
5945 * Return the number of characters copied into 'cp'. No more than
5946 * 'cplen' characters will be copied to 'cp'.
5948 static int asc_prt_asc_board_info(struct Scsi_Host
*shost
, char *cp
, int cplen
)
5950 asc_board_t
*boardp
;
5958 int renegotiate
= 0;
5960 boardp
= ASC_BOARDP(shost
);
5961 v
= &boardp
->dvc_var
.asc_dvc_var
;
5962 c
= &boardp
->dvc_cfg
.asc_dvc_cfg
;
5963 chip_scsi_id
= c
->chip_scsi_id
;
5968 len
= asc_prt_line(cp
, leftlen
,
5969 "\nAsc Library Configuration and Statistics for AdvanSys SCSI Host %d:\n",
5973 len
= asc_prt_line(cp
, leftlen
,
5974 " chip_version %u, lib_version 0x%x, lib_serial_no %u, mcode_date 0x%x\n",
5975 c
->chip_version
, c
->lib_version
, c
->lib_serial_no
,
5979 len
= asc_prt_line(cp
, leftlen
,
5980 " mcode_version 0x%x, err_code %u\n",
5981 c
->mcode_version
, v
->err_code
);
5984 /* Current number of commands waiting for the host. */
5985 len
= asc_prt_line(cp
, leftlen
,
5986 " Total Command Pending: %d\n", v
->cur_total_qng
);
5989 len
= asc_prt_line(cp
, leftlen
, " Command Queuing:");
5991 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
5992 if ((chip_scsi_id
== i
) ||
5993 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
5996 len
= asc_prt_line(cp
, leftlen
, " %X:%c",
5999 use_tagged_qng
& ADV_TID_TO_TIDMASK(i
)) ?
6003 len
= asc_prt_line(cp
, leftlen
, "\n");
6006 /* Current number of commands waiting for a device. */
6007 len
= asc_prt_line(cp
, leftlen
, " Command Queue Pending:");
6009 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
6010 if ((chip_scsi_id
== i
) ||
6011 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6014 len
= asc_prt_line(cp
, leftlen
, " %X:%u", i
, v
->cur_dvc_qng
[i
]);
6017 len
= asc_prt_line(cp
, leftlen
, "\n");
6020 /* Current limit on number of commands that can be sent to a device. */
6021 len
= asc_prt_line(cp
, leftlen
, " Command Queue Limit:");
6023 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
6024 if ((chip_scsi_id
== i
) ||
6025 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6028 len
= asc_prt_line(cp
, leftlen
, " %X:%u", i
, v
->max_dvc_qng
[i
]);
6031 len
= asc_prt_line(cp
, leftlen
, "\n");
6034 /* Indicate whether the device has returned queue full status. */
6035 len
= asc_prt_line(cp
, leftlen
, " Command Queue Full:");
6037 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
6038 if ((chip_scsi_id
== i
) ||
6039 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6042 if (boardp
->queue_full
& ADV_TID_TO_TIDMASK(i
)) {
6043 len
= asc_prt_line(cp
, leftlen
, " %X:Y-%d",
6044 i
, boardp
->queue_full_cnt
[i
]);
6046 len
= asc_prt_line(cp
, leftlen
, " %X:N", i
);
6050 len
= asc_prt_line(cp
, leftlen
, "\n");
6053 len
= asc_prt_line(cp
, leftlen
, " Synchronous Transfer:");
6055 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
6056 if ((chip_scsi_id
== i
) ||
6057 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6060 len
= asc_prt_line(cp
, leftlen
, " %X:%c",
6063 sdtr_done
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' :
6067 len
= asc_prt_line(cp
, leftlen
, "\n");
6070 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
6071 uchar syn_period_ix
;
6073 if ((chip_scsi_id
== i
) ||
6074 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0) ||
6075 ((v
->init_sdtr
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6079 len
= asc_prt_line(cp
, leftlen
, " %X:", i
);
6082 if ((boardp
->sdtr_data
[i
] & ASC_SYN_MAX_OFFSET
) == 0) {
6083 len
= asc_prt_line(cp
, leftlen
, " Asynchronous");
6087 (boardp
->sdtr_data
[i
] >> 4) & (v
->max_sdtr_index
-
6090 len
= asc_prt_line(cp
, leftlen
,
6091 " Transfer Period Factor: %d (%d.%d Mhz),",
6092 v
->sdtr_period_tbl
[syn_period_ix
],
6094 v
->sdtr_period_tbl
[syn_period_ix
],
6101 len
= asc_prt_line(cp
, leftlen
, " REQ/ACK Offset: %d",
6103 sdtr_data
[i
] & ASC_SYN_MAX_OFFSET
);
6107 if ((v
->sdtr_done
& ADV_TID_TO_TIDMASK(i
)) == 0) {
6108 len
= asc_prt_line(cp
, leftlen
, "*\n");
6111 len
= asc_prt_line(cp
, leftlen
, "\n");
6117 len
= asc_prt_line(cp
, leftlen
,
6118 " * = Re-negotiation pending before next command.\n");
6126 * asc_prt_adv_board_info()
6128 * Print dynamic board configuration information.
6130 * Note: no single line should be greater than ASC_PRTLINE_SIZE,
6131 * cf. asc_prt_line().
6133 * Return the number of characters copied into 'cp'. No more than
6134 * 'cplen' characters will be copied to 'cp'.
6136 static int asc_prt_adv_board_info(struct Scsi_Host
*shost
, char *cp
, int cplen
)
6138 asc_board_t
*boardp
;
6145 AdvPortAddr iop_base
;
6146 ushort chip_scsi_id
;
6150 ushort sdtr_able
, wdtr_able
;
6151 ushort wdtr_done
, sdtr_done
;
6153 int renegotiate
= 0;
6155 boardp
= ASC_BOARDP(shost
);
6156 v
= &boardp
->dvc_var
.adv_dvc_var
;
6157 c
= &boardp
->dvc_cfg
.adv_dvc_cfg
;
6158 iop_base
= v
->iop_base
;
6159 chip_scsi_id
= v
->chip_scsi_id
;
6164 len
= asc_prt_line(cp
, leftlen
,
6165 "\nAdv Library Configuration and Statistics for AdvanSys SCSI Host %d:\n",
6169 len
= asc_prt_line(cp
, leftlen
,
6170 " iop_base 0x%lx, cable_detect: %X, err_code %u\n",
6172 AdvReadWordRegister(iop_base
,
6173 IOPW_SCSI_CFG1
) & CABLE_DETECT
,
6177 len
= asc_prt_line(cp
, leftlen
,
6178 " chip_version %u, lib_version 0x%x, mcode_date 0x%x, mcode_version 0x%x\n",
6179 c
->chip_version
, c
->lib_version
, c
->mcode_date
,
6183 AdvReadWordLram(iop_base
, ASC_MC_TAGQNG_ABLE
, tagqng_able
);
6184 len
= asc_prt_line(cp
, leftlen
, " Queuing Enabled:");
6186 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
6187 if ((chip_scsi_id
== i
) ||
6188 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6192 len
= asc_prt_line(cp
, leftlen
, " %X:%c",
6194 (tagqng_able
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' :
6198 len
= asc_prt_line(cp
, leftlen
, "\n");
6201 len
= asc_prt_line(cp
, leftlen
, " Queue Limit:");
6203 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
6204 if ((chip_scsi_id
== i
) ||
6205 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6209 AdvReadByteLram(iop_base
, ASC_MC_NUMBER_OF_MAX_CMD
+ i
,
6212 len
= asc_prt_line(cp
, leftlen
, " %X:%d", i
, lrambyte
);
6215 len
= asc_prt_line(cp
, leftlen
, "\n");
6218 len
= asc_prt_line(cp
, leftlen
, " Command Pending:");
6220 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
6221 if ((chip_scsi_id
== i
) ||
6222 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6226 AdvReadByteLram(iop_base
, ASC_MC_NUMBER_OF_QUEUED_CMD
+ i
,
6229 len
= asc_prt_line(cp
, leftlen
, " %X:%d", i
, lrambyte
);
6232 len
= asc_prt_line(cp
, leftlen
, "\n");
6235 AdvReadWordLram(iop_base
, ASC_MC_WDTR_ABLE
, wdtr_able
);
6236 len
= asc_prt_line(cp
, leftlen
, " Wide Enabled:");
6238 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
6239 if ((chip_scsi_id
== i
) ||
6240 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6244 len
= asc_prt_line(cp
, leftlen
, " %X:%c",
6246 (wdtr_able
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' :
6250 len
= asc_prt_line(cp
, leftlen
, "\n");
6253 AdvReadWordLram(iop_base
, ASC_MC_WDTR_DONE
, wdtr_done
);
6254 len
= asc_prt_line(cp
, leftlen
, " Transfer Bit Width:");
6256 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
6257 if ((chip_scsi_id
== i
) ||
6258 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6262 AdvReadWordLram(iop_base
,
6263 ASC_MC_DEVICE_HSHK_CFG_TABLE
+ (2 * i
),
6266 len
= asc_prt_line(cp
, leftlen
, " %X:%d",
6267 i
, (lramword
& 0x8000) ? 16 : 8);
6270 if ((wdtr_able
& ADV_TID_TO_TIDMASK(i
)) &&
6271 (wdtr_done
& ADV_TID_TO_TIDMASK(i
)) == 0) {
6272 len
= asc_prt_line(cp
, leftlen
, "*");
6277 len
= asc_prt_line(cp
, leftlen
, "\n");
6280 AdvReadWordLram(iop_base
, ASC_MC_SDTR_ABLE
, sdtr_able
);
6281 len
= asc_prt_line(cp
, leftlen
, " Synchronous Enabled:");
6283 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
6284 if ((chip_scsi_id
== i
) ||
6285 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6289 len
= asc_prt_line(cp
, leftlen
, " %X:%c",
6291 (sdtr_able
& ADV_TID_TO_TIDMASK(i
)) ? 'Y' :
6295 len
= asc_prt_line(cp
, leftlen
, "\n");
6298 AdvReadWordLram(iop_base
, ASC_MC_SDTR_DONE
, sdtr_done
);
6299 for (i
= 0; i
<= ADV_MAX_TID
; i
++) {
6301 AdvReadWordLram(iop_base
,
6302 ASC_MC_DEVICE_HSHK_CFG_TABLE
+ (2 * i
),
6304 lramword
&= ~0x8000;
6306 if ((chip_scsi_id
== i
) ||
6307 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(i
)) == 0) ||
6308 ((sdtr_able
& ADV_TID_TO_TIDMASK(i
)) == 0)) {
6312 len
= asc_prt_line(cp
, leftlen
, " %X:", i
);
6315 if ((lramword
& 0x1F) == 0) { /* Check for REQ/ACK Offset 0. */
6316 len
= asc_prt_line(cp
, leftlen
, " Asynchronous");
6320 asc_prt_line(cp
, leftlen
,
6321 " Transfer Period Factor: ");
6324 if ((lramword
& 0x1F00) == 0x1100) { /* 80 Mhz */
6326 asc_prt_line(cp
, leftlen
, "9 (80.0 Mhz),");
6328 } else if ((lramword
& 0x1F00) == 0x1000) { /* 40 Mhz */
6330 asc_prt_line(cp
, leftlen
, "10 (40.0 Mhz),");
6332 } else { /* 20 Mhz or below. */
6334 period
= (((lramword
>> 8) * 25) + 50) / 4;
6336 if (period
== 0) { /* Should never happen. */
6338 asc_prt_line(cp
, leftlen
,
6342 len
= asc_prt_line(cp
, leftlen
,
6344 period
, 250 / period
,
6351 len
= asc_prt_line(cp
, leftlen
, " REQ/ACK Offset: %d",
6356 if ((sdtr_done
& ADV_TID_TO_TIDMASK(i
)) == 0) {
6357 len
= asc_prt_line(cp
, leftlen
, "*\n");
6360 len
= asc_prt_line(cp
, leftlen
, "\n");
6366 len
= asc_prt_line(cp
, leftlen
,
6367 " * = Re-negotiation pending before next command.\n");
6377 * Copy proc information to a read buffer taking into account the current
6378 * read offset in the file and the remaining space in the read buffer.
6381 asc_proc_copy(off_t advoffset
, off_t offset
, char *curbuf
, int leftlen
,
6382 char *cp
, int cplen
)
6386 ASC_DBG3(2, "asc_proc_copy: offset %d, advoffset %d, cplen %d\n",
6387 (unsigned)offset
, (unsigned)advoffset
, cplen
);
6388 if (offset
<= advoffset
) {
6389 /* Read offset below current offset, copy everything. */
6390 cnt
= min(cplen
, leftlen
);
6391 ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n",
6392 (ulong
)curbuf
, (ulong
)cp
, cnt
);
6393 memcpy(curbuf
, cp
, cnt
);
6394 } else if (offset
< advoffset
+ cplen
) {
6395 /* Read offset within current range, partial copy. */
6396 cnt
= (advoffset
+ cplen
) - offset
;
6397 cp
= (cp
+ cplen
) - cnt
;
6398 cnt
= min(cnt
, leftlen
);
6399 ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n",
6400 (ulong
)curbuf
, (ulong
)cp
, cnt
);
6401 memcpy(curbuf
, cp
, cnt
);
6409 * If 'cp' is NULL print to the console, otherwise print to a buffer.
6411 * Return 0 if printing to the console, otherwise return the number of
6412 * bytes written to the buffer.
6414 * Note: If any single line is greater than ASC_PRTLINE_SIZE bytes the stack
6415 * will be corrupted. 's[]' is defined to be ASC_PRTLINE_SIZE bytes.
6417 static int asc_prt_line(char *buf
, int buflen
, char *fmt
, ...)
6421 char s
[ASC_PRTLINE_SIZE
];
6423 va_start(args
, fmt
);
6424 ret
= vsprintf(s
, fmt
, args
);
6425 ASC_ASSERT(ret
< ASC_PRTLINE_SIZE
);
6430 ret
= min(buflen
, ret
);
6431 memcpy(buf
, s
, ret
);
6436 #endif /* CONFIG_PROC_FS */
6439 * --- Functions Required by the Asc Library
6443 * Delay for 'n' milliseconds. Don't use the 'jiffies'
6444 * global variable which is incremented once every 5 ms
6445 * from a timer interrupt, because this function may be
6446 * called when interrupts are disabled.
6448 static void DvcSleepMilliSecond(ADV_DCNT n
)
6450 ASC_DBG1(4, "DvcSleepMilliSecond: %lu\n", (ulong
)n
);
6455 * Currently and inline noop but leave as a placeholder.
6456 * Leave DvcEnterCritical() as a noop placeholder.
6458 static inline ulong
DvcEnterCritical(void)
6464 * Critical sections are all protected by the board spinlock.
6465 * Leave DvcLeaveCritical() as a noop placeholder.
6467 static inline void DvcLeaveCritical(ulong flags
)
6474 * DvcPutScsiQ(PortAddr iop_base, ushort s_addr, uchar *outbuf, int words)
6476 * Calling/Exit State:
6480 * Output an ASC_SCSI_Q structure to the chip
6483 DvcPutScsiQ(PortAddr iop_base
, ushort s_addr
, uchar
*outbuf
, int words
)
6487 ASC_DBG_PRT_HEX(2, "DvcPutScsiQ", outbuf
, 2 * words
);
6488 AscSetChipLramAddr(iop_base
, s_addr
);
6489 for (i
= 0; i
< 2 * words
; i
+= 2) {
6490 if (i
== 4 || i
== 20) {
6493 outpw(iop_base
+ IOP_RAM_DATA
,
6494 ((ushort
)outbuf
[i
+ 1] << 8) | outbuf
[i
]);
6500 * DvcGetQinfo(PortAddr iop_base, ushort s_addr, uchar *inbuf, int words)
6502 * Calling/Exit State:
6506 * Input an ASC_QDONE_INFO structure from the chip
6509 DvcGetQinfo(PortAddr iop_base
, ushort s_addr
, uchar
*inbuf
, int words
)
6514 AscSetChipLramAddr(iop_base
, s_addr
);
6515 for (i
= 0; i
< 2 * words
; i
+= 2) {
6519 word
= inpw(iop_base
+ IOP_RAM_DATA
);
6520 inbuf
[i
] = word
& 0xff;
6521 inbuf
[i
+ 1] = (word
>> 8) & 0xff;
6523 ASC_DBG_PRT_HEX(2, "DvcGetQinfo", inbuf
, 2 * words
);
6527 * Return the BIOS address of the adapter at the specified
6528 * I/O port and with the specified bus type.
6530 static unsigned short __devinit
6531 AscGetChipBiosAddress(PortAddr iop_base
, unsigned short bus_type
)
6533 unsigned short cfg_lsw
;
6534 unsigned short bios_addr
;
6537 * The PCI BIOS is re-located by the motherboard BIOS. Because
6538 * of this the driver can not determine where a PCI BIOS is
6539 * loaded and executes.
6541 if (bus_type
& ASC_IS_PCI
)
6545 if ((bus_type
& ASC_IS_EISA
) != 0) {
6546 cfg_lsw
= AscGetEisaChipCfg(iop_base
);
6548 bios_addr
= ASC_BIOS_MIN_ADDR
+ cfg_lsw
* ASC_BIOS_BANK_SIZE
;
6551 #endif /* CONFIG_ISA */
6553 cfg_lsw
= AscGetChipCfgLsw(iop_base
);
6556 * ISA PnP uses the top bit as the 32K BIOS flag
6558 if (bus_type
== ASC_IS_ISAPNP
)
6560 bios_addr
= ASC_BIOS_MIN_ADDR
+ (cfg_lsw
>> 12) * ASC_BIOS_BANK_SIZE
;
6565 * --- Functions Required by the Adv Library
6571 * Return the physical address of 'vaddr' and set '*lenp' to the
6572 * number of physically contiguous bytes that follow 'vaddr'.
6573 * 'flag' indicates the type of structure whose physical address
6574 * is being translated.
6576 * Note: Because Linux currently doesn't page the kernel and all
6577 * kernel buffers are physically contiguous, leave '*lenp' unchanged.
6580 DvcGetPhyAddr(ADV_DVC_VAR
*asc_dvc
, ADV_SCSI_REQ_Q
*scsiq
,
6581 uchar
*vaddr
, ADV_SDCNT
*lenp
, int flag
)
6585 paddr
= virt_to_bus(vaddr
);
6588 "DvcGetPhyAddr: vaddr 0x%lx, lenp 0x%lx *lenp %lu, paddr 0x%lx\n",
6589 (ulong
)vaddr
, (ulong
)lenp
, (ulong
)*((ulong
*)lenp
),
6596 * --- Tracing and Debugging Functions
6599 #ifdef ADVANSYS_STATS
6600 #ifdef CONFIG_PROC_FS
6602 * asc_prt_board_stats()
6604 * Note: no single line should be greater than ASC_PRTLINE_SIZE,
6605 * cf. asc_prt_line().
6607 * Return the number of characters copied into 'cp'. No more than
6608 * 'cplen' characters will be copied to 'cp'.
6610 static int asc_prt_board_stats(struct Scsi_Host
*shost
, char *cp
, int cplen
)
6615 struct asc_stats
*s
;
6616 asc_board_t
*boardp
;
6621 boardp
= ASC_BOARDP(shost
);
6622 s
= &boardp
->asc_stats
;
6624 len
= asc_prt_line(cp
, leftlen
,
6625 "\nLinux Driver Statistics for AdvanSys SCSI Host %d:\n",
6629 len
= asc_prt_line(cp
, leftlen
,
6630 " queuecommand %lu, reset %lu, biosparam %lu, interrupt %lu\n",
6631 s
->queuecommand
, s
->reset
, s
->biosparam
,
6635 len
= asc_prt_line(cp
, leftlen
,
6636 " callback %lu, done %lu, build_error %lu, build_noreq %lu, build_nosg %lu\n",
6637 s
->callback
, s
->done
, s
->build_error
,
6638 s
->adv_build_noreq
, s
->adv_build_nosg
);
6641 len
= asc_prt_line(cp
, leftlen
,
6642 " exe_noerror %lu, exe_busy %lu, exe_error %lu, exe_unknown %lu\n",
6643 s
->exe_noerror
, s
->exe_busy
, s
->exe_error
,
6648 * Display data transfer statistics.
6650 if (s
->cont_cnt
> 0) {
6651 len
= asc_prt_line(cp
, leftlen
, " cont_cnt %lu, ", s
->cont_cnt
);
6654 len
= asc_prt_line(cp
, leftlen
, "cont_xfer %lu.%01lu kb ",
6656 ASC_TENTHS(s
->cont_xfer
, 2));
6659 /* Contiguous transfer average size */
6660 len
= asc_prt_line(cp
, leftlen
, "avg_xfer %lu.%01lu kb\n",
6661 (s
->cont_xfer
/ 2) / s
->cont_cnt
,
6662 ASC_TENTHS((s
->cont_xfer
/ 2), s
->cont_cnt
));
6666 if (s
->sg_cnt
> 0) {
6668 len
= asc_prt_line(cp
, leftlen
, " sg_cnt %lu, sg_elem %lu, ",
6669 s
->sg_cnt
, s
->sg_elem
);
6672 len
= asc_prt_line(cp
, leftlen
, "sg_xfer %lu.%01lu kb\n",
6673 s
->sg_xfer
/ 2, ASC_TENTHS(s
->sg_xfer
, 2));
6676 /* Scatter gather transfer statistics */
6677 len
= asc_prt_line(cp
, leftlen
, " avg_num_elem %lu.%01lu, ",
6678 s
->sg_elem
/ s
->sg_cnt
,
6679 ASC_TENTHS(s
->sg_elem
, s
->sg_cnt
));
6682 len
= asc_prt_line(cp
, leftlen
, "avg_elem_size %lu.%01lu kb, ",
6683 (s
->sg_xfer
/ 2) / s
->sg_elem
,
6684 ASC_TENTHS((s
->sg_xfer
/ 2), s
->sg_elem
));
6687 len
= asc_prt_line(cp
, leftlen
, "avg_xfer_size %lu.%01lu kb\n",
6688 (s
->sg_xfer
/ 2) / s
->sg_cnt
,
6689 ASC_TENTHS((s
->sg_xfer
/ 2), s
->sg_cnt
));
6694 * Display request queuing statistics.
6696 len
= asc_prt_line(cp
, leftlen
,
6697 " Active and Waiting Request Queues (Time Unit: %d HZ):\n",
6705 * asc_prt_target_stats()
6707 * Note: no single line should be greater than ASC_PRTLINE_SIZE,
6708 * cf. asc_prt_line().
6710 * This is separated from asc_prt_board_stats because a full set
6711 * of targets will overflow ASC_PRTBUF_SIZE.
6713 * Return the number of characters copied into 'cp'. No more than
6714 * 'cplen' characters will be copied to 'cp'.
6717 asc_prt_target_stats(struct Scsi_Host
*shost
, int tgt_id
, char *cp
, int cplen
)
6722 struct asc_stats
*s
;
6723 ushort chip_scsi_id
;
6724 asc_board_t
*boardp
;
6725 asc_queue_t
*active
;
6726 asc_queue_t
*waiting
;
6731 boardp
= ASC_BOARDP(shost
);
6732 s
= &boardp
->asc_stats
;
6734 active
= &ASC_BOARDP(shost
)->active
;
6735 waiting
= &ASC_BOARDP(shost
)->waiting
;
6737 if (ASC_NARROW_BOARD(boardp
)) {
6738 chip_scsi_id
= boardp
->dvc_cfg
.asc_dvc_cfg
.chip_scsi_id
;
6740 chip_scsi_id
= boardp
->dvc_var
.adv_dvc_var
.chip_scsi_id
;
6743 if ((chip_scsi_id
== tgt_id
) ||
6744 ((boardp
->init_tidmask
& ADV_TID_TO_TIDMASK(tgt_id
)) == 0)) {
6749 if (active
->q_tot_cnt
[tgt_id
] > 0
6750 || waiting
->q_tot_cnt
[tgt_id
] > 0) {
6751 len
= asc_prt_line(cp
, leftlen
, " target %d\n", tgt_id
);
6754 len
= asc_prt_line(cp
, leftlen
,
6755 " active: cnt [cur %d, max %d, tot %u], time [min %d, max %d, avg %lu.%01lu]\n",
6756 active
->q_cur_cnt
[tgt_id
],
6757 active
->q_max_cnt
[tgt_id
],
6758 active
->q_tot_cnt
[tgt_id
],
6759 active
->q_min_tim
[tgt_id
],
6760 active
->q_max_tim
[tgt_id
],
6761 (active
->q_tot_cnt
[tgt_id
] ==
6766 (active
->q_tot_cnt
[tgt_id
] ==
6767 0) ? 0 : ASC_TENTHS(active
->
6775 len
= asc_prt_line(cp
, leftlen
,
6776 " waiting: cnt [cur %d, max %d, tot %u], time [min %u, max %u, avg %lu.%01lu]\n",
6777 waiting
->q_cur_cnt
[tgt_id
],
6778 waiting
->q_max_cnt
[tgt_id
],
6779 waiting
->q_tot_cnt
[tgt_id
],
6780 waiting
->q_min_tim
[tgt_id
],
6781 waiting
->q_max_tim
[tgt_id
],
6782 (waiting
->q_tot_cnt
[tgt_id
] ==
6787 (waiting
->q_tot_cnt
[tgt_id
] ==
6788 0) ? 0 : ASC_TENTHS(waiting
->
6800 #endif /* CONFIG_PROC_FS */
6801 #endif /* ADVANSYS_STATS */
6803 #ifdef ADVANSYS_DEBUG
6805 * asc_prt_scsi_host()
6807 static void asc_prt_scsi_host(struct Scsi_Host
*s
)
6809 asc_board_t
*boardp
;
6811 boardp
= ASC_BOARDP(s
);
6813 printk("Scsi_Host at addr 0x%lx\n", (ulong
)s
);
6814 printk(" host_busy %u, host_no %d, last_reset %d,\n",
6815 s
->host_busy
, s
->host_no
, (unsigned)s
->last_reset
);
6817 printk(" base 0x%lx, io_port 0x%lx, irq 0x%x,\n",
6818 (ulong
)s
->base
, (ulong
)s
->io_port
, s
->irq
);
6820 printk(" dma_channel %d, this_id %d, can_queue %d,\n",
6821 s
->dma_channel
, s
->this_id
, s
->can_queue
);
6823 printk(" cmd_per_lun %d, sg_tablesize %d, unchecked_isa_dma %d\n",
6824 s
->cmd_per_lun
, s
->sg_tablesize
, s
->unchecked_isa_dma
);
6826 if (ASC_NARROW_BOARD(boardp
)) {
6827 asc_prt_asc_dvc_var(&ASC_BOARDP(s
)->dvc_var
.asc_dvc_var
);
6828 asc_prt_asc_dvc_cfg(&ASC_BOARDP(s
)->dvc_cfg
.asc_dvc_cfg
);
6830 asc_prt_adv_dvc_var(&ASC_BOARDP(s
)->dvc_var
.adv_dvc_var
);
6831 asc_prt_adv_dvc_cfg(&ASC_BOARDP(s
)->dvc_cfg
.adv_dvc_cfg
);
6836 * asc_prt_scsi_cmnd()
6838 static void asc_prt_scsi_cmnd(struct scsi_cmnd
*s
)
6840 printk("struct scsi_cmnd at addr 0x%lx\n", (ulong
)s
);
6842 printk(" host 0x%lx, device 0x%lx, target %u, lun %u, channel %u,\n",
6843 (ulong
)s
->device
->host
, (ulong
)s
->device
, s
->device
->id
,
6844 s
->device
->lun
, s
->device
->channel
);
6846 asc_prt_hex(" CDB", s
->cmnd
, s
->cmd_len
);
6848 printk("sc_data_direction %u, resid %d\n",
6849 s
->sc_data_direction
, s
->resid
);
6851 printk(" use_sg %u, sglist_len %u\n", s
->use_sg
, s
->sglist_len
);
6853 printk(" serial_number 0x%x, retries %d, allowed %d\n",
6854 (unsigned)s
->serial_number
, s
->retries
, s
->allowed
);
6856 printk(" timeout_per_command %d\n", s
->timeout_per_command
);
6858 printk(" scsi_done 0x%p, done 0x%p, host_scribble 0x%p, result 0x%x\n",
6859 s
->scsi_done
, s
->done
, s
->host_scribble
, s
->result
);
6861 printk(" tag %u, pid %u\n", (unsigned)s
->tag
, (unsigned)s
->pid
);
6865 * asc_prt_asc_dvc_var()
6867 static void asc_prt_asc_dvc_var(ASC_DVC_VAR
*h
)
6869 printk("ASC_DVC_VAR at addr 0x%lx\n", (ulong
)h
);
6871 printk(" iop_base 0x%x, err_code 0x%x, dvc_cntl 0x%x, bug_fix_cntl "
6872 "%d,\n", h
->iop_base
, h
->err_code
, h
->dvc_cntl
, h
->bug_fix_cntl
);
6874 printk(" bus_type %d, init_sdtr 0x%x,\n", h
->bus_type
,
6875 (unsigned)h
->init_sdtr
);
6877 printk(" sdtr_done 0x%x, use_tagged_qng 0x%x, unit_not_ready 0x%x, "
6878 "chip_no 0x%x,\n", (unsigned)h
->sdtr_done
,
6879 (unsigned)h
->use_tagged_qng
, (unsigned)h
->unit_not_ready
,
6880 (unsigned)h
->chip_no
);
6882 printk(" queue_full_or_busy 0x%x, start_motor 0x%x, scsi_reset_wait "
6883 "%u,\n", (unsigned)h
->queue_full_or_busy
,
6884 (unsigned)h
->start_motor
, (unsigned)h
->scsi_reset_wait
);
6886 printk(" is_in_int %u, max_total_qng %u, cur_total_qng %u, "
6887 "in_critical_cnt %u,\n", (unsigned)h
->is_in_int
,
6888 (unsigned)h
->max_total_qng
, (unsigned)h
->cur_total_qng
,
6889 (unsigned)h
->in_critical_cnt
);
6891 printk(" last_q_shortage %u, init_state 0x%x, no_scam 0x%x, "
6892 "pci_fix_asyn_xfer 0x%x,\n", (unsigned)h
->last_q_shortage
,
6893 (unsigned)h
->init_state
, (unsigned)h
->no_scam
,
6894 (unsigned)h
->pci_fix_asyn_xfer
);
6896 printk(" cfg 0x%lx, irq_no 0x%x\n", (ulong
)h
->cfg
, (unsigned)h
->irq_no
);
6900 * asc_prt_asc_dvc_cfg()
6902 static void asc_prt_asc_dvc_cfg(ASC_DVC_CFG
*h
)
6904 printk("ASC_DVC_CFG at addr 0x%lx\n", (ulong
)h
);
6906 printk(" can_tagged_qng 0x%x, cmd_qng_enabled 0x%x,\n",
6907 h
->can_tagged_qng
, h
->cmd_qng_enabled
);
6908 printk(" disc_enable 0x%x, sdtr_enable 0x%x,\n",
6909 h
->disc_enable
, h
->sdtr_enable
);
6912 (" chip_scsi_id %d, isa_dma_speed %d, isa_dma_channel %d, chip_version %d,\n",
6913 h
->chip_scsi_id
, h
->isa_dma_speed
, h
->isa_dma_channel
,
6917 (" pci_device_id %d, lib_serial_no %u, lib_version %u, mcode_date 0x%x,\n",
6918 to_pci_dev(h
->dev
)->device
, h
->lib_serial_no
, h
->lib_version
,
6921 printk(" mcode_version %d, overrun_buf 0x%lx\n",
6922 h
->mcode_version
, (ulong
)h
->overrun_buf
);
6926 * asc_prt_asc_scsi_q()
6928 static void asc_prt_asc_scsi_q(ASC_SCSI_Q
*q
)
6933 printk("ASC_SCSI_Q at addr 0x%lx\n", (ulong
)q
);
6936 (" target_ix 0x%x, target_lun %u, srb_ptr 0x%lx, tag_code 0x%x,\n",
6937 q
->q2
.target_ix
, q
->q1
.target_lun
, (ulong
)q
->q2
.srb_ptr
,
6941 (" data_addr 0x%lx, data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n",
6942 (ulong
)le32_to_cpu(q
->q1
.data_addr
),
6943 (ulong
)le32_to_cpu(q
->q1
.data_cnt
),
6944 (ulong
)le32_to_cpu(q
->q1
.sense_addr
), q
->q1
.sense_len
);
6946 printk(" cdbptr 0x%lx, cdb_len %u, sg_head 0x%lx, sg_queue_cnt %u\n",
6947 (ulong
)q
->cdbptr
, q
->q2
.cdb_len
,
6948 (ulong
)q
->sg_head
, q
->q1
.sg_queue_cnt
);
6952 printk("ASC_SG_HEAD at addr 0x%lx\n", (ulong
)sgp
);
6953 printk(" entry_cnt %u, queue_cnt %u\n", sgp
->entry_cnt
,
6955 for (i
= 0; i
< sgp
->entry_cnt
; i
++) {
6956 printk(" [%u]: addr 0x%lx, bytes %lu\n",
6957 i
, (ulong
)le32_to_cpu(sgp
->sg_list
[i
].addr
),
6958 (ulong
)le32_to_cpu(sgp
->sg_list
[i
].bytes
));
6965 * asc_prt_asc_qdone_info()
6967 static void asc_prt_asc_qdone_info(ASC_QDONE_INFO
*q
)
6969 printk("ASC_QDONE_INFO at addr 0x%lx\n", (ulong
)q
);
6970 printk(" srb_ptr 0x%lx, target_ix %u, cdb_len %u, tag_code %u,\n",
6971 (ulong
)q
->d2
.srb_ptr
, q
->d2
.target_ix
, q
->d2
.cdb_len
,
6974 (" done_stat 0x%x, host_stat 0x%x, scsi_stat 0x%x, scsi_msg 0x%x\n",
6975 q
->d3
.done_stat
, q
->d3
.host_stat
, q
->d3
.scsi_stat
, q
->d3
.scsi_msg
);
6979 * asc_prt_adv_dvc_var()
6981 * Display an ADV_DVC_VAR structure.
6983 static void asc_prt_adv_dvc_var(ADV_DVC_VAR
*h
)
6985 printk(" ADV_DVC_VAR at addr 0x%lx\n", (ulong
)h
);
6987 printk(" iop_base 0x%lx, err_code 0x%x, ultra_able 0x%x\n",
6988 (ulong
)h
->iop_base
, h
->err_code
, (unsigned)h
->ultra_able
);
6990 printk(" isr_callback 0x%lx, sdtr_able 0x%x, wdtr_able 0x%x\n",
6991 (ulong
)h
->isr_callback
, (unsigned)h
->sdtr_able
,
6992 (unsigned)h
->wdtr_able
);
6994 printk(" start_motor 0x%x, scsi_reset_wait 0x%x, irq_no 0x%x,\n",
6995 (unsigned)h
->start_motor
,
6996 (unsigned)h
->scsi_reset_wait
, (unsigned)h
->irq_no
);
6998 printk(" max_host_qng %u, max_dvc_qng %u, carr_freelist 0x%lxn\n",
6999 (unsigned)h
->max_host_qng
, (unsigned)h
->max_dvc_qng
,
7000 (ulong
)h
->carr_freelist
);
7002 printk(" icq_sp 0x%lx, irq_sp 0x%lx\n",
7003 (ulong
)h
->icq_sp
, (ulong
)h
->irq_sp
);
7005 printk(" no_scam 0x%x, tagqng_able 0x%x\n",
7006 (unsigned)h
->no_scam
, (unsigned)h
->tagqng_able
);
7008 printk(" chip_scsi_id 0x%x, cfg 0x%lx\n",
7009 (unsigned)h
->chip_scsi_id
, (ulong
)h
->cfg
);
7013 * asc_prt_adv_dvc_cfg()
7015 * Display an ADV_DVC_CFG structure.
7017 static void asc_prt_adv_dvc_cfg(ADV_DVC_CFG
*h
)
7019 printk(" ADV_DVC_CFG at addr 0x%lx\n", (ulong
)h
);
7021 printk(" disc_enable 0x%x, termination 0x%x\n",
7022 h
->disc_enable
, h
->termination
);
7024 printk(" chip_version 0x%x, mcode_date 0x%x\n",
7025 h
->chip_version
, h
->mcode_date
);
7027 printk(" mcode_version 0x%x, pci_device_id 0x%x, lib_version %u\n",
7028 h
->mcode_version
, to_pci_dev(h
->dev
)->device
, h
->lib_version
);
7030 printk(" control_flag 0x%x\n", h
->control_flag
);
7034 * asc_prt_adv_scsi_req_q()
7036 * Display an ADV_SCSI_REQ_Q structure.
7038 static void asc_prt_adv_scsi_req_q(ADV_SCSI_REQ_Q
*q
)
7041 struct asc_sg_block
*sg_ptr
;
7043 printk("ADV_SCSI_REQ_Q at addr 0x%lx\n", (ulong
)q
);
7045 printk(" target_id %u, target_lun %u, srb_ptr 0x%lx, a_flag 0x%x\n",
7046 q
->target_id
, q
->target_lun
, (ulong
)q
->srb_ptr
, q
->a_flag
);
7048 printk(" cntl 0x%x, data_addr 0x%lx, vdata_addr 0x%lx\n",
7049 q
->cntl
, (ulong
)le32_to_cpu(q
->data_addr
), (ulong
)q
->vdata_addr
);
7051 printk(" data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n",
7052 (ulong
)le32_to_cpu(q
->data_cnt
),
7053 (ulong
)le32_to_cpu(q
->sense_addr
), q
->sense_len
);
7056 (" cdb_len %u, done_status 0x%x, host_status 0x%x, scsi_status 0x%x\n",
7057 q
->cdb_len
, q
->done_status
, q
->host_status
, q
->scsi_status
);
7059 printk(" sg_working_ix 0x%x, target_cmd %u\n",
7060 q
->sg_working_ix
, q
->target_cmd
);
7062 printk(" scsiq_rptr 0x%lx, sg_real_addr 0x%lx, sg_list_ptr 0x%lx\n",
7063 (ulong
)le32_to_cpu(q
->scsiq_rptr
),
7064 (ulong
)le32_to_cpu(q
->sg_real_addr
), (ulong
)q
->sg_list_ptr
);
7066 /* Display the request's ADV_SG_BLOCK structures. */
7067 if (q
->sg_list_ptr
!= NULL
) {
7071 * 'sg_ptr' is a physical address. Convert it to a virtual
7072 * address by indexing 'sg_blk_cnt' into the virtual address
7073 * array 'sg_list_ptr'.
7075 * XXX - Assumes all SG physical blocks are virtually contiguous.
7078 &(((ADV_SG_BLOCK
*)(q
->sg_list_ptr
))[sg_blk_cnt
]);
7079 asc_prt_adv_sgblock(sg_blk_cnt
, sg_ptr
);
7080 if (sg_ptr
->sg_ptr
== 0) {
7089 * asc_prt_adv_sgblock()
7091 * Display an ADV_SG_BLOCK structure.
7093 static void asc_prt_adv_sgblock(int sgblockno
, ADV_SG_BLOCK
*b
)
7097 printk(" ASC_SG_BLOCK at addr 0x%lx (sgblockno %d)\n",
7098 (ulong
)b
, sgblockno
);
7099 printk(" sg_cnt %u, sg_ptr 0x%lx\n",
7100 b
->sg_cnt
, (ulong
)le32_to_cpu(b
->sg_ptr
));
7101 ASC_ASSERT(b
->sg_cnt
<= NO_OF_SG_PER_BLOCK
);
7102 if (b
->sg_ptr
!= 0) {
7103 ASC_ASSERT(b
->sg_cnt
== NO_OF_SG_PER_BLOCK
);
7105 for (i
= 0; i
< b
->sg_cnt
; i
++) {
7106 printk(" [%u]: sg_addr 0x%lx, sg_count 0x%lx\n",
7107 i
, (ulong
)b
->sg_list
[i
].sg_addr
,
7108 (ulong
)b
->sg_list
[i
].sg_count
);
7115 * Print hexadecimal output in 4 byte groupings 32 bytes
7116 * or 8 double-words per line.
7118 static void asc_prt_hex(char *f
, uchar
*s
, int l
)
7125 printk("%s: (%d bytes)\n", f
, l
);
7127 for (i
= 0; i
< l
; i
+= 32) {
7129 /* Display a maximum of 8 double-words per line. */
7130 if ((k
= (l
- i
) / 4) >= 8) {
7137 for (j
= 0; j
< k
; j
++) {
7138 printk(" %2.2X%2.2X%2.2X%2.2X",
7139 (unsigned)s
[i
+ (j
* 4)],
7140 (unsigned)s
[i
+ (j
* 4) + 1],
7141 (unsigned)s
[i
+ (j
* 4) + 2],
7142 (unsigned)s
[i
+ (j
* 4) + 3]);
7150 printk(" %2.2X", (unsigned)s
[i
+ (j
* 4)]);
7153 printk(" %2.2X%2.2X",
7154 (unsigned)s
[i
+ (j
* 4)],
7155 (unsigned)s
[i
+ (j
* 4) + 1]);
7158 printk(" %2.2X%2.2X%2.2X",
7159 (unsigned)s
[i
+ (j
* 4) + 1],
7160 (unsigned)s
[i
+ (j
* 4) + 2],
7161 (unsigned)s
[i
+ (j
* 4) + 3]);
7168 #endif /* ADVANSYS_DEBUG */
7171 * --- Asc Library Functions
7174 static ushort __devinit
AscGetEisaChipCfg(PortAddr iop_base
)
7176 PortAddr eisa_cfg_iop
;
7178 eisa_cfg_iop
= (PortAddr
) ASC_GET_EISA_SLOT(iop_base
) |
7179 (PortAddr
) (ASC_EISA_CFG_IOP_MASK
);
7180 return (inpw(eisa_cfg_iop
));
7183 static uchar __devinit
AscSetChipScsiID(PortAddr iop_base
, uchar new_host_id
)
7187 if (AscGetChipScsiID(iop_base
) == new_host_id
) {
7188 return (new_host_id
);
7190 cfg_lsw
= AscGetChipCfgLsw(iop_base
);
7192 cfg_lsw
|= (ushort
)((new_host_id
& ASC_MAX_TID
) << 8);
7193 AscSetChipCfgLsw(iop_base
, cfg_lsw
);
7194 return (AscGetChipScsiID(iop_base
));
7197 static unsigned char __devinit
AscGetChipScsiCtrl(PortAddr iop_base
)
7201 AscSetBank(iop_base
, 1);
7202 sc
= inp(iop_base
+ IOP_REG_SC
);
7203 AscSetBank(iop_base
, 0);
7207 static unsigned char __devinit
7208 AscGetChipVersion(PortAddr iop_base
, unsigned short bus_type
)
7210 if (bus_type
& ASC_IS_EISA
) {
7212 unsigned char revision
;
7213 eisa_iop
= (PortAddr
) ASC_GET_EISA_SLOT(iop_base
) |
7214 (PortAddr
) ASC_EISA_REV_IOP_MASK
;
7215 revision
= inp(eisa_iop
);
7216 return ASC_CHIP_MIN_VER_EISA
- 1 + revision
;
7218 return AscGetChipVerNo(iop_base
);
7222 AscLoadMicroCode(PortAddr iop_base
,
7223 ushort s_addr
, uchar
*mcode_buf
, ushort mcode_size
)
7226 ushort mcode_word_size
;
7227 ushort mcode_chksum
;
7229 /* Write the microcode buffer starting at LRAM address 0. */
7230 mcode_word_size
= (ushort
)(mcode_size
>> 1);
7231 AscMemWordSetLram(iop_base
, s_addr
, 0, mcode_word_size
);
7232 AscMemWordCopyPtrToLram(iop_base
, s_addr
, mcode_buf
, mcode_word_size
);
7234 chksum
= AscMemSumLramWord(iop_base
, s_addr
, mcode_word_size
);
7235 ASC_DBG1(1, "AscLoadMicroCode: chksum 0x%lx\n", (ulong
)chksum
);
7236 mcode_chksum
= (ushort
)AscMemSumLramWord(iop_base
,
7237 (ushort
)ASC_CODE_SEC_BEG
,
7238 (ushort
)((mcode_size
-
7242 ASC_DBG1(1, "AscLoadMicroCode: mcode_chksum 0x%lx\n",
7243 (ulong
)mcode_chksum
);
7244 AscWriteLramWord(iop_base
, ASCV_MCODE_CHKSUM_W
, mcode_chksum
);
7245 AscWriteLramWord(iop_base
, ASCV_MCODE_SIZE_W
, mcode_size
);
7249 static int AscFindSignature(PortAddr iop_base
)
7253 ASC_DBG2(1, "AscFindSignature: AscGetChipSignatureByte(0x%x) 0x%x\n",
7254 iop_base
, AscGetChipSignatureByte(iop_base
));
7255 if (AscGetChipSignatureByte(iop_base
) == (uchar
)ASC_1000_ID1B
) {
7257 "AscFindSignature: AscGetChipSignatureWord(0x%x) 0x%x\n",
7258 iop_base
, AscGetChipSignatureWord(iop_base
));
7259 sig_word
= AscGetChipSignatureWord(iop_base
);
7260 if ((sig_word
== (ushort
)ASC_1000_ID0W
) ||
7261 (sig_word
== (ushort
)ASC_1000_ID0W_FIX
)) {
7268 static void __devinit
AscToggleIRQAct(PortAddr iop_base
)
7270 AscSetChipStatus(iop_base
, CIW_IRQ_ACT
);
7271 AscSetChipStatus(iop_base
, 0);
7275 static uchar __devinit
AscGetChipIRQ(PortAddr iop_base
, ushort bus_type
)
7280 if ((bus_type
& ASC_IS_EISA
) != 0) {
7281 cfg_lsw
= AscGetEisaChipCfg(iop_base
);
7282 chip_irq
= (uchar
)(((cfg_lsw
>> 8) & 0x07) + 10);
7283 if ((chip_irq
== 13) || (chip_irq
> 15)) {
7288 if ((bus_type
& ASC_IS_VL
) != 0) {
7289 cfg_lsw
= AscGetChipCfgLsw(iop_base
);
7290 chip_irq
= (uchar
)(((cfg_lsw
>> 2) & 0x07));
7291 if ((chip_irq
== 0) || (chip_irq
== 4) || (chip_irq
== 7)) {
7294 return ((uchar
)(chip_irq
+ (ASC_MIN_IRQ_NO
- 1)));
7296 cfg_lsw
= AscGetChipCfgLsw(iop_base
);
7297 chip_irq
= (uchar
)(((cfg_lsw
>> 2) & 0x03));
7299 chip_irq
+= (uchar
)2;
7300 return ((uchar
)(chip_irq
+ ASC_MIN_IRQ_NO
));
7303 static uchar __devinit
7304 AscSetChipIRQ(PortAddr iop_base
, uchar irq_no
, ushort bus_type
)
7308 if ((bus_type
& ASC_IS_VL
) != 0) {
7310 if ((irq_no
< ASC_MIN_IRQ_NO
)
7311 || (irq_no
> ASC_MAX_IRQ_NO
)) {
7314 irq_no
-= (uchar
)((ASC_MIN_IRQ_NO
- 1));
7317 cfg_lsw
= (ushort
)(AscGetChipCfgLsw(iop_base
) & 0xFFE3);
7318 cfg_lsw
|= (ushort
)0x0010;
7319 AscSetChipCfgLsw(iop_base
, cfg_lsw
);
7320 AscToggleIRQAct(iop_base
);
7321 cfg_lsw
= (ushort
)(AscGetChipCfgLsw(iop_base
) & 0xFFE0);
7322 cfg_lsw
|= (ushort
)((irq_no
& 0x07) << 2);
7323 AscSetChipCfgLsw(iop_base
, cfg_lsw
);
7324 AscToggleIRQAct(iop_base
);
7325 return (AscGetChipIRQ(iop_base
, bus_type
));
7327 if ((bus_type
& (ASC_IS_ISA
)) != 0) {
7330 irq_no
-= (uchar
)ASC_MIN_IRQ_NO
;
7331 cfg_lsw
= (ushort
)(AscGetChipCfgLsw(iop_base
) & 0xFFF3);
7332 cfg_lsw
|= (ushort
)((irq_no
& 0x03) << 2);
7333 AscSetChipCfgLsw(iop_base
, cfg_lsw
);
7334 return (AscGetChipIRQ(iop_base
, bus_type
));
7340 static void __devinit
AscEnableIsaDma(uchar dma_channel
)
7342 if (dma_channel
< 4) {
7343 outp(0x000B, (ushort
)(0xC0 | dma_channel
));
7344 outp(0x000A, dma_channel
);
7345 } else if (dma_channel
< 8) {
7346 outp(0x00D6, (ushort
)(0xC0 | (dma_channel
- 4)));
7347 outp(0x00D4, (ushort
)(dma_channel
- 4));
7351 #endif /* CONFIG_ISA */
7353 static int AscIsrChipHalted(ASC_DVC_VAR
*asc_dvc
)
7359 ushort int_halt_code
;
7360 ASC_SCSI_BIT_ID_TYPE scsi_busy
;
7361 ASC_SCSI_BIT_ID_TYPE target_id
;
7368 uchar q_cntl
, tid_no
;
7372 asc_board_t
*boardp
;
7374 ASC_ASSERT(asc_dvc
->drv_ptr
!= NULL
);
7375 boardp
= asc_dvc
->drv_ptr
;
7377 iop_base
= asc_dvc
->iop_base
;
7378 int_halt_code
= AscReadLramWord(iop_base
, ASCV_HALTCODE_W
);
7380 halt_qp
= AscReadLramByte(iop_base
, ASCV_CURCDB_B
);
7381 halt_q_addr
= ASC_QNO_TO_QADDR(halt_qp
);
7382 target_ix
= AscReadLramByte(iop_base
,
7383 (ushort
)(halt_q_addr
+
7384 (ushort
)ASC_SCSIQ_B_TARGET_IX
));
7386 AscReadLramByte(iop_base
,
7387 (ushort
)(halt_q_addr
+ (ushort
)ASC_SCSIQ_B_CNTL
));
7388 tid_no
= ASC_TIX_TO_TID(target_ix
);
7389 target_id
= (uchar
)ASC_TID_TO_TARGET_ID(tid_no
);
7390 if (asc_dvc
->pci_fix_asyn_xfer
& target_id
) {
7391 asyn_sdtr
= ASYN_SDTR_DATA_FIX_PCI_REV_AB
;
7395 if (int_halt_code
== ASC_HALT_DISABLE_ASYN_USE_SYN_FIX
) {
7396 if (asc_dvc
->pci_fix_asyn_xfer
& target_id
) {
7397 AscSetChipSDTR(iop_base
, 0, tid_no
);
7398 boardp
->sdtr_data
[tid_no
] = 0;
7400 AscWriteLramWord(iop_base
, ASCV_HALTCODE_W
, 0);
7402 } else if (int_halt_code
== ASC_HALT_ENABLE_ASYN_USE_SYN_FIX
) {
7403 if (asc_dvc
->pci_fix_asyn_xfer
& target_id
) {
7404 AscSetChipSDTR(iop_base
, asyn_sdtr
, tid_no
);
7405 boardp
->sdtr_data
[tid_no
] = asyn_sdtr
;
7407 AscWriteLramWord(iop_base
, ASCV_HALTCODE_W
, 0);
7409 } else if (int_halt_code
== ASC_HALT_EXTMSG_IN
) {
7411 AscMemWordCopyPtrFromLram(iop_base
,
7414 sizeof(EXT_MSG
) >> 1);
7416 if (ext_msg
.msg_type
== EXTENDED_MESSAGE
&&
7417 ext_msg
.msg_req
== EXTENDED_SDTR
&&
7418 ext_msg
.msg_len
== MS_SDTR_LEN
) {
7420 if ((ext_msg
.req_ack_offset
> ASC_SYN_MAX_OFFSET
)) {
7422 sdtr_accept
= FALSE
;
7423 ext_msg
.req_ack_offset
= ASC_SYN_MAX_OFFSET
;
7425 if ((ext_msg
.xfer_period
<
7426 asc_dvc
->sdtr_period_tbl
[asc_dvc
->
7427 host_init_sdtr_index
])
7428 || (ext_msg
.xfer_period
>
7429 asc_dvc
->sdtr_period_tbl
[asc_dvc
->
7431 sdtr_accept
= FALSE
;
7432 ext_msg
.xfer_period
=
7433 asc_dvc
->sdtr_period_tbl
[asc_dvc
->
7434 host_init_sdtr_index
];
7438 AscCalSDTRData(asc_dvc
, ext_msg
.xfer_period
,
7439 ext_msg
.req_ack_offset
);
7440 if ((sdtr_data
== 0xFF)) {
7442 q_cntl
|= QC_MSG_OUT
;
7443 asc_dvc
->init_sdtr
&= ~target_id
;
7444 asc_dvc
->sdtr_done
&= ~target_id
;
7445 AscSetChipSDTR(iop_base
, asyn_sdtr
,
7447 boardp
->sdtr_data
[tid_no
] = asyn_sdtr
;
7450 if (ext_msg
.req_ack_offset
== 0) {
7452 q_cntl
&= ~QC_MSG_OUT
;
7453 asc_dvc
->init_sdtr
&= ~target_id
;
7454 asc_dvc
->sdtr_done
&= ~target_id
;
7455 AscSetChipSDTR(iop_base
, asyn_sdtr
, tid_no
);
7457 if (sdtr_accept
&& (q_cntl
& QC_MSG_OUT
)) {
7459 q_cntl
&= ~QC_MSG_OUT
;
7460 asc_dvc
->sdtr_done
|= target_id
;
7461 asc_dvc
->init_sdtr
|= target_id
;
7462 asc_dvc
->pci_fix_asyn_xfer
&=
7465 AscCalSDTRData(asc_dvc
,
7466 ext_msg
.xfer_period
,
7469 AscSetChipSDTR(iop_base
, sdtr_data
,
7471 boardp
->sdtr_data
[tid_no
] = sdtr_data
;
7474 q_cntl
|= QC_MSG_OUT
;
7475 AscMsgOutSDTR(asc_dvc
,
7476 ext_msg
.xfer_period
,
7477 ext_msg
.req_ack_offset
);
7478 asc_dvc
->pci_fix_asyn_xfer
&=
7481 AscCalSDTRData(asc_dvc
,
7482 ext_msg
.xfer_period
,
7485 AscSetChipSDTR(iop_base
, sdtr_data
,
7487 boardp
->sdtr_data
[tid_no
] = sdtr_data
;
7488 asc_dvc
->sdtr_done
|= target_id
;
7489 asc_dvc
->init_sdtr
|= target_id
;
7493 AscWriteLramByte(iop_base
,
7494 (ushort
)(halt_q_addr
+
7495 (ushort
)ASC_SCSIQ_B_CNTL
),
7497 AscWriteLramWord(iop_base
, ASCV_HALTCODE_W
, 0);
7499 } else if (ext_msg
.msg_type
== EXTENDED_MESSAGE
&&
7500 ext_msg
.msg_req
== EXTENDED_WDTR
&&
7501 ext_msg
.msg_len
== MS_WDTR_LEN
) {
7503 ext_msg
.wdtr_width
= 0;
7504 AscMemWordCopyPtrToLram(iop_base
,
7507 sizeof(EXT_MSG
) >> 1);
7508 q_cntl
|= QC_MSG_OUT
;
7509 AscWriteLramByte(iop_base
,
7510 (ushort
)(halt_q_addr
+
7511 (ushort
)ASC_SCSIQ_B_CNTL
),
7513 AscWriteLramWord(iop_base
, ASCV_HALTCODE_W
, 0);
7517 ext_msg
.msg_type
= MESSAGE_REJECT
;
7518 AscMemWordCopyPtrToLram(iop_base
,
7521 sizeof(EXT_MSG
) >> 1);
7522 q_cntl
|= QC_MSG_OUT
;
7523 AscWriteLramByte(iop_base
,
7524 (ushort
)(halt_q_addr
+
7525 (ushort
)ASC_SCSIQ_B_CNTL
),
7527 AscWriteLramWord(iop_base
, ASCV_HALTCODE_W
, 0);
7530 } else if (int_halt_code
== ASC_HALT_CHK_CONDITION
) {
7532 q_cntl
|= QC_REQ_SENSE
;
7534 if ((asc_dvc
->init_sdtr
& target_id
) != 0) {
7536 asc_dvc
->sdtr_done
&= ~target_id
;
7538 sdtr_data
= AscGetMCodeInitSDTRAtID(iop_base
, tid_no
);
7539 q_cntl
|= QC_MSG_OUT
;
7540 AscMsgOutSDTR(asc_dvc
,
7542 sdtr_period_tbl
[(sdtr_data
>> 4) &
7546 (uchar
)(sdtr_data
& (uchar
)
7547 ASC_SYN_MAX_OFFSET
));
7550 AscWriteLramByte(iop_base
,
7551 (ushort
)(halt_q_addr
+
7552 (ushort
)ASC_SCSIQ_B_CNTL
), q_cntl
);
7554 tag_code
= AscReadLramByte(iop_base
,
7555 (ushort
)(halt_q_addr
+ (ushort
)
7556 ASC_SCSIQ_B_TAG_CODE
));
7558 if ((asc_dvc
->pci_fix_asyn_xfer
& target_id
)
7559 && !(asc_dvc
->pci_fix_asyn_xfer_always
& target_id
)
7562 tag_code
|= (ASC_TAG_FLAG_DISABLE_DISCONNECT
7563 | ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX
);
7566 AscWriteLramByte(iop_base
,
7567 (ushort
)(halt_q_addr
+
7568 (ushort
)ASC_SCSIQ_B_TAG_CODE
),
7571 q_status
= AscReadLramByte(iop_base
,
7572 (ushort
)(halt_q_addr
+ (ushort
)
7573 ASC_SCSIQ_B_STATUS
));
7574 q_status
|= (QS_READY
| QS_BUSY
);
7575 AscWriteLramByte(iop_base
,
7576 (ushort
)(halt_q_addr
+
7577 (ushort
)ASC_SCSIQ_B_STATUS
),
7580 scsi_busy
= AscReadLramByte(iop_base
, (ushort
)ASCV_SCSIBUSY_B
);
7581 scsi_busy
&= ~target_id
;
7582 AscWriteLramByte(iop_base
, (ushort
)ASCV_SCSIBUSY_B
, scsi_busy
);
7584 AscWriteLramWord(iop_base
, ASCV_HALTCODE_W
, 0);
7586 } else if (int_halt_code
== ASC_HALT_SDTR_REJECTED
) {
7588 AscMemWordCopyPtrFromLram(iop_base
,
7591 sizeof(EXT_MSG
) >> 1);
7593 if ((out_msg
.msg_type
== EXTENDED_MESSAGE
) &&
7594 (out_msg
.msg_len
== MS_SDTR_LEN
) &&
7595 (out_msg
.msg_req
== EXTENDED_SDTR
)) {
7597 asc_dvc
->init_sdtr
&= ~target_id
;
7598 asc_dvc
->sdtr_done
&= ~target_id
;
7599 AscSetChipSDTR(iop_base
, asyn_sdtr
, tid_no
);
7600 boardp
->sdtr_data
[tid_no
] = asyn_sdtr
;
7602 q_cntl
&= ~QC_MSG_OUT
;
7603 AscWriteLramByte(iop_base
,
7604 (ushort
)(halt_q_addr
+
7605 (ushort
)ASC_SCSIQ_B_CNTL
), q_cntl
);
7606 AscWriteLramWord(iop_base
, ASCV_HALTCODE_W
, 0);
7608 } else if (int_halt_code
== ASC_HALT_SS_QUEUE_FULL
) {
7610 scsi_status
= AscReadLramByte(iop_base
,
7611 (ushort
)((ushort
)halt_q_addr
+
7613 ASC_SCSIQ_SCSI_STATUS
));
7615 AscReadLramByte(iop_base
,
7616 (ushort
)((ushort
)ASC_QADR_BEG
+
7617 (ushort
)target_ix
));
7618 if ((cur_dvc_qng
> 0) && (asc_dvc
->cur_dvc_qng
[tid_no
] > 0)) {
7620 scsi_busy
= AscReadLramByte(iop_base
,
7621 (ushort
)ASCV_SCSIBUSY_B
);
7622 scsi_busy
|= target_id
;
7623 AscWriteLramByte(iop_base
,
7624 (ushort
)ASCV_SCSIBUSY_B
, scsi_busy
);
7625 asc_dvc
->queue_full_or_busy
|= target_id
;
7627 if (scsi_status
== SAM_STAT_TASK_SET_FULL
) {
7628 if (cur_dvc_qng
> ASC_MIN_TAGGED_CMD
) {
7630 asc_dvc
->max_dvc_qng
[tid_no
] =
7633 AscWriteLramByte(iop_base
,
7635 ASCV_MAX_DVC_QNG_BEG
7641 * Set the device queue depth to the number of
7642 * active requests when the QUEUE FULL condition
7645 boardp
->queue_full
|= target_id
;
7646 boardp
->queue_full_cnt
[tid_no
] =
7651 AscWriteLramWord(iop_base
, ASCV_HALTCODE_W
, 0);
7654 #if CC_VERY_LONG_SG_LIST
7655 else if (int_halt_code
== ASC_HALT_HOST_COPY_SG_LIST_TO_RISC
) {
7659 uchar first_sg_wk_q_no
;
7660 ASC_SCSI_Q
*scsiq
; /* Ptr to driver request. */
7661 ASC_SG_HEAD
*sg_head
; /* Ptr to driver SG request. */
7662 ASC_SG_LIST_Q scsi_sg_q
; /* Structure written to queue. */
7663 ushort sg_list_dwords
;
7664 ushort sg_entry_cnt
;
7668 q_no
= AscReadLramByte(iop_base
, (ushort
)ASCV_REQ_SG_LIST_QP
);
7669 if (q_no
== ASC_QLINK_END
) {
7673 q_addr
= ASC_QNO_TO_QADDR(q_no
);
7676 * Convert the request's SRB pointer to a host ASC_SCSI_REQ
7677 * structure pointer using a macro provided by the driver.
7678 * The ASC_SCSI_REQ pointer provides a pointer to the
7679 * host ASC_SG_HEAD structure.
7681 /* Read request's SRB pointer. */
7682 scsiq
= (ASC_SCSI_Q
*)
7683 ASC_SRB2SCSIQ(ASC_U32_TO_VADDR(AscReadLramDWord(iop_base
,
7686 ASC_SCSIQ_D_SRBPTR
))));
7689 * Get request's first and working SG queue.
7691 sg_wk_q_no
= AscReadLramByte(iop_base
,
7693 ASC_SCSIQ_B_SG_WK_QP
));
7695 first_sg_wk_q_no
= AscReadLramByte(iop_base
,
7697 ASC_SCSIQ_B_FIRST_SG_WK_QP
));
7700 * Reset request's working SG queue back to the
7703 AscWriteLramByte(iop_base
,
7705 (ushort
)ASC_SCSIQ_B_SG_WK_QP
),
7708 sg_head
= scsiq
->sg_head
;
7711 * Set sg_entry_cnt to the number of SG elements
7712 * that will be completed on this interrupt.
7714 * Note: The allocated SG queues contain ASC_MAX_SG_LIST - 1
7715 * SG elements. The data_cnt and data_addr fields which
7716 * add 1 to the SG element capacity are not used when
7717 * restarting SG handling after a halt.
7719 if (scsiq
->remain_sg_entry_cnt
> (ASC_MAX_SG_LIST
- 1)) {
7720 sg_entry_cnt
= ASC_MAX_SG_LIST
- 1;
7723 * Keep track of remaining number of SG elements that will
7724 * need to be handled on the next interrupt.
7726 scsiq
->remain_sg_entry_cnt
-= (ASC_MAX_SG_LIST
- 1);
7728 sg_entry_cnt
= scsiq
->remain_sg_entry_cnt
;
7729 scsiq
->remain_sg_entry_cnt
= 0;
7733 * Copy SG elements into the list of allocated SG queues.
7735 * Last index completed is saved in scsiq->next_sg_index.
7737 next_qp
= first_sg_wk_q_no
;
7738 q_addr
= ASC_QNO_TO_QADDR(next_qp
);
7739 scsi_sg_q
.sg_head_qp
= q_no
;
7740 scsi_sg_q
.cntl
= QCSG_SG_XFER_LIST
;
7741 for (i
= 0; i
< sg_head
->queue_cnt
; i
++) {
7742 scsi_sg_q
.seq_no
= i
+ 1;
7743 if (sg_entry_cnt
> ASC_SG_LIST_PER_Q
) {
7744 sg_list_dwords
= (uchar
)(ASC_SG_LIST_PER_Q
* 2);
7745 sg_entry_cnt
-= ASC_SG_LIST_PER_Q
;
7747 * After very first SG queue RISC FW uses next
7748 * SG queue first element then checks sg_list_cnt
7749 * against zero and then decrements, so set
7750 * sg_list_cnt 1 less than number of SG elements
7753 scsi_sg_q
.sg_list_cnt
= ASC_SG_LIST_PER_Q
- 1;
7754 scsi_sg_q
.sg_cur_list_cnt
=
7755 ASC_SG_LIST_PER_Q
- 1;
7758 * This is the last SG queue in the list of
7759 * allocated SG queues. If there are more
7760 * SG elements than will fit in the allocated
7761 * queues, then set the QCSG_SG_XFER_MORE flag.
7763 if (scsiq
->remain_sg_entry_cnt
!= 0) {
7764 scsi_sg_q
.cntl
|= QCSG_SG_XFER_MORE
;
7766 scsi_sg_q
.cntl
|= QCSG_SG_XFER_END
;
7768 /* equals sg_entry_cnt * 2 */
7769 sg_list_dwords
= sg_entry_cnt
<< 1;
7770 scsi_sg_q
.sg_list_cnt
= sg_entry_cnt
- 1;
7771 scsi_sg_q
.sg_cur_list_cnt
= sg_entry_cnt
- 1;
7775 scsi_sg_q
.q_no
= next_qp
;
7776 AscMemWordCopyPtrToLram(iop_base
,
7777 q_addr
+ ASC_SCSIQ_SGHD_CPY_BEG
,
7778 (uchar
*)&scsi_sg_q
,
7779 sizeof(ASC_SG_LIST_Q
) >> 1);
7781 AscMemDWordCopyPtrToLram(iop_base
,
7782 q_addr
+ ASC_SGQ_LIST_BEG
,
7784 sg_list
[scsiq
->next_sg_index
],
7787 scsiq
->next_sg_index
+= ASC_SG_LIST_PER_Q
;
7790 * If the just completed SG queue contained the
7791 * last SG element, then no more SG queues need
7794 if (scsi_sg_q
.cntl
& QCSG_SG_XFER_END
) {
7798 next_qp
= AscReadLramByte(iop_base
,
7801 q_addr
= ASC_QNO_TO_QADDR(next_qp
);
7805 * Clear the halt condition so the RISC will be restarted
7808 AscWriteLramWord(iop_base
, ASCV_HALTCODE_W
, 0);
7811 #endif /* CC_VERY_LONG_SG_LIST */
7816 _AscCopyLramScsiDoneQ(PortAddr iop_base
,
7818 ASC_QDONE_INFO
*scsiq
, ASC_DCNT max_dma_count
)
7823 DvcGetQinfo(iop_base
,
7824 q_addr
+ ASC_SCSIQ_DONE_INFO_BEG
,
7826 (sizeof(ASC_SCSIQ_2
) + sizeof(ASC_SCSIQ_3
)) / 2);
7828 _val
= AscReadLramWord(iop_base
,
7829 (ushort
)(q_addr
+ (ushort
)ASC_SCSIQ_B_STATUS
));
7830 scsiq
->q_status
= (uchar
)_val
;
7831 scsiq
->q_no
= (uchar
)(_val
>> 8);
7832 _val
= AscReadLramWord(iop_base
,
7833 (ushort
)(q_addr
+ (ushort
)ASC_SCSIQ_B_CNTL
));
7834 scsiq
->cntl
= (uchar
)_val
;
7835 sg_queue_cnt
= (uchar
)(_val
>> 8);
7836 _val
= AscReadLramWord(iop_base
,
7838 (ushort
)ASC_SCSIQ_B_SENSE_LEN
));
7839 scsiq
->sense_len
= (uchar
)_val
;
7840 scsiq
->extra_bytes
= (uchar
)(_val
>> 8);
7843 * Read high word of remain bytes from alternate location.
7845 scsiq
->remain_bytes
= (((ADV_DCNT
)AscReadLramWord(iop_base
,
7848 ASC_SCSIQ_W_ALT_DC1
)))
7851 * Read low word of remain bytes from original location.
7853 scsiq
->remain_bytes
+= AscReadLramWord(iop_base
,
7854 (ushort
)(q_addr
+ (ushort
)
7855 ASC_SCSIQ_DW_REMAIN_XFER_CNT
));
7857 scsiq
->remain_bytes
&= max_dma_count
;
7858 return (sg_queue_cnt
);
7861 static int AscIsrQDone(ASC_DVC_VAR
*asc_dvc
)
7870 ASC_SCSI_BIT_ID_TYPE scsi_busy
;
7871 ASC_SCSI_BIT_ID_TYPE target_id
;
7875 uchar cur_target_qng
;
7876 ASC_QDONE_INFO scsiq_buf
;
7877 ASC_QDONE_INFO
*scsiq
;
7880 iop_base
= asc_dvc
->iop_base
;
7882 scsiq
= (ASC_QDONE_INFO
*)&scsiq_buf
;
7883 done_q_tail
= (uchar
)AscGetVarDoneQTail(iop_base
);
7884 q_addr
= ASC_QNO_TO_QADDR(done_q_tail
);
7885 next_qp
= AscReadLramByte(iop_base
,
7886 (ushort
)(q_addr
+ (ushort
)ASC_SCSIQ_B_FWD
));
7887 if (next_qp
!= ASC_QLINK_END
) {
7888 AscPutVarDoneQTail(iop_base
, next_qp
);
7889 q_addr
= ASC_QNO_TO_QADDR(next_qp
);
7890 sg_queue_cnt
= _AscCopyLramScsiDoneQ(iop_base
, q_addr
, scsiq
,
7891 asc_dvc
->max_dma_count
);
7892 AscWriteLramByte(iop_base
,
7894 (ushort
)ASC_SCSIQ_B_STATUS
),
7896 q_status
& (uchar
)~(QS_READY
|
7898 tid_no
= ASC_TIX_TO_TID(scsiq
->d2
.target_ix
);
7899 target_id
= ASC_TIX_TO_TARGET_ID(scsiq
->d2
.target_ix
);
7900 if ((scsiq
->cntl
& QC_SG_HEAD
) != 0) {
7902 sg_list_qp
= next_qp
;
7903 for (q_cnt
= 0; q_cnt
< sg_queue_cnt
; q_cnt
++) {
7904 sg_list_qp
= AscReadLramByte(iop_base
,
7908 sg_q_addr
= ASC_QNO_TO_QADDR(sg_list_qp
);
7909 if (sg_list_qp
== ASC_QLINK_END
) {
7910 AscSetLibErrorCode(asc_dvc
,
7911 ASCQ_ERR_SG_Q_LINKS
);
7912 scsiq
->d3
.done_stat
= QD_WITH_ERROR
;
7913 scsiq
->d3
.host_stat
=
7914 QHSTA_D_QDONE_SG_LIST_CORRUPTED
;
7915 goto FATAL_ERR_QDONE
;
7917 AscWriteLramByte(iop_base
,
7918 (ushort
)(sg_q_addr
+ (ushort
)
7919 ASC_SCSIQ_B_STATUS
),
7922 n_q_used
= sg_queue_cnt
+ 1;
7923 AscPutVarDoneQTail(iop_base
, sg_list_qp
);
7925 if (asc_dvc
->queue_full_or_busy
& target_id
) {
7926 cur_target_qng
= AscReadLramByte(iop_base
,
7932 if (cur_target_qng
< asc_dvc
->max_dvc_qng
[tid_no
]) {
7933 scsi_busy
= AscReadLramByte(iop_base
, (ushort
)
7935 scsi_busy
&= ~target_id
;
7936 AscWriteLramByte(iop_base
,
7937 (ushort
)ASCV_SCSIBUSY_B
,
7939 asc_dvc
->queue_full_or_busy
&= ~target_id
;
7942 if (asc_dvc
->cur_total_qng
>= n_q_used
) {
7943 asc_dvc
->cur_total_qng
-= n_q_used
;
7944 if (asc_dvc
->cur_dvc_qng
[tid_no
] != 0) {
7945 asc_dvc
->cur_dvc_qng
[tid_no
]--;
7948 AscSetLibErrorCode(asc_dvc
, ASCQ_ERR_CUR_QNG
);
7949 scsiq
->d3
.done_stat
= QD_WITH_ERROR
;
7950 goto FATAL_ERR_QDONE
;
7952 if ((scsiq
->d2
.srb_ptr
== 0UL) ||
7953 ((scsiq
->q_status
& QS_ABORTED
) != 0)) {
7955 } else if (scsiq
->q_status
== QS_DONE
) {
7956 false_overrun
= FALSE
;
7957 if (scsiq
->extra_bytes
!= 0) {
7958 scsiq
->remain_bytes
+=
7959 (ADV_DCNT
)scsiq
->extra_bytes
;
7961 if (scsiq
->d3
.done_stat
== QD_WITH_ERROR
) {
7962 if (scsiq
->d3
.host_stat
==
7963 QHSTA_M_DATA_OVER_RUN
) {
7965 cntl
& (QC_DATA_IN
| QC_DATA_OUT
))
7967 scsiq
->d3
.done_stat
=
7969 scsiq
->d3
.host_stat
=
7971 } else if (false_overrun
) {
7972 scsiq
->d3
.done_stat
=
7974 scsiq
->d3
.host_stat
=
7977 } else if (scsiq
->d3
.host_stat
==
7978 QHSTA_M_HUNG_REQ_SCSI_BUS_RESET
) {
7979 AscStopChip(iop_base
);
7980 AscSetChipControl(iop_base
,
7981 (uchar
)(CC_SCSI_RESET
7983 DvcDelayNanoSecond(asc_dvc
, 60000);
7984 AscSetChipControl(iop_base
, CC_HALT
);
7985 AscSetChipStatus(iop_base
,
7986 CIW_CLR_SCSI_RESET_INT
);
7987 AscSetChipStatus(iop_base
, 0);
7988 AscSetChipControl(iop_base
, 0);
7991 if ((scsiq
->cntl
& QC_NO_CALLBACK
) == 0) {
7992 asc_isr_callback(asc_dvc
, scsiq
);
7994 if ((AscReadLramByte(iop_base
,
7995 (ushort
)(q_addr
+ (ushort
)
7998 asc_dvc
->unit_not_ready
&= ~target_id
;
7999 if (scsiq
->d3
.done_stat
!= QD_NO_ERROR
) {
8000 asc_dvc
->start_motor
&=
8007 AscSetLibErrorCode(asc_dvc
, ASCQ_ERR_Q_STATUS
);
8009 if ((scsiq
->cntl
& QC_NO_CALLBACK
) == 0) {
8010 asc_isr_callback(asc_dvc
, scsiq
);
8018 static int AscISR(ASC_DVC_VAR
*asc_dvc
)
8020 ASC_CS_TYPE chipstat
;
8022 ushort saved_ram_addr
;
8024 uchar saved_ctrl_reg
;
8029 iop_base
= asc_dvc
->iop_base
;
8030 int_pending
= FALSE
;
8032 if (AscIsIntPending(iop_base
) == 0) {
8036 if ((asc_dvc
->init_state
& ASC_INIT_STATE_END_LOAD_MC
) == 0) {
8039 if (asc_dvc
->in_critical_cnt
!= 0) {
8040 AscSetLibErrorCode(asc_dvc
, ASCQ_ERR_ISR_ON_CRITICAL
);
8043 if (asc_dvc
->is_in_int
) {
8044 AscSetLibErrorCode(asc_dvc
, ASCQ_ERR_ISR_RE_ENTRY
);
8047 asc_dvc
->is_in_int
= TRUE
;
8048 ctrl_reg
= AscGetChipControl(iop_base
);
8049 saved_ctrl_reg
= ctrl_reg
& (~(CC_SCSI_RESET
| CC_CHIP_RESET
|
8050 CC_SINGLE_STEP
| CC_DIAG
| CC_TEST
));
8051 chipstat
= AscGetChipStatus(iop_base
);
8052 if (chipstat
& CSW_SCSI_RESET_LATCH
) {
8053 if (!(asc_dvc
->bus_type
& (ASC_IS_VL
| ASC_IS_EISA
))) {
8056 asc_dvc
->sdtr_done
= 0;
8057 saved_ctrl_reg
&= (uchar
)(~CC_HALT
);
8058 while ((AscGetChipStatus(iop_base
) &
8059 CSW_SCSI_RESET_ACTIVE
) && (i
-- > 0)) {
8060 DvcSleepMilliSecond(100);
8062 AscSetChipControl(iop_base
, (CC_CHIP_RESET
| CC_HALT
));
8063 AscSetChipControl(iop_base
, CC_HALT
);
8064 AscSetChipStatus(iop_base
, CIW_CLR_SCSI_RESET_INT
);
8065 AscSetChipStatus(iop_base
, 0);
8066 chipstat
= AscGetChipStatus(iop_base
);
8069 saved_ram_addr
= AscGetChipLramAddr(iop_base
);
8070 host_flag
= AscReadLramByte(iop_base
,
8072 (uchar
)(~ASC_HOST_FLAG_IN_ISR
);
8073 AscWriteLramByte(iop_base
, ASCV_HOST_FLAG_B
,
8074 (uchar
)(host_flag
| (uchar
)ASC_HOST_FLAG_IN_ISR
));
8075 if ((chipstat
& CSW_INT_PENDING
)
8078 AscAckInterrupt(iop_base
);
8080 if ((chipstat
& CSW_HALTED
) && (ctrl_reg
& CC_SINGLE_STEP
)) {
8081 if (AscIsrChipHalted(asc_dvc
) == ERR
) {
8082 goto ISR_REPORT_QDONE_FATAL_ERROR
;
8084 saved_ctrl_reg
&= (uchar
)(~CC_HALT
);
8087 ISR_REPORT_QDONE_FATAL_ERROR
:
8088 if ((asc_dvc
->dvc_cntl
& ASC_CNTL_INT_MULTI_Q
) != 0) {
8090 AscIsrQDone(asc_dvc
)) & 0x01) != 0) {
8095 AscIsrQDone(asc_dvc
)) == 1) {
8098 } while (status
== 0x11);
8100 if ((status
& 0x80) != 0)
8104 AscWriteLramByte(iop_base
, ASCV_HOST_FLAG_B
, host_flag
);
8105 AscSetChipLramAddr(iop_base
, saved_ram_addr
);
8106 AscSetChipControl(iop_base
, saved_ctrl_reg
);
8107 asc_dvc
->is_in_int
= FALSE
;
8108 return (int_pending
);
8111 /* Microcode buffer is kept after initialization for error recovery. */
8112 static uchar _asc_mcode_buf
[] = {
8113 0x01, 0x03, 0x01, 0x19, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8114 0x00, 0x00, 0x00, 0x00,
8115 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
8116 0x00, 0x00, 0x00, 0x00,
8117 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8118 0x00, 0x00, 0x00, 0x00,
8119 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8120 0x00, 0x00, 0x00, 0x00,
8121 0x00, 0x00, 0x00, 0x00, 0xC3, 0x12, 0x0D, 0x05, 0x01, 0x00, 0x00, 0x00,
8122 0x00, 0xFF, 0x00, 0x00,
8123 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
8124 0x00, 0x00, 0x00, 0x00,
8125 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0xFF,
8126 0x00, 0x00, 0x00, 0x00,
8127 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x88,
8128 0x00, 0x00, 0x00, 0x00,
8129 0x80, 0x73, 0x48, 0x04, 0x36, 0x00, 0x00, 0xA2, 0xC2, 0x00, 0x80, 0x73,
8130 0x03, 0x23, 0x36, 0x40,
8131 0xB6, 0x00, 0x36, 0x00, 0x05, 0xD6, 0x0C, 0xD2, 0x12, 0xDA, 0x00, 0xA2,
8132 0xC2, 0x00, 0x92, 0x80,
8133 0x1E, 0x98, 0x50, 0x00, 0xF5, 0x00, 0x48, 0x98, 0xDF, 0x23, 0x36, 0x60,
8134 0xB6, 0x00, 0x92, 0x80,
8135 0x4F, 0x00, 0xF5, 0x00, 0x48, 0x98, 0xEF, 0x23, 0x36, 0x60, 0xB6, 0x00,
8136 0x92, 0x80, 0x80, 0x62,
8137 0x92, 0x80, 0x00, 0x46, 0x15, 0xEE, 0x13, 0xEA, 0x02, 0x01, 0x09, 0xD8,
8138 0xCD, 0x04, 0x4D, 0x00,
8139 0x00, 0xA3, 0xD6, 0x00, 0xA6, 0x97, 0x7F, 0x23, 0x04, 0x61, 0x84, 0x01,
8140 0xE6, 0x84, 0xD2, 0xC1,
8141 0x80, 0x73, 0xCD, 0x04, 0x4D, 0x00, 0x00, 0xA3, 0xDA, 0x01, 0xA6, 0x97,
8142 0xC6, 0x81, 0xC2, 0x88,
8143 0x80, 0x73, 0x80, 0x77, 0x00, 0x01, 0x01, 0xA1, 0xFE, 0x00, 0x4F, 0x00,
8144 0x84, 0x97, 0x07, 0xA6,
8145 0x08, 0x01, 0x00, 0x33, 0x03, 0x00, 0xC2, 0x88, 0x03, 0x03, 0x01, 0xDE,
8146 0xC2, 0x88, 0xCE, 0x00,
8147 0x69, 0x60, 0xCE, 0x00, 0x02, 0x03, 0x4A, 0x60, 0x00, 0xA2, 0x78, 0x01,
8148 0x80, 0x63, 0x07, 0xA6,
8149 0x24, 0x01, 0x78, 0x81, 0x03, 0x03, 0x80, 0x63, 0xE2, 0x00, 0x07, 0xA6,
8150 0x34, 0x01, 0x00, 0x33,
8151 0x04, 0x00, 0xC2, 0x88, 0x03, 0x07, 0x02, 0x01, 0x04, 0xCA, 0x0D, 0x23,
8152 0x68, 0x98, 0x4D, 0x04,
8153 0x04, 0x85, 0x05, 0xD8, 0x0D, 0x23, 0x68, 0x98, 0xCD, 0x04, 0x15, 0x23,
8154 0xF8, 0x88, 0xFB, 0x23,
8155 0x02, 0x61, 0x82, 0x01, 0x80, 0x63, 0x02, 0x03, 0x06, 0xA3, 0x62, 0x01,
8156 0x00, 0x33, 0x0A, 0x00,
8157 0xC2, 0x88, 0x4E, 0x00, 0x07, 0xA3, 0x6E, 0x01, 0x00, 0x33, 0x0B, 0x00,
8158 0xC2, 0x88, 0xCD, 0x04,
8159 0x36, 0x2D, 0x00, 0x33, 0x1A, 0x00, 0xC2, 0x88, 0x50, 0x04, 0x88, 0x81,
8160 0x06, 0xAB, 0x82, 0x01,
8161 0x88, 0x81, 0x4E, 0x00, 0x07, 0xA3, 0x92, 0x01, 0x50, 0x00, 0x00, 0xA3,
8162 0x3C, 0x01, 0x00, 0x05,
8163 0x7C, 0x81, 0x46, 0x97, 0x02, 0x01, 0x05, 0xC6, 0x04, 0x23, 0xA0, 0x01,
8164 0x15, 0x23, 0xA1, 0x01,
8165 0xBE, 0x81, 0xFD, 0x23, 0x02, 0x61, 0x82, 0x01, 0x0A, 0xDA, 0x4A, 0x00,
8166 0x06, 0x61, 0x00, 0xA0,
8167 0xB4, 0x01, 0x80, 0x63, 0xCD, 0x04, 0x36, 0x2D, 0x00, 0x33, 0x1B, 0x00,
8168 0xC2, 0x88, 0x06, 0x23,
8169 0x68, 0x98, 0xCD, 0x04, 0xE6, 0x84, 0x06, 0x01, 0x00, 0xA2, 0xD4, 0x01,
8170 0x57, 0x60, 0x00, 0xA0,
8171 0xDA, 0x01, 0xE6, 0x84, 0x80, 0x23, 0xA0, 0x01, 0xE6, 0x84, 0x80, 0x73,
8172 0x4B, 0x00, 0x06, 0x61,
8173 0x00, 0xA2, 0x00, 0x02, 0x04, 0x01, 0x0C, 0xDE, 0x02, 0x01, 0x03, 0xCC,
8174 0x4F, 0x00, 0x84, 0x97,
8175 0xFC, 0x81, 0x08, 0x23, 0x02, 0x41, 0x82, 0x01, 0x4F, 0x00, 0x62, 0x97,
8176 0x48, 0x04, 0x84, 0x80,
8177 0xF0, 0x97, 0x00, 0x46, 0x56, 0x00, 0x03, 0xC0, 0x01, 0x23, 0xE8, 0x00,
8178 0x81, 0x73, 0x06, 0x29,
8179 0x03, 0x42, 0x06, 0xE2, 0x03, 0xEE, 0x6B, 0xEB, 0x11, 0x23, 0xF8, 0x88,
8180 0x04, 0x98, 0xF0, 0x80,
8181 0x80, 0x73, 0x80, 0x77, 0x07, 0xA4, 0x2A, 0x02, 0x7C, 0x95, 0x06, 0xA6,
8182 0x34, 0x02, 0x03, 0xA6,
8183 0x4C, 0x04, 0x46, 0x82, 0x04, 0x01, 0x03, 0xD8, 0xB4, 0x98, 0x6A, 0x96,
8184 0x46, 0x82, 0xFE, 0x95,
8185 0x80, 0x67, 0x83, 0x03, 0x80, 0x63, 0xB6, 0x2D, 0x02, 0xA6, 0x6C, 0x02,
8186 0x07, 0xA6, 0x5A, 0x02,
8187 0x06, 0xA6, 0x5E, 0x02, 0x03, 0xA6, 0x62, 0x02, 0xC2, 0x88, 0x7C, 0x95,
8188 0x48, 0x82, 0x60, 0x96,
8189 0x48, 0x82, 0x04, 0x23, 0xA0, 0x01, 0x14, 0x23, 0xA1, 0x01, 0x3C, 0x84,
8190 0x04, 0x01, 0x0C, 0xDC,
8191 0xE0, 0x23, 0x25, 0x61, 0xEF, 0x00, 0x14, 0x01, 0x4F, 0x04, 0xA8, 0x01,
8192 0x6F, 0x00, 0xA5, 0x01,
8193 0x03, 0x23, 0xA4, 0x01, 0x06, 0x23, 0x9C, 0x01, 0x24, 0x2B, 0x1C, 0x01,
8194 0x02, 0xA6, 0xAA, 0x02,
8195 0x07, 0xA6, 0x5A, 0x02, 0x06, 0xA6, 0x5E, 0x02, 0x03, 0xA6, 0x20, 0x04,
8196 0x01, 0xA6, 0xB4, 0x02,
8197 0x00, 0xA6, 0xB4, 0x02, 0x00, 0x33, 0x12, 0x00, 0xC2, 0x88, 0x00, 0x0E,
8198 0x80, 0x63, 0x00, 0x43,
8199 0x00, 0xA0, 0x8C, 0x02, 0x4D, 0x04, 0x04, 0x01, 0x0B, 0xDC, 0xE7, 0x23,
8200 0x04, 0x61, 0x84, 0x01,
8201 0x10, 0x31, 0x12, 0x35, 0x14, 0x01, 0xEC, 0x00, 0x6C, 0x38, 0x00, 0x3F,
8202 0x00, 0x00, 0xEA, 0x82,
8203 0x18, 0x23, 0x04, 0x61, 0x18, 0xA0, 0xE2, 0x02, 0x04, 0x01, 0xA2, 0xC8,
8204 0x00, 0x33, 0x1F, 0x00,
8205 0xC2, 0x88, 0x08, 0x31, 0x0A, 0x35, 0x0C, 0x39, 0x0E, 0x3D, 0x7E, 0x98,
8206 0xB6, 0x2D, 0x01, 0xA6,
8207 0x14, 0x03, 0x00, 0xA6, 0x14, 0x03, 0x07, 0xA6, 0x0C, 0x03, 0x06, 0xA6,
8208 0x10, 0x03, 0x03, 0xA6,
8209 0x20, 0x04, 0x02, 0xA6, 0x6C, 0x02, 0x00, 0x33, 0x33, 0x00, 0xC2, 0x88,
8210 0x7C, 0x95, 0xEE, 0x82,
8211 0x60, 0x96, 0xEE, 0x82, 0x82, 0x98, 0x80, 0x42, 0x7E, 0x98, 0x64, 0xE4,
8212 0x04, 0x01, 0x2D, 0xC8,
8213 0x31, 0x05, 0x07, 0x01, 0x00, 0xA2, 0x54, 0x03, 0x00, 0x43, 0x87, 0x01,
8214 0x05, 0x05, 0x86, 0x98,
8215 0x7E, 0x98, 0x00, 0xA6, 0x16, 0x03, 0x07, 0xA6, 0x4C, 0x03, 0x03, 0xA6,
8216 0x3C, 0x04, 0x06, 0xA6,
8217 0x50, 0x03, 0x01, 0xA6, 0x16, 0x03, 0x00, 0x33, 0x25, 0x00, 0xC2, 0x88,
8218 0x7C, 0x95, 0x32, 0x83,
8219 0x60, 0x96, 0x32, 0x83, 0x04, 0x01, 0x10, 0xCE, 0x07, 0xC8, 0x05, 0x05,
8220 0xEB, 0x04, 0x00, 0x33,
8221 0x00, 0x20, 0xC0, 0x20, 0x81, 0x62, 0x72, 0x83, 0x00, 0x01, 0x05, 0x05,
8222 0xFF, 0xA2, 0x7A, 0x03,
8223 0xB1, 0x01, 0x08, 0x23, 0xB2, 0x01, 0x2E, 0x83, 0x05, 0x05, 0x15, 0x01,
8224 0x00, 0xA2, 0x9A, 0x03,
8225 0xEC, 0x00, 0x6E, 0x00, 0x95, 0x01, 0x6C, 0x38, 0x00, 0x3F, 0x00, 0x00,
8226 0x01, 0xA6, 0x96, 0x03,
8227 0x00, 0xA6, 0x96, 0x03, 0x10, 0x84, 0x80, 0x42, 0x7E, 0x98, 0x01, 0xA6,
8228 0xA4, 0x03, 0x00, 0xA6,
8229 0xBC, 0x03, 0x10, 0x84, 0xA8, 0x98, 0x80, 0x42, 0x01, 0xA6, 0xA4, 0x03,
8230 0x07, 0xA6, 0xB2, 0x03,
8231 0xD4, 0x83, 0x7C, 0x95, 0xA8, 0x83, 0x00, 0x33, 0x2F, 0x00, 0xC2, 0x88,
8232 0xA8, 0x98, 0x80, 0x42,
8233 0x00, 0xA6, 0xBC, 0x03, 0x07, 0xA6, 0xCA, 0x03, 0xD4, 0x83, 0x7C, 0x95,
8234 0xC0, 0x83, 0x00, 0x33,
8235 0x26, 0x00, 0xC2, 0x88, 0x38, 0x2B, 0x80, 0x32, 0x80, 0x36, 0x04, 0x23,
8236 0xA0, 0x01, 0x12, 0x23,
8237 0xA1, 0x01, 0x10, 0x84, 0x07, 0xF0, 0x06, 0xA4, 0xF4, 0x03, 0x80, 0x6B,
8238 0x80, 0x67, 0x05, 0x23,
8239 0x83, 0x03, 0x80, 0x63, 0x03, 0xA6, 0x0E, 0x04, 0x07, 0xA6, 0x06, 0x04,
8240 0x06, 0xA6, 0x0A, 0x04,
8241 0x00, 0x33, 0x17, 0x00, 0xC2, 0x88, 0x7C, 0x95, 0xF4, 0x83, 0x60, 0x96,
8242 0xF4, 0x83, 0x20, 0x84,
8243 0x07, 0xF0, 0x06, 0xA4, 0x20, 0x04, 0x80, 0x6B, 0x80, 0x67, 0x05, 0x23,
8244 0x83, 0x03, 0x80, 0x63,
8245 0xB6, 0x2D, 0x03, 0xA6, 0x3C, 0x04, 0x07, 0xA6, 0x34, 0x04, 0x06, 0xA6,
8246 0x38, 0x04, 0x00, 0x33,
8247 0x30, 0x00, 0xC2, 0x88, 0x7C, 0x95, 0x20, 0x84, 0x60, 0x96, 0x20, 0x84,
8248 0x1D, 0x01, 0x06, 0xCC,
8249 0x00, 0x33, 0x00, 0x84, 0xC0, 0x20, 0x00, 0x23, 0xEA, 0x00, 0x81, 0x62,
8250 0xA2, 0x0D, 0x80, 0x63,
8251 0x07, 0xA6, 0x5A, 0x04, 0x00, 0x33, 0x18, 0x00, 0xC2, 0x88, 0x03, 0x03,
8252 0x80, 0x63, 0xA3, 0x01,
8253 0x07, 0xA4, 0x64, 0x04, 0x23, 0x01, 0x00, 0xA2, 0x86, 0x04, 0x0A, 0xA0,
8254 0x76, 0x04, 0xE0, 0x00,
8255 0x00, 0x33, 0x1D, 0x00, 0xC2, 0x88, 0x0B, 0xA0, 0x82, 0x04, 0xE0, 0x00,
8256 0x00, 0x33, 0x1E, 0x00,
8257 0xC2, 0x88, 0x42, 0x23, 0xF8, 0x88, 0x00, 0x23, 0x22, 0xA3, 0xE6, 0x04,
8258 0x08, 0x23, 0x22, 0xA3,
8259 0xA2, 0x04, 0x28, 0x23, 0x22, 0xA3, 0xAE, 0x04, 0x02, 0x23, 0x22, 0xA3,
8260 0xC4, 0x04, 0x42, 0x23,
8261 0xF8, 0x88, 0x4A, 0x00, 0x06, 0x61, 0x00, 0xA0, 0xAE, 0x04, 0x45, 0x23,
8262 0xF8, 0x88, 0x04, 0x98,
8263 0x00, 0xA2, 0xC0, 0x04, 0xB4, 0x98, 0x00, 0x33, 0x00, 0x82, 0xC0, 0x20,
8264 0x81, 0x62, 0xE8, 0x81,
8265 0x47, 0x23, 0xF8, 0x88, 0x04, 0x01, 0x0B, 0xDE, 0x04, 0x98, 0xB4, 0x98,
8266 0x00, 0x33, 0x00, 0x81,
8267 0xC0, 0x20, 0x81, 0x62, 0x14, 0x01, 0x00, 0xA0, 0x00, 0x02, 0x43, 0x23,
8268 0xF8, 0x88, 0x04, 0x23,
8269 0xA0, 0x01, 0x44, 0x23, 0xA1, 0x01, 0x80, 0x73, 0x4D, 0x00, 0x03, 0xA3,
8270 0xF4, 0x04, 0x00, 0x33,
8271 0x27, 0x00, 0xC2, 0x88, 0x04, 0x01, 0x04, 0xDC, 0x02, 0x23, 0xA2, 0x01,
8272 0x04, 0x23, 0xA0, 0x01,
8273 0x04, 0x98, 0x26, 0x95, 0x4B, 0x00, 0xF6, 0x00, 0x4F, 0x04, 0x4F, 0x00,
8274 0x00, 0xA3, 0x22, 0x05,
8275 0x00, 0x05, 0x76, 0x00, 0x06, 0x61, 0x00, 0xA2, 0x1C, 0x05, 0x0A, 0x85,
8276 0x46, 0x97, 0xCD, 0x04,
8277 0x24, 0x85, 0x48, 0x04, 0x84, 0x80, 0x02, 0x01, 0x03, 0xDA, 0x80, 0x23,
8278 0x82, 0x01, 0x34, 0x85,
8279 0x02, 0x23, 0xA0, 0x01, 0x4A, 0x00, 0x06, 0x61, 0x00, 0xA2, 0x40, 0x05,
8280 0x1D, 0x01, 0x04, 0xD6,
8281 0xFF, 0x23, 0x86, 0x41, 0x4B, 0x60, 0xCB, 0x00, 0xFF, 0x23, 0x80, 0x01,
8282 0x49, 0x00, 0x81, 0x01,
8283 0x04, 0x01, 0x02, 0xC8, 0x30, 0x01, 0x80, 0x01, 0xF7, 0x04, 0x03, 0x01,
8284 0x49, 0x04, 0x80, 0x01,
8285 0xC9, 0x00, 0x00, 0x05, 0x00, 0x01, 0xFF, 0xA0, 0x60, 0x05, 0x77, 0x04,
8286 0x01, 0x23, 0xEA, 0x00,
8287 0x5D, 0x00, 0xFE, 0xC7, 0x00, 0x62, 0x00, 0x23, 0xEA, 0x00, 0x00, 0x63,
8288 0x07, 0xA4, 0xF8, 0x05,
8289 0x03, 0x03, 0x02, 0xA0, 0x8E, 0x05, 0xF4, 0x85, 0x00, 0x33, 0x2D, 0x00,
8290 0xC2, 0x88, 0x04, 0xA0,
8291 0xB8, 0x05, 0x80, 0x63, 0x00, 0x23, 0xDF, 0x00, 0x4A, 0x00, 0x06, 0x61,
8292 0x00, 0xA2, 0xA4, 0x05,
8293 0x1D, 0x01, 0x06, 0xD6, 0x02, 0x23, 0x02, 0x41, 0x82, 0x01, 0x50, 0x00,
8294 0x62, 0x97, 0x04, 0x85,
8295 0x04, 0x23, 0x02, 0x41, 0x82, 0x01, 0x04, 0x85, 0x08, 0xA0, 0xBE, 0x05,
8296 0xF4, 0x85, 0x03, 0xA0,
8297 0xC4, 0x05, 0xF4, 0x85, 0x01, 0xA0, 0xCE, 0x05, 0x88, 0x00, 0x80, 0x63,
8298 0xCC, 0x86, 0x07, 0xA0,
8299 0xEE, 0x05, 0x5F, 0x00, 0x00, 0x2B, 0xDF, 0x08, 0x00, 0xA2, 0xE6, 0x05,
8300 0x80, 0x67, 0x80, 0x63,
8301 0x01, 0xA2, 0x7A, 0x06, 0x7C, 0x85, 0x06, 0x23, 0x68, 0x98, 0x48, 0x23,
8302 0xF8, 0x88, 0x07, 0x23,
8303 0x80, 0x00, 0x06, 0x87, 0x80, 0x63, 0x7C, 0x85, 0x00, 0x23, 0xDF, 0x00,
8304 0x00, 0x63, 0x4A, 0x00,
8305 0x06, 0x61, 0x00, 0xA2, 0x36, 0x06, 0x1D, 0x01, 0x16, 0xD4, 0xC0, 0x23,
8306 0x07, 0x41, 0x83, 0x03,
8307 0x80, 0x63, 0x06, 0xA6, 0x1C, 0x06, 0x00, 0x33, 0x37, 0x00, 0xC2, 0x88,
8308 0x1D, 0x01, 0x01, 0xD6,
8309 0x20, 0x23, 0x63, 0x60, 0x83, 0x03, 0x80, 0x63, 0x02, 0x23, 0xDF, 0x00,
8310 0x07, 0xA6, 0x7C, 0x05,
8311 0xEF, 0x04, 0x6F, 0x00, 0x00, 0x63, 0x4B, 0x00, 0x06, 0x41, 0xCB, 0x00,
8312 0x52, 0x00, 0x06, 0x61,
8313 0x00, 0xA2, 0x4E, 0x06, 0x1D, 0x01, 0x03, 0xCA, 0xC0, 0x23, 0x07, 0x41,
8314 0x00, 0x63, 0x1D, 0x01,
8315 0x04, 0xCC, 0x00, 0x33, 0x00, 0x83, 0xC0, 0x20, 0x81, 0x62, 0x80, 0x23,
8316 0x07, 0x41, 0x00, 0x63,
8317 0x80, 0x67, 0x08, 0x23, 0x83, 0x03, 0x80, 0x63, 0x00, 0x63, 0x01, 0x23,
8318 0xDF, 0x00, 0x06, 0xA6,
8319 0x84, 0x06, 0x07, 0xA6, 0x7C, 0x05, 0x80, 0x67, 0x80, 0x63, 0x00, 0x33,
8320 0x00, 0x40, 0xC0, 0x20,
8321 0x81, 0x62, 0x00, 0x63, 0x00, 0x00, 0xFE, 0x95, 0x83, 0x03, 0x80, 0x63,
8322 0x06, 0xA6, 0x94, 0x06,
8323 0x07, 0xA6, 0x7C, 0x05, 0x00, 0x00, 0x01, 0xA0, 0x14, 0x07, 0x00, 0x2B,
8324 0x40, 0x0E, 0x80, 0x63,
8325 0x01, 0x00, 0x06, 0xA6, 0xAA, 0x06, 0x07, 0xA6, 0x7C, 0x05, 0x40, 0x0E,
8326 0x80, 0x63, 0x00, 0x43,
8327 0x00, 0xA0, 0xA2, 0x06, 0x06, 0xA6, 0xBC, 0x06, 0x07, 0xA6, 0x7C, 0x05,
8328 0x80, 0x67, 0x40, 0x0E,
8329 0x80, 0x63, 0x07, 0xA6, 0x7C, 0x05, 0x00, 0x23, 0xDF, 0x00, 0x00, 0x63,
8330 0x07, 0xA6, 0xD6, 0x06,
8331 0x00, 0x33, 0x2A, 0x00, 0xC2, 0x88, 0x03, 0x03, 0x80, 0x63, 0x89, 0x00,
8332 0x0A, 0x2B, 0x07, 0xA6,
8333 0xE8, 0x06, 0x00, 0x33, 0x29, 0x00, 0xC2, 0x88, 0x00, 0x43, 0x00, 0xA2,
8334 0xF4, 0x06, 0xC0, 0x0E,
8335 0x80, 0x63, 0xDE, 0x86, 0xC0, 0x0E, 0x00, 0x33, 0x00, 0x80, 0xC0, 0x20,
8336 0x81, 0x62, 0x04, 0x01,
8337 0x02, 0xDA, 0x80, 0x63, 0x7C, 0x85, 0x80, 0x7B, 0x80, 0x63, 0x06, 0xA6,
8338 0x8C, 0x06, 0x00, 0x33,
8339 0x2C, 0x00, 0xC2, 0x88, 0x0C, 0xA2, 0x2E, 0x07, 0xFE, 0x95, 0x83, 0x03,
8340 0x80, 0x63, 0x06, 0xA6,
8341 0x2C, 0x07, 0x07, 0xA6, 0x7C, 0x05, 0x00, 0x33, 0x3D, 0x00, 0xC2, 0x88,
8342 0x00, 0x00, 0x80, 0x67,
8343 0x83, 0x03, 0x80, 0x63, 0x0C, 0xA0, 0x44, 0x07, 0x07, 0xA6, 0x7C, 0x05,
8344 0xBF, 0x23, 0x04, 0x61,
8345 0x84, 0x01, 0xE6, 0x84, 0x00, 0x63, 0xF0, 0x04, 0x01, 0x01, 0xF1, 0x00,
8346 0x00, 0x01, 0xF2, 0x00,
8347 0x01, 0x05, 0x80, 0x01, 0x72, 0x04, 0x71, 0x00, 0x81, 0x01, 0x70, 0x04,
8348 0x80, 0x05, 0x81, 0x05,
8349 0x00, 0x63, 0xF0, 0x04, 0xF2, 0x00, 0x72, 0x04, 0x01, 0x01, 0xF1, 0x00,
8350 0x70, 0x00, 0x81, 0x01,
8351 0x70, 0x04, 0x71, 0x00, 0x81, 0x01, 0x72, 0x00, 0x80, 0x01, 0x71, 0x04,
8352 0x70, 0x00, 0x80, 0x01,
8353 0x70, 0x04, 0x00, 0x63, 0xF0, 0x04, 0xF2, 0x00, 0x72, 0x04, 0x00, 0x01,
8354 0xF1, 0x00, 0x70, 0x00,
8355 0x80, 0x01, 0x70, 0x04, 0x71, 0x00, 0x80, 0x01, 0x72, 0x00, 0x81, 0x01,
8356 0x71, 0x04, 0x70, 0x00,
8357 0x81, 0x01, 0x70, 0x04, 0x00, 0x63, 0x00, 0x23, 0xB3, 0x01, 0x83, 0x05,
8358 0xA3, 0x01, 0xA2, 0x01,
8359 0xA1, 0x01, 0x01, 0x23, 0xA0, 0x01, 0x00, 0x01, 0xC8, 0x00, 0x03, 0xA1,
8360 0xC4, 0x07, 0x00, 0x33,
8361 0x07, 0x00, 0xC2, 0x88, 0x80, 0x05, 0x81, 0x05, 0x04, 0x01, 0x11, 0xC8,
8362 0x48, 0x00, 0xB0, 0x01,
8363 0xB1, 0x01, 0x08, 0x23, 0xB2, 0x01, 0x05, 0x01, 0x48, 0x04, 0x00, 0x43,
8364 0x00, 0xA2, 0xE4, 0x07,
8365 0x00, 0x05, 0xDA, 0x87, 0x00, 0x01, 0xC8, 0x00, 0xFF, 0x23, 0x80, 0x01,
8366 0x05, 0x05, 0x00, 0x63,
8367 0xF7, 0x04, 0x1A, 0x09, 0xF6, 0x08, 0x6E, 0x04, 0x00, 0x02, 0x80, 0x43,
8368 0x76, 0x08, 0x80, 0x02,
8369 0x77, 0x04, 0x00, 0x63, 0xF7, 0x04, 0x1A, 0x09, 0xF6, 0x08, 0x6E, 0x04,
8370 0x00, 0x02, 0x00, 0xA0,
8371 0x14, 0x08, 0x16, 0x88, 0x00, 0x43, 0x76, 0x08, 0x80, 0x02, 0x77, 0x04,
8372 0x00, 0x63, 0xF3, 0x04,
8373 0x00, 0x23, 0xF4, 0x00, 0x74, 0x00, 0x80, 0x43, 0xF4, 0x00, 0xCF, 0x40,
8374 0x00, 0xA2, 0x44, 0x08,
8375 0x74, 0x04, 0x02, 0x01, 0xF7, 0xC9, 0xF6, 0xD9, 0x00, 0x01, 0x01, 0xA1,
8376 0x24, 0x08, 0x04, 0x98,
8377 0x26, 0x95, 0x24, 0x88, 0x73, 0x04, 0x00, 0x63, 0xF3, 0x04, 0x75, 0x04,
8378 0x5A, 0x88, 0x02, 0x01,
8379 0x04, 0xD8, 0x46, 0x97, 0x04, 0x98, 0x26, 0x95, 0x4A, 0x88, 0x75, 0x00,
8380 0x00, 0xA3, 0x64, 0x08,
8381 0x00, 0x05, 0x4E, 0x88, 0x73, 0x04, 0x00, 0x63, 0x80, 0x7B, 0x80, 0x63,
8382 0x06, 0xA6, 0x76, 0x08,
8383 0x00, 0x33, 0x3E, 0x00, 0xC2, 0x88, 0x80, 0x67, 0x83, 0x03, 0x80, 0x63,
8384 0x00, 0x63, 0x38, 0x2B,
8385 0x9C, 0x88, 0x38, 0x2B, 0x92, 0x88, 0x32, 0x09, 0x31, 0x05, 0x92, 0x98,
8386 0x05, 0x05, 0xB2, 0x09,
8387 0x00, 0x63, 0x00, 0x32, 0x00, 0x36, 0x00, 0x3A, 0x00, 0x3E, 0x00, 0x63,
8388 0x80, 0x32, 0x80, 0x36,
8389 0x80, 0x3A, 0x80, 0x3E, 0xB4, 0x3D, 0x00, 0x63, 0x38, 0x2B, 0x40, 0x32,
8390 0x40, 0x36, 0x40, 0x3A,
8391 0x40, 0x3E, 0x00, 0x63, 0x5A, 0x20, 0xC9, 0x40, 0x00, 0xA0, 0xB4, 0x08,
8392 0x5D, 0x00, 0xFE, 0xC3,
8393 0x00, 0x63, 0x80, 0x73, 0xE6, 0x20, 0x02, 0x23, 0xE8, 0x00, 0x82, 0x73,
8394 0xFF, 0xFD, 0x80, 0x73,
8395 0x13, 0x23, 0xF8, 0x88, 0x66, 0x20, 0xC0, 0x20, 0x04, 0x23, 0xA0, 0x01,
8396 0xA1, 0x23, 0xA1, 0x01,
8397 0x81, 0x62, 0xE2, 0x88, 0x80, 0x73, 0x80, 0x77, 0x68, 0x00, 0x00, 0xA2,
8398 0x80, 0x00, 0x03, 0xC2,
8399 0xF1, 0xC7, 0x41, 0x23, 0xF8, 0x88, 0x11, 0x23, 0xA1, 0x01, 0x04, 0x23,
8400 0xA0, 0x01, 0xE6, 0x84,
8403 static ushort _asc_mcode_size
= sizeof(_asc_mcode_buf
);
8404 static ADV_DCNT _asc_mcode_chksum
= 0x012C453FUL
;
8406 #define ASC_SYN_OFFSET_ONE_DISABLE_LIST 16
8407 static uchar _syn_offset_one_disable_cmd
[ASC_SYN_OFFSET_ONE_DISABLE_LIST
] = {
8426 static int AscExeScsiQueue(ASC_DVC_VAR
*asc_dvc
, ASC_SCSI_Q
*scsiq
)
8429 ulong last_int_level
;
8432 int disable_syn_offset_one_fix
;
8435 ushort sg_entry_cnt
= 0;
8436 ushort sg_entry_cnt_minus_one
= 0;
8443 ASC_SG_HEAD
*sg_head
;
8446 iop_base
= asc_dvc
->iop_base
;
8447 sg_head
= scsiq
->sg_head
;
8448 if (asc_dvc
->err_code
!= 0)
8450 if (scsiq
== (ASC_SCSI_Q
*)0L) {
8451 AscSetLibErrorCode(asc_dvc
, ASCQ_ERR_SCSIQ_NULL_PTR
);
8455 if ((scsiq
->q2
.tag_code
& ASC_TAG_FLAG_EXTRA_BYTES
) == 0) {
8456 scsiq
->q1
.extra_bytes
= 0;
8459 target_ix
= scsiq
->q2
.target_ix
;
8460 tid_no
= ASC_TIX_TO_TID(target_ix
);
8462 if (scsiq
->cdbptr
[0] == REQUEST_SENSE
) {
8463 if ((asc_dvc
->init_sdtr
& scsiq
->q1
.target_id
) != 0) {
8464 asc_dvc
->sdtr_done
&= ~scsiq
->q1
.target_id
;
8465 sdtr_data
= AscGetMCodeInitSDTRAtID(iop_base
, tid_no
);
8466 AscMsgOutSDTR(asc_dvc
,
8468 sdtr_period_tbl
[(sdtr_data
>> 4) &
8472 (uchar
)(sdtr_data
& (uchar
)
8473 ASC_SYN_MAX_OFFSET
));
8474 scsiq
->q1
.cntl
|= (QC_MSG_OUT
| QC_URGENT
);
8477 last_int_level
= DvcEnterCritical();
8478 if (asc_dvc
->in_critical_cnt
!= 0) {
8479 DvcLeaveCritical(last_int_level
);
8480 AscSetLibErrorCode(asc_dvc
, ASCQ_ERR_CRITICAL_RE_ENTRY
);
8483 asc_dvc
->in_critical_cnt
++;
8484 if ((scsiq
->q1
.cntl
& QC_SG_HEAD
) != 0) {
8485 if ((sg_entry_cnt
= sg_head
->entry_cnt
) == 0) {
8486 asc_dvc
->in_critical_cnt
--;
8487 DvcLeaveCritical(last_int_level
);
8490 #if !CC_VERY_LONG_SG_LIST
8491 if (sg_entry_cnt
> ASC_MAX_SG_LIST
) {
8492 asc_dvc
->in_critical_cnt
--;
8493 DvcLeaveCritical(last_int_level
);
8496 #endif /* !CC_VERY_LONG_SG_LIST */
8497 if (sg_entry_cnt
== 1) {
8498 scsiq
->q1
.data_addr
=
8499 (ADV_PADDR
)sg_head
->sg_list
[0].addr
;
8500 scsiq
->q1
.data_cnt
=
8501 (ADV_DCNT
)sg_head
->sg_list
[0].bytes
;
8502 scsiq
->q1
.cntl
&= ~(QC_SG_HEAD
| QC_SG_SWAP_QUEUE
);
8504 sg_entry_cnt_minus_one
= sg_entry_cnt
- 1;
8506 scsi_cmd
= scsiq
->cdbptr
[0];
8507 disable_syn_offset_one_fix
= FALSE
;
8508 if ((asc_dvc
->pci_fix_asyn_xfer
& scsiq
->q1
.target_id
) &&
8509 !(asc_dvc
->pci_fix_asyn_xfer_always
& scsiq
->q1
.target_id
)) {
8510 if (scsiq
->q1
.cntl
& QC_SG_HEAD
) {
8512 for (i
= 0; i
< sg_entry_cnt
; i
++) {
8514 (ADV_DCNT
)le32_to_cpu(sg_head
->sg_list
[i
].
8518 data_cnt
= le32_to_cpu(scsiq
->q1
.data_cnt
);
8520 if (data_cnt
!= 0UL) {
8521 if (data_cnt
< 512UL) {
8522 disable_syn_offset_one_fix
= TRUE
;
8524 for (i
= 0; i
< ASC_SYN_OFFSET_ONE_DISABLE_LIST
;
8527 _syn_offset_one_disable_cmd
[i
];
8528 if (disable_cmd
== 0xFF) {
8531 if (scsi_cmd
== disable_cmd
) {
8532 disable_syn_offset_one_fix
=
8540 if (disable_syn_offset_one_fix
) {
8541 scsiq
->q2
.tag_code
&= ~MSG_SIMPLE_TAG
;
8542 scsiq
->q2
.tag_code
|= (ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX
|
8543 ASC_TAG_FLAG_DISABLE_DISCONNECT
);
8545 scsiq
->q2
.tag_code
&= 0x27;
8547 if ((scsiq
->q1
.cntl
& QC_SG_HEAD
) != 0) {
8548 if (asc_dvc
->bug_fix_cntl
) {
8549 if (asc_dvc
->bug_fix_cntl
& ASC_BUG_FIX_IF_NOT_DWB
) {
8550 if ((scsi_cmd
== READ_6
) ||
8551 (scsi_cmd
== READ_10
)) {
8553 (ADV_PADDR
)le32_to_cpu(sg_head
->
8555 [sg_entry_cnt_minus_one
].
8557 (ADV_DCNT
)le32_to_cpu(sg_head
->
8559 [sg_entry_cnt_minus_one
].
8562 (uchar
)((ushort
)addr
& 0x0003);
8563 if ((extra_bytes
!= 0)
8567 ASC_TAG_FLAG_EXTRA_BYTES
)
8569 scsiq
->q2
.tag_code
|=
8570 ASC_TAG_FLAG_EXTRA_BYTES
;
8571 scsiq
->q1
.extra_bytes
=
8574 le32_to_cpu(sg_head
->
8576 [sg_entry_cnt_minus_one
].
8579 (ASC_DCNT
) extra_bytes
;
8582 [sg_entry_cnt_minus_one
].
8584 cpu_to_le32(data_cnt
);
8589 sg_head
->entry_to_copy
= sg_head
->entry_cnt
;
8590 #if CC_VERY_LONG_SG_LIST
8592 * Set the sg_entry_cnt to the maximum possible. The rest of
8593 * the SG elements will be copied when the RISC completes the
8594 * SG elements that fit and halts.
8596 if (sg_entry_cnt
> ASC_MAX_SG_LIST
) {
8597 sg_entry_cnt
= ASC_MAX_SG_LIST
;
8599 #endif /* CC_VERY_LONG_SG_LIST */
8600 n_q_required
= AscSgListToQueue(sg_entry_cnt
);
8601 if ((AscGetNumOfFreeQueue(asc_dvc
, target_ix
, n_q_required
) >=
8602 (uint
) n_q_required
)
8603 || ((scsiq
->q1
.cntl
& QC_URGENT
) != 0)) {
8605 AscSendScsiQueue(asc_dvc
, scsiq
,
8606 n_q_required
)) == 1) {
8607 asc_dvc
->in_critical_cnt
--;
8608 DvcLeaveCritical(last_int_level
);
8613 if (asc_dvc
->bug_fix_cntl
) {
8614 if (asc_dvc
->bug_fix_cntl
& ASC_BUG_FIX_IF_NOT_DWB
) {
8615 if ((scsi_cmd
== READ_6
) ||
8616 (scsi_cmd
== READ_10
)) {
8618 le32_to_cpu(scsiq
->q1
.data_addr
) +
8619 le32_to_cpu(scsiq
->q1
.data_cnt
);
8621 (uchar
)((ushort
)addr
& 0x0003);
8622 if ((extra_bytes
!= 0)
8626 ASC_TAG_FLAG_EXTRA_BYTES
)
8629 le32_to_cpu(scsiq
->q1
.
8631 if (((ushort
)data_cnt
& 0x01FF)
8633 scsiq
->q2
.tag_code
|=
8634 ASC_TAG_FLAG_EXTRA_BYTES
;
8635 data_cnt
-= (ASC_DCNT
)
8637 scsiq
->q1
.data_cnt
=
8640 scsiq
->q1
.extra_bytes
=
8648 if ((AscGetNumOfFreeQueue(asc_dvc
, target_ix
, 1) >= 1) ||
8649 ((scsiq
->q1
.cntl
& QC_URGENT
) != 0)) {
8650 if ((sta
= AscSendScsiQueue(asc_dvc
, scsiq
,
8651 n_q_required
)) == 1) {
8652 asc_dvc
->in_critical_cnt
--;
8653 DvcLeaveCritical(last_int_level
);
8658 asc_dvc
->in_critical_cnt
--;
8659 DvcLeaveCritical(last_int_level
);
8664 AscSendScsiQueue(ASC_DVC_VAR
*asc_dvc
, ASC_SCSI_Q
*scsiq
, uchar n_q_required
)
8673 iop_base
= asc_dvc
->iop_base
;
8674 target_ix
= scsiq
->q2
.target_ix
;
8675 tid_no
= ASC_TIX_TO_TID(target_ix
);
8677 free_q_head
= (uchar
)AscGetVarFreeQHead(iop_base
);
8678 if (n_q_required
> 1) {
8679 if ((next_qp
= AscAllocMultipleFreeQueue(iop_base
,
8680 free_q_head
, (uchar
)
8682 != (uchar
)ASC_QLINK_END
) {
8683 asc_dvc
->last_q_shortage
= 0;
8684 scsiq
->sg_head
->queue_cnt
= n_q_required
- 1;
8685 scsiq
->q1
.q_no
= free_q_head
;
8686 if ((sta
= AscPutReadySgListQueue(asc_dvc
, scsiq
,
8687 free_q_head
)) == 1) {
8688 AscPutVarFreeQHead(iop_base
, next_qp
);
8689 asc_dvc
->cur_total_qng
+= (uchar
)(n_q_required
);
8690 asc_dvc
->cur_dvc_qng
[tid_no
]++;
8694 } else if (n_q_required
== 1) {
8695 if ((next_qp
= AscAllocFreeQueue(iop_base
,
8698 scsiq
->q1
.q_no
= free_q_head
;
8699 if ((sta
= AscPutReadyQueue(asc_dvc
, scsiq
,
8700 free_q_head
)) == 1) {
8701 AscPutVarFreeQHead(iop_base
, next_qp
);
8702 asc_dvc
->cur_total_qng
++;
8703 asc_dvc
->cur_dvc_qng
[tid_no
]++;
8711 static int AscSgListToQueue(int sg_list
)
8715 n_sg_list_qs
= ((sg_list
- 1) / ASC_SG_LIST_PER_Q
);
8716 if (((sg_list
- 1) % ASC_SG_LIST_PER_Q
) != 0)
8718 return (n_sg_list_qs
+ 1);
8722 AscGetNumOfFreeQueue(ASC_DVC_VAR
*asc_dvc
, uchar target_ix
, uchar n_qs
)
8726 ASC_SCSI_BIT_ID_TYPE target_id
;
8729 target_id
= ASC_TIX_TO_TARGET_ID(target_ix
);
8730 tid_no
= ASC_TIX_TO_TID(target_ix
);
8731 if ((asc_dvc
->unit_not_ready
& target_id
) ||
8732 (asc_dvc
->queue_full_or_busy
& target_id
)) {
8736 cur_used_qs
= (uint
) asc_dvc
->cur_total_qng
+
8737 (uint
) asc_dvc
->last_q_shortage
+ (uint
) ASC_MIN_FREE_Q
;
8739 cur_used_qs
= (uint
) asc_dvc
->cur_total_qng
+
8740 (uint
) ASC_MIN_FREE_Q
;
8742 if ((uint
) (cur_used_qs
+ n_qs
) <= (uint
) asc_dvc
->max_total_qng
) {
8743 cur_free_qs
= (uint
) asc_dvc
->max_total_qng
- cur_used_qs
;
8744 if (asc_dvc
->cur_dvc_qng
[tid_no
] >=
8745 asc_dvc
->max_dvc_qng
[tid_no
]) {
8748 return (cur_free_qs
);
8751 if ((n_qs
> asc_dvc
->last_q_shortage
)
8752 && (n_qs
<= (asc_dvc
->max_total_qng
- ASC_MIN_FREE_Q
))) {
8753 asc_dvc
->last_q_shortage
= n_qs
;
8759 static int AscPutReadyQueue(ASC_DVC_VAR
*asc_dvc
, ASC_SCSI_Q
*scsiq
, uchar q_no
)
8764 uchar syn_period_ix
;
8768 iop_base
= asc_dvc
->iop_base
;
8769 if (((asc_dvc
->init_sdtr
& scsiq
->q1
.target_id
) != 0) &&
8770 ((asc_dvc
->sdtr_done
& scsiq
->q1
.target_id
) == 0)) {
8771 tid_no
= ASC_TIX_TO_TID(scsiq
->q2
.target_ix
);
8772 sdtr_data
= AscGetMCodeInitSDTRAtID(iop_base
, tid_no
);
8774 (sdtr_data
>> 4) & (asc_dvc
->max_sdtr_index
- 1);
8775 syn_offset
= sdtr_data
& ASC_SYN_MAX_OFFSET
;
8776 AscMsgOutSDTR(asc_dvc
,
8777 asc_dvc
->sdtr_period_tbl
[syn_period_ix
],
8779 scsiq
->q1
.cntl
|= QC_MSG_OUT
;
8781 q_addr
= ASC_QNO_TO_QADDR(q_no
);
8782 if ((scsiq
->q1
.target_id
& asc_dvc
->use_tagged_qng
) == 0) {
8783 scsiq
->q2
.tag_code
&= ~MSG_SIMPLE_TAG
;
8785 scsiq
->q1
.status
= QS_FREE
;
8786 AscMemWordCopyPtrToLram(iop_base
,
8787 q_addr
+ ASC_SCSIQ_CDB_BEG
,
8788 (uchar
*)scsiq
->cdbptr
, scsiq
->q2
.cdb_len
>> 1);
8790 DvcPutScsiQ(iop_base
,
8791 q_addr
+ ASC_SCSIQ_CPY_BEG
,
8792 (uchar
*)&scsiq
->q1
.cntl
,
8793 ((sizeof(ASC_SCSIQ_1
) + sizeof(ASC_SCSIQ_2
)) / 2) - 1);
8794 AscWriteLramWord(iop_base
,
8795 (ushort
)(q_addr
+ (ushort
)ASC_SCSIQ_B_STATUS
),
8796 (ushort
)(((ushort
)scsiq
->q1
.
8797 q_no
<< 8) | (ushort
)QS_READY
));
8802 AscPutReadySgListQueue(ASC_DVC_VAR
*asc_dvc
, ASC_SCSI_Q
*scsiq
, uchar q_no
)
8806 ASC_SG_HEAD
*sg_head
;
8807 ASC_SG_LIST_Q scsi_sg_q
;
8808 ASC_DCNT saved_data_addr
;
8809 ASC_DCNT saved_data_cnt
;
8811 ushort sg_list_dwords
;
8813 ushort sg_entry_cnt
;
8817 iop_base
= asc_dvc
->iop_base
;
8818 sg_head
= scsiq
->sg_head
;
8819 saved_data_addr
= scsiq
->q1
.data_addr
;
8820 saved_data_cnt
= scsiq
->q1
.data_cnt
;
8821 scsiq
->q1
.data_addr
= (ASC_PADDR
) sg_head
->sg_list
[0].addr
;
8822 scsiq
->q1
.data_cnt
= (ASC_DCNT
) sg_head
->sg_list
[0].bytes
;
8823 #if CC_VERY_LONG_SG_LIST
8825 * If sg_head->entry_cnt is greater than ASC_MAX_SG_LIST
8826 * then not all SG elements will fit in the allocated queues.
8827 * The rest of the SG elements will be copied when the RISC
8828 * completes the SG elements that fit and halts.
8830 if (sg_head
->entry_cnt
> ASC_MAX_SG_LIST
) {
8832 * Set sg_entry_cnt to be the number of SG elements that
8833 * will fit in the allocated SG queues. It is minus 1, because
8834 * the first SG element is handled above. ASC_MAX_SG_LIST is
8835 * already inflated by 1 to account for this. For example it
8836 * may be 50 which is 1 + 7 queues * 7 SG elements.
8838 sg_entry_cnt
= ASC_MAX_SG_LIST
- 1;
8841 * Keep track of remaining number of SG elements that will
8842 * need to be handled from a_isr.c.
8844 scsiq
->remain_sg_entry_cnt
=
8845 sg_head
->entry_cnt
- ASC_MAX_SG_LIST
;
8847 #endif /* CC_VERY_LONG_SG_LIST */
8849 * Set sg_entry_cnt to be the number of SG elements that
8850 * will fit in the allocated SG queues. It is minus 1, because
8851 * the first SG element is handled above.
8853 sg_entry_cnt
= sg_head
->entry_cnt
- 1;
8854 #if CC_VERY_LONG_SG_LIST
8856 #endif /* CC_VERY_LONG_SG_LIST */
8857 if (sg_entry_cnt
!= 0) {
8858 scsiq
->q1
.cntl
|= QC_SG_HEAD
;
8859 q_addr
= ASC_QNO_TO_QADDR(q_no
);
8861 scsiq
->q1
.sg_queue_cnt
= sg_head
->queue_cnt
;
8862 scsi_sg_q
.sg_head_qp
= q_no
;
8863 scsi_sg_q
.cntl
= QCSG_SG_XFER_LIST
;
8864 for (i
= 0; i
< sg_head
->queue_cnt
; i
++) {
8865 scsi_sg_q
.seq_no
= i
+ 1;
8866 if (sg_entry_cnt
> ASC_SG_LIST_PER_Q
) {
8867 sg_list_dwords
= (uchar
)(ASC_SG_LIST_PER_Q
* 2);
8868 sg_entry_cnt
-= ASC_SG_LIST_PER_Q
;
8870 scsi_sg_q
.sg_list_cnt
=
8872 scsi_sg_q
.sg_cur_list_cnt
=
8875 scsi_sg_q
.sg_list_cnt
=
8876 ASC_SG_LIST_PER_Q
- 1;
8877 scsi_sg_q
.sg_cur_list_cnt
=
8878 ASC_SG_LIST_PER_Q
- 1;
8881 #if CC_VERY_LONG_SG_LIST
8883 * This is the last SG queue in the list of
8884 * allocated SG queues. If there are more
8885 * SG elements than will fit in the allocated
8886 * queues, then set the QCSG_SG_XFER_MORE flag.
8888 if (sg_head
->entry_cnt
> ASC_MAX_SG_LIST
) {
8889 scsi_sg_q
.cntl
|= QCSG_SG_XFER_MORE
;
8891 #endif /* CC_VERY_LONG_SG_LIST */
8892 scsi_sg_q
.cntl
|= QCSG_SG_XFER_END
;
8893 #if CC_VERY_LONG_SG_LIST
8895 #endif /* CC_VERY_LONG_SG_LIST */
8896 sg_list_dwords
= sg_entry_cnt
<< 1;
8898 scsi_sg_q
.sg_list_cnt
= sg_entry_cnt
;
8899 scsi_sg_q
.sg_cur_list_cnt
=
8902 scsi_sg_q
.sg_list_cnt
=
8904 scsi_sg_q
.sg_cur_list_cnt
=
8909 next_qp
= AscReadLramByte(iop_base
,
8912 scsi_sg_q
.q_no
= next_qp
;
8913 q_addr
= ASC_QNO_TO_QADDR(next_qp
);
8914 AscMemWordCopyPtrToLram(iop_base
,
8915 q_addr
+ ASC_SCSIQ_SGHD_CPY_BEG
,
8916 (uchar
*)&scsi_sg_q
,
8917 sizeof(ASC_SG_LIST_Q
) >> 1);
8918 AscMemDWordCopyPtrToLram(iop_base
,
8919 q_addr
+ ASC_SGQ_LIST_BEG
,
8923 sg_index
+= ASC_SG_LIST_PER_Q
;
8924 scsiq
->next_sg_index
= sg_index
;
8927 scsiq
->q1
.cntl
&= ~QC_SG_HEAD
;
8929 sta
= AscPutReadyQueue(asc_dvc
, scsiq
, q_no
);
8930 scsiq
->q1
.data_addr
= saved_data_addr
;
8931 scsiq
->q1
.data_cnt
= saved_data_cnt
;
8936 AscSetRunChipSynRegAtID(PortAddr iop_base
, uchar tid_no
, uchar sdtr_data
)
8940 if (AscHostReqRiscHalt(iop_base
)) {
8941 sta
= AscSetChipSynRegAtID(iop_base
, tid_no
, sdtr_data
);
8942 AscStartChip(iop_base
);
8948 static int AscSetChipSynRegAtID(PortAddr iop_base
, uchar id
, uchar sdtr_data
)
8950 ASC_SCSI_BIT_ID_TYPE org_id
;
8954 AscSetBank(iop_base
, 1);
8955 org_id
= AscReadChipDvcID(iop_base
);
8956 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
8957 if (org_id
== (0x01 << i
))
8960 org_id
= (ASC_SCSI_BIT_ID_TYPE
) i
;
8961 AscWriteChipDvcID(iop_base
, id
);
8962 if (AscReadChipDvcID(iop_base
) == (0x01 << id
)) {
8963 AscSetBank(iop_base
, 0);
8964 AscSetChipSyn(iop_base
, sdtr_data
);
8965 if (AscGetChipSyn(iop_base
) != sdtr_data
) {
8971 AscSetBank(iop_base
, 1);
8972 AscWriteChipDvcID(iop_base
, org_id
);
8973 AscSetBank(iop_base
, 0);
8977 static ushort
AscInitLram(ASC_DVC_VAR
*asc_dvc
)
8984 iop_base
= asc_dvc
->iop_base
;
8986 AscMemWordSetLram(iop_base
, ASC_QADR_BEG
, 0,
8987 (ushort
)(((int)(asc_dvc
->max_total_qng
+ 2 + 1) *
8990 i
= ASC_MIN_ACTIVE_QNO
;
8991 s_addr
= ASC_QADR_BEG
+ ASC_QBLK_SIZE
;
8992 AscWriteLramByte(iop_base
, (ushort
)(s_addr
+ ASC_SCSIQ_B_FWD
),
8994 AscWriteLramByte(iop_base
, (ushort
)(s_addr
+ ASC_SCSIQ_B_BWD
),
8995 (uchar
)(asc_dvc
->max_total_qng
));
8996 AscWriteLramByte(iop_base
, (ushort
)(s_addr
+ ASC_SCSIQ_B_QNO
),
8999 s_addr
+= ASC_QBLK_SIZE
;
9000 for (; i
< asc_dvc
->max_total_qng
; i
++, s_addr
+= ASC_QBLK_SIZE
) {
9001 AscWriteLramByte(iop_base
, (ushort
)(s_addr
+ ASC_SCSIQ_B_FWD
),
9003 AscWriteLramByte(iop_base
, (ushort
)(s_addr
+ ASC_SCSIQ_B_BWD
),
9005 AscWriteLramByte(iop_base
, (ushort
)(s_addr
+ ASC_SCSIQ_B_QNO
),
9008 AscWriteLramByte(iop_base
, (ushort
)(s_addr
+ ASC_SCSIQ_B_FWD
),
9009 (uchar
)ASC_QLINK_END
);
9010 AscWriteLramByte(iop_base
, (ushort
)(s_addr
+ ASC_SCSIQ_B_BWD
),
9011 (uchar
)(asc_dvc
->max_total_qng
- 1));
9012 AscWriteLramByte(iop_base
, (ushort
)(s_addr
+ ASC_SCSIQ_B_QNO
),
9013 (uchar
)asc_dvc
->max_total_qng
);
9015 s_addr
+= ASC_QBLK_SIZE
;
9016 for (; i
<= (uchar
)(asc_dvc
->max_total_qng
+ 3);
9017 i
++, s_addr
+= ASC_QBLK_SIZE
) {
9018 AscWriteLramByte(iop_base
,
9019 (ushort
)(s_addr
+ (ushort
)ASC_SCSIQ_B_FWD
), i
);
9020 AscWriteLramByte(iop_base
,
9021 (ushort
)(s_addr
+ (ushort
)ASC_SCSIQ_B_BWD
), i
);
9022 AscWriteLramByte(iop_base
,
9023 (ushort
)(s_addr
+ (ushort
)ASC_SCSIQ_B_QNO
), i
);
9028 static ushort
AscInitQLinkVar(ASC_DVC_VAR
*asc_dvc
)
9034 iop_base
= asc_dvc
->iop_base
;
9035 AscPutRiscVarFreeQHead(iop_base
, 1);
9036 AscPutRiscVarDoneQTail(iop_base
, asc_dvc
->max_total_qng
);
9037 AscPutVarFreeQHead(iop_base
, 1);
9038 AscPutVarDoneQTail(iop_base
, asc_dvc
->max_total_qng
);
9039 AscWriteLramByte(iop_base
, ASCV_BUSY_QHEAD_B
,
9040 (uchar
)((int)asc_dvc
->max_total_qng
+ 1));
9041 AscWriteLramByte(iop_base
, ASCV_DISC1_QHEAD_B
,
9042 (uchar
)((int)asc_dvc
->max_total_qng
+ 2));
9043 AscWriteLramByte(iop_base
, (ushort
)ASCV_TOTAL_READY_Q_B
,
9044 asc_dvc
->max_total_qng
);
9045 AscWriteLramWord(iop_base
, ASCV_ASCDVC_ERR_CODE_W
, 0);
9046 AscWriteLramWord(iop_base
, ASCV_HALTCODE_W
, 0);
9047 AscWriteLramByte(iop_base
, ASCV_STOP_CODE_B
, 0);
9048 AscWriteLramByte(iop_base
, ASCV_SCSIBUSY_B
, 0);
9049 AscWriteLramByte(iop_base
, ASCV_WTM_FLAG_B
, 0);
9050 AscPutQDoneInProgress(iop_base
, 0);
9051 lram_addr
= ASC_QADR_BEG
;
9052 for (i
= 0; i
< 32; i
++, lram_addr
+= 2) {
9053 AscWriteLramWord(iop_base
, lram_addr
, 0);
9058 static int AscSetLibErrorCode(ASC_DVC_VAR
*asc_dvc
, ushort err_code
)
9060 if (asc_dvc
->err_code
== 0) {
9061 asc_dvc
->err_code
= err_code
;
9062 AscWriteLramWord(asc_dvc
->iop_base
, ASCV_ASCDVC_ERR_CODE_W
,
9069 AscMsgOutSDTR(ASC_DVC_VAR
*asc_dvc
, uchar sdtr_period
, uchar sdtr_offset
)
9072 uchar sdtr_period_index
;
9075 iop_base
= asc_dvc
->iop_base
;
9076 sdtr_buf
.msg_type
= EXTENDED_MESSAGE
;
9077 sdtr_buf
.msg_len
= MS_SDTR_LEN
;
9078 sdtr_buf
.msg_req
= EXTENDED_SDTR
;
9079 sdtr_buf
.xfer_period
= sdtr_period
;
9080 sdtr_offset
&= ASC_SYN_MAX_OFFSET
;
9081 sdtr_buf
.req_ack_offset
= sdtr_offset
;
9082 if ((sdtr_period_index
=
9083 AscGetSynPeriodIndex(asc_dvc
, sdtr_period
)) <=
9084 asc_dvc
->max_sdtr_index
) {
9085 AscMemWordCopyPtrToLram(iop_base
,
9088 sizeof(EXT_MSG
) >> 1);
9089 return ((sdtr_period_index
<< 4) | sdtr_offset
);
9092 sdtr_buf
.req_ack_offset
= 0;
9093 AscMemWordCopyPtrToLram(iop_base
,
9096 sizeof(EXT_MSG
) >> 1);
9102 AscCalSDTRData(ASC_DVC_VAR
*asc_dvc
, uchar sdtr_period
, uchar syn_offset
)
9105 uchar sdtr_period_ix
;
9107 sdtr_period_ix
= AscGetSynPeriodIndex(asc_dvc
, sdtr_period
);
9108 if ((sdtr_period_ix
> asc_dvc
->max_sdtr_index
)
9112 byte
= (sdtr_period_ix
<< 4) | (syn_offset
& ASC_SYN_MAX_OFFSET
);
9116 static void AscSetChipSDTR(PortAddr iop_base
, uchar sdtr_data
, uchar tid_no
)
9118 AscSetChipSynRegAtID(iop_base
, tid_no
, sdtr_data
);
9119 AscPutMCodeSDTRDoneAtID(iop_base
, tid_no
, sdtr_data
);
9123 static uchar
AscGetSynPeriodIndex(ASC_DVC_VAR
*asc_dvc
, uchar syn_time
)
9125 uchar
*period_table
;
9130 period_table
= asc_dvc
->sdtr_period_tbl
;
9131 max_index
= (int)asc_dvc
->max_sdtr_index
;
9132 min_index
= (int)asc_dvc
->host_init_sdtr_index
;
9133 if ((syn_time
<= period_table
[max_index
])) {
9134 for (i
= min_index
; i
< (max_index
- 1); i
++) {
9135 if (syn_time
<= period_table
[i
]) {
9139 return ((uchar
)max_index
);
9141 return ((uchar
)(max_index
+ 1));
9145 static uchar
AscAllocFreeQueue(PortAddr iop_base
, uchar free_q_head
)
9151 q_addr
= ASC_QNO_TO_QADDR(free_q_head
);
9152 q_status
= (uchar
)AscReadLramByte(iop_base
,
9154 ASC_SCSIQ_B_STATUS
));
9155 next_qp
= AscReadLramByte(iop_base
, (ushort
)(q_addr
+ ASC_SCSIQ_B_FWD
));
9156 if (((q_status
& QS_READY
) == 0) && (next_qp
!= ASC_QLINK_END
)) {
9159 return (ASC_QLINK_END
);
9163 AscAllocMultipleFreeQueue(PortAddr iop_base
, uchar free_q_head
, uchar n_free_q
)
9167 for (i
= 0; i
< n_free_q
; i
++) {
9168 if ((free_q_head
= AscAllocFreeQueue(iop_base
, free_q_head
))
9170 return (ASC_QLINK_END
);
9173 return (free_q_head
);
9176 static int AscHostReqRiscHalt(PortAddr iop_base
)
9180 uchar saved_stop_code
;
9182 if (AscIsChipHalted(iop_base
))
9184 saved_stop_code
= AscReadLramByte(iop_base
, ASCV_STOP_CODE_B
);
9185 AscWriteLramByte(iop_base
, ASCV_STOP_CODE_B
,
9186 ASC_STOP_HOST_REQ_RISC_HALT
| ASC_STOP_REQ_RISC_STOP
);
9188 if (AscIsChipHalted(iop_base
)) {
9192 DvcSleepMilliSecond(100);
9193 } while (count
++ < 20);
9194 AscWriteLramByte(iop_base
, ASCV_STOP_CODE_B
, saved_stop_code
);
9198 static int AscStopQueueExe(PortAddr iop_base
)
9202 if (AscReadLramByte(iop_base
, ASCV_STOP_CODE_B
) == 0) {
9203 AscWriteLramByte(iop_base
, ASCV_STOP_CODE_B
,
9204 ASC_STOP_REQ_RISC_STOP
);
9206 if (AscReadLramByte(iop_base
, ASCV_STOP_CODE_B
) &
9207 ASC_STOP_ACK_RISC_STOP
) {
9210 DvcSleepMilliSecond(100);
9211 } while (count
++ < 20);
9216 static void DvcDelayMicroSecond(ADV_DVC_VAR
*asc_dvc
, ushort micro_sec
)
9221 static void DvcDelayNanoSecond(ASC_DVC_VAR
*asc_dvc
, ASC_DCNT nano_sec
)
9223 udelay((nano_sec
+ 999) / 1000);
9226 static int AscStartChip(PortAddr iop_base
)
9228 AscSetChipControl(iop_base
, 0);
9229 if ((AscGetChipStatus(iop_base
) & CSW_HALTED
) != 0) {
9235 static int AscStopChip(PortAddr iop_base
)
9240 AscGetChipControl(iop_base
) &
9241 (~(CC_SINGLE_STEP
| CC_TEST
| CC_DIAG
));
9242 AscSetChipControl(iop_base
, (uchar
)(cc_val
| CC_HALT
));
9243 AscSetChipIH(iop_base
, INS_HALT
);
9244 AscSetChipIH(iop_base
, INS_RFLAG_WTM
);
9245 if ((AscGetChipStatus(iop_base
) & CSW_HALTED
) == 0) {
9251 static int AscIsChipHalted(PortAddr iop_base
)
9253 if ((AscGetChipStatus(iop_base
) & CSW_HALTED
) != 0) {
9254 if ((AscGetChipControl(iop_base
) & CC_HALT
) != 0) {
9261 static void AscSetChipIH(PortAddr iop_base
, ushort ins_code
)
9263 AscSetBank(iop_base
, 1);
9264 AscWriteChipIH(iop_base
, ins_code
);
9265 AscSetBank(iop_base
, 0);
9269 static void AscAckInterrupt(PortAddr iop_base
)
9277 risc_flag
= AscReadLramByte(iop_base
, ASCV_RISC_FLAG_B
);
9278 if (loop
++ > 0x7FFF) {
9281 } while ((risc_flag
& ASC_RISC_FLAG_GEN_INT
) != 0);
9283 AscReadLramByte(iop_base
,
9284 ASCV_HOST_FLAG_B
) & (~ASC_HOST_FLAG_ACK_INT
);
9285 AscWriteLramByte(iop_base
, ASCV_HOST_FLAG_B
,
9286 (uchar
)(host_flag
| ASC_HOST_FLAG_ACK_INT
));
9287 AscSetChipStatus(iop_base
, CIW_INT_ACK
);
9289 while (AscGetChipStatus(iop_base
) & CSW_INT_PENDING
) {
9290 AscSetChipStatus(iop_base
, CIW_INT_ACK
);
9295 AscWriteLramByte(iop_base
, ASCV_HOST_FLAG_B
, host_flag
);
9299 static void AscDisableInterrupt(PortAddr iop_base
)
9303 cfg
= AscGetChipCfgLsw(iop_base
);
9304 AscSetChipCfgLsw(iop_base
, cfg
& (~ASC_CFG0_HOST_INT_ON
));
9308 static void AscEnableInterrupt(PortAddr iop_base
)
9312 cfg
= AscGetChipCfgLsw(iop_base
);
9313 AscSetChipCfgLsw(iop_base
, cfg
| ASC_CFG0_HOST_INT_ON
);
9317 static void AscSetBank(PortAddr iop_base
, uchar bank
)
9321 val
= AscGetChipControl(iop_base
) &
9323 (CC_SINGLE_STEP
| CC_TEST
| CC_DIAG
| CC_SCSI_RESET
|
9327 } else if (bank
== 2) {
9328 val
|= CC_DIAG
| CC_BANK_ONE
;
9330 val
&= ~CC_BANK_ONE
;
9332 AscSetChipControl(iop_base
, val
);
9336 static int AscResetChipAndScsiBus(ASC_DVC_VAR
*asc_dvc
)
9341 iop_base
= asc_dvc
->iop_base
;
9342 while ((AscGetChipStatus(iop_base
) & CSW_SCSI_RESET_ACTIVE
)
9344 DvcSleepMilliSecond(100);
9346 AscStopChip(iop_base
);
9347 AscSetChipControl(iop_base
, CC_CHIP_RESET
| CC_SCSI_RESET
| CC_HALT
);
9348 DvcDelayNanoSecond(asc_dvc
, 60000);
9349 AscSetChipIH(iop_base
, INS_RFLAG_WTM
);
9350 AscSetChipIH(iop_base
, INS_HALT
);
9351 AscSetChipControl(iop_base
, CC_CHIP_RESET
| CC_HALT
);
9352 AscSetChipControl(iop_base
, CC_HALT
);
9353 DvcSleepMilliSecond(200);
9354 AscSetChipStatus(iop_base
, CIW_CLR_SCSI_RESET_INT
);
9355 AscSetChipStatus(iop_base
, 0);
9356 return (AscIsChipHalted(iop_base
));
9359 static ASC_DCNT __devinit
AscGetMaxDmaCount(ushort bus_type
)
9361 if (bus_type
& ASC_IS_ISA
)
9362 return (ASC_MAX_ISA_DMA_COUNT
);
9363 else if (bus_type
& (ASC_IS_EISA
| ASC_IS_VL
))
9364 return (ASC_MAX_VL_DMA_COUNT
);
9365 return (ASC_MAX_PCI_DMA_COUNT
);
9369 static ushort __devinit
AscGetIsaDmaChannel(PortAddr iop_base
)
9373 channel
= AscGetChipCfgLsw(iop_base
) & 0x0003;
9374 if (channel
== 0x03)
9376 else if (channel
== 0x00)
9378 return (channel
+ 4);
9381 static ushort __devinit
AscSetIsaDmaChannel(PortAddr iop_base
, ushort dma_channel
)
9386 if ((dma_channel
>= 5) && (dma_channel
<= 7)) {
9387 if (dma_channel
== 7)
9390 value
= dma_channel
- 4;
9391 cfg_lsw
= AscGetChipCfgLsw(iop_base
) & 0xFFFC;
9393 AscSetChipCfgLsw(iop_base
, cfg_lsw
);
9394 return (AscGetIsaDmaChannel(iop_base
));
9399 static uchar __devinit
AscSetIsaDmaSpeed(PortAddr iop_base
, uchar speed_value
)
9401 speed_value
&= 0x07;
9402 AscSetBank(iop_base
, 1);
9403 AscWriteChipDmaSpeed(iop_base
, speed_value
);
9404 AscSetBank(iop_base
, 0);
9405 return (AscGetIsaDmaSpeed(iop_base
));
9408 static uchar __devinit
AscGetIsaDmaSpeed(PortAddr iop_base
)
9412 AscSetBank(iop_base
, 1);
9413 speed_value
= AscReadChipDmaSpeed(iop_base
);
9414 speed_value
&= 0x07;
9415 AscSetBank(iop_base
, 0);
9416 return (speed_value
);
9418 #endif /* CONFIG_ISA */
9420 static ushort __devinit
AscInitGetConfig(ASC_DVC_VAR
*asc_dvc
)
9422 unsigned short warn_code
= 0;
9424 asc_dvc
->init_state
= ASC_INIT_STATE_BEG_GET_CFG
;
9425 if (asc_dvc
->err_code
!= 0)
9428 if (AscFindSignature(asc_dvc
->iop_base
)) {
9429 warn_code
|= AscInitAscDvcVar(asc_dvc
);
9430 warn_code
|= AscInitFromEEP(asc_dvc
);
9431 asc_dvc
->init_state
|= ASC_INIT_STATE_END_GET_CFG
;
9432 if (asc_dvc
->scsi_reset_wait
> ASC_MAX_SCSI_RESET_WAIT
)
9433 asc_dvc
->scsi_reset_wait
= ASC_MAX_SCSI_RESET_WAIT
;
9435 asc_dvc
->err_code
= ASC_IERR_BAD_SIGNATURE
;
9440 static unsigned short __devinit
9441 AscInitSetConfig(struct pci_dev
*pdev
, ASC_DVC_VAR
*asc_dvc
)
9443 PortAddr iop_base
= asc_dvc
->iop_base
;
9444 unsigned short cfg_msw
;
9445 unsigned short warn_code
= 0;
9447 asc_dvc
->init_state
|= ASC_INIT_STATE_BEG_SET_CFG
;
9448 if (asc_dvc
->err_code
!= 0)
9450 if (!AscFindSignature(asc_dvc
->iop_base
)) {
9451 asc_dvc
->err_code
= ASC_IERR_BAD_SIGNATURE
;
9455 cfg_msw
= AscGetChipCfgMsw(iop_base
);
9456 if ((cfg_msw
& ASC_CFG_MSW_CLR_MASK
) != 0) {
9457 cfg_msw
&= (~(ASC_CFG_MSW_CLR_MASK
));
9458 warn_code
|= ASC_WARN_CFG_MSW_RECOVER
;
9459 AscSetChipCfgMsw(iop_base
, cfg_msw
);
9461 if ((asc_dvc
->cfg
->cmd_qng_enabled
& asc_dvc
->cfg
->disc_enable
) !=
9462 asc_dvc
->cfg
->cmd_qng_enabled
) {
9463 asc_dvc
->cfg
->disc_enable
= asc_dvc
->cfg
->cmd_qng_enabled
;
9464 warn_code
|= ASC_WARN_CMD_QNG_CONFLICT
;
9466 if (AscGetChipStatus(iop_base
) & CSW_AUTO_CONFIG
) {
9467 warn_code
|= ASC_WARN_AUTO_CONFIG
;
9469 if ((asc_dvc
->bus_type
& (ASC_IS_ISA
| ASC_IS_VL
)) != 0) {
9470 if (AscSetChipIRQ(iop_base
, asc_dvc
->irq_no
, asc_dvc
->bus_type
)
9471 != asc_dvc
->irq_no
) {
9472 asc_dvc
->err_code
|= ASC_IERR_SET_IRQ_NO
;
9476 if (asc_dvc
->bus_type
& ASC_IS_PCI
) {
9478 AscSetChipCfgMsw(iop_base
, cfg_msw
);
9479 if ((asc_dvc
->bus_type
& ASC_IS_PCI_ULTRA
) == ASC_IS_PCI_ULTRA
) {
9481 if ((pdev
->device
== PCI_DEVICE_ID_ASP_1200A
) ||
9482 (pdev
->device
== PCI_DEVICE_ID_ASP_ABP940
)) {
9483 asc_dvc
->bug_fix_cntl
|= ASC_BUG_FIX_IF_NOT_DWB
;
9484 asc_dvc
->bug_fix_cntl
|=
9485 ASC_BUG_FIX_ASYN_USE_SYN
;
9489 #endif /* CONFIG_PCI */
9490 if (asc_dvc
->bus_type
== ASC_IS_ISAPNP
) {
9491 if (AscGetChipVersion(iop_base
, asc_dvc
->bus_type
)
9492 == ASC_CHIP_VER_ASYN_BUG
) {
9493 asc_dvc
->bug_fix_cntl
|= ASC_BUG_FIX_ASYN_USE_SYN
;
9496 if (AscSetChipScsiID(iop_base
, asc_dvc
->cfg
->chip_scsi_id
) !=
9497 asc_dvc
->cfg
->chip_scsi_id
) {
9498 asc_dvc
->err_code
|= ASC_IERR_SET_SCSI_ID
;
9501 if (asc_dvc
->bus_type
& ASC_IS_ISA
) {
9502 AscSetIsaDmaChannel(iop_base
, asc_dvc
->cfg
->isa_dma_channel
);
9503 AscSetIsaDmaSpeed(iop_base
, asc_dvc
->cfg
->isa_dma_speed
);
9505 #endif /* CONFIG_ISA */
9507 asc_dvc
->init_state
|= ASC_INIT_STATE_END_SET_CFG
;
9511 static ushort
AscInitAsc1000Driver(ASC_DVC_VAR
*asc_dvc
)
9516 iop_base
= asc_dvc
->iop_base
;
9518 if ((asc_dvc
->dvc_cntl
& ASC_CNTL_RESET_SCSI
) &&
9519 !(asc_dvc
->init_state
& ASC_INIT_RESET_SCSI_DONE
)) {
9520 AscResetChipAndScsiBus(asc_dvc
);
9521 DvcSleepMilliSecond((ASC_DCNT
)
9522 ((ushort
)asc_dvc
->scsi_reset_wait
* 1000));
9524 asc_dvc
->init_state
|= ASC_INIT_STATE_BEG_LOAD_MC
;
9525 if (asc_dvc
->err_code
!= 0)
9527 if (!AscFindSignature(asc_dvc
->iop_base
)) {
9528 asc_dvc
->err_code
= ASC_IERR_BAD_SIGNATURE
;
9531 AscDisableInterrupt(iop_base
);
9532 warn_code
|= AscInitLram(asc_dvc
);
9533 if (asc_dvc
->err_code
!= 0)
9535 ASC_DBG1(1, "AscInitAsc1000Driver: _asc_mcode_chksum 0x%lx\n",
9536 (ulong
)_asc_mcode_chksum
);
9537 if (AscLoadMicroCode(iop_base
, 0, _asc_mcode_buf
,
9538 _asc_mcode_size
) != _asc_mcode_chksum
) {
9539 asc_dvc
->err_code
|= ASC_IERR_MCODE_CHKSUM
;
9542 warn_code
|= AscInitMicroCodeVar(asc_dvc
);
9543 asc_dvc
->init_state
|= ASC_INIT_STATE_END_LOAD_MC
;
9544 AscEnableInterrupt(iop_base
);
9548 static ushort __devinit
AscInitAscDvcVar(ASC_DVC_VAR
*asc_dvc
)
9555 iop_base
= asc_dvc
->iop_base
;
9557 asc_dvc
->err_code
= 0;
9558 if ((asc_dvc
->bus_type
&
9559 (ASC_IS_ISA
| ASC_IS_PCI
| ASC_IS_EISA
| ASC_IS_VL
)) == 0) {
9560 asc_dvc
->err_code
|= ASC_IERR_NO_BUS_TYPE
;
9562 AscSetChipControl(iop_base
, CC_HALT
);
9563 AscSetChipStatus(iop_base
, 0);
9564 asc_dvc
->bug_fix_cntl
= 0;
9565 asc_dvc
->pci_fix_asyn_xfer
= 0;
9566 asc_dvc
->pci_fix_asyn_xfer_always
= 0;
9567 /* asc_dvc->init_state initalized in AscInitGetConfig(). */
9568 asc_dvc
->sdtr_done
= 0;
9569 asc_dvc
->cur_total_qng
= 0;
9570 asc_dvc
->is_in_int
= 0;
9571 asc_dvc
->in_critical_cnt
= 0;
9572 asc_dvc
->last_q_shortage
= 0;
9573 asc_dvc
->use_tagged_qng
= 0;
9574 asc_dvc
->no_scam
= 0;
9575 asc_dvc
->unit_not_ready
= 0;
9576 asc_dvc
->queue_full_or_busy
= 0;
9577 asc_dvc
->redo_scam
= 0;
9579 asc_dvc
->host_init_sdtr_index
= 0;
9580 asc_dvc
->cfg
->can_tagged_qng
= 0;
9581 asc_dvc
->cfg
->cmd_qng_enabled
= 0;
9582 asc_dvc
->dvc_cntl
= ASC_DEF_DVC_CNTL
;
9583 asc_dvc
->init_sdtr
= 0;
9584 asc_dvc
->max_total_qng
= ASC_DEF_MAX_TOTAL_QNG
;
9585 asc_dvc
->scsi_reset_wait
= 3;
9586 asc_dvc
->start_motor
= ASC_SCSI_WIDTH_BIT_SET
;
9587 asc_dvc
->max_dma_count
= AscGetMaxDmaCount(asc_dvc
->bus_type
);
9588 asc_dvc
->cfg
->sdtr_enable
= ASC_SCSI_WIDTH_BIT_SET
;
9589 asc_dvc
->cfg
->disc_enable
= ASC_SCSI_WIDTH_BIT_SET
;
9590 asc_dvc
->cfg
->chip_scsi_id
= ASC_DEF_CHIP_SCSI_ID
;
9591 asc_dvc
->cfg
->lib_serial_no
= ASC_LIB_SERIAL_NUMBER
;
9592 asc_dvc
->cfg
->lib_version
= (ASC_LIB_VERSION_MAJOR
<< 8) |
9593 ASC_LIB_VERSION_MINOR
;
9594 chip_version
= AscGetChipVersion(iop_base
, asc_dvc
->bus_type
);
9595 asc_dvc
->cfg
->chip_version
= chip_version
;
9596 asc_dvc
->sdtr_period_tbl
[0] = SYN_XFER_NS_0
;
9597 asc_dvc
->sdtr_period_tbl
[1] = SYN_XFER_NS_1
;
9598 asc_dvc
->sdtr_period_tbl
[2] = SYN_XFER_NS_2
;
9599 asc_dvc
->sdtr_period_tbl
[3] = SYN_XFER_NS_3
;
9600 asc_dvc
->sdtr_period_tbl
[4] = SYN_XFER_NS_4
;
9601 asc_dvc
->sdtr_period_tbl
[5] = SYN_XFER_NS_5
;
9602 asc_dvc
->sdtr_period_tbl
[6] = SYN_XFER_NS_6
;
9603 asc_dvc
->sdtr_period_tbl
[7] = SYN_XFER_NS_7
;
9604 asc_dvc
->max_sdtr_index
= 7;
9605 if ((asc_dvc
->bus_type
& ASC_IS_PCI
) &&
9606 (chip_version
>= ASC_CHIP_VER_PCI_ULTRA_3150
)) {
9607 asc_dvc
->bus_type
= ASC_IS_PCI_ULTRA
;
9608 asc_dvc
->sdtr_period_tbl
[0] = SYN_ULTRA_XFER_NS_0
;
9609 asc_dvc
->sdtr_period_tbl
[1] = SYN_ULTRA_XFER_NS_1
;
9610 asc_dvc
->sdtr_period_tbl
[2] = SYN_ULTRA_XFER_NS_2
;
9611 asc_dvc
->sdtr_period_tbl
[3] = SYN_ULTRA_XFER_NS_3
;
9612 asc_dvc
->sdtr_period_tbl
[4] = SYN_ULTRA_XFER_NS_4
;
9613 asc_dvc
->sdtr_period_tbl
[5] = SYN_ULTRA_XFER_NS_5
;
9614 asc_dvc
->sdtr_period_tbl
[6] = SYN_ULTRA_XFER_NS_6
;
9615 asc_dvc
->sdtr_period_tbl
[7] = SYN_ULTRA_XFER_NS_7
;
9616 asc_dvc
->sdtr_period_tbl
[8] = SYN_ULTRA_XFER_NS_8
;
9617 asc_dvc
->sdtr_period_tbl
[9] = SYN_ULTRA_XFER_NS_9
;
9618 asc_dvc
->sdtr_period_tbl
[10] = SYN_ULTRA_XFER_NS_10
;
9619 asc_dvc
->sdtr_period_tbl
[11] = SYN_ULTRA_XFER_NS_11
;
9620 asc_dvc
->sdtr_period_tbl
[12] = SYN_ULTRA_XFER_NS_12
;
9621 asc_dvc
->sdtr_period_tbl
[13] = SYN_ULTRA_XFER_NS_13
;
9622 asc_dvc
->sdtr_period_tbl
[14] = SYN_ULTRA_XFER_NS_14
;
9623 asc_dvc
->sdtr_period_tbl
[15] = SYN_ULTRA_XFER_NS_15
;
9624 asc_dvc
->max_sdtr_index
= 15;
9625 if (chip_version
== ASC_CHIP_VER_PCI_ULTRA_3150
) {
9626 AscSetExtraControl(iop_base
,
9627 (SEC_ACTIVE_NEGATE
| SEC_SLEW_RATE
));
9628 } else if (chip_version
>= ASC_CHIP_VER_PCI_ULTRA_3050
) {
9629 AscSetExtraControl(iop_base
,
9630 (SEC_ACTIVE_NEGATE
|
9631 SEC_ENABLE_FILTER
));
9634 if (asc_dvc
->bus_type
== ASC_IS_PCI
) {
9635 AscSetExtraControl(iop_base
,
9636 (SEC_ACTIVE_NEGATE
| SEC_SLEW_RATE
));
9639 asc_dvc
->cfg
->isa_dma_speed
= ASC_DEF_ISA_DMA_SPEED
;
9641 if ((asc_dvc
->bus_type
& ASC_IS_ISA
) != 0) {
9642 if (chip_version
>= ASC_CHIP_MIN_VER_ISA_PNP
) {
9643 AscSetChipIFC(iop_base
, IFC_INIT_DEFAULT
);
9644 asc_dvc
->bus_type
= ASC_IS_ISAPNP
;
9646 asc_dvc
->cfg
->isa_dma_channel
=
9647 (uchar
)AscGetIsaDmaChannel(iop_base
);
9649 #endif /* CONFIG_ISA */
9650 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
9651 asc_dvc
->cur_dvc_qng
[i
] = 0;
9652 asc_dvc
->max_dvc_qng
[i
] = ASC_MAX_SCSI1_QNG
;
9653 asc_dvc
->scsiq_busy_head
[i
] = (ASC_SCSI_Q
*)0L;
9654 asc_dvc
->scsiq_busy_tail
[i
] = (ASC_SCSI_Q
*)0L;
9655 asc_dvc
->cfg
->max_tag_qng
[i
] = ASC_MAX_INRAM_TAG_QNG
;
9660 static ushort __devinit
AscInitFromEEP(ASC_DVC_VAR
*asc_dvc
)
9662 ASCEEP_CONFIG eep_config_buf
;
9663 ASCEEP_CONFIG
*eep_config
;
9667 ushort cfg_msw
, cfg_lsw
;
9671 iop_base
= asc_dvc
->iop_base
;
9673 AscWriteLramWord(iop_base
, ASCV_HALTCODE_W
, 0x00FE);
9674 AscStopQueueExe(iop_base
);
9675 if ((AscStopChip(iop_base
) == FALSE
) ||
9676 (AscGetChipScsiCtrl(iop_base
) != 0)) {
9677 asc_dvc
->init_state
|= ASC_INIT_RESET_SCSI_DONE
;
9678 AscResetChipAndScsiBus(asc_dvc
);
9679 DvcSleepMilliSecond((ASC_DCNT
)
9680 ((ushort
)asc_dvc
->scsi_reset_wait
* 1000));
9682 if (AscIsChipHalted(iop_base
) == FALSE
) {
9683 asc_dvc
->err_code
|= ASC_IERR_START_STOP_CHIP
;
9686 AscSetPCAddr(iop_base
, ASC_MCODE_START_ADDR
);
9687 if (AscGetPCAddr(iop_base
) != ASC_MCODE_START_ADDR
) {
9688 asc_dvc
->err_code
|= ASC_IERR_SET_PC_ADDR
;
9691 eep_config
= (ASCEEP_CONFIG
*)&eep_config_buf
;
9692 cfg_msw
= AscGetChipCfgMsw(iop_base
);
9693 cfg_lsw
= AscGetChipCfgLsw(iop_base
);
9694 if ((cfg_msw
& ASC_CFG_MSW_CLR_MASK
) != 0) {
9695 cfg_msw
&= (~(ASC_CFG_MSW_CLR_MASK
));
9696 warn_code
|= ASC_WARN_CFG_MSW_RECOVER
;
9697 AscSetChipCfgMsw(iop_base
, cfg_msw
);
9699 chksum
= AscGetEEPConfig(iop_base
, eep_config
, asc_dvc
->bus_type
);
9700 ASC_DBG1(1, "AscInitFromEEP: chksum 0x%x\n", chksum
);
9704 if (AscGetChipStatus(iop_base
) & CSW_AUTO_CONFIG
) {
9705 warn_code
|= ASC_WARN_AUTO_CONFIG
;
9706 if (asc_dvc
->cfg
->chip_version
== 3) {
9707 if (eep_config
->cfg_lsw
!= cfg_lsw
) {
9708 warn_code
|= ASC_WARN_EEPROM_RECOVER
;
9709 eep_config
->cfg_lsw
=
9710 AscGetChipCfgLsw(iop_base
);
9712 if (eep_config
->cfg_msw
!= cfg_msw
) {
9713 warn_code
|= ASC_WARN_EEPROM_RECOVER
;
9714 eep_config
->cfg_msw
=
9715 AscGetChipCfgMsw(iop_base
);
9719 eep_config
->cfg_msw
&= ~ASC_CFG_MSW_CLR_MASK
;
9720 eep_config
->cfg_lsw
|= ASC_CFG0_HOST_INT_ON
;
9721 ASC_DBG1(1, "AscInitFromEEP: eep_config->chksum 0x%x\n",
9722 eep_config
->chksum
);
9723 if (chksum
!= eep_config
->chksum
) {
9724 if (AscGetChipVersion(iop_base
, asc_dvc
->bus_type
) ==
9725 ASC_CHIP_VER_PCI_ULTRA_3050
) {
9727 "AscInitFromEEP: chksum error ignored; EEPROM-less board\n");
9728 eep_config
->init_sdtr
= 0xFF;
9729 eep_config
->disc_enable
= 0xFF;
9730 eep_config
->start_motor
= 0xFF;
9731 eep_config
->use_cmd_qng
= 0;
9732 eep_config
->max_total_qng
= 0xF0;
9733 eep_config
->max_tag_qng
= 0x20;
9734 eep_config
->cntl
= 0xBFFF;
9735 ASC_EEP_SET_CHIP_ID(eep_config
, 7);
9736 eep_config
->no_scam
= 0;
9737 eep_config
->adapter_info
[0] = 0;
9738 eep_config
->adapter_info
[1] = 0;
9739 eep_config
->adapter_info
[2] = 0;
9740 eep_config
->adapter_info
[3] = 0;
9741 eep_config
->adapter_info
[4] = 0;
9742 /* Indicate EEPROM-less board. */
9743 eep_config
->adapter_info
[5] = 0xBB;
9746 ("AscInitFromEEP: EEPROM checksum error; Will try to re-write EEPROM.\n");
9748 warn_code
|= ASC_WARN_EEPROM_CHKSUM
;
9751 asc_dvc
->cfg
->sdtr_enable
= eep_config
->init_sdtr
;
9752 asc_dvc
->cfg
->disc_enable
= eep_config
->disc_enable
;
9753 asc_dvc
->cfg
->cmd_qng_enabled
= eep_config
->use_cmd_qng
;
9754 asc_dvc
->cfg
->isa_dma_speed
= ASC_EEP_GET_DMA_SPD(eep_config
);
9755 asc_dvc
->start_motor
= eep_config
->start_motor
;
9756 asc_dvc
->dvc_cntl
= eep_config
->cntl
;
9757 asc_dvc
->no_scam
= eep_config
->no_scam
;
9758 asc_dvc
->cfg
->adapter_info
[0] = eep_config
->adapter_info
[0];
9759 asc_dvc
->cfg
->adapter_info
[1] = eep_config
->adapter_info
[1];
9760 asc_dvc
->cfg
->adapter_info
[2] = eep_config
->adapter_info
[2];
9761 asc_dvc
->cfg
->adapter_info
[3] = eep_config
->adapter_info
[3];
9762 asc_dvc
->cfg
->adapter_info
[4] = eep_config
->adapter_info
[4];
9763 asc_dvc
->cfg
->adapter_info
[5] = eep_config
->adapter_info
[5];
9764 if (!AscTestExternalLram(asc_dvc
)) {
9765 if (((asc_dvc
->bus_type
& ASC_IS_PCI_ULTRA
) ==
9766 ASC_IS_PCI_ULTRA
)) {
9767 eep_config
->max_total_qng
=
9768 ASC_MAX_PCI_ULTRA_INRAM_TOTAL_QNG
;
9769 eep_config
->max_tag_qng
=
9770 ASC_MAX_PCI_ULTRA_INRAM_TAG_QNG
;
9772 eep_config
->cfg_msw
|= 0x0800;
9774 AscSetChipCfgMsw(iop_base
, cfg_msw
);
9775 eep_config
->max_total_qng
= ASC_MAX_PCI_INRAM_TOTAL_QNG
;
9776 eep_config
->max_tag_qng
= ASC_MAX_INRAM_TAG_QNG
;
9780 if (eep_config
->max_total_qng
< ASC_MIN_TOTAL_QNG
) {
9781 eep_config
->max_total_qng
= ASC_MIN_TOTAL_QNG
;
9783 if (eep_config
->max_total_qng
> ASC_MAX_TOTAL_QNG
) {
9784 eep_config
->max_total_qng
= ASC_MAX_TOTAL_QNG
;
9786 if (eep_config
->max_tag_qng
> eep_config
->max_total_qng
) {
9787 eep_config
->max_tag_qng
= eep_config
->max_total_qng
;
9789 if (eep_config
->max_tag_qng
< ASC_MIN_TAG_Q_PER_DVC
) {
9790 eep_config
->max_tag_qng
= ASC_MIN_TAG_Q_PER_DVC
;
9792 asc_dvc
->max_total_qng
= eep_config
->max_total_qng
;
9793 if ((eep_config
->use_cmd_qng
& eep_config
->disc_enable
) !=
9794 eep_config
->use_cmd_qng
) {
9795 eep_config
->disc_enable
= eep_config
->use_cmd_qng
;
9796 warn_code
|= ASC_WARN_CMD_QNG_CONFLICT
;
9798 if (asc_dvc
->bus_type
& (ASC_IS_ISA
| ASC_IS_VL
| ASC_IS_EISA
)) {
9799 asc_dvc
->irq_no
= AscGetChipIRQ(iop_base
, asc_dvc
->bus_type
);
9801 ASC_EEP_SET_CHIP_ID(eep_config
,
9802 ASC_EEP_GET_CHIP_ID(eep_config
) & ASC_MAX_TID
);
9803 asc_dvc
->cfg
->chip_scsi_id
= ASC_EEP_GET_CHIP_ID(eep_config
);
9804 if (((asc_dvc
->bus_type
& ASC_IS_PCI_ULTRA
) == ASC_IS_PCI_ULTRA
) &&
9805 !(asc_dvc
->dvc_cntl
& ASC_CNTL_SDTR_ENABLE_ULTRA
)) {
9806 asc_dvc
->host_init_sdtr_index
= ASC_SDTR_ULTRA_PCI_10MB_INDEX
;
9809 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
9810 asc_dvc
->dos_int13_table
[i
] = eep_config
->dos_int13_table
[i
];
9811 asc_dvc
->cfg
->max_tag_qng
[i
] = eep_config
->max_tag_qng
;
9812 asc_dvc
->cfg
->sdtr_period_offset
[i
] =
9813 (uchar
)(ASC_DEF_SDTR_OFFSET
|
9814 (asc_dvc
->host_init_sdtr_index
<< 4));
9816 eep_config
->cfg_msw
= AscGetChipCfgMsw(iop_base
);
9819 AscSetEEPConfig(iop_base
, eep_config
,
9820 asc_dvc
->bus_type
)) != 0) {
9822 ("AscInitFromEEP: Failed to re-write EEPROM with %d errors.\n",
9826 ("AscInitFromEEP: Successfully re-wrote EEPROM.\n");
9832 static ushort
AscInitMicroCodeVar(ASC_DVC_VAR
*asc_dvc
)
9840 iop_base
= asc_dvc
->iop_base
;
9842 for (i
= 0; i
<= ASC_MAX_TID
; i
++) {
9843 AscPutMCodeInitSDTRAtID(iop_base
, i
,
9844 asc_dvc
->cfg
->sdtr_period_offset
[i
]
9848 AscInitQLinkVar(asc_dvc
);
9849 AscWriteLramByte(iop_base
, ASCV_DISC_ENABLE_B
,
9850 asc_dvc
->cfg
->disc_enable
);
9851 AscWriteLramByte(iop_base
, ASCV_HOSTSCSI_ID_B
,
9852 ASC_TID_TO_TARGET_ID(asc_dvc
->cfg
->chip_scsi_id
));
9854 /* Align overrun buffer on an 8 byte boundary. */
9855 phy_addr
= virt_to_bus(asc_dvc
->cfg
->overrun_buf
);
9856 phy_addr
= cpu_to_le32((phy_addr
+ 7) & ~0x7);
9857 AscMemDWordCopyPtrToLram(iop_base
, ASCV_OVERRUN_PADDR_D
,
9858 (uchar
*)&phy_addr
, 1);
9859 phy_size
= cpu_to_le32(ASC_OVERRUN_BSIZE
- 8);
9860 AscMemDWordCopyPtrToLram(iop_base
, ASCV_OVERRUN_BSIZE_D
,
9861 (uchar
*)&phy_size
, 1);
9863 asc_dvc
->cfg
->mcode_date
=
9864 AscReadLramWord(iop_base
, (ushort
)ASCV_MC_DATE_W
);
9865 asc_dvc
->cfg
->mcode_version
=
9866 AscReadLramWord(iop_base
, (ushort
)ASCV_MC_VER_W
);
9868 AscSetPCAddr(iop_base
, ASC_MCODE_START_ADDR
);
9869 if (AscGetPCAddr(iop_base
) != ASC_MCODE_START_ADDR
) {
9870 asc_dvc
->err_code
|= ASC_IERR_SET_PC_ADDR
;
9873 if (AscStartChip(iop_base
) != 1) {
9874 asc_dvc
->err_code
|= ASC_IERR_START_STOP_CHIP
;
9881 static int __devinit
AscTestExternalLram(ASC_DVC_VAR
*asc_dvc
)
9888 iop_base
= asc_dvc
->iop_base
;
9890 q_addr
= ASC_QNO_TO_QADDR(241);
9891 saved_word
= AscReadLramWord(iop_base
, q_addr
);
9892 AscSetChipLramAddr(iop_base
, q_addr
);
9893 AscSetChipLramData(iop_base
, 0x55AA);
9894 DvcSleepMilliSecond(10);
9895 AscSetChipLramAddr(iop_base
, q_addr
);
9896 if (AscGetChipLramData(iop_base
) == 0x55AA) {
9898 AscWriteLramWord(iop_base
, q_addr
, saved_word
);
9903 static int __devinit
AscWriteEEPCmdReg(PortAddr iop_base
, uchar cmd_reg
)
9910 AscSetChipEEPCmd(iop_base
, cmd_reg
);
9911 DvcSleepMilliSecond(1);
9912 read_back
= AscGetChipEEPCmd(iop_base
);
9913 if (read_back
== cmd_reg
) {
9916 if (retry
++ > ASC_EEP_MAX_RETRY
) {
9922 static int __devinit
AscWriteEEPDataReg(PortAddr iop_base
, ushort data_reg
)
9929 AscSetChipEEPData(iop_base
, data_reg
);
9930 DvcSleepMilliSecond(1);
9931 read_back
= AscGetChipEEPData(iop_base
);
9932 if (read_back
== data_reg
) {
9935 if (retry
++ > ASC_EEP_MAX_RETRY
) {
9941 static void __devinit
AscWaitEEPRead(void)
9943 DvcSleepMilliSecond(1);
9947 static void __devinit
AscWaitEEPWrite(void)
9949 DvcSleepMilliSecond(20);
9953 static ushort __devinit
AscReadEEPWord(PortAddr iop_base
, uchar addr
)
9958 AscWriteEEPCmdReg(iop_base
, ASC_EEP_CMD_WRITE_DISABLE
);
9960 cmd_reg
= addr
| ASC_EEP_CMD_READ
;
9961 AscWriteEEPCmdReg(iop_base
, cmd_reg
);
9963 read_wval
= AscGetChipEEPData(iop_base
);
9968 static ushort __devinit
9969 AscWriteEEPWord(PortAddr iop_base
, uchar addr
, ushort word_val
)
9973 read_wval
= AscReadEEPWord(iop_base
, addr
);
9974 if (read_wval
!= word_val
) {
9975 AscWriteEEPCmdReg(iop_base
, ASC_EEP_CMD_WRITE_ABLE
);
9977 AscWriteEEPDataReg(iop_base
, word_val
);
9979 AscWriteEEPCmdReg(iop_base
,
9980 (uchar
)((uchar
)ASC_EEP_CMD_WRITE
| addr
));
9982 AscWriteEEPCmdReg(iop_base
, ASC_EEP_CMD_WRITE_DISABLE
);
9984 return (AscReadEEPWord(iop_base
, addr
));
9989 static ushort __devinit
9990 AscGetEEPConfig(PortAddr iop_base
, ASCEEP_CONFIG
*cfg_buf
, ushort bus_type
)
9997 int uchar_end_in_config
= ASC_EEP_MAX_DVC_ADDR
- 2;
10000 wbuf
= (ushort
*)cfg_buf
;
10002 /* Read two config words; Byte-swapping done by AscReadEEPWord(). */
10003 for (s_addr
= 0; s_addr
< 2; s_addr
++, wbuf
++) {
10004 *wbuf
= AscReadEEPWord(iop_base
, (uchar
)s_addr
);
10007 if (bus_type
& ASC_IS_VL
) {
10008 cfg_beg
= ASC_EEP_DVC_CFG_BEG_VL
;
10009 cfg_end
= ASC_EEP_MAX_DVC_ADDR_VL
;
10011 cfg_beg
= ASC_EEP_DVC_CFG_BEG
;
10012 cfg_end
= ASC_EEP_MAX_DVC_ADDR
;
10014 for (s_addr
= cfg_beg
; s_addr
<= (cfg_end
- 1); s_addr
++, wbuf
++) {
10015 wval
= AscReadEEPWord(iop_base
, (uchar
)s_addr
);
10016 if (s_addr
<= uchar_end_in_config
) {
10018 * Swap all char fields - must unswap bytes already swapped
10019 * by AscReadEEPWord().
10021 *wbuf
= le16_to_cpu(wval
);
10023 /* Don't swap word field at the end - cntl field. */
10026 sum
+= wval
; /* Checksum treats all EEPROM data as words. */
10029 * Read the checksum word which will be compared against 'sum'
10030 * by the caller. Word field already swapped.
10032 *wbuf
= AscReadEEPWord(iop_base
, (uchar
)s_addr
);
10036 static int __devinit
10037 AscSetEEPConfigOnce(PortAddr iop_base
, ASCEEP_CONFIG
*cfg_buf
, ushort bus_type
)
10046 int uchar_end_in_config
= ASC_EEP_MAX_DVC_ADDR
- 2;
10048 wbuf
= (ushort
*)cfg_buf
;
10051 /* Write two config words; AscWriteEEPWord() will swap bytes. */
10052 for (s_addr
= 0; s_addr
< 2; s_addr
++, wbuf
++) {
10054 if (*wbuf
!= AscWriteEEPWord(iop_base
, (uchar
)s_addr
, *wbuf
)) {
10058 if (bus_type
& ASC_IS_VL
) {
10059 cfg_beg
= ASC_EEP_DVC_CFG_BEG_VL
;
10060 cfg_end
= ASC_EEP_MAX_DVC_ADDR_VL
;
10062 cfg_beg
= ASC_EEP_DVC_CFG_BEG
;
10063 cfg_end
= ASC_EEP_MAX_DVC_ADDR
;
10065 for (s_addr
= cfg_beg
; s_addr
<= (cfg_end
- 1); s_addr
++, wbuf
++) {
10066 if (s_addr
<= uchar_end_in_config
) {
10068 * This is a char field. Swap char fields before they are
10069 * swapped again by AscWriteEEPWord().
10071 word
= cpu_to_le16(*wbuf
);
10073 AscWriteEEPWord(iop_base
, (uchar
)s_addr
, word
)) {
10077 /* Don't swap word field at the end - cntl field. */
10079 AscWriteEEPWord(iop_base
, (uchar
)s_addr
, *wbuf
)) {
10083 sum
+= *wbuf
; /* Checksum calculated from word values. */
10085 /* Write checksum word. It will be swapped by AscWriteEEPWord(). */
10087 if (sum
!= AscWriteEEPWord(iop_base
, (uchar
)s_addr
, sum
)) {
10091 /* Read EEPROM back again. */
10092 wbuf
= (ushort
*)cfg_buf
;
10094 * Read two config words; Byte-swapping done by AscReadEEPWord().
10096 for (s_addr
= 0; s_addr
< 2; s_addr
++, wbuf
++) {
10097 if (*wbuf
!= AscReadEEPWord(iop_base
, (uchar
)s_addr
)) {
10101 if (bus_type
& ASC_IS_VL
) {
10102 cfg_beg
= ASC_EEP_DVC_CFG_BEG_VL
;
10103 cfg_end
= ASC_EEP_MAX_DVC_ADDR_VL
;
10105 cfg_beg
= ASC_EEP_DVC_CFG_BEG
;
10106 cfg_end
= ASC_EEP_MAX_DVC_ADDR
;
10108 for (s_addr
= cfg_beg
; s_addr
<= (cfg_end
- 1); s_addr
++, wbuf
++) {
10109 if (s_addr
<= uchar_end_in_config
) {
10111 * Swap all char fields. Must unswap bytes already swapped
10112 * by AscReadEEPWord().
10115 le16_to_cpu(AscReadEEPWord
10116 (iop_base
, (uchar
)s_addr
));
10118 /* Don't swap word field at the end - cntl field. */
10119 word
= AscReadEEPWord(iop_base
, (uchar
)s_addr
);
10121 if (*wbuf
!= word
) {
10125 /* Read checksum; Byte swapping not needed. */
10126 if (AscReadEEPWord(iop_base
, (uchar
)s_addr
) != sum
) {
10132 static int __devinit
10133 AscSetEEPConfig(PortAddr iop_base
, ASCEEP_CONFIG
*cfg_buf
, ushort bus_type
)
10140 if ((n_error
= AscSetEEPConfigOnce(iop_base
, cfg_buf
,
10144 if (++retry
> ASC_EEP_MAX_RETRY
) {
10151 static void AscAsyncFix(ASC_DVC_VAR
*asc_dvc
, struct scsi_device
*sdev
)
10153 char type
= sdev
->type
;
10154 ASC_SCSI_BIT_ID_TYPE tid_bits
= 1 << sdev
->id
;
10156 if (asc_dvc
->bug_fix_cntl
& ASC_BUG_FIX_ASYN_USE_SYN
) {
10157 if (!(asc_dvc
->init_sdtr
& tid_bits
)) {
10158 if ((type
== TYPE_ROM
) &&
10159 (strncmp(sdev
->vendor
, "HP ", 3) == 0)) {
10160 asc_dvc
->pci_fix_asyn_xfer_always
|= tid_bits
;
10162 asc_dvc
->pci_fix_asyn_xfer
|= tid_bits
;
10163 if ((type
== TYPE_PROCESSOR
) ||
10164 (type
== TYPE_SCANNER
) || (type
== TYPE_ROM
) ||
10165 (type
== TYPE_TAPE
)) {
10166 asc_dvc
->pci_fix_asyn_xfer
&= ~tid_bits
;
10169 if (asc_dvc
->pci_fix_asyn_xfer
& tid_bits
) {
10170 AscSetRunChipSynRegAtID(asc_dvc
->iop_base
,
10172 ASYN_SDTR_DATA_FIX_PCI_REV_AB
);
10178 static uchar
AscReadLramByte(PortAddr iop_base
, ushort addr
)
10183 if (isodd_word(addr
)) {
10184 AscSetChipLramAddr(iop_base
, addr
- 1);
10185 word_data
= AscGetChipLramData(iop_base
);
10186 byte_data
= (uchar
)((word_data
>> 8) & 0xFF);
10188 AscSetChipLramAddr(iop_base
, addr
);
10189 word_data
= AscGetChipLramData(iop_base
);
10190 byte_data
= (uchar
)(word_data
& 0xFF);
10192 return (byte_data
);
10195 static ushort
AscReadLramWord(PortAddr iop_base
, ushort addr
)
10199 AscSetChipLramAddr(iop_base
, addr
);
10200 word_data
= AscGetChipLramData(iop_base
);
10201 return (word_data
);
10204 #if CC_VERY_LONG_SG_LIST
10205 static ASC_DCNT
AscReadLramDWord(PortAddr iop_base
, ushort addr
)
10207 ushort val_low
, val_high
;
10208 ASC_DCNT dword_data
;
10210 AscSetChipLramAddr(iop_base
, addr
);
10211 val_low
= AscGetChipLramData(iop_base
);
10212 val_high
= AscGetChipLramData(iop_base
);
10213 dword_data
= ((ASC_DCNT
) val_high
<< 16) | (ASC_DCNT
) val_low
;
10214 return (dword_data
);
10216 #endif /* CC_VERY_LONG_SG_LIST */
10218 static void AscWriteLramWord(PortAddr iop_base
, ushort addr
, ushort word_val
)
10220 AscSetChipLramAddr(iop_base
, addr
);
10221 AscSetChipLramData(iop_base
, word_val
);
10225 static void AscWriteLramByte(PortAddr iop_base
, ushort addr
, uchar byte_val
)
10229 if (isodd_word(addr
)) {
10231 word_data
= AscReadLramWord(iop_base
, addr
);
10232 word_data
&= 0x00FF;
10233 word_data
|= (((ushort
)byte_val
<< 8) & 0xFF00);
10235 word_data
= AscReadLramWord(iop_base
, addr
);
10236 word_data
&= 0xFF00;
10237 word_data
|= ((ushort
)byte_val
& 0x00FF);
10239 AscWriteLramWord(iop_base
, addr
, word_data
);
10244 * Copy 2 bytes to LRAM.
10246 * The source data is assumed to be in little-endian order in memory
10247 * and is maintained in little-endian order when written to LRAM.
10250 AscMemWordCopyPtrToLram(PortAddr iop_base
,
10251 ushort s_addr
, uchar
*s_buffer
, int words
)
10255 AscSetChipLramAddr(iop_base
, s_addr
);
10256 for (i
= 0; i
< 2 * words
; i
+= 2) {
10258 * On a little-endian system the second argument below
10259 * produces a little-endian ushort which is written to
10260 * LRAM in little-endian order. On a big-endian system
10261 * the second argument produces a big-endian ushort which
10262 * is "transparently" byte-swapped by outpw() and written
10263 * in little-endian order to LRAM.
10265 outpw(iop_base
+ IOP_RAM_DATA
,
10266 ((ushort
)s_buffer
[i
+ 1] << 8) | s_buffer
[i
]);
10272 * Copy 4 bytes to LRAM.
10274 * The source data is assumed to be in little-endian order in memory
10275 * and is maintained in little-endian order when writen to LRAM.
10278 AscMemDWordCopyPtrToLram(PortAddr iop_base
,
10279 ushort s_addr
, uchar
*s_buffer
, int dwords
)
10283 AscSetChipLramAddr(iop_base
, s_addr
);
10284 for (i
= 0; i
< 4 * dwords
; i
+= 4) {
10285 outpw(iop_base
+ IOP_RAM_DATA
, ((ushort
)s_buffer
[i
+ 1] << 8) | s_buffer
[i
]); /* LSW */
10286 outpw(iop_base
+ IOP_RAM_DATA
, ((ushort
)s_buffer
[i
+ 3] << 8) | s_buffer
[i
+ 2]); /* MSW */
10292 * Copy 2 bytes from LRAM.
10294 * The source data is assumed to be in little-endian order in LRAM
10295 * and is maintained in little-endian order when written to memory.
10298 AscMemWordCopyPtrFromLram(PortAddr iop_base
,
10299 ushort s_addr
, uchar
*d_buffer
, int words
)
10304 AscSetChipLramAddr(iop_base
, s_addr
);
10305 for (i
= 0; i
< 2 * words
; i
+= 2) {
10306 word
= inpw(iop_base
+ IOP_RAM_DATA
);
10307 d_buffer
[i
] = word
& 0xff;
10308 d_buffer
[i
+ 1] = (word
>> 8) & 0xff;
10313 static ASC_DCNT
AscMemSumLramWord(PortAddr iop_base
, ushort s_addr
, int words
)
10319 for (i
= 0; i
< words
; i
++, s_addr
+= 2) {
10320 sum
+= AscReadLramWord(iop_base
, s_addr
);
10326 AscMemWordSetLram(PortAddr iop_base
, ushort s_addr
, ushort set_wval
, int words
)
10330 AscSetChipLramAddr(iop_base
, s_addr
);
10331 for (i
= 0; i
< words
; i
++) {
10332 AscSetChipLramData(iop_base
, set_wval
);
10338 * --- Adv Library Functions
10343 /* Microcode buffer is kept after initialization for error recovery. */
10344 static unsigned char _adv_asc3550_buf
[] = {
10345 0x00, 0x00, 0x00, 0xf2, 0x00, 0xf0, 0x00, 0x16, 0x18, 0xe4, 0x00, 0xfc,
10346 0x01, 0x00, 0x48, 0xe4,
10347 0xbe, 0x18, 0x18, 0x80, 0x03, 0xf6, 0x02, 0x00, 0x00, 0xfa, 0xff, 0xff,
10348 0x28, 0x0e, 0x9e, 0xe7,
10349 0xff, 0x00, 0x82, 0xe7, 0x00, 0xea, 0x00, 0xf6, 0x01, 0xe6, 0x09, 0xe7,
10350 0x55, 0xf0, 0x01, 0xf6,
10351 0x01, 0xfa, 0x08, 0x00, 0x03, 0x00, 0x04, 0x00, 0x18, 0xf4, 0x10, 0x00,
10352 0x00, 0xec, 0x85, 0xf0,
10353 0xbc, 0x00, 0xd5, 0xf0, 0x8e, 0x0c, 0x38, 0x54, 0x00, 0xe6, 0x1e, 0xf0,
10354 0x86, 0xf0, 0xb4, 0x00,
10355 0x98, 0x57, 0xd0, 0x01, 0x0c, 0x1c, 0x3e, 0x1c, 0x0c, 0x00, 0xbb, 0x00,
10356 0xaa, 0x18, 0x02, 0x80,
10357 0x32, 0xf0, 0x01, 0xfc, 0x88, 0x0c, 0xc6, 0x12, 0x02, 0x13, 0x18, 0x40,
10358 0x00, 0x57, 0x01, 0xea,
10359 0x3c, 0x00, 0x6c, 0x01, 0x6e, 0x01, 0x04, 0x12, 0x3e, 0x57, 0x00, 0x80,
10360 0x03, 0xe6, 0xb6, 0x00,
10361 0xc0, 0x00, 0x01, 0x01, 0x3e, 0x01, 0xda, 0x0f, 0x22, 0x10, 0x08, 0x12,
10362 0x02, 0x4a, 0xb9, 0x54,
10363 0x03, 0x58, 0x1b, 0x80, 0x30, 0xe4, 0x4b, 0xe4, 0x20, 0x00, 0x32, 0x00,
10364 0x3e, 0x00, 0x80, 0x00,
10365 0x24, 0x01, 0x3c, 0x01, 0x68, 0x01, 0x6a, 0x01, 0x70, 0x01, 0x72, 0x01,
10366 0x74, 0x01, 0x76, 0x01,
10367 0x78, 0x01, 0x62, 0x0a, 0x92, 0x0c, 0x2c, 0x10, 0x2e, 0x10, 0x06, 0x13,
10368 0x4c, 0x1c, 0xbb, 0x55,
10369 0x3c, 0x56, 0x04, 0x80, 0x4a, 0xe4, 0x02, 0xee, 0x5b, 0xf0, 0xb1, 0xf0,
10370 0x03, 0xf7, 0x06, 0xf7,
10371 0x03, 0xfc, 0x0f, 0x00, 0x40, 0x00, 0xbe, 0x00, 0x00, 0x01, 0xb0, 0x08,
10372 0x30, 0x13, 0x64, 0x15,
10373 0x32, 0x1c, 0x38, 0x1c, 0x4e, 0x1c, 0x10, 0x44, 0x02, 0x48, 0x00, 0x4c,
10374 0x04, 0xea, 0x5d, 0xf0,
10375 0x04, 0xf6, 0x02, 0xfc, 0x05, 0x00, 0x34, 0x00, 0x36, 0x00, 0x98, 0x00,
10376 0xcc, 0x00, 0x20, 0x01,
10377 0x4e, 0x01, 0x4e, 0x0b, 0x1e, 0x0e, 0x0c, 0x10, 0x0a, 0x12, 0x04, 0x13,
10378 0x40, 0x13, 0x30, 0x1c,
10379 0x00, 0x4e, 0xbd, 0x56, 0x06, 0x83, 0x00, 0xdc, 0x05, 0xf0, 0x09, 0xf0,
10380 0x59, 0xf0, 0xa7, 0xf0,
10381 0xb8, 0xf0, 0x0e, 0xf7, 0x06, 0x00, 0x19, 0x00, 0x33, 0x00, 0x9b, 0x00,
10382 0xa4, 0x00, 0xb5, 0x00,
10383 0xba, 0x00, 0xd0, 0x00, 0xe1, 0x00, 0xe7, 0x00, 0xde, 0x03, 0x56, 0x0a,
10384 0x14, 0x0e, 0x02, 0x10,
10385 0x04, 0x10, 0x0a, 0x10, 0x36, 0x10, 0x0a, 0x13, 0x12, 0x13, 0x52, 0x13,
10386 0x10, 0x15, 0x14, 0x15,
10387 0xac, 0x16, 0x20, 0x1c, 0x34, 0x1c, 0x36, 0x1c, 0x08, 0x44, 0x38, 0x44,
10388 0x91, 0x44, 0x0a, 0x45,
10389 0x48, 0x46, 0x01, 0x48, 0x68, 0x54, 0x83, 0x55, 0xb0, 0x57, 0x01, 0x58,
10390 0x83, 0x59, 0x05, 0xe6,
10391 0x0b, 0xf0, 0x0c, 0xf0, 0x5c, 0xf0, 0x4b, 0xf4, 0x04, 0xf8, 0x05, 0xf8,
10392 0x02, 0xfa, 0x03, 0xfa,
10393 0x04, 0xfc, 0x05, 0xfc, 0x07, 0x00, 0x0a, 0x00, 0x0d, 0x00, 0x1c, 0x00,
10394 0x9e, 0x00, 0xa8, 0x00,
10395 0xaa, 0x00, 0xb9, 0x00, 0xe0, 0x00, 0x22, 0x01, 0x26, 0x01, 0x79, 0x01,
10396 0x7a, 0x01, 0xc0, 0x01,
10397 0xc2, 0x01, 0x7c, 0x02, 0x5a, 0x03, 0xea, 0x04, 0xe8, 0x07, 0x68, 0x08,
10398 0x69, 0x08, 0xba, 0x08,
10399 0xe9, 0x09, 0x06, 0x0b, 0x3a, 0x0e, 0x00, 0x10, 0x1a, 0x10, 0xed, 0x10,
10400 0xf1, 0x10, 0x06, 0x12,
10401 0x0c, 0x13, 0x16, 0x13, 0x1e, 0x13, 0x82, 0x13, 0x42, 0x14, 0xd6, 0x14,
10402 0x8a, 0x15, 0xc6, 0x17,
10403 0xd2, 0x17, 0x6b, 0x18, 0x12, 0x1c, 0x46, 0x1c, 0x9c, 0x32, 0x00, 0x40,
10404 0x0e, 0x47, 0x48, 0x47,
10405 0x41, 0x48, 0x89, 0x48, 0x80, 0x4c, 0x00, 0x54, 0x44, 0x55, 0xe5, 0x55,
10406 0x14, 0x56, 0x77, 0x57,
10407 0xbf, 0x57, 0x40, 0x5c, 0x06, 0x80, 0x08, 0x90, 0x03, 0xa1, 0xfe, 0x9c,
10408 0xf0, 0x29, 0x02, 0xfe,
10409 0xb8, 0x0c, 0xff, 0x10, 0x00, 0x00, 0xd0, 0xfe, 0xcc, 0x18, 0x00, 0xcf,
10410 0xfe, 0x80, 0x01, 0xff,
10411 0x03, 0x00, 0x00, 0xfe, 0x93, 0x15, 0xfe, 0x0f, 0x05, 0xff, 0x38, 0x00,
10412 0x00, 0xfe, 0x57, 0x24,
10413 0x00, 0xfe, 0x48, 0x00, 0x4f, 0xff, 0x04, 0x00, 0x00, 0x10, 0xff, 0x09,
10414 0x00, 0x00, 0xff, 0x08,
10415 0x01, 0x01, 0xff, 0x08, 0xff, 0xff, 0xff, 0x27, 0x00, 0x00, 0xff, 0x10,
10416 0xff, 0xff, 0xff, 0x0f,
10417 0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, 0x00, 0x00,
10418 0xfe, 0x04, 0xf7, 0xcf,
10419 0x2a, 0x67, 0x0b, 0x01, 0xfe, 0xce, 0x0e, 0xfe, 0x04, 0xf7, 0xcf, 0x67,
10420 0x0b, 0x3c, 0x2a, 0xfe,
10421 0x3d, 0xf0, 0xfe, 0x02, 0x02, 0xfe, 0x20, 0xf0, 0x9c, 0xfe, 0x91, 0xf0,
10422 0xfe, 0xf0, 0x01, 0xfe,
10423 0x90, 0xf0, 0xfe, 0xf0, 0x01, 0xfe, 0x8f, 0xf0, 0x9c, 0x05, 0x51, 0x3b,
10424 0x02, 0xfe, 0xd4, 0x0c,
10425 0x01, 0xfe, 0x44, 0x0d, 0xfe, 0xdd, 0x12, 0xfe, 0xfc, 0x10, 0xfe, 0x28,
10426 0x1c, 0x05, 0xfe, 0xa6,
10427 0x00, 0xfe, 0xd3, 0x12, 0x47, 0x18, 0xfe, 0xa6, 0x00, 0xb5, 0xfe, 0x48,
10428 0xf0, 0xfe, 0x86, 0x02,
10429 0xfe, 0x49, 0xf0, 0xfe, 0xa0, 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xbe, 0x02,
10430 0xfe, 0x46, 0xf0, 0xfe,
10431 0x50, 0x02, 0xfe, 0x47, 0xf0, 0xfe, 0x56, 0x02, 0xfe, 0x43, 0xf0, 0xfe,
10432 0x44, 0x02, 0xfe, 0x44,
10433 0xf0, 0xfe, 0x48, 0x02, 0xfe, 0x45, 0xf0, 0xfe, 0x4c, 0x02, 0x17, 0x0b,
10434 0xa0, 0x17, 0x06, 0x18,
10435 0x96, 0x02, 0x29, 0xfe, 0x00, 0x1c, 0xde, 0xfe, 0x02, 0x1c, 0xdd, 0xfe,
10436 0x1e, 0x1c, 0xfe, 0xe9,
10437 0x10, 0x01, 0xfe, 0x20, 0x17, 0xfe, 0xe7, 0x10, 0xfe, 0x06, 0xfc, 0xc7,
10438 0x0a, 0x6b, 0x01, 0x9e,
10439 0x02, 0x29, 0x14, 0x4d, 0x37, 0x97, 0x01, 0xfe, 0x64, 0x0f, 0x0a, 0x6b,
10440 0x01, 0x82, 0xfe, 0xbd,
10441 0x10, 0x0a, 0x6b, 0x01, 0x82, 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c, 0xfe,
10442 0x58, 0x1c, 0x17, 0x06,
10443 0x18, 0x96, 0x2a, 0x25, 0x29, 0xfe, 0x3d, 0xf0, 0xfe, 0x02, 0x02, 0x21,
10444 0xfe, 0x94, 0x02, 0xfe,
10445 0x5a, 0x1c, 0xea, 0xfe, 0x14, 0x1c, 0x14, 0xfe, 0x30, 0x00, 0x37, 0x97,
10446 0x01, 0xfe, 0x54, 0x0f,
10447 0x17, 0x06, 0x18, 0x96, 0x02, 0xd0, 0x1e, 0x20, 0x07, 0x10, 0x34, 0xfe,
10448 0x69, 0x10, 0x17, 0x06,
10449 0x18, 0x96, 0xfe, 0x04, 0xec, 0x20, 0x46, 0x3d, 0x12, 0x20, 0xfe, 0x05,
10450 0xf6, 0xc7, 0x01, 0xfe,
10451 0x52, 0x16, 0x09, 0x4a, 0x4c, 0x35, 0x11, 0x2d, 0x3c, 0x8a, 0x01, 0xe6,
10452 0x02, 0x29, 0x0a, 0x40,
10453 0x01, 0x0e, 0x07, 0x00, 0x5d, 0x01, 0x6f, 0xfe, 0x18, 0x10, 0xfe, 0x41,
10454 0x58, 0x0a, 0x99, 0x01,
10455 0x0e, 0xfe, 0xc8, 0x54, 0x64, 0xfe, 0x0c, 0x03, 0x01, 0xe6, 0x02, 0x29,
10456 0x2a, 0x46, 0xfe, 0x02,
10457 0xe8, 0x27, 0xf8, 0xfe, 0x9e, 0x43, 0xf7, 0xfe, 0x27, 0xf0, 0xfe, 0xdc,
10458 0x01, 0xfe, 0x07, 0x4b,
10459 0xfe, 0x20, 0xf0, 0x9c, 0xfe, 0x40, 0x1c, 0x25, 0xd2, 0xfe, 0x26, 0xf0,
10460 0xfe, 0x56, 0x03, 0xfe,
10461 0xa0, 0xf0, 0xfe, 0x44, 0x03, 0xfe, 0x11, 0xf0, 0x9c, 0xfe, 0xef, 0x10,
10462 0xfe, 0x9f, 0xf0, 0xfe,
10463 0x64, 0x03, 0xeb, 0x0f, 0xfe, 0x11, 0x00, 0x02, 0x5a, 0x2a, 0xfe, 0x48,
10464 0x1c, 0xeb, 0x09, 0x04,
10465 0x1d, 0xfe, 0x18, 0x13, 0x23, 0x1e, 0x98, 0xac, 0x12, 0x98, 0x0a, 0x40,
10466 0x01, 0x0e, 0xac, 0x75,
10467 0x01, 0xfe, 0xbc, 0x15, 0x11, 0xca, 0x25, 0xd2, 0xfe, 0x01, 0xf0, 0xd2,
10468 0xfe, 0x82, 0xf0, 0xfe,
10469 0x92, 0x03, 0xec, 0x11, 0xfe, 0xe4, 0x00, 0x65, 0xfe, 0xa4, 0x03, 0x25,
10470 0x32, 0x1f, 0xfe, 0xb4,
10471 0x03, 0x01, 0x43, 0xfe, 0x06, 0xf0, 0xfe, 0xc4, 0x03, 0x8d, 0x81, 0xfe,
10472 0x0a, 0xf0, 0xfe, 0x7a,
10473 0x06, 0x02, 0x22, 0x05, 0x6b, 0x28, 0x16, 0xfe, 0xf6, 0x04, 0x14, 0x2c,
10474 0x01, 0x33, 0x8f, 0xfe,
10475 0x66, 0x02, 0x02, 0xd1, 0xeb, 0x2a, 0x67, 0x1a, 0xfe, 0x67, 0x1b, 0xf8,
10476 0xf7, 0xfe, 0x48, 0x1c,
10477 0x70, 0x01, 0x6e, 0x87, 0x0a, 0x40, 0x01, 0x0e, 0x07, 0x00, 0x16, 0xd3,
10478 0x0a, 0xca, 0x01, 0x0e,
10479 0x74, 0x60, 0x59, 0x76, 0x27, 0x05, 0x6b, 0x28, 0xfe, 0x10, 0x12, 0x14,
10480 0x2c, 0x01, 0x33, 0x8f,
10481 0xfe, 0x66, 0x02, 0x02, 0xd1, 0xbc, 0x7d, 0xbd, 0x7f, 0x25, 0x22, 0x65,
10482 0xfe, 0x3c, 0x04, 0x1f,
10483 0xfe, 0x38, 0x04, 0x68, 0xfe, 0xa0, 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x4e,
10484 0x12, 0x2b, 0xff, 0x02,
10485 0x00, 0x10, 0x01, 0x08, 0x1f, 0xfe, 0xe0, 0x04, 0x2b, 0x01, 0x08, 0x1f,
10486 0x22, 0x30, 0x2e, 0xd5,
10487 0xfe, 0x4c, 0x44, 0xfe, 0x4c, 0x12, 0x60, 0xfe, 0x44, 0x48, 0x13, 0x2c,
10488 0xfe, 0x4c, 0x54, 0x64,
10489 0xd3, 0x46, 0x76, 0x27, 0xfa, 0xef, 0xfe, 0x62, 0x13, 0x09, 0x04, 0x1d,
10490 0xfe, 0x2a, 0x13, 0x2f,
10491 0x07, 0x7e, 0xa5, 0xfe, 0x20, 0x10, 0x13, 0x2c, 0xfe, 0x4c, 0x54, 0x64,
10492 0xd3, 0xfa, 0xef, 0x86,
10493 0x09, 0x04, 0x1d, 0xfe, 0x08, 0x13, 0x2f, 0x07, 0x7e, 0x6e, 0x09, 0x04,
10494 0x1d, 0xfe, 0x1c, 0x12,
10495 0x14, 0x92, 0x09, 0x04, 0x06, 0x3b, 0x14, 0xc4, 0x01, 0x33, 0x8f, 0xfe,
10496 0x70, 0x0c, 0x02, 0x22,
10497 0x2b, 0x11, 0xfe, 0xe6, 0x00, 0xfe, 0x1c, 0x90, 0xf9, 0x03, 0x14, 0x92,
10498 0x01, 0x33, 0x02, 0x29,
10499 0xfe, 0x42, 0x5b, 0x67, 0x1a, 0xfe, 0x46, 0x59, 0xf8, 0xf7, 0xfe, 0x87,
10500 0x80, 0xfe, 0x31, 0xe4,
10501 0x4f, 0x09, 0x04, 0x0b, 0xfe, 0x78, 0x13, 0xfe, 0x20, 0x80, 0x07, 0x1a,
10502 0xfe, 0x70, 0x12, 0x49,
10503 0x04, 0x06, 0xfe, 0x60, 0x13, 0x05, 0xfe, 0xa2, 0x00, 0x28, 0x16, 0xfe,
10504 0x80, 0x05, 0xfe, 0x31,
10505 0xe4, 0x6a, 0x49, 0x04, 0x0b, 0xfe, 0x4a, 0x13, 0x05, 0xfe, 0xa0, 0x00,
10506 0x28, 0xfe, 0x42, 0x12,
10507 0x5e, 0x01, 0x08, 0x25, 0x32, 0xf1, 0x01, 0x08, 0x26, 0xfe, 0x98, 0x05,
10508 0x11, 0xfe, 0xe3, 0x00,
10509 0x23, 0x49, 0xfe, 0x4a, 0xf0, 0xfe, 0x6a, 0x05, 0xfe, 0x49, 0xf0, 0xfe,
10510 0x64, 0x05, 0x83, 0x24,
10511 0xfe, 0x21, 0x00, 0xa1, 0x24, 0xfe, 0x22, 0x00, 0xa0, 0x24, 0x4c, 0xfe,
10512 0x09, 0x48, 0x01, 0x08,
10513 0x26, 0xfe, 0x98, 0x05, 0xfe, 0xe2, 0x08, 0x49, 0x04, 0xc5, 0x3b, 0x01,
10514 0x86, 0x24, 0x06, 0x12,
10515 0xcc, 0x37, 0xfe, 0x27, 0x01, 0x09, 0x04, 0x1d, 0xfe, 0x22, 0x12, 0x47,
10516 0x01, 0xa7, 0x14, 0x92,
10517 0x09, 0x04, 0x06, 0x3b, 0x14, 0xc4, 0x01, 0x33, 0x8f, 0xfe, 0x70, 0x0c,
10518 0x02, 0x22, 0x05, 0xfe,
10519 0x9c, 0x00, 0x28, 0xfe, 0x3e, 0x12, 0x05, 0x50, 0x28, 0xfe, 0x36, 0x13,
10520 0x47, 0x01, 0xa7, 0x26,
10521 0xfe, 0x08, 0x06, 0x0a, 0x06, 0x49, 0x04, 0x19, 0xfe, 0x02, 0x12, 0x5f,
10522 0x01, 0xfe, 0xaa, 0x14,
10523 0x1f, 0xfe, 0xfe, 0x05, 0x11, 0x9a, 0x01, 0x43, 0x11, 0xfe, 0xe5, 0x00,
10524 0x05, 0x50, 0xb4, 0x0c,
10525 0x50, 0x05, 0xc6, 0x28, 0xfe, 0x62, 0x12, 0x05, 0x3f, 0x28, 0xfe, 0x5a,
10526 0x13, 0x01, 0xfe, 0x14,
10527 0x18, 0x01, 0xfe, 0x66, 0x18, 0xfe, 0x43, 0x48, 0xb7, 0x19, 0x13, 0x6c,
10528 0xff, 0x02, 0x00, 0x57,
10529 0x48, 0x8b, 0x1c, 0x3d, 0x85, 0xb7, 0x69, 0x47, 0x01, 0xa7, 0x26, 0xfe,
10530 0x72, 0x06, 0x49, 0x04,
10531 0x1b, 0xdf, 0x89, 0x0a, 0x4d, 0x01, 0xfe, 0xd8, 0x14, 0x1f, 0xfe, 0x68,
10532 0x06, 0x11, 0x9a, 0x01,
10533 0x43, 0x11, 0xfe, 0xe5, 0x00, 0x05, 0x3f, 0xb4, 0x0c, 0x3f, 0x17, 0x06,
10534 0x01, 0xa7, 0xec, 0x72,
10535 0x70, 0x01, 0x6e, 0x87, 0x11, 0xfe, 0xe2, 0x00, 0x01, 0x08, 0x25, 0x32,
10536 0xfe, 0x0a, 0xf0, 0xfe,
10537 0xa6, 0x06, 0x8c, 0xfe, 0x5c, 0x07, 0xfe, 0x06, 0xf0, 0xfe, 0x64, 0x07,
10538 0x8d, 0x81, 0x02, 0x22,
10539 0x09, 0x04, 0x0b, 0xfe, 0x2e, 0x12, 0x15, 0x1a, 0x01, 0x08, 0x15, 0x00,
10540 0x01, 0x08, 0x15, 0x00,
10541 0x01, 0x08, 0x15, 0x00, 0x01, 0x08, 0xfe, 0x99, 0xa4, 0x01, 0x08, 0x15,
10542 0x00, 0x02, 0xfe, 0x32,
10543 0x08, 0x61, 0x04, 0x1b, 0xfe, 0x38, 0x12, 0x09, 0x04, 0x1b, 0x6e, 0x15,
10544 0xfe, 0x1b, 0x00, 0x01,
10545 0x08, 0x15, 0x00, 0x01, 0x08, 0x15, 0x00, 0x01, 0x08, 0x15, 0x00, 0x01,
10546 0x08, 0x15, 0x06, 0x01,
10547 0x08, 0x15, 0x00, 0x02, 0xd9, 0x66, 0x4c, 0xfe, 0x3a, 0x55, 0x5f, 0xfe,
10548 0x9a, 0x81, 0x4b, 0x1d,
10549 0xba, 0xfe, 0x32, 0x07, 0x0a, 0x1d, 0xfe, 0x09, 0x6f, 0xaf, 0xfe, 0xca,
10550 0x45, 0xfe, 0x32, 0x12,
10551 0x62, 0x2c, 0x85, 0x66, 0x7b, 0x01, 0x08, 0x25, 0x32, 0xfe, 0x0a, 0xf0,
10552 0xfe, 0x32, 0x07, 0x8d,
10553 0x81, 0x8c, 0xfe, 0x5c, 0x07, 0x02, 0x22, 0x01, 0x43, 0x02, 0xfe, 0x8a,
10554 0x06, 0x15, 0x19, 0x02,
10555 0xfe, 0x8a, 0x06, 0xfe, 0x9c, 0xf7, 0xd4, 0xfe, 0x2c, 0x90, 0xfe, 0xae,
10556 0x90, 0x77, 0xfe, 0xca,
10557 0x07, 0x0c, 0x54, 0x18, 0x55, 0x09, 0x4a, 0x6a, 0x35, 0x1e, 0x20, 0x07,
10558 0x10, 0xfe, 0x0e, 0x12,
10559 0x74, 0xfe, 0x80, 0x80, 0x37, 0x20, 0x63, 0x27, 0xfe, 0x06, 0x10, 0xfe,
10560 0x83, 0xe7, 0xc4, 0xa1,
10561 0xfe, 0x03, 0x40, 0x09, 0x4a, 0x4f, 0x35, 0x01, 0xa8, 0xad, 0xfe, 0x1f,
10562 0x40, 0x12, 0x58, 0x01,
10563 0xa5, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0xfe, 0x44, 0x51, 0xfe, 0xc6,
10564 0x51, 0x83, 0xfb, 0xfe,
10565 0x8a, 0x90, 0x0c, 0x52, 0x18, 0x53, 0xfe, 0x0c, 0x90, 0xfe, 0x8e, 0x90,
10566 0xfe, 0x40, 0x50, 0xfe,
10567 0xc2, 0x50, 0x0c, 0x39, 0x18, 0x3a, 0xfe, 0x4a, 0x10, 0x09, 0x04, 0x6a,
10568 0xfe, 0x2a, 0x12, 0xfe,
10569 0x2c, 0x90, 0xfe, 0xae, 0x90, 0x0c, 0x54, 0x18, 0x55, 0x09, 0x04, 0x4f,
10570 0x85, 0x01, 0xa8, 0xfe,
10571 0x1f, 0x80, 0x12, 0x58, 0xfe, 0x44, 0x90, 0xfe, 0xc6, 0x90, 0x0c, 0x56,
10572 0x18, 0x57, 0xfb, 0xfe,
10573 0x8a, 0x90, 0x0c, 0x52, 0x18, 0x53, 0xfe, 0x40, 0x90, 0xfe, 0xc2, 0x90,
10574 0x0c, 0x39, 0x18, 0x3a,
10575 0x0c, 0x38, 0x18, 0x4e, 0x09, 0x4a, 0x19, 0x35, 0x2a, 0x13, 0xfe, 0x4e,
10576 0x11, 0x65, 0xfe, 0x48,
10577 0x08, 0xfe, 0x9e, 0xf0, 0xfe, 0x5c, 0x08, 0xb1, 0x16, 0x32, 0x2a, 0x73,
10578 0xdd, 0xb8, 0xfe, 0x80,
10579 0x08, 0xb9, 0xfe, 0x9e, 0x08, 0x8c, 0xfe, 0x74, 0x08, 0xfe, 0x06, 0xf0,
10580 0xfe, 0x7a, 0x08, 0x8d,
10581 0x81, 0x02, 0x22, 0x01, 0x43, 0xfe, 0xc9, 0x10, 0x15, 0x19, 0xfe, 0xc9,
10582 0x10, 0x61, 0x04, 0x06,
10583 0xfe, 0x10, 0x12, 0x61, 0x04, 0x0b, 0x45, 0x09, 0x04, 0x0b, 0xfe, 0x68,
10584 0x12, 0xfe, 0x2e, 0x1c,
10585 0x02, 0xfe, 0x24, 0x0a, 0x61, 0x04, 0x06, 0x45, 0x61, 0x04, 0x0b, 0xfe,
10586 0x52, 0x12, 0xfe, 0x2c,
10587 0x1c, 0xfe, 0xaa, 0xf0, 0xfe, 0x1e, 0x09, 0xfe, 0xac, 0xf0, 0xfe, 0xbe,
10588 0x08, 0xfe, 0x8a, 0x10,
10589 0xaa, 0xfe, 0xf3, 0x10, 0xfe, 0xad, 0xf0, 0xfe, 0xca, 0x08, 0x02, 0xfe,
10590 0x24, 0x0a, 0xab, 0xfe,
10591 0xe7, 0x10, 0xfe, 0x2b, 0xf0, 0x9d, 0xe9, 0x1c, 0xfe, 0x00, 0xfe, 0xfe,
10592 0x1c, 0x12, 0xb5, 0xfe,
10593 0xd2, 0xf0, 0x9d, 0xfe, 0x76, 0x18, 0x1c, 0x1a, 0x16, 0x9d, 0x05, 0xcb,
10594 0x1c, 0x06, 0x16, 0x9d,
10595 0xb8, 0x6d, 0xb9, 0x6d, 0xaa, 0xab, 0xfe, 0xb1, 0x10, 0x70, 0x5e, 0x2b,
10596 0x14, 0x92, 0x01, 0x33,
10597 0x0f, 0xfe, 0x35, 0x00, 0xfe, 0x01, 0xf0, 0x5a, 0x0f, 0x7c, 0x02, 0x5a,
10598 0xfe, 0x74, 0x18, 0x1c,
10599 0xfe, 0x00, 0xf8, 0x16, 0x6d, 0x67, 0x1b, 0x01, 0xfe, 0x44, 0x0d, 0x3b,
10600 0x01, 0xe6, 0x1e, 0x27,
10601 0x74, 0x67, 0x1a, 0x02, 0x6d, 0x09, 0x04, 0x0b, 0x21, 0xfe, 0x06, 0x0a,
10602 0x09, 0x04, 0x6a, 0xfe,
10603 0x82, 0x12, 0x09, 0x04, 0x19, 0xfe, 0x66, 0x13, 0x1e, 0x58, 0xac, 0xfc,
10604 0xfe, 0x83, 0x80, 0xfe,
10605 0xc8, 0x44, 0xfe, 0x2e, 0x13, 0xfe, 0x04, 0x91, 0xfe, 0x86, 0x91, 0x63,
10606 0x27, 0xfe, 0x40, 0x59,
10607 0xfe, 0xc1, 0x59, 0x77, 0xd7, 0x05, 0x54, 0x31, 0x55, 0x0c, 0x7b, 0x18,
10608 0x7c, 0xbe, 0x54, 0xbf,
10609 0x55, 0x01, 0xa8, 0xad, 0x63, 0x27, 0x12, 0x58, 0xc0, 0x38, 0xc1, 0x4e,
10610 0x79, 0x56, 0x68, 0x57,
10611 0xf4, 0xf5, 0xfe, 0x04, 0xfa, 0x38, 0xfe, 0x05, 0xfa, 0x4e, 0x01, 0xa5,
10612 0xa2, 0x23, 0x0c, 0x7b,
10613 0x0c, 0x7c, 0x79, 0x56, 0x68, 0x57, 0xfe, 0x12, 0x10, 0x09, 0x04, 0x19,
10614 0x16, 0xd7, 0x79, 0x39,
10615 0x68, 0x3a, 0x09, 0x04, 0xfe, 0xf7, 0x00, 0x35, 0x05, 0x52, 0x31, 0x53,
10616 0xfe, 0x10, 0x58, 0xfe,
10617 0x91, 0x58, 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0x02, 0x6d, 0x09, 0x04,
10618 0x19, 0x16, 0xd7, 0x09,
10619 0x04, 0xfe, 0xf7, 0x00, 0x35, 0xfe, 0x3a, 0x55, 0xfe, 0x19, 0x81, 0x5f,
10620 0xfe, 0x10, 0x90, 0xfe,
10621 0x92, 0x90, 0xfe, 0xd7, 0x10, 0x2f, 0x07, 0x9b, 0x16, 0xfe, 0xc6, 0x08,
10622 0x11, 0x9b, 0x09, 0x04,
10623 0x0b, 0xfe, 0x14, 0x13, 0x05, 0x39, 0x31, 0x3a, 0x77, 0xfe, 0xc6, 0x08,
10624 0xfe, 0x0c, 0x58, 0xfe,
10625 0x8d, 0x58, 0x02, 0x6d, 0x23, 0x47, 0xfe, 0x19, 0x80, 0xde, 0x09, 0x04,
10626 0x0b, 0xfe, 0x1a, 0x12,
10627 0xfe, 0x6c, 0x19, 0xfe, 0x19, 0x41, 0xe9, 0xb5, 0xfe, 0xd1, 0xf0, 0xd9,
10628 0x14, 0x7a, 0x01, 0x33,
10629 0x0f, 0xfe, 0x44, 0x00, 0xfe, 0x8e, 0x10, 0xfe, 0x6c, 0x19, 0xbe, 0x39,
10630 0xfe, 0xed, 0x19, 0xbf,
10631 0x3a, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0xe9, 0x1c, 0xfe, 0x00, 0xff,
10632 0x34, 0xfe, 0x74, 0x10,
10633 0xb5, 0xfe, 0xd2, 0xf0, 0xfe, 0xb2, 0x0a, 0xfe, 0x76, 0x18, 0x1c, 0x1a,
10634 0x84, 0x05, 0xcb, 0x1c,
10635 0x06, 0xfe, 0x08, 0x13, 0x0f, 0xfe, 0x16, 0x00, 0x02, 0x5a, 0xfe, 0xd1,
10636 0xf0, 0xfe, 0xc4, 0x0a,
10637 0x14, 0x7a, 0x01, 0x33, 0x0f, 0xfe, 0x17, 0x00, 0xfe, 0x42, 0x10, 0xfe,
10638 0xce, 0xf0, 0xfe, 0xca,
10639 0x0a, 0xfe, 0x3c, 0x10, 0xfe, 0xcd, 0xf0, 0xfe, 0xd6, 0x0a, 0x0f, 0xfe,
10640 0x22, 0x00, 0x02, 0x5a,
10641 0xfe, 0xcb, 0xf0, 0xfe, 0xe2, 0x0a, 0x0f, 0xfe, 0x24, 0x00, 0x02, 0x5a,
10642 0xfe, 0xd0, 0xf0, 0xfe,
10643 0xec, 0x0a, 0x0f, 0x93, 0xdc, 0xfe, 0xcf, 0xf0, 0xfe, 0xf6, 0x0a, 0x0f,
10644 0x4c, 0xfe, 0x10, 0x10,
10645 0xfe, 0xcc, 0xf0, 0xd9, 0x61, 0x04, 0x19, 0x3b, 0x0f, 0xfe, 0x12, 0x00,
10646 0x2a, 0x13, 0xfe, 0x4e,
10647 0x11, 0x65, 0xfe, 0x0c, 0x0b, 0xfe, 0x9e, 0xf0, 0xfe, 0x20, 0x0b, 0xb1,
10648 0x16, 0x32, 0x2a, 0x73,
10649 0xdd, 0xb8, 0x22, 0xb9, 0x22, 0x2a, 0xec, 0x65, 0xfe, 0x2c, 0x0b, 0x25,
10650 0x32, 0x8c, 0xfe, 0x48,
10651 0x0b, 0x8d, 0x81, 0xb8, 0xd4, 0xb9, 0xd4, 0x02, 0x22, 0x01, 0x43, 0xfe,
10652 0xdb, 0x10, 0x11, 0xfe,
10653 0xe8, 0x00, 0xaa, 0xab, 0x70, 0xbc, 0x7d, 0xbd, 0x7f, 0xfe, 0x89, 0xf0,
10654 0x22, 0x30, 0x2e, 0xd8,
10655 0xbc, 0x7d, 0xbd, 0x7f, 0x01, 0x08, 0x1f, 0x22, 0x30, 0x2e, 0xd6, 0xb1,
10656 0x45, 0x0f, 0xfe, 0x42,
10657 0x00, 0x02, 0x5a, 0x78, 0x06, 0xfe, 0x81, 0x49, 0x16, 0xfe, 0x38, 0x0c,
10658 0x09, 0x04, 0x0b, 0xfe,
10659 0x44, 0x13, 0x0f, 0x00, 0x4b, 0x0b, 0xfe, 0x54, 0x12, 0x4b, 0xfe, 0x28,
10660 0x00, 0x21, 0xfe, 0xa6,
10661 0x0c, 0x0a, 0x40, 0x01, 0x0e, 0x07, 0x00, 0x5d, 0x3e, 0xfe, 0x28, 0x00,
10662 0xfe, 0xe2, 0x10, 0x01,
10663 0xe7, 0x01, 0xe8, 0x0a, 0x99, 0x01, 0xfe, 0x32, 0x0e, 0x59, 0x11, 0x2d,
10664 0x01, 0x6f, 0x02, 0x29,
10665 0x0f, 0xfe, 0x44, 0x00, 0x4b, 0x0b, 0xdf, 0x3e, 0x0b, 0xfe, 0xb4, 0x10,
10666 0x01, 0x86, 0x3e, 0x0b,
10667 0xfe, 0xaa, 0x10, 0x01, 0x86, 0xfe, 0x19, 0x82, 0xfe, 0x34, 0x46, 0xa3,
10668 0x3e, 0x0b, 0x0f, 0xfe,
10669 0x43, 0x00, 0xfe, 0x96, 0x10, 0x09, 0x4a, 0x0b, 0x35, 0x01, 0xe7, 0x01,
10670 0xe8, 0x59, 0x11, 0x2d,
10671 0x01, 0x6f, 0x67, 0x0b, 0x59, 0x3c, 0x8a, 0x02, 0xfe, 0x2a, 0x03, 0x09,
10672 0x04, 0x0b, 0x84, 0x3e,
10673 0x0b, 0x0f, 0x00, 0xfe, 0x5c, 0x10, 0x61, 0x04, 0x1b, 0xfe, 0x58, 0x12,
10674 0x09, 0x04, 0x1b, 0xfe,
10675 0x50, 0x13, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x5c, 0x0c, 0xfe,
10676 0x1c, 0x1c, 0xfe, 0x9d,
10677 0xf0, 0xfe, 0x62, 0x0c, 0x09, 0x4a, 0x1b, 0x35, 0xfe, 0xa9, 0x10, 0x0f,
10678 0xfe, 0x15, 0x00, 0xfe,
10679 0x04, 0xe6, 0x0b, 0x5f, 0x5c, 0x0f, 0xfe, 0x13, 0x00, 0xfe, 0x10, 0x10,
10680 0x0f, 0xfe, 0x47, 0x00,
10681 0xa1, 0x0f, 0xfe, 0x41, 0x00, 0xa0, 0x0f, 0xfe, 0x24, 0x00, 0x87, 0xaa,
10682 0xab, 0x70, 0x05, 0x6b,
10683 0x28, 0x21, 0xd1, 0x5f, 0xfe, 0x04, 0xe6, 0x1b, 0xfe, 0x9d, 0x41, 0xfe,
10684 0x1c, 0x42, 0x59, 0x01,
10685 0xda, 0x02, 0x29, 0xea, 0x14, 0x0b, 0x37, 0x95, 0xa9, 0x14, 0xfe, 0x31,
10686 0x00, 0x37, 0x97, 0x01,
10687 0xfe, 0x54, 0x0f, 0x02, 0xd0, 0x3c, 0xfe, 0x06, 0xec, 0xc9, 0xee, 0x3e,
10688 0x1d, 0xfe, 0xce, 0x45,
10689 0x34, 0x3c, 0xfe, 0x06, 0xea, 0xc9, 0xfe, 0x47, 0x4b, 0x89, 0xfe, 0x75,
10690 0x57, 0x05, 0x51, 0xfe,
10691 0x98, 0x56, 0xfe, 0x38, 0x12, 0x0a, 0x42, 0x01, 0x0e, 0xfe, 0x44, 0x48,
10692 0x46, 0x09, 0x04, 0x1d,
10693 0xfe, 0x1a, 0x13, 0x0a, 0x40, 0x01, 0x0e, 0x47, 0xfe, 0x41, 0x58, 0x0a,
10694 0x99, 0x01, 0x0e, 0xfe,
10695 0x49, 0x54, 0x8e, 0xfe, 0x2a, 0x0d, 0x02, 0xfe, 0x2a, 0x03, 0x0a, 0x51,
10696 0xfe, 0xee, 0x14, 0xee,
10697 0x3e, 0x1d, 0xfe, 0xce, 0x45, 0x34, 0x3c, 0xfe, 0xce, 0x47, 0xfe, 0xad,
10698 0x13, 0x02, 0x29, 0x1e,
10699 0x20, 0x07, 0x10, 0xfe, 0x9e, 0x12, 0x23, 0x12, 0x4d, 0x12, 0x94, 0x12,
10700 0xce, 0x1e, 0x2d, 0x47,
10701 0x37, 0x2d, 0xb1, 0xe0, 0xfe, 0xbc, 0xf0, 0xfe, 0xec, 0x0d, 0x13, 0x06,
10702 0x12, 0x4d, 0x01, 0xfe,
10703 0xe2, 0x15, 0x05, 0xfe, 0x38, 0x01, 0x31, 0xfe, 0x3a, 0x01, 0x77, 0xfe,
10704 0xf0, 0x0d, 0xfe, 0x02,
10705 0xec, 0xce, 0x62, 0x00, 0x5d, 0xfe, 0x04, 0xec, 0x20, 0x46, 0xfe, 0x05,
10706 0xf6, 0xfe, 0x34, 0x01,
10707 0x01, 0xfe, 0x52, 0x16, 0xfb, 0xfe, 0x48, 0xf4, 0x0d, 0xfe, 0x18, 0x13,
10708 0xaf, 0xfe, 0x02, 0xea,
10709 0xce, 0x62, 0x7a, 0xfe, 0xc5, 0x13, 0x14, 0x1b, 0x37, 0x95, 0xa9, 0x5c,
10710 0x05, 0xfe, 0x38, 0x01,
10711 0x1c, 0xfe, 0xf0, 0xff, 0x0c, 0xfe, 0x60, 0x01, 0x05, 0xfe, 0x3a, 0x01,
10712 0x0c, 0xfe, 0x62, 0x01,
10713 0x3d, 0x12, 0x20, 0x24, 0x06, 0x12, 0x2d, 0x11, 0x2d, 0x8a, 0x13, 0x06,
10714 0x03, 0x23, 0x03, 0x1e,
10715 0x4d, 0xfe, 0xf7, 0x12, 0x1e, 0x94, 0xac, 0x12, 0x94, 0x07, 0x7a, 0xfe,
10716 0x71, 0x13, 0xfe, 0x24,
10717 0x1c, 0x14, 0x1a, 0x37, 0x95, 0xa9, 0xfe, 0xd9, 0x10, 0xb6, 0xfe, 0x03,
10718 0xdc, 0xfe, 0x73, 0x57,
10719 0xfe, 0x80, 0x5d, 0x03, 0xb6, 0xfe, 0x03, 0xdc, 0xfe, 0x5b, 0x57, 0xfe,
10720 0x80, 0x5d, 0x03, 0xfe,
10721 0x03, 0x57, 0xb6, 0x23, 0xfe, 0x00, 0xcc, 0x03, 0xfe, 0x03, 0x57, 0xb6,
10722 0x75, 0x03, 0x09, 0x04,
10723 0x4c, 0xfe, 0x22, 0x13, 0xfe, 0x1c, 0x80, 0x07, 0x06, 0xfe, 0x1a, 0x13,
10724 0xfe, 0x1e, 0x80, 0xe1,
10725 0xfe, 0x1d, 0x80, 0xa4, 0xfe, 0x0c, 0x90, 0xfe, 0x0e, 0x13, 0xfe, 0x0e,
10726 0x90, 0xa3, 0xfe, 0x3c,
10727 0x90, 0xfe, 0x30, 0xf4, 0x0b, 0xfe, 0x3c, 0x50, 0xa0, 0x01, 0xfe, 0x82,
10728 0x16, 0x2f, 0x07, 0x2d,
10729 0xe0, 0x01, 0xfe, 0xbc, 0x15, 0x09, 0x04, 0x1d, 0x45, 0x01, 0xe7, 0x01,
10730 0xe8, 0x11, 0xfe, 0xe9,
10731 0x00, 0x09, 0x04, 0x4c, 0xfe, 0x2c, 0x13, 0x01, 0xfe, 0x14, 0x16, 0xfe,
10732 0x1e, 0x1c, 0xfe, 0x14,
10733 0x90, 0xfe, 0x96, 0x90, 0x0c, 0xfe, 0x64, 0x01, 0x18, 0xfe, 0x66, 0x01,
10734 0x09, 0x04, 0x4f, 0xfe,
10735 0x12, 0x12, 0xfe, 0x03, 0x80, 0x74, 0xfe, 0x01, 0xec, 0x20, 0xfe, 0x80,
10736 0x40, 0x12, 0x20, 0x63,
10737 0x27, 0x11, 0xc8, 0x59, 0x1e, 0x20, 0xed, 0x76, 0x20, 0x03, 0xfe, 0x08,
10738 0x1c, 0x05, 0xfe, 0xac,
10739 0x00, 0xfe, 0x06, 0x58, 0x05, 0xfe, 0xae, 0x00, 0xfe, 0x07, 0x58, 0x05,
10740 0xfe, 0xb0, 0x00, 0xfe,
10741 0x08, 0x58, 0x05, 0xfe, 0xb2, 0x00, 0xfe, 0x09, 0x58, 0xfe, 0x0a, 0x1c,
10742 0x24, 0x69, 0x12, 0xc9,
10743 0x23, 0x0c, 0x50, 0x0c, 0x3f, 0x13, 0x40, 0x48, 0x5f, 0x17, 0x1d, 0xfe,
10744 0x90, 0x4d, 0xfe, 0x91,
10745 0x54, 0x21, 0xfe, 0x08, 0x0f, 0x3e, 0x10, 0x13, 0x42, 0x48, 0x17, 0x4c,
10746 0xfe, 0x90, 0x4d, 0xfe,
10747 0x91, 0x54, 0x21, 0xfe, 0x1e, 0x0f, 0x24, 0x10, 0x12, 0x20, 0x78, 0x2c,
10748 0x46, 0x1e, 0x20, 0xed,
10749 0x76, 0x20, 0x11, 0xc8, 0xf6, 0xfe, 0xd6, 0xf0, 0xfe, 0x32, 0x0f, 0xea,
10750 0x70, 0xfe, 0x14, 0x1c,
10751 0xfe, 0x10, 0x1c, 0xfe, 0x18, 0x1c, 0x03, 0x3c, 0xfe, 0x0c, 0x14, 0xee,
10752 0xfe, 0x07, 0xe6, 0x1d,
10753 0xfe, 0xce, 0x47, 0xfe, 0xf5, 0x13, 0x03, 0x01, 0x86, 0x78, 0x2c, 0x46,
10754 0xfa, 0xef, 0xfe, 0x42,
10755 0x13, 0x2f, 0x07, 0x2d, 0xfe, 0x34, 0x13, 0x0a, 0x42, 0x01, 0x0e, 0xb0,
10756 0xfe, 0x36, 0x12, 0xf0,
10757 0xfe, 0x45, 0x48, 0x01, 0xe3, 0xfe, 0x00, 0xcc, 0xb0, 0xfe, 0xf3, 0x13,
10758 0x3d, 0x75, 0x07, 0x10,
10759 0xa3, 0x0a, 0x80, 0x01, 0x0e, 0xfe, 0x80, 0x5c, 0x01, 0x6f, 0xfe, 0x0e,
10760 0x10, 0x07, 0x7e, 0x45,
10761 0xf6, 0xfe, 0xd6, 0xf0, 0xfe, 0x6c, 0x0f, 0x03, 0xfe, 0x44, 0x58, 0x74,
10762 0xfe, 0x01, 0xec, 0x97,
10763 0xfe, 0x9e, 0x40, 0xfe, 0x9d, 0xe7, 0x00, 0xfe, 0x9c, 0xe7, 0x1b, 0x76,
10764 0x27, 0x01, 0xda, 0xfe,
10765 0xdd, 0x10, 0x2a, 0xbc, 0x7d, 0xbd, 0x7f, 0x30, 0x2e, 0xd5, 0x07, 0x1b,
10766 0xfe, 0x48, 0x12, 0x07,
10767 0x0b, 0xfe, 0x56, 0x12, 0x07, 0x1a, 0xfe, 0x30, 0x12, 0x07, 0xc2, 0x16,
10768 0xfe, 0x3e, 0x11, 0x07,
10769 0xfe, 0x23, 0x00, 0x16, 0xfe, 0x4a, 0x11, 0x07, 0x06, 0x16, 0xfe, 0xa8,
10770 0x11, 0x07, 0x19, 0xfe,
10771 0x12, 0x12, 0x07, 0x00, 0x16, 0x22, 0x14, 0xc2, 0x01, 0x33, 0x9f, 0x2b,
10772 0x01, 0x08, 0x8c, 0x43,
10773 0x03, 0x2b, 0xfe, 0x62, 0x08, 0x0a, 0xca, 0x01, 0xfe, 0x32, 0x0e, 0x11,
10774 0x7e, 0x02, 0x29, 0x2b,
10775 0x2f, 0x07, 0x9b, 0xfe, 0xd9, 0x13, 0x79, 0x39, 0x68, 0x3a, 0x77, 0xfe,
10776 0xfc, 0x10, 0x09, 0x04,
10777 0x6a, 0xfe, 0x72, 0x12, 0xc0, 0x38, 0xc1, 0x4e, 0xf4, 0xf5, 0x8e, 0xfe,
10778 0xc6, 0x10, 0x1e, 0x58,
10779 0xfe, 0x26, 0x13, 0x05, 0x7b, 0x31, 0x7c, 0x77, 0xfe, 0x82, 0x0c, 0x0c,
10780 0x54, 0x18, 0x55, 0x23,
10781 0x0c, 0x7b, 0x0c, 0x7c, 0x01, 0xa8, 0x24, 0x69, 0x73, 0x12, 0x58, 0x01,
10782 0xa5, 0xc0, 0x38, 0xc1,
10783 0x4e, 0xfe, 0x04, 0x55, 0xfe, 0xa5, 0x55, 0xfe, 0x04, 0xfa, 0x38, 0xfe,
10784 0x05, 0xfa, 0x4e, 0xfe,
10785 0x91, 0x10, 0x05, 0x56, 0x31, 0x57, 0xfe, 0x40, 0x56, 0xfe, 0xe1, 0x56,
10786 0x0c, 0x56, 0x18, 0x57,
10787 0x83, 0xc0, 0x38, 0xc1, 0x4e, 0xf4, 0xf5, 0x05, 0x52, 0x31, 0x53, 0xfe,
10788 0x00, 0x56, 0xfe, 0xa1,
10789 0x56, 0x0c, 0x52, 0x18, 0x53, 0x09, 0x04, 0x6a, 0xfe, 0x1e, 0x12, 0x1e,
10790 0x58, 0xfe, 0x1f, 0x40,
10791 0x05, 0x54, 0x31, 0x55, 0xfe, 0x2c, 0x50, 0xfe, 0xae, 0x50, 0x05, 0x56,
10792 0x31, 0x57, 0xfe, 0x44,
10793 0x50, 0xfe, 0xc6, 0x50, 0x05, 0x52, 0x31, 0x53, 0xfe, 0x08, 0x50, 0xfe,
10794 0x8a, 0x50, 0x05, 0x39,
10795 0x31, 0x3a, 0xfe, 0x40, 0x50, 0xfe, 0xc2, 0x50, 0x02, 0x5c, 0x24, 0x06,
10796 0x12, 0xcd, 0x02, 0x5b,
10797 0x2b, 0x01, 0x08, 0x1f, 0x44, 0x30, 0x2e, 0xd5, 0x07, 0x06, 0x21, 0x44,
10798 0x2f, 0x07, 0x9b, 0x21,
10799 0x5b, 0x01, 0x6e, 0x1c, 0x3d, 0x16, 0x44, 0x09, 0x04, 0x0b, 0xe2, 0x79,
10800 0x39, 0x68, 0x3a, 0xfe,
10801 0x0a, 0x55, 0x34, 0xfe, 0x8b, 0x55, 0xbe, 0x39, 0xbf, 0x3a, 0xfe, 0x0c,
10802 0x51, 0xfe, 0x8e, 0x51,
10803 0x02, 0x5b, 0xfe, 0x19, 0x81, 0xaf, 0xfe, 0x19, 0x41, 0x02, 0x5b, 0x2b,
10804 0x01, 0x08, 0x25, 0x32,
10805 0x1f, 0xa2, 0x30, 0x2e, 0xd8, 0x4b, 0x1a, 0xfe, 0xa6, 0x12, 0x4b, 0x0b,
10806 0x3b, 0x02, 0x44, 0x01,
10807 0x08, 0x25, 0x32, 0x1f, 0xa2, 0x30, 0x2e, 0xd6, 0x07, 0x1a, 0x21, 0x44,
10808 0x01, 0x08, 0x1f, 0xa2,
10809 0x30, 0x2e, 0xfe, 0xe8, 0x09, 0xfe, 0xc2, 0x49, 0x60, 0x05, 0xfe, 0x9c,
10810 0x00, 0x28, 0x84, 0x49,
10811 0x04, 0x19, 0x34, 0x9f, 0xfe, 0xbb, 0x45, 0x4b, 0x00, 0x45, 0x3e, 0x06,
10812 0x78, 0x3d, 0xfe, 0xda,
10813 0x14, 0x01, 0x6e, 0x87, 0xfe, 0x4b, 0x45, 0xe2, 0x2f, 0x07, 0x9a, 0xe1,
10814 0x05, 0xc6, 0x28, 0x84,
10815 0x05, 0x3f, 0x28, 0x34, 0x5e, 0x02, 0x5b, 0xfe, 0xc0, 0x5d, 0xfe, 0xf8,
10816 0x14, 0xfe, 0x03, 0x17,
10817 0x05, 0x50, 0xb4, 0x0c, 0x50, 0x5e, 0x2b, 0x01, 0x08, 0x26, 0x5c, 0x01,
10818 0xfe, 0xaa, 0x14, 0x02,
10819 0x5c, 0x01, 0x08, 0x25, 0x32, 0x1f, 0x44, 0x30, 0x2e, 0xd6, 0x07, 0x06,
10820 0x21, 0x44, 0x01, 0xfe,
10821 0x8e, 0x13, 0xfe, 0x42, 0x58, 0xfe, 0x82, 0x14, 0xfe, 0xa4, 0x14, 0x87,
10822 0xfe, 0x4a, 0xf4, 0x0b,
10823 0x16, 0x44, 0xfe, 0x4a, 0xf4, 0x06, 0xfe, 0x0c, 0x12, 0x2f, 0x07, 0x9a,
10824 0x85, 0x02, 0x5b, 0x05,
10825 0x3f, 0xb4, 0x0c, 0x3f, 0x5e, 0x2b, 0x01, 0x08, 0x26, 0x5c, 0x01, 0xfe,
10826 0xd8, 0x14, 0x02, 0x5c,
10827 0x13, 0x06, 0x65, 0xfe, 0xca, 0x12, 0x26, 0xfe, 0xe0, 0x12, 0x72, 0xf1,
10828 0x01, 0x08, 0x23, 0x72,
10829 0x03, 0x8f, 0xfe, 0xdc, 0x12, 0x25, 0xfe, 0xdc, 0x12, 0x1f, 0xfe, 0xca,
10830 0x12, 0x5e, 0x2b, 0x01,
10831 0x08, 0xfe, 0xd5, 0x10, 0x13, 0x6c, 0xff, 0x02, 0x00, 0x57, 0x48, 0x8b,
10832 0x1c, 0xfe, 0xff, 0x7f,
10833 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x13, 0x6c, 0xff, 0x02, 0x00,
10834 0x57, 0x48, 0x8b, 0x1c,
10835 0x3d, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x13, 0x6c, 0xff, 0x02,
10836 0x00, 0x57, 0x48, 0x8b,
10837 0x03, 0x13, 0x6c, 0xff, 0x02, 0x00, 0x57, 0x48, 0x8b, 0xfe, 0x0b, 0x58,
10838 0x03, 0x0a, 0x50, 0x01,
10839 0x82, 0x0a, 0x3f, 0x01, 0x82, 0x03, 0xfc, 0x1c, 0x10, 0xff, 0x03, 0x00,
10840 0x54, 0xfe, 0x00, 0xf4,
10841 0x19, 0x48, 0xfe, 0x00, 0x7d, 0xfe, 0x01, 0x7d, 0xfe, 0x02, 0x7d, 0xfe,
10842 0x03, 0x7c, 0x63, 0x27,
10843 0x0c, 0x52, 0x18, 0x53, 0xbe, 0x56, 0xbf, 0x57, 0x03, 0xfe, 0x62, 0x08,
10844 0xfe, 0x82, 0x4a, 0xfe,
10845 0xe1, 0x1a, 0xfe, 0x83, 0x5a, 0x74, 0x03, 0x01, 0xfe, 0x14, 0x18, 0xfe,
10846 0x42, 0x48, 0x5f, 0x60,
10847 0x89, 0x01, 0x08, 0x1f, 0xfe, 0xa2, 0x14, 0x30, 0x2e, 0xd8, 0x01, 0x08,
10848 0x1f, 0xfe, 0xa2, 0x14,
10849 0x30, 0x2e, 0xfe, 0xe8, 0x0a, 0xfe, 0xc1, 0x59, 0x05, 0xc6, 0x28, 0xfe,
10850 0xcc, 0x12, 0x49, 0x04,
10851 0x1b, 0xfe, 0xc4, 0x13, 0x23, 0x62, 0x1b, 0xe2, 0x4b, 0xc3, 0x64, 0xfe,
10852 0xe8, 0x13, 0x3b, 0x13,
10853 0x06, 0x17, 0xc3, 0x78, 0xdb, 0xfe, 0x78, 0x10, 0xff, 0x02, 0x83, 0x55,
10854 0xa1, 0xff, 0x02, 0x83,
10855 0x55, 0x62, 0x1a, 0xa4, 0xbb, 0xfe, 0x30, 0x00, 0x8e, 0xe4, 0x17, 0x2c,
10856 0x13, 0x06, 0xfe, 0x56,
10857 0x10, 0x62, 0x0b, 0xe1, 0xbb, 0xfe, 0x64, 0x00, 0x8e, 0xe4, 0x0a, 0xfe,
10858 0x64, 0x00, 0x17, 0x93,
10859 0x13, 0x06, 0xfe, 0x28, 0x10, 0x62, 0x06, 0xfe, 0x60, 0x13, 0xbb, 0xfe,
10860 0xc8, 0x00, 0x8e, 0xe4,
10861 0x0a, 0xfe, 0xc8, 0x00, 0x17, 0x4d, 0x13, 0x06, 0x83, 0xbb, 0xfe, 0x90,
10862 0x01, 0xba, 0xfe, 0x4e,
10863 0x14, 0x89, 0xfe, 0x12, 0x10, 0xfe, 0x43, 0xf4, 0x94, 0xfe, 0x56, 0xf0,
10864 0xfe, 0x60, 0x14, 0xfe,
10865 0x04, 0xf4, 0x6c, 0xfe, 0x43, 0xf4, 0x93, 0xfe, 0xf3, 0x10, 0xf9, 0x01,
10866 0xfe, 0x22, 0x13, 0x1c,
10867 0x3d, 0xfe, 0x10, 0x13, 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x69, 0xba,
10868 0xfe, 0x9c, 0x14, 0xb7,
10869 0x69, 0xfe, 0x1c, 0x10, 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x19, 0xba,
10870 0xfe, 0x9c, 0x14, 0xb7,
10871 0x19, 0x83, 0x60, 0x23, 0xfe, 0x4d, 0xf4, 0x00, 0xdf, 0x89, 0x13, 0x06,
10872 0xfe, 0xb4, 0x56, 0xfe,
10873 0xc3, 0x58, 0x03, 0x60, 0x13, 0x0b, 0x03, 0x15, 0x06, 0x01, 0x08, 0x26,
10874 0xe5, 0x15, 0x0b, 0x01,
10875 0x08, 0x26, 0xe5, 0x15, 0x1a, 0x01, 0x08, 0x26, 0xe5, 0x72, 0xfe, 0x89,
10876 0x49, 0x01, 0x08, 0x03,
10877 0x15, 0x06, 0x01, 0x08, 0x26, 0xa6, 0x15, 0x1a, 0x01, 0x08, 0x26, 0xa6,
10878 0x15, 0x06, 0x01, 0x08,
10879 0x26, 0xa6, 0xfe, 0x89, 0x49, 0x01, 0x08, 0x26, 0xa6, 0x72, 0xfe, 0x89,
10880 0x4a, 0x01, 0x08, 0x03,
10881 0x60, 0x03, 0x1e, 0xcc, 0x07, 0x06, 0xfe, 0x44, 0x13, 0xad, 0x12, 0xcc,
10882 0xfe, 0x49, 0xf4, 0x00,
10883 0x3b, 0x72, 0x9f, 0x5e, 0xfe, 0x01, 0xec, 0xfe, 0x27, 0x01, 0xf1, 0x01,
10884 0x08, 0x2f, 0x07, 0xfe,
10885 0xe3, 0x00, 0xfe, 0x20, 0x13, 0x1f, 0xfe, 0x5a, 0x15, 0x23, 0x12, 0xcd,
10886 0x01, 0x43, 0x1e, 0xcd,
10887 0x07, 0x06, 0x45, 0x09, 0x4a, 0x06, 0x35, 0x03, 0x0a, 0x42, 0x01, 0x0e,
10888 0xed, 0x88, 0x07, 0x10,
10889 0xa4, 0x0a, 0x80, 0x01, 0x0e, 0x88, 0x0a, 0x51, 0x01, 0x9e, 0x03, 0x0a,
10890 0x80, 0x01, 0x0e, 0x88,
10891 0xfe, 0x80, 0xe7, 0x10, 0x07, 0x10, 0x84, 0xfe, 0x45, 0x58, 0x01, 0xe3,
10892 0x88, 0x03, 0x0a, 0x42,
10893 0x01, 0x0e, 0x88, 0x0a, 0x51, 0x01, 0x9e, 0x03, 0x0a, 0x42, 0x01, 0x0e,
10894 0xfe, 0x80, 0x80, 0xf2,
10895 0xfe, 0x49, 0xe4, 0x10, 0xa4, 0x0a, 0x80, 0x01, 0x0e, 0xf2, 0x0a, 0x51,
10896 0x01, 0x82, 0x03, 0x17,
10897 0x10, 0x71, 0x66, 0xfe, 0x60, 0x01, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde,
10898 0xfe, 0x24, 0x1c, 0xfe,
10899 0x1d, 0xf7, 0x1d, 0x90, 0xfe, 0xf6, 0x15, 0x01, 0xfe, 0xfc, 0x16, 0xe0,
10900 0x91, 0x1d, 0x66, 0xfe,
10901 0x2c, 0x01, 0xfe, 0x2f, 0x19, 0x03, 0xae, 0x21, 0xfe, 0xe6, 0x15, 0xfe,
10902 0xda, 0x10, 0x17, 0x10,
10903 0x71, 0x05, 0xfe, 0x64, 0x01, 0xfe, 0x00, 0xf4, 0x19, 0xfe, 0x18, 0x58,
10904 0x05, 0xfe, 0x66, 0x01,
10905 0xfe, 0x19, 0x58, 0x91, 0x19, 0xfe, 0x3c, 0x90, 0xfe, 0x30, 0xf4, 0x06,
10906 0xfe, 0x3c, 0x50, 0x66,
10907 0xfe, 0x38, 0x00, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7, 0x19, 0x90, 0xfe,
10908 0x40, 0x16, 0xfe, 0xb6,
10909 0x14, 0x34, 0x03, 0xae, 0x21, 0xfe, 0x18, 0x16, 0xfe, 0x9c, 0x10, 0x17,
10910 0x10, 0x71, 0xfe, 0x83,
10911 0x5a, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, 0x1d, 0xf7, 0x38, 0x90,
10912 0xfe, 0x62, 0x16, 0xfe,
10913 0x94, 0x14, 0xfe, 0x10, 0x13, 0x91, 0x38, 0x66, 0x1b, 0xfe, 0xaf, 0x19,
10914 0xfe, 0x98, 0xe7, 0x00,
10915 0x03, 0xae, 0x21, 0xfe, 0x56, 0x16, 0xfe, 0x6c, 0x10, 0x17, 0x10, 0x71,
10916 0xfe, 0x30, 0xbc, 0xfe,
10917 0xb2, 0xbc, 0x91, 0xc5, 0x66, 0x1b, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7,
10918 0xc5, 0x90, 0xfe, 0x9a,
10919 0x16, 0xfe, 0x5c, 0x14, 0x34, 0x03, 0xae, 0x21, 0xfe, 0x86, 0x16, 0xfe,
10920 0x42, 0x10, 0xfe, 0x02,
10921 0xf6, 0x10, 0x71, 0xfe, 0x18, 0xfe, 0x54, 0xfe, 0x19, 0xfe, 0x55, 0xfc,
10922 0xfe, 0x1d, 0xf7, 0x4f,
10923 0x90, 0xfe, 0xc0, 0x16, 0xfe, 0x36, 0x14, 0xfe, 0x1c, 0x13, 0x91, 0x4f,
10924 0x47, 0xfe, 0x83, 0x58,
10925 0xfe, 0xaf, 0x19, 0xfe, 0x80, 0xe7, 0x10, 0xfe, 0x81, 0xe7, 0x10, 0x11,
10926 0xfe, 0xdd, 0x00, 0x63,
10927 0x27, 0x03, 0x63, 0x27, 0xfe, 0x12, 0x45, 0x21, 0xfe, 0xb0, 0x16, 0x14,
10928 0x06, 0x37, 0x95, 0xa9,
10929 0x02, 0x29, 0xfe, 0x39, 0xf0, 0xfe, 0x04, 0x17, 0x23, 0x03, 0xfe, 0x7e,
10930 0x18, 0x1c, 0x1a, 0x5d,
10931 0x13, 0x0d, 0x03, 0x71, 0x05, 0xcb, 0x1c, 0x06, 0xfe, 0xef, 0x12, 0xfe,
10932 0xe1, 0x10, 0x78, 0x2c,
10933 0x46, 0x2f, 0x07, 0x2d, 0xfe, 0x3c, 0x13, 0xfe, 0x82, 0x14, 0xfe, 0x42,
10934 0x13, 0x3c, 0x8a, 0x0a,
10935 0x42, 0x01, 0x0e, 0xb0, 0xfe, 0x3e, 0x12, 0xf0, 0xfe, 0x45, 0x48, 0x01,
10936 0xe3, 0xfe, 0x00, 0xcc,
10937 0xb0, 0xfe, 0xf3, 0x13, 0x3d, 0x75, 0x07, 0x10, 0xa3, 0x0a, 0x80, 0x01,
10938 0x0e, 0xf2, 0x01, 0x6f,
10939 0xfe, 0x16, 0x10, 0x07, 0x7e, 0x85, 0xfe, 0x40, 0x14, 0xfe, 0x24, 0x12,
10940 0xf6, 0xfe, 0xd6, 0xf0,
10941 0xfe, 0x24, 0x17, 0x17, 0x0b, 0x03, 0xfe, 0x9c, 0xe7, 0x0b, 0x0f, 0xfe,
10942 0x15, 0x00, 0x59, 0x76,
10943 0x27, 0x01, 0xda, 0x17, 0x06, 0x03, 0x3c, 0x8a, 0x09, 0x4a, 0x1d, 0x35,
10944 0x11, 0x2d, 0x01, 0x6f,
10945 0x17, 0x06, 0x03, 0xfe, 0x38, 0x90, 0xfe, 0xba, 0x90, 0x79, 0xc7, 0x68,
10946 0xc8, 0xfe, 0x48, 0x55,
10947 0x34, 0xfe, 0xc9, 0x55, 0x03, 0x1e, 0x98, 0x73, 0x12, 0x98, 0x03, 0x0a,
10948 0x99, 0x01, 0x0e, 0xf0,
10949 0x0a, 0x40, 0x01, 0x0e, 0xfe, 0x49, 0x44, 0x16, 0xfe, 0xf0, 0x17, 0x73,
10950 0x75, 0x03, 0x0a, 0x42,
10951 0x01, 0x0e, 0x07, 0x10, 0x45, 0x0a, 0x51, 0x01, 0x9e, 0x0a, 0x40, 0x01,
10952 0x0e, 0x73, 0x75, 0x03,
10953 0xfe, 0x4e, 0xe4, 0x1a, 0x64, 0xfe, 0x24, 0x18, 0x05, 0xfe, 0x90, 0x00,
10954 0xfe, 0x3a, 0x45, 0x5b,
10955 0xfe, 0x4e, 0xe4, 0xc2, 0x64, 0xfe, 0x36, 0x18, 0x05, 0xfe, 0x92, 0x00,
10956 0xfe, 0x02, 0xe6, 0x1b,
10957 0xdc, 0xfe, 0x4e, 0xe4, 0xfe, 0x0b, 0x00, 0x64, 0xfe, 0x48, 0x18, 0x05,
10958 0xfe, 0x94, 0x00, 0xfe,
10959 0x02, 0xe6, 0x19, 0xfe, 0x08, 0x10, 0x05, 0xfe, 0x96, 0x00, 0xfe, 0x02,
10960 0xe6, 0x2c, 0xfe, 0x4e,
10961 0x45, 0xfe, 0x0c, 0x12, 0xaf, 0xff, 0x04, 0x68, 0x54, 0xde, 0x1c, 0x69,
10962 0x03, 0x07, 0x7a, 0xfe,
10963 0x5a, 0xf0, 0xfe, 0x74, 0x18, 0x24, 0xfe, 0x09, 0x00, 0xfe, 0x34, 0x10,
10964 0x07, 0x1b, 0xfe, 0x5a,
10965 0xf0, 0xfe, 0x82, 0x18, 0x24, 0xc3, 0xfe, 0x26, 0x10, 0x07, 0x1a, 0x5d,
10966 0x24, 0x2c, 0xdc, 0x07,
10967 0x0b, 0x5d, 0x24, 0x93, 0xfe, 0x0e, 0x10, 0x07, 0x06, 0x5d, 0x24, 0x4d,
10968 0x9f, 0xad, 0x03, 0x14,
10969 0xfe, 0x09, 0x00, 0x01, 0x33, 0xfe, 0x04, 0xfe, 0x7d, 0x05, 0x7f, 0xf9,
10970 0x03, 0x25, 0xfe, 0xca,
10971 0x18, 0xfe, 0x14, 0xf0, 0x08, 0x65, 0xfe, 0xc6, 0x18, 0x03, 0xff, 0x1a,
10975 static unsigned short _adv_asc3550_size
= sizeof(_adv_asc3550_buf
); /* 0x13AD */
10976 static ADV_DCNT _adv_asc3550_chksum
= 0x04D52DDDUL
; /* Expanded little-endian checksum. */
10978 /* Microcode buffer is kept after initialization for error recovery. */
10979 static unsigned char _adv_asc38C0800_buf
[] = {
10980 0x00, 0x00, 0x00, 0xf2, 0x00, 0xf0, 0x00, 0xfc, 0x00, 0x16, 0x18, 0xe4,
10981 0x01, 0x00, 0x48, 0xe4,
10982 0x18, 0x80, 0x03, 0xf6, 0x02, 0x00, 0xce, 0x19, 0x00, 0xfa, 0xff, 0xff,
10983 0x1c, 0x0f, 0x00, 0xf6,
10984 0x9e, 0xe7, 0xff, 0x00, 0x82, 0xe7, 0x00, 0xea, 0x01, 0xfa, 0x01, 0xe6,
10985 0x09, 0xe7, 0x55, 0xf0,
10986 0x01, 0xf6, 0x03, 0x00, 0x04, 0x00, 0x10, 0x00, 0x1e, 0xf0, 0x85, 0xf0,
10987 0x18, 0xf4, 0x08, 0x00,
10988 0xbc, 0x00, 0x38, 0x54, 0x00, 0xec, 0xd5, 0xf0, 0x82, 0x0d, 0x00, 0xe6,
10989 0x86, 0xf0, 0xb1, 0xf0,
10990 0x98, 0x57, 0x01, 0xfc, 0xb4, 0x00, 0xd4, 0x01, 0x0c, 0x1c, 0x3e, 0x1c,
10991 0x3c, 0x00, 0xbb, 0x00,
10992 0x00, 0x10, 0xba, 0x19, 0x02, 0x80, 0x32, 0xf0, 0x7c, 0x0d, 0x02, 0x13,
10993 0xba, 0x13, 0x18, 0x40,
10994 0x00, 0x57, 0x01, 0xea, 0x02, 0xfc, 0x03, 0xfc, 0x3e, 0x00, 0x6c, 0x01,
10995 0x6e, 0x01, 0x74, 0x01,
10996 0x76, 0x01, 0xb9, 0x54, 0x3e, 0x57, 0x00, 0x80, 0x03, 0xe6, 0xb6, 0x00,
10997 0xc0, 0x00, 0x01, 0x01,
10998 0x3e, 0x01, 0x7a, 0x01, 0xca, 0x08, 0xce, 0x10, 0x16, 0x11, 0x04, 0x12,
10999 0x08, 0x12, 0x02, 0x4a,
11000 0xbb, 0x55, 0x3c, 0x56, 0x03, 0x58, 0x1b, 0x80, 0x30, 0xe4, 0x4b, 0xe4,
11001 0x5d, 0xf0, 0x02, 0xfa,
11002 0x20, 0x00, 0x32, 0x00, 0x40, 0x00, 0x80, 0x00, 0x24, 0x01, 0x3c, 0x01,
11003 0x68, 0x01, 0x6a, 0x01,
11004 0x70, 0x01, 0x72, 0x01, 0x78, 0x01, 0x7c, 0x01, 0x62, 0x0a, 0x86, 0x0d,
11005 0x06, 0x13, 0x4c, 0x1c,
11006 0x04, 0x80, 0x4a, 0xe4, 0x02, 0xee, 0x5b, 0xf0, 0x03, 0xf7, 0x0c, 0x00,
11007 0x0f, 0x00, 0x47, 0x00,
11008 0xbe, 0x00, 0x00, 0x01, 0x20, 0x11, 0x5c, 0x16, 0x32, 0x1c, 0x38, 0x1c,
11009 0x4e, 0x1c, 0x10, 0x44,
11010 0x00, 0x4c, 0x04, 0xea, 0x5c, 0xf0, 0xa7, 0xf0, 0x04, 0xf6, 0x03, 0xfa,
11011 0x05, 0x00, 0x34, 0x00,
11012 0x36, 0x00, 0x98, 0x00, 0xcc, 0x00, 0x20, 0x01, 0x4e, 0x01, 0x4a, 0x0b,
11013 0x42, 0x0c, 0x12, 0x0f,
11014 0x0c, 0x10, 0x22, 0x11, 0x0a, 0x12, 0x04, 0x13, 0x30, 0x1c, 0x02, 0x48,
11015 0x00, 0x4e, 0x42, 0x54,
11016 0x44, 0x55, 0xbd, 0x56, 0x06, 0x83, 0x00, 0xdc, 0x05, 0xf0, 0x09, 0xf0,
11017 0x59, 0xf0, 0xb8, 0xf0,
11018 0x4b, 0xf4, 0x06, 0xf7, 0x0e, 0xf7, 0x04, 0xfc, 0x05, 0xfc, 0x06, 0x00,
11019 0x19, 0x00, 0x33, 0x00,
11020 0x9b, 0x00, 0xa4, 0x00, 0xb5, 0x00, 0xba, 0x00, 0xd0, 0x00, 0xe1, 0x00,
11021 0xe7, 0x00, 0xe2, 0x03,
11022 0x08, 0x0f, 0x02, 0x10, 0x04, 0x10, 0x0a, 0x10, 0x0a, 0x13, 0x0c, 0x13,
11023 0x12, 0x13, 0x24, 0x14,
11024 0x34, 0x14, 0x04, 0x16, 0x08, 0x16, 0xa4, 0x17, 0x20, 0x1c, 0x34, 0x1c,
11025 0x36, 0x1c, 0x08, 0x44,
11026 0x38, 0x44, 0x91, 0x44, 0x0a, 0x45, 0x48, 0x46, 0x01, 0x48, 0x68, 0x54,
11027 0x3a, 0x55, 0x83, 0x55,
11028 0xe5, 0x55, 0xb0, 0x57, 0x01, 0x58, 0x83, 0x59, 0x05, 0xe6, 0x0b, 0xf0,
11029 0x0c, 0xf0, 0x04, 0xf8,
11030 0x05, 0xf8, 0x07, 0x00, 0x0a, 0x00, 0x1c, 0x00, 0x1e, 0x00, 0x9e, 0x00,
11031 0xa8, 0x00, 0xaa, 0x00,
11032 0xb9, 0x00, 0xe0, 0x00, 0x22, 0x01, 0x26, 0x01, 0x79, 0x01, 0x7e, 0x01,
11033 0xc4, 0x01, 0xc6, 0x01,
11034 0x80, 0x02, 0x5e, 0x03, 0xee, 0x04, 0x9a, 0x06, 0xf8, 0x07, 0x62, 0x08,
11035 0x68, 0x08, 0x69, 0x08,
11036 0xd6, 0x08, 0xe9, 0x09, 0xfa, 0x0b, 0x2e, 0x0f, 0x12, 0x10, 0x1a, 0x10,
11037 0xed, 0x10, 0xf1, 0x10,
11038 0x2a, 0x11, 0x06, 0x12, 0x0c, 0x12, 0x3e, 0x12, 0x10, 0x13, 0x16, 0x13,
11039 0x1e, 0x13, 0x46, 0x14,
11040 0x76, 0x14, 0x82, 0x14, 0x36, 0x15, 0xca, 0x15, 0x6b, 0x18, 0xbe, 0x18,
11041 0xca, 0x18, 0xe6, 0x19,
11042 0x12, 0x1c, 0x46, 0x1c, 0x9c, 0x32, 0x00, 0x40, 0x0e, 0x47, 0xfe, 0x9c,
11043 0xf0, 0x2b, 0x02, 0xfe,
11044 0xac, 0x0d, 0xff, 0x10, 0x00, 0x00, 0xd7, 0xfe, 0xe8, 0x19, 0x00, 0xd6,
11045 0xfe, 0x84, 0x01, 0xff,
11046 0x03, 0x00, 0x00, 0xfe, 0x93, 0x15, 0xfe, 0x0f, 0x05, 0xff, 0x38, 0x00,
11047 0x00, 0xfe, 0x57, 0x24,
11048 0x00, 0xfe, 0x4c, 0x00, 0x5b, 0xff, 0x04, 0x00, 0x00, 0x11, 0xff, 0x09,
11049 0x00, 0x00, 0xff, 0x08,
11050 0x01, 0x01, 0xff, 0x08, 0xff, 0xff, 0xff, 0x27, 0x00, 0x00, 0xff, 0x10,
11051 0xff, 0xff, 0xff, 0x11,
11052 0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, 0x00, 0x00,
11053 0xfe, 0x04, 0xf7, 0xd6,
11054 0x2c, 0x99, 0x0a, 0x01, 0xfe, 0xc2, 0x0f, 0xfe, 0x04, 0xf7, 0xd6, 0x99,
11055 0x0a, 0x42, 0x2c, 0xfe,
11056 0x3d, 0xf0, 0xfe, 0x06, 0x02, 0xfe, 0x20, 0xf0, 0xa7, 0xfe, 0x91, 0xf0,
11057 0xfe, 0xf4, 0x01, 0xfe,
11058 0x90, 0xf0, 0xfe, 0xf4, 0x01, 0xfe, 0x8f, 0xf0, 0xa7, 0x03, 0x5d, 0x4d,
11059 0x02, 0xfe, 0xc8, 0x0d,
11060 0x01, 0xfe, 0x38, 0x0e, 0xfe, 0xdd, 0x12, 0xfe, 0xfc, 0x10, 0xfe, 0x28,
11061 0x1c, 0x03, 0xfe, 0xa6,
11062 0x00, 0xfe, 0xd3, 0x12, 0x41, 0x14, 0xfe, 0xa6, 0x00, 0xc2, 0xfe, 0x48,
11063 0xf0, 0xfe, 0x8a, 0x02,
11064 0xfe, 0x49, 0xf0, 0xfe, 0xa4, 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xc2, 0x02,
11065 0xfe, 0x46, 0xf0, 0xfe,
11066 0x54, 0x02, 0xfe, 0x47, 0xf0, 0xfe, 0x5a, 0x02, 0xfe, 0x43, 0xf0, 0xfe,
11067 0x48, 0x02, 0xfe, 0x44,
11068 0xf0, 0xfe, 0x4c, 0x02, 0xfe, 0x45, 0xf0, 0xfe, 0x50, 0x02, 0x18, 0x0a,
11069 0xaa, 0x18, 0x06, 0x14,
11070 0xa1, 0x02, 0x2b, 0xfe, 0x00, 0x1c, 0xe7, 0xfe, 0x02, 0x1c, 0xe6, 0xfe,
11071 0x1e, 0x1c, 0xfe, 0xe9,
11072 0x10, 0x01, 0xfe, 0x18, 0x18, 0xfe, 0xe7, 0x10, 0xfe, 0x06, 0xfc, 0xce,
11073 0x09, 0x70, 0x01, 0xa8,
11074 0x02, 0x2b, 0x15, 0x59, 0x39, 0xa2, 0x01, 0xfe, 0x58, 0x10, 0x09, 0x70,
11075 0x01, 0x87, 0xfe, 0xbd,
11076 0x10, 0x09, 0x70, 0x01, 0x87, 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c, 0xfe,
11077 0x58, 0x1c, 0x18, 0x06,
11078 0x14, 0xa1, 0x2c, 0x1c, 0x2b, 0xfe, 0x3d, 0xf0, 0xfe, 0x06, 0x02, 0x23,
11079 0xfe, 0x98, 0x02, 0xfe,
11080 0x5a, 0x1c, 0xf8, 0xfe, 0x14, 0x1c, 0x15, 0xfe, 0x30, 0x00, 0x39, 0xa2,
11081 0x01, 0xfe, 0x48, 0x10,
11082 0x18, 0x06, 0x14, 0xa1, 0x02, 0xd7, 0x22, 0x20, 0x07, 0x11, 0x35, 0xfe,
11083 0x69, 0x10, 0x18, 0x06,
11084 0x14, 0xa1, 0xfe, 0x04, 0xec, 0x20, 0x4f, 0x43, 0x13, 0x20, 0xfe, 0x05,
11085 0xf6, 0xce, 0x01, 0xfe,
11086 0x4a, 0x17, 0x08, 0x54, 0x58, 0x37, 0x12, 0x2f, 0x42, 0x92, 0x01, 0xfe,
11087 0x82, 0x16, 0x02, 0x2b,
11088 0x09, 0x46, 0x01, 0x0e, 0x07, 0x00, 0x66, 0x01, 0x73, 0xfe, 0x18, 0x10,
11089 0xfe, 0x41, 0x58, 0x09,
11090 0xa4, 0x01, 0x0e, 0xfe, 0xc8, 0x54, 0x6b, 0xfe, 0x10, 0x03, 0x01, 0xfe,
11091 0x82, 0x16, 0x02, 0x2b,
11092 0x2c, 0x4f, 0xfe, 0x02, 0xe8, 0x2a, 0xfe, 0xbf, 0x57, 0xfe, 0x9e, 0x43,
11093 0xfe, 0x77, 0x57, 0xfe,
11094 0x27, 0xf0, 0xfe, 0xe0, 0x01, 0xfe, 0x07, 0x4b, 0xfe, 0x20, 0xf0, 0xa7,
11095 0xfe, 0x40, 0x1c, 0x1c,
11096 0xd9, 0xfe, 0x26, 0xf0, 0xfe, 0x5a, 0x03, 0xfe, 0xa0, 0xf0, 0xfe, 0x48,
11097 0x03, 0xfe, 0x11, 0xf0,
11098 0xa7, 0xfe, 0xef, 0x10, 0xfe, 0x9f, 0xf0, 0xfe, 0x68, 0x03, 0xf9, 0x10,
11099 0xfe, 0x11, 0x00, 0x02,
11100 0x65, 0x2c, 0xfe, 0x48, 0x1c, 0xf9, 0x08, 0x05, 0x1b, 0xfe, 0x18, 0x13,
11101 0x21, 0x22, 0xa3, 0xb7,
11102 0x13, 0xa3, 0x09, 0x46, 0x01, 0x0e, 0xb7, 0x78, 0x01, 0xfe, 0xb4, 0x16,
11103 0x12, 0xd1, 0x1c, 0xd9,
11104 0xfe, 0x01, 0xf0, 0xd9, 0xfe, 0x82, 0xf0, 0xfe, 0x96, 0x03, 0xfa, 0x12,
11105 0xfe, 0xe4, 0x00, 0x27,
11106 0xfe, 0xa8, 0x03, 0x1c, 0x34, 0x1d, 0xfe, 0xb8, 0x03, 0x01, 0x4b, 0xfe,
11107 0x06, 0xf0, 0xfe, 0xc8,
11108 0x03, 0x95, 0x86, 0xfe, 0x0a, 0xf0, 0xfe, 0x8a, 0x06, 0x02, 0x24, 0x03,
11109 0x70, 0x28, 0x17, 0xfe,
11110 0xfa, 0x04, 0x15, 0x6d, 0x01, 0x36, 0x7b, 0xfe, 0x6a, 0x02, 0x02, 0xd8,
11111 0xf9, 0x2c, 0x99, 0x19,
11112 0xfe, 0x67, 0x1b, 0xfe, 0xbf, 0x57, 0xfe, 0x77, 0x57, 0xfe, 0x48, 0x1c,
11113 0x74, 0x01, 0xaf, 0x8c,
11114 0x09, 0x46, 0x01, 0x0e, 0x07, 0x00, 0x17, 0xda, 0x09, 0xd1, 0x01, 0x0e,
11115 0x8d, 0x51, 0x64, 0x79,
11116 0x2a, 0x03, 0x70, 0x28, 0xfe, 0x10, 0x12, 0x15, 0x6d, 0x01, 0x36, 0x7b,
11117 0xfe, 0x6a, 0x02, 0x02,
11118 0xd8, 0xc7, 0x81, 0xc8, 0x83, 0x1c, 0x24, 0x27, 0xfe, 0x40, 0x04, 0x1d,
11119 0xfe, 0x3c, 0x04, 0x3b,
11120 0xfe, 0xa0, 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x4e, 0x12, 0x2d, 0xff, 0x02,
11121 0x00, 0x10, 0x01, 0x0b,
11122 0x1d, 0xfe, 0xe4, 0x04, 0x2d, 0x01, 0x0b, 0x1d, 0x24, 0x33, 0x31, 0xde,
11123 0xfe, 0x4c, 0x44, 0xfe,
11124 0x4c, 0x12, 0x51, 0xfe, 0x44, 0x48, 0x0f, 0x6f, 0xfe, 0x4c, 0x54, 0x6b,
11125 0xda, 0x4f, 0x79, 0x2a,
11126 0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x62, 0x13, 0x08, 0x05, 0x1b,
11127 0xfe, 0x2a, 0x13, 0x32,
11128 0x07, 0x82, 0xfe, 0x52, 0x13, 0xfe, 0x20, 0x10, 0x0f, 0x6f, 0xfe, 0x4c,
11129 0x54, 0x6b, 0xda, 0xfe,
11130 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x40, 0x13, 0x08, 0x05, 0x1b, 0xfe,
11131 0x08, 0x13, 0x32, 0x07,
11132 0x82, 0xfe, 0x30, 0x13, 0x08, 0x05, 0x1b, 0xfe, 0x1c, 0x12, 0x15, 0x9d,
11133 0x08, 0x05, 0x06, 0x4d,
11134 0x15, 0xfe, 0x0d, 0x00, 0x01, 0x36, 0x7b, 0xfe, 0x64, 0x0d, 0x02, 0x24,
11135 0x2d, 0x12, 0xfe, 0xe6,
11136 0x00, 0xfe, 0x1c, 0x90, 0xfe, 0x40, 0x5c, 0x04, 0x15, 0x9d, 0x01, 0x36,
11137 0x02, 0x2b, 0xfe, 0x42,
11138 0x5b, 0x99, 0x19, 0xfe, 0x46, 0x59, 0xfe, 0xbf, 0x57, 0xfe, 0x77, 0x57,
11139 0xfe, 0x87, 0x80, 0xfe,
11140 0x31, 0xe4, 0x5b, 0x08, 0x05, 0x0a, 0xfe, 0x84, 0x13, 0xfe, 0x20, 0x80,
11141 0x07, 0x19, 0xfe, 0x7c,
11142 0x12, 0x53, 0x05, 0x06, 0xfe, 0x6c, 0x13, 0x03, 0xfe, 0xa2, 0x00, 0x28,
11143 0x17, 0xfe, 0x90, 0x05,
11144 0xfe, 0x31, 0xe4, 0x5a, 0x53, 0x05, 0x0a, 0xfe, 0x56, 0x13, 0x03, 0xfe,
11145 0xa0, 0x00, 0x28, 0xfe,
11146 0x4e, 0x12, 0x67, 0xff, 0x02, 0x00, 0x10, 0x27, 0xfe, 0x48, 0x05, 0x1c,
11147 0x34, 0xfe, 0x89, 0x48,
11148 0xff, 0x02, 0x00, 0x10, 0x27, 0xfe, 0x56, 0x05, 0x26, 0xfe, 0xa8, 0x05,
11149 0x12, 0xfe, 0xe3, 0x00,
11150 0x21, 0x53, 0xfe, 0x4a, 0xf0, 0xfe, 0x76, 0x05, 0xfe, 0x49, 0xf0, 0xfe,
11151 0x70, 0x05, 0x88, 0x25,
11152 0xfe, 0x21, 0x00, 0xab, 0x25, 0xfe, 0x22, 0x00, 0xaa, 0x25, 0x58, 0xfe,
11153 0x09, 0x48, 0xff, 0x02,
11154 0x00, 0x10, 0x27, 0xfe, 0x86, 0x05, 0x26, 0xfe, 0xa8, 0x05, 0xfe, 0xe2,
11155 0x08, 0x53, 0x05, 0xcb,
11156 0x4d, 0x01, 0xb0, 0x25, 0x06, 0x13, 0xd3, 0x39, 0xfe, 0x27, 0x01, 0x08,
11157 0x05, 0x1b, 0xfe, 0x22,
11158 0x12, 0x41, 0x01, 0xb2, 0x15, 0x9d, 0x08, 0x05, 0x06, 0x4d, 0x15, 0xfe,
11159 0x0d, 0x00, 0x01, 0x36,
11160 0x7b, 0xfe, 0x64, 0x0d, 0x02, 0x24, 0x03, 0xfe, 0x9c, 0x00, 0x28, 0xeb,
11161 0x03, 0x5c, 0x28, 0xfe,
11162 0x36, 0x13, 0x41, 0x01, 0xb2, 0x26, 0xfe, 0x18, 0x06, 0x09, 0x06, 0x53,
11163 0x05, 0x1f, 0xfe, 0x02,
11164 0x12, 0x50, 0x01, 0xfe, 0x9e, 0x15, 0x1d, 0xfe, 0x0e, 0x06, 0x12, 0xa5,
11165 0x01, 0x4b, 0x12, 0xfe,
11166 0xe5, 0x00, 0x03, 0x5c, 0xc1, 0x0c, 0x5c, 0x03, 0xcd, 0x28, 0xfe, 0x62,
11167 0x12, 0x03, 0x45, 0x28,
11168 0xfe, 0x5a, 0x13, 0x01, 0xfe, 0x0c, 0x19, 0x01, 0xfe, 0x76, 0x19, 0xfe,
11169 0x43, 0x48, 0xc4, 0xcc,
11170 0x0f, 0x71, 0xff, 0x02, 0x00, 0x57, 0x52, 0x93, 0x1e, 0x43, 0x8b, 0xc4,
11171 0x6e, 0x41, 0x01, 0xb2,
11172 0x26, 0xfe, 0x82, 0x06, 0x53, 0x05, 0x1a, 0xe9, 0x91, 0x09, 0x59, 0x01,
11173 0xfe, 0xcc, 0x15, 0x1d,
11174 0xfe, 0x78, 0x06, 0x12, 0xa5, 0x01, 0x4b, 0x12, 0xfe, 0xe5, 0x00, 0x03,
11175 0x45, 0xc1, 0x0c, 0x45,
11176 0x18, 0x06, 0x01, 0xb2, 0xfa, 0x76, 0x74, 0x01, 0xaf, 0x8c, 0x12, 0xfe,
11177 0xe2, 0x00, 0x27, 0xdb,
11178 0x1c, 0x34, 0xfe, 0x0a, 0xf0, 0xfe, 0xb6, 0x06, 0x94, 0xfe, 0x6c, 0x07,
11179 0xfe, 0x06, 0xf0, 0xfe,
11180 0x74, 0x07, 0x95, 0x86, 0x02, 0x24, 0x08, 0x05, 0x0a, 0xfe, 0x2e, 0x12,
11181 0x16, 0x19, 0x01, 0x0b,
11182 0x16, 0x00, 0x01, 0x0b, 0x16, 0x00, 0x01, 0x0b, 0x16, 0x00, 0x01, 0x0b,
11183 0xfe, 0x99, 0xa4, 0x01,
11184 0x0b, 0x16, 0x00, 0x02, 0xfe, 0x42, 0x08, 0x68, 0x05, 0x1a, 0xfe, 0x38,
11185 0x12, 0x08, 0x05, 0x1a,
11186 0xfe, 0x30, 0x13, 0x16, 0xfe, 0x1b, 0x00, 0x01, 0x0b, 0x16, 0x00, 0x01,
11187 0x0b, 0x16, 0x00, 0x01,
11188 0x0b, 0x16, 0x00, 0x01, 0x0b, 0x16, 0x06, 0x01, 0x0b, 0x16, 0x00, 0x02,
11189 0xe2, 0x6c, 0x58, 0xbe,
11190 0x50, 0xfe, 0x9a, 0x81, 0x55, 0x1b, 0x7a, 0xfe, 0x42, 0x07, 0x09, 0x1b,
11191 0xfe, 0x09, 0x6f, 0xba,
11192 0xfe, 0xca, 0x45, 0xfe, 0x32, 0x12, 0x69, 0x6d, 0x8b, 0x6c, 0x7f, 0x27,
11193 0xfe, 0x54, 0x07, 0x1c,
11194 0x34, 0xfe, 0x0a, 0xf0, 0xfe, 0x42, 0x07, 0x95, 0x86, 0x94, 0xfe, 0x6c,
11195 0x07, 0x02, 0x24, 0x01,
11196 0x4b, 0x02, 0xdb, 0x16, 0x1f, 0x02, 0xdb, 0xfe, 0x9c, 0xf7, 0xdc, 0xfe,
11197 0x2c, 0x90, 0xfe, 0xae,
11198 0x90, 0x56, 0xfe, 0xda, 0x07, 0x0c, 0x60, 0x14, 0x61, 0x08, 0x54, 0x5a,
11199 0x37, 0x22, 0x20, 0x07,
11200 0x11, 0xfe, 0x0e, 0x12, 0x8d, 0xfe, 0x80, 0x80, 0x39, 0x20, 0x6a, 0x2a,
11201 0xfe, 0x06, 0x10, 0xfe,
11202 0x83, 0xe7, 0xfe, 0x48, 0x00, 0xab, 0xfe, 0x03, 0x40, 0x08, 0x54, 0x5b,
11203 0x37, 0x01, 0xb3, 0xb8,
11204 0xfe, 0x1f, 0x40, 0x13, 0x62, 0x01, 0xef, 0xfe, 0x08, 0x50, 0xfe, 0x8a,
11205 0x50, 0xfe, 0x44, 0x51,
11206 0xfe, 0xc6, 0x51, 0x88, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90, 0x0c, 0x5e,
11207 0x14, 0x5f, 0xfe, 0x0c,
11208 0x90, 0xfe, 0x8e, 0x90, 0xfe, 0x40, 0x50, 0xfe, 0xc2, 0x50, 0x0c, 0x3d,
11209 0x14, 0x3e, 0xfe, 0x4a,
11210 0x10, 0x08, 0x05, 0x5a, 0xfe, 0x2a, 0x12, 0xfe, 0x2c, 0x90, 0xfe, 0xae,
11211 0x90, 0x0c, 0x60, 0x14,
11212 0x61, 0x08, 0x05, 0x5b, 0x8b, 0x01, 0xb3, 0xfe, 0x1f, 0x80, 0x13, 0x62,
11213 0xfe, 0x44, 0x90, 0xfe,
11214 0xc6, 0x90, 0x0c, 0x3f, 0x14, 0x40, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90,
11215 0x0c, 0x5e, 0x14, 0x5f,
11216 0xfe, 0x40, 0x90, 0xfe, 0xc2, 0x90, 0x0c, 0x3d, 0x14, 0x3e, 0x0c, 0x2e,
11217 0x14, 0x3c, 0x21, 0x0c,
11218 0x49, 0x0c, 0x63, 0x08, 0x54, 0x1f, 0x37, 0x2c, 0x0f, 0xfe, 0x4e, 0x11,
11219 0x27, 0xdd, 0xfe, 0x9e,
11220 0xf0, 0xfe, 0x76, 0x08, 0xbc, 0x17, 0x34, 0x2c, 0x77, 0xe6, 0xc5, 0xfe,
11221 0x9a, 0x08, 0xc6, 0xfe,
11222 0xb8, 0x08, 0x94, 0xfe, 0x8e, 0x08, 0xfe, 0x06, 0xf0, 0xfe, 0x94, 0x08,
11223 0x95, 0x86, 0x02, 0x24,
11224 0x01, 0x4b, 0xfe, 0xc9, 0x10, 0x16, 0x1f, 0xfe, 0xc9, 0x10, 0x68, 0x05,
11225 0x06, 0xfe, 0x10, 0x12,
11226 0x68, 0x05, 0x0a, 0x4e, 0x08, 0x05, 0x0a, 0xfe, 0x90, 0x12, 0xfe, 0x2e,
11227 0x1c, 0x02, 0xfe, 0x18,
11228 0x0b, 0x68, 0x05, 0x06, 0x4e, 0x68, 0x05, 0x0a, 0xfe, 0x7a, 0x12, 0xfe,
11229 0x2c, 0x1c, 0xfe, 0xaa,
11230 0xf0, 0xfe, 0xd2, 0x09, 0xfe, 0xac, 0xf0, 0xfe, 0x00, 0x09, 0x02, 0xfe,
11231 0xde, 0x09, 0xfe, 0xb7,
11232 0xf0, 0xfe, 0xfc, 0x08, 0xfe, 0x02, 0xf6, 0x1a, 0x50, 0xfe, 0x70, 0x18,
11233 0xfe, 0xf1, 0x18, 0xfe,
11234 0x40, 0x55, 0xfe, 0xe1, 0x55, 0xfe, 0x10, 0x58, 0xfe, 0x91, 0x58, 0xfe,
11235 0x14, 0x59, 0xfe, 0x95,
11236 0x59, 0x1c, 0x85, 0xfe, 0x8c, 0xf0, 0xfe, 0xfc, 0x08, 0xfe, 0xac, 0xf0,
11237 0xfe, 0xf0, 0x08, 0xb5,
11238 0xfe, 0xcb, 0x10, 0xfe, 0xad, 0xf0, 0xfe, 0x0c, 0x09, 0x02, 0xfe, 0x18,
11239 0x0b, 0xb6, 0xfe, 0xbf,
11240 0x10, 0xfe, 0x2b, 0xf0, 0x85, 0xf4, 0x1e, 0xfe, 0x00, 0xfe, 0xfe, 0x1c,
11241 0x12, 0xc2, 0xfe, 0xd2,
11242 0xf0, 0x85, 0xfe, 0x76, 0x18, 0x1e, 0x19, 0x17, 0x85, 0x03, 0xd2, 0x1e,
11243 0x06, 0x17, 0x85, 0xc5,
11244 0x4a, 0xc6, 0x4a, 0xb5, 0xb6, 0xfe, 0x89, 0x10, 0x74, 0x67, 0x2d, 0x15,
11245 0x9d, 0x01, 0x36, 0x10,
11246 0xfe, 0x35, 0x00, 0xfe, 0x01, 0xf0, 0x65, 0x10, 0x80, 0x02, 0x65, 0xfe,
11247 0x98, 0x80, 0xfe, 0x19,
11248 0xe4, 0x0a, 0xfe, 0x1a, 0x12, 0x51, 0xfe, 0x19, 0x82, 0xfe, 0x6c, 0x18,
11249 0xfe, 0x44, 0x54, 0xbe,
11250 0xfe, 0x19, 0x81, 0xfe, 0x74, 0x18, 0x8f, 0x90, 0x17, 0xfe, 0xce, 0x08,
11251 0x02, 0x4a, 0x08, 0x05,
11252 0x5a, 0xec, 0x03, 0x2e, 0x29, 0x3c, 0x0c, 0x3f, 0x14, 0x40, 0x9b, 0x2e,
11253 0x9c, 0x3c, 0xfe, 0x6c,
11254 0x18, 0xfe, 0xed, 0x18, 0xfe, 0x44, 0x54, 0xfe, 0xe5, 0x54, 0x3a, 0x3f,
11255 0x3b, 0x40, 0x03, 0x49,
11256 0x29, 0x63, 0x8f, 0xfe, 0xe3, 0x54, 0xfe, 0x74, 0x18, 0xfe, 0xf5, 0x18,
11257 0x8f, 0xfe, 0xe3, 0x54,
11258 0x90, 0xc0, 0x56, 0xfe, 0xce, 0x08, 0x02, 0x4a, 0xfe, 0x37, 0xf0, 0xfe,
11259 0xda, 0x09, 0xfe, 0x8b,
11260 0xf0, 0xfe, 0x60, 0x09, 0x02, 0x4a, 0x08, 0x05, 0x0a, 0x23, 0xfe, 0xfa,
11261 0x0a, 0x3a, 0x49, 0x3b,
11262 0x63, 0x56, 0xfe, 0x3e, 0x0a, 0x0f, 0xfe, 0xc0, 0x07, 0x41, 0x98, 0x00,
11263 0xad, 0xfe, 0x01, 0x59,
11264 0xfe, 0x52, 0xf0, 0xfe, 0x0c, 0x0a, 0x8f, 0x7a, 0xfe, 0x24, 0x0a, 0x3a,
11265 0x49, 0x8f, 0xfe, 0xe3,
11266 0x54, 0x57, 0x49, 0x7d, 0x63, 0xfe, 0x14, 0x58, 0xfe, 0x95, 0x58, 0x02,
11267 0x4a, 0x3a, 0x49, 0x3b,
11268 0x63, 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0xbe, 0x57, 0x49, 0x57, 0x63,
11269 0x02, 0x4a, 0x08, 0x05,
11270 0x5a, 0xfe, 0x82, 0x12, 0x08, 0x05, 0x1f, 0xfe, 0x66, 0x13, 0x22, 0x62,
11271 0xb7, 0xfe, 0x03, 0xa1,
11272 0xfe, 0x83, 0x80, 0xfe, 0xc8, 0x44, 0xfe, 0x2e, 0x13, 0xfe, 0x04, 0x91,
11273 0xfe, 0x86, 0x91, 0x6a,
11274 0x2a, 0xfe, 0x40, 0x59, 0xfe, 0xc1, 0x59, 0x56, 0xe0, 0x03, 0x60, 0x29,
11275 0x61, 0x0c, 0x7f, 0x14,
11276 0x80, 0x57, 0x60, 0x7d, 0x61, 0x01, 0xb3, 0xb8, 0x6a, 0x2a, 0x13, 0x62,
11277 0x9b, 0x2e, 0x9c, 0x3c,
11278 0x3a, 0x3f, 0x3b, 0x40, 0x90, 0xc0, 0xfe, 0x04, 0xfa, 0x2e, 0xfe, 0x05,
11279 0xfa, 0x3c, 0x01, 0xef,
11280 0xfe, 0x36, 0x10, 0x21, 0x0c, 0x7f, 0x0c, 0x80, 0x3a, 0x3f, 0x3b, 0x40,
11281 0xe4, 0x08, 0x05, 0x1f,
11282 0x17, 0xe0, 0x3a, 0x3d, 0x3b, 0x3e, 0x08, 0x05, 0xfe, 0xf7, 0x00, 0x37,
11283 0x03, 0x5e, 0x29, 0x5f,
11284 0xfe, 0x10, 0x58, 0xfe, 0x91, 0x58, 0x57, 0x49, 0x7d, 0x63, 0x02, 0xfe,
11285 0xf4, 0x09, 0x08, 0x05,
11286 0x1f, 0x17, 0xe0, 0x08, 0x05, 0xfe, 0xf7, 0x00, 0x37, 0xbe, 0xfe, 0x19,
11287 0x81, 0x50, 0xfe, 0x10,
11288 0x90, 0xfe, 0x92, 0x90, 0xfe, 0xd3, 0x10, 0x32, 0x07, 0xa6, 0x17, 0xfe,
11289 0x08, 0x09, 0x12, 0xa6,
11290 0x08, 0x05, 0x0a, 0xfe, 0x14, 0x13, 0x03, 0x3d, 0x29, 0x3e, 0x56, 0xfe,
11291 0x08, 0x09, 0xfe, 0x0c,
11292 0x58, 0xfe, 0x8d, 0x58, 0x02, 0x4a, 0x21, 0x41, 0xfe, 0x19, 0x80, 0xe7,
11293 0x08, 0x05, 0x0a, 0xfe,
11294 0x1a, 0x12, 0xfe, 0x6c, 0x19, 0xfe, 0x19, 0x41, 0xf4, 0xc2, 0xfe, 0xd1,
11295 0xf0, 0xe2, 0x15, 0x7e,
11296 0x01, 0x36, 0x10, 0xfe, 0x44, 0x00, 0xfe, 0x8e, 0x10, 0xfe, 0x6c, 0x19,
11297 0x57, 0x3d, 0xfe, 0xed,
11298 0x19, 0x7d, 0x3e, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0xf4, 0x1e, 0xfe,
11299 0x00, 0xff, 0x35, 0xfe,
11300 0x74, 0x10, 0xc2, 0xfe, 0xd2, 0xf0, 0xfe, 0xa6, 0x0b, 0xfe, 0x76, 0x18,
11301 0x1e, 0x19, 0x8a, 0x03,
11302 0xd2, 0x1e, 0x06, 0xfe, 0x08, 0x13, 0x10, 0xfe, 0x16, 0x00, 0x02, 0x65,
11303 0xfe, 0xd1, 0xf0, 0xfe,
11304 0xb8, 0x0b, 0x15, 0x7e, 0x01, 0x36, 0x10, 0xfe, 0x17, 0x00, 0xfe, 0x42,
11305 0x10, 0xfe, 0xce, 0xf0,
11306 0xfe, 0xbe, 0x0b, 0xfe, 0x3c, 0x10, 0xfe, 0xcd, 0xf0, 0xfe, 0xca, 0x0b,
11307 0x10, 0xfe, 0x22, 0x00,
11308 0x02, 0x65, 0xfe, 0xcb, 0xf0, 0xfe, 0xd6, 0x0b, 0x10, 0xfe, 0x24, 0x00,
11309 0x02, 0x65, 0xfe, 0xd0,
11310 0xf0, 0xfe, 0xe0, 0x0b, 0x10, 0x9e, 0xe5, 0xfe, 0xcf, 0xf0, 0xfe, 0xea,
11311 0x0b, 0x10, 0x58, 0xfe,
11312 0x10, 0x10, 0xfe, 0xcc, 0xf0, 0xe2, 0x68, 0x05, 0x1f, 0x4d, 0x10, 0xfe,
11313 0x12, 0x00, 0x2c, 0x0f,
11314 0xfe, 0x4e, 0x11, 0x27, 0xfe, 0x00, 0x0c, 0xfe, 0x9e, 0xf0, 0xfe, 0x14,
11315 0x0c, 0xbc, 0x17, 0x34,
11316 0x2c, 0x77, 0xe6, 0xc5, 0x24, 0xc6, 0x24, 0x2c, 0xfa, 0x27, 0xfe, 0x20,
11317 0x0c, 0x1c, 0x34, 0x94,
11318 0xfe, 0x3c, 0x0c, 0x95, 0x86, 0xc5, 0xdc, 0xc6, 0xdc, 0x02, 0x24, 0x01,
11319 0x4b, 0xfe, 0xdb, 0x10,
11320 0x12, 0xfe, 0xe8, 0x00, 0xb5, 0xb6, 0x74, 0xc7, 0x81, 0xc8, 0x83, 0xfe,
11321 0x89, 0xf0, 0x24, 0x33,
11322 0x31, 0xe1, 0xc7, 0x81, 0xc8, 0x83, 0x27, 0xfe, 0x66, 0x0c, 0x1d, 0x24,
11323 0x33, 0x31, 0xdf, 0xbc,
11324 0x4e, 0x10, 0xfe, 0x42, 0x00, 0x02, 0x65, 0x7c, 0x06, 0xfe, 0x81, 0x49,
11325 0x17, 0xfe, 0x2c, 0x0d,
11326 0x08, 0x05, 0x0a, 0xfe, 0x44, 0x13, 0x10, 0x00, 0x55, 0x0a, 0xfe, 0x54,
11327 0x12, 0x55, 0xfe, 0x28,
11328 0x00, 0x23, 0xfe, 0x9a, 0x0d, 0x09, 0x46, 0x01, 0x0e, 0x07, 0x00, 0x66,
11329 0x44, 0xfe, 0x28, 0x00,
11330 0xfe, 0xe2, 0x10, 0x01, 0xf5, 0x01, 0xf6, 0x09, 0xa4, 0x01, 0xfe, 0x26,
11331 0x0f, 0x64, 0x12, 0x2f,
11332 0x01, 0x73, 0x02, 0x2b, 0x10, 0xfe, 0x44, 0x00, 0x55, 0x0a, 0xe9, 0x44,
11333 0x0a, 0xfe, 0xb4, 0x10,
11334 0x01, 0xb0, 0x44, 0x0a, 0xfe, 0xaa, 0x10, 0x01, 0xb0, 0xfe, 0x19, 0x82,
11335 0xfe, 0x34, 0x46, 0xac,
11336 0x44, 0x0a, 0x10, 0xfe, 0x43, 0x00, 0xfe, 0x96, 0x10, 0x08, 0x54, 0x0a,
11337 0x37, 0x01, 0xf5, 0x01,
11338 0xf6, 0x64, 0x12, 0x2f, 0x01, 0x73, 0x99, 0x0a, 0x64, 0x42, 0x92, 0x02,
11339 0xfe, 0x2e, 0x03, 0x08,
11340 0x05, 0x0a, 0x8a, 0x44, 0x0a, 0x10, 0x00, 0xfe, 0x5c, 0x10, 0x68, 0x05,
11341 0x1a, 0xfe, 0x58, 0x12,
11342 0x08, 0x05, 0x1a, 0xfe, 0x50, 0x13, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0,
11343 0xfe, 0x50, 0x0d, 0xfe,
11344 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x56, 0x0d, 0x08, 0x54, 0x1a, 0x37,
11345 0xfe, 0xa9, 0x10, 0x10,
11346 0xfe, 0x15, 0x00, 0xfe, 0x04, 0xe6, 0x0a, 0x50, 0xfe, 0x2e, 0x10, 0x10,
11347 0xfe, 0x13, 0x00, 0xfe,
11348 0x10, 0x10, 0x10, 0x6f, 0xab, 0x10, 0xfe, 0x41, 0x00, 0xaa, 0x10, 0xfe,
11349 0x24, 0x00, 0x8c, 0xb5,
11350 0xb6, 0x74, 0x03, 0x70, 0x28, 0x23, 0xd8, 0x50, 0xfe, 0x04, 0xe6, 0x1a,
11351 0xfe, 0x9d, 0x41, 0xfe,
11352 0x1c, 0x42, 0x64, 0x01, 0xe3, 0x02, 0x2b, 0xf8, 0x15, 0x0a, 0x39, 0xa0,
11353 0xb4, 0x15, 0xfe, 0x31,
11354 0x00, 0x39, 0xa2, 0x01, 0xfe, 0x48, 0x10, 0x02, 0xd7, 0x42, 0xfe, 0x06,
11355 0xec, 0xd0, 0xfc, 0x44,
11356 0x1b, 0xfe, 0xce, 0x45, 0x35, 0x42, 0xfe, 0x06, 0xea, 0xd0, 0xfe, 0x47,
11357 0x4b, 0x91, 0xfe, 0x75,
11358 0x57, 0x03, 0x5d, 0xfe, 0x98, 0x56, 0xfe, 0x38, 0x12, 0x09, 0x48, 0x01,
11359 0x0e, 0xfe, 0x44, 0x48,
11360 0x4f, 0x08, 0x05, 0x1b, 0xfe, 0x1a, 0x13, 0x09, 0x46, 0x01, 0x0e, 0x41,
11361 0xfe, 0x41, 0x58, 0x09,
11362 0xa4, 0x01, 0x0e, 0xfe, 0x49, 0x54, 0x96, 0xfe, 0x1e, 0x0e, 0x02, 0xfe,
11363 0x2e, 0x03, 0x09, 0x5d,
11364 0xfe, 0xee, 0x14, 0xfc, 0x44, 0x1b, 0xfe, 0xce, 0x45, 0x35, 0x42, 0xfe,
11365 0xce, 0x47, 0xfe, 0xad,
11366 0x13, 0x02, 0x2b, 0x22, 0x20, 0x07, 0x11, 0xfe, 0x9e, 0x12, 0x21, 0x13,
11367 0x59, 0x13, 0x9f, 0x13,
11368 0xd5, 0x22, 0x2f, 0x41, 0x39, 0x2f, 0xbc, 0xad, 0xfe, 0xbc, 0xf0, 0xfe,
11369 0xe0, 0x0e, 0x0f, 0x06,
11370 0x13, 0x59, 0x01, 0xfe, 0xda, 0x16, 0x03, 0xfe, 0x38, 0x01, 0x29, 0xfe,
11371 0x3a, 0x01, 0x56, 0xfe,
11372 0xe4, 0x0e, 0xfe, 0x02, 0xec, 0xd5, 0x69, 0x00, 0x66, 0xfe, 0x04, 0xec,
11373 0x20, 0x4f, 0xfe, 0x05,
11374 0xf6, 0xfe, 0x34, 0x01, 0x01, 0xfe, 0x4a, 0x17, 0xfe, 0x08, 0x90, 0xfe,
11375 0x48, 0xf4, 0x0d, 0xfe,
11376 0x18, 0x13, 0xba, 0xfe, 0x02, 0xea, 0xd5, 0x69, 0x7e, 0xfe, 0xc5, 0x13,
11377 0x15, 0x1a, 0x39, 0xa0,
11378 0xb4, 0xfe, 0x2e, 0x10, 0x03, 0xfe, 0x38, 0x01, 0x1e, 0xfe, 0xf0, 0xff,
11379 0x0c, 0xfe, 0x60, 0x01,
11380 0x03, 0xfe, 0x3a, 0x01, 0x0c, 0xfe, 0x62, 0x01, 0x43, 0x13, 0x20, 0x25,
11381 0x06, 0x13, 0x2f, 0x12,
11382 0x2f, 0x92, 0x0f, 0x06, 0x04, 0x21, 0x04, 0x22, 0x59, 0xfe, 0xf7, 0x12,
11383 0x22, 0x9f, 0xb7, 0x13,
11384 0x9f, 0x07, 0x7e, 0xfe, 0x71, 0x13, 0xfe, 0x24, 0x1c, 0x15, 0x19, 0x39,
11385 0xa0, 0xb4, 0xfe, 0xd9,
11386 0x10, 0xc3, 0xfe, 0x03, 0xdc, 0xfe, 0x73, 0x57, 0xfe, 0x80, 0x5d, 0x04,
11387 0xc3, 0xfe, 0x03, 0xdc,
11388 0xfe, 0x5b, 0x57, 0xfe, 0x80, 0x5d, 0x04, 0xfe, 0x03, 0x57, 0xc3, 0x21,
11389 0xfe, 0x00, 0xcc, 0x04,
11390 0xfe, 0x03, 0x57, 0xc3, 0x78, 0x04, 0x08, 0x05, 0x58, 0xfe, 0x22, 0x13,
11391 0xfe, 0x1c, 0x80, 0x07,
11392 0x06, 0xfe, 0x1a, 0x13, 0xfe, 0x1e, 0x80, 0xed, 0xfe, 0x1d, 0x80, 0xae,
11393 0xfe, 0x0c, 0x90, 0xfe,
11394 0x0e, 0x13, 0xfe, 0x0e, 0x90, 0xac, 0xfe, 0x3c, 0x90, 0xfe, 0x30, 0xf4,
11395 0x0a, 0xfe, 0x3c, 0x50,
11396 0xaa, 0x01, 0xfe, 0x7a, 0x17, 0x32, 0x07, 0x2f, 0xad, 0x01, 0xfe, 0xb4,
11397 0x16, 0x08, 0x05, 0x1b,
11398 0x4e, 0x01, 0xf5, 0x01, 0xf6, 0x12, 0xfe, 0xe9, 0x00, 0x08, 0x05, 0x58,
11399 0xfe, 0x2c, 0x13, 0x01,
11400 0xfe, 0x0c, 0x17, 0xfe, 0x1e, 0x1c, 0xfe, 0x14, 0x90, 0xfe, 0x96, 0x90,
11401 0x0c, 0xfe, 0x64, 0x01,
11402 0x14, 0xfe, 0x66, 0x01, 0x08, 0x05, 0x5b, 0xfe, 0x12, 0x12, 0xfe, 0x03,
11403 0x80, 0x8d, 0xfe, 0x01,
11404 0xec, 0x20, 0xfe, 0x80, 0x40, 0x13, 0x20, 0x6a, 0x2a, 0x12, 0xcf, 0x64,
11405 0x22, 0x20, 0xfb, 0x79,
11406 0x20, 0x04, 0xfe, 0x08, 0x1c, 0x03, 0xfe, 0xac, 0x00, 0xfe, 0x06, 0x58,
11407 0x03, 0xfe, 0xae, 0x00,
11409 0xfe, 0x07, 0x58, 0x03, 0xfe, 0xb0, 0x00, 0xfe, 0x08, 0x58, 0x03, 0xfe,
11410 0xb2, 0x00, 0xfe, 0x09,
11411 0x58, 0xfe, 0x0a, 0x1c, 0x25, 0x6e, 0x13, 0xd0, 0x21, 0x0c, 0x5c, 0x0c,
11412 0x45, 0x0f, 0x46, 0x52,
11413 0x50, 0x18, 0x1b, 0xfe, 0x90, 0x4d, 0xfe, 0x91, 0x54, 0x23, 0xfe, 0xfc,
11414 0x0f, 0x44, 0x11, 0x0f,
11415 0x48, 0x52, 0x18, 0x58, 0xfe, 0x90, 0x4d, 0xfe, 0x91, 0x54, 0x23, 0xe4,
11416 0x25, 0x11, 0x13, 0x20,
11417 0x7c, 0x6f, 0x4f, 0x22, 0x20, 0xfb, 0x79, 0x20, 0x12, 0xcf, 0xfe, 0x14,
11418 0x56, 0xfe, 0xd6, 0xf0,
11419 0xfe, 0x26, 0x10, 0xf8, 0x74, 0xfe, 0x14, 0x1c, 0xfe, 0x10, 0x1c, 0xfe,
11420 0x18, 0x1c, 0x04, 0x42,
11421 0xfe, 0x0c, 0x14, 0xfc, 0xfe, 0x07, 0xe6, 0x1b, 0xfe, 0xce, 0x47, 0xfe,
11422 0xf5, 0x13, 0x04, 0x01,
11423 0xb0, 0x7c, 0x6f, 0x4f, 0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x42,
11424 0x13, 0x32, 0x07, 0x2f,
11425 0xfe, 0x34, 0x13, 0x09, 0x48, 0x01, 0x0e, 0xbb, 0xfe, 0x36, 0x12, 0xfe,
11426 0x41, 0x48, 0xfe, 0x45,
11427 0x48, 0x01, 0xf0, 0xfe, 0x00, 0xcc, 0xbb, 0xfe, 0xf3, 0x13, 0x43, 0x78,
11428 0x07, 0x11, 0xac, 0x09,
11429 0x84, 0x01, 0x0e, 0xfe, 0x80, 0x5c, 0x01, 0x73, 0xfe, 0x0e, 0x10, 0x07,
11430 0x82, 0x4e, 0xfe, 0x14,
11431 0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0x60, 0x10, 0x04, 0xfe, 0x44, 0x58, 0x8d,
11432 0xfe, 0x01, 0xec, 0xa2,
11433 0xfe, 0x9e, 0x40, 0xfe, 0x9d, 0xe7, 0x00, 0xfe, 0x9c, 0xe7, 0x1a, 0x79,
11434 0x2a, 0x01, 0xe3, 0xfe,
11435 0xdd, 0x10, 0x2c, 0xc7, 0x81, 0xc8, 0x83, 0x33, 0x31, 0xde, 0x07, 0x1a,
11436 0xfe, 0x48, 0x12, 0x07,
11437 0x0a, 0xfe, 0x56, 0x12, 0x07, 0x19, 0xfe, 0x30, 0x12, 0x07, 0xc9, 0x17,
11438 0xfe, 0x32, 0x12, 0x07,
11439 0xfe, 0x23, 0x00, 0x17, 0xeb, 0x07, 0x06, 0x17, 0xfe, 0x9c, 0x12, 0x07,
11440 0x1f, 0xfe, 0x12, 0x12,
11441 0x07, 0x00, 0x17, 0x24, 0x15, 0xc9, 0x01, 0x36, 0xa9, 0x2d, 0x01, 0x0b,
11442 0x94, 0x4b, 0x04, 0x2d,
11443 0xdd, 0x09, 0xd1, 0x01, 0xfe, 0x26, 0x0f, 0x12, 0x82, 0x02, 0x2b, 0x2d,
11444 0x32, 0x07, 0xa6, 0xfe,
11445 0xd9, 0x13, 0x3a, 0x3d, 0x3b, 0x3e, 0x56, 0xfe, 0xf0, 0x11, 0x08, 0x05,
11446 0x5a, 0xfe, 0x72, 0x12,
11447 0x9b, 0x2e, 0x9c, 0x3c, 0x90, 0xc0, 0x96, 0xfe, 0xba, 0x11, 0x22, 0x62,
11448 0xfe, 0x26, 0x13, 0x03,
11449 0x7f, 0x29, 0x80, 0x56, 0xfe, 0x76, 0x0d, 0x0c, 0x60, 0x14, 0x61, 0x21,
11450 0x0c, 0x7f, 0x0c, 0x80,
11451 0x01, 0xb3, 0x25, 0x6e, 0x77, 0x13, 0x62, 0x01, 0xef, 0x9b, 0x2e, 0x9c,
11452 0x3c, 0xfe, 0x04, 0x55,
11453 0xfe, 0xa5, 0x55, 0xfe, 0x04, 0xfa, 0x2e, 0xfe, 0x05, 0xfa, 0x3c, 0xfe,
11454 0x91, 0x10, 0x03, 0x3f,
11455 0x29, 0x40, 0xfe, 0x40, 0x56, 0xfe, 0xe1, 0x56, 0x0c, 0x3f, 0x14, 0x40,
11456 0x88, 0x9b, 0x2e, 0x9c,
11457 0x3c, 0x90, 0xc0, 0x03, 0x5e, 0x29, 0x5f, 0xfe, 0x00, 0x56, 0xfe, 0xa1,
11458 0x56, 0x0c, 0x5e, 0x14,
11459 0x5f, 0x08, 0x05, 0x5a, 0xfe, 0x1e, 0x12, 0x22, 0x62, 0xfe, 0x1f, 0x40,
11460 0x03, 0x60, 0x29, 0x61,
11461 0xfe, 0x2c, 0x50, 0xfe, 0xae, 0x50, 0x03, 0x3f, 0x29, 0x40, 0xfe, 0x44,
11462 0x50, 0xfe, 0xc6, 0x50,
11463 0x03, 0x5e, 0x29, 0x5f, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0x03, 0x3d,
11464 0x29, 0x3e, 0xfe, 0x40,
11465 0x50, 0xfe, 0xc2, 0x50, 0x02, 0x89, 0x25, 0x06, 0x13, 0xd4, 0x02, 0x72,
11466 0x2d, 0x01, 0x0b, 0x1d,
11467 0x4c, 0x33, 0x31, 0xde, 0x07, 0x06, 0x23, 0x4c, 0x32, 0x07, 0xa6, 0x23,
11468 0x72, 0x01, 0xaf, 0x1e,
11469 0x43, 0x17, 0x4c, 0x08, 0x05, 0x0a, 0xee, 0x3a, 0x3d, 0x3b, 0x3e, 0xfe,
11470 0x0a, 0x55, 0x35, 0xfe,
11471 0x8b, 0x55, 0x57, 0x3d, 0x7d, 0x3e, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51,
11472 0x02, 0x72, 0xfe, 0x19,
11473 0x81, 0xba, 0xfe, 0x19, 0x41, 0x02, 0x72, 0x2d, 0x01, 0x0b, 0x1c, 0x34,
11474 0x1d, 0xe8, 0x33, 0x31,
11475 0xe1, 0x55, 0x19, 0xfe, 0xa6, 0x12, 0x55, 0x0a, 0x4d, 0x02, 0x4c, 0x01,
11476 0x0b, 0x1c, 0x34, 0x1d,
11477 0xe8, 0x33, 0x31, 0xdf, 0x07, 0x19, 0x23, 0x4c, 0x01, 0x0b, 0x1d, 0xe8,
11478 0x33, 0x31, 0xfe, 0xe8,
11479 0x09, 0xfe, 0xc2, 0x49, 0x51, 0x03, 0xfe, 0x9c, 0x00, 0x28, 0x8a, 0x53,
11480 0x05, 0x1f, 0x35, 0xa9,
11481 0xfe, 0xbb, 0x45, 0x55, 0x00, 0x4e, 0x44, 0x06, 0x7c, 0x43, 0xfe, 0xda,
11482 0x14, 0x01, 0xaf, 0x8c,
11483 0xfe, 0x4b, 0x45, 0xee, 0x32, 0x07, 0xa5, 0xed, 0x03, 0xcd, 0x28, 0x8a,
11484 0x03, 0x45, 0x28, 0x35,
11485 0x67, 0x02, 0x72, 0xfe, 0xc0, 0x5d, 0xfe, 0xf8, 0x14, 0xfe, 0x03, 0x17,
11486 0x03, 0x5c, 0xc1, 0x0c,
11487 0x5c, 0x67, 0x2d, 0x01, 0x0b, 0x26, 0x89, 0x01, 0xfe, 0x9e, 0x15, 0x02,
11488 0x89, 0x01, 0x0b, 0x1c,
11489 0x34, 0x1d, 0x4c, 0x33, 0x31, 0xdf, 0x07, 0x06, 0x23, 0x4c, 0x01, 0xf1,
11490 0xfe, 0x42, 0x58, 0xf1,
11491 0xfe, 0xa4, 0x14, 0x8c, 0xfe, 0x4a, 0xf4, 0x0a, 0x17, 0x4c, 0xfe, 0x4a,
11492 0xf4, 0x06, 0xea, 0x32,
11493 0x07, 0xa5, 0x8b, 0x02, 0x72, 0x03, 0x45, 0xc1, 0x0c, 0x45, 0x67, 0x2d,
11494 0x01, 0x0b, 0x26, 0x89,
11495 0x01, 0xfe, 0xcc, 0x15, 0x02, 0x89, 0x0f, 0x06, 0x27, 0xfe, 0xbe, 0x13,
11496 0x26, 0xfe, 0xd4, 0x13,
11497 0x76, 0xfe, 0x89, 0x48, 0x01, 0x0b, 0x21, 0x76, 0x04, 0x7b, 0xfe, 0xd0,
11498 0x13, 0x1c, 0xfe, 0xd0,
11499 0x13, 0x1d, 0xfe, 0xbe, 0x13, 0x67, 0x2d, 0x01, 0x0b, 0xfe, 0xd5, 0x10,
11500 0x0f, 0x71, 0xff, 0x02,
11501 0x00, 0x57, 0x52, 0x93, 0x1e, 0xfe, 0xff, 0x7f, 0xfe, 0x30, 0x56, 0xfe,
11502 0x00, 0x5c, 0x04, 0x0f,
11503 0x71, 0xff, 0x02, 0x00, 0x57, 0x52, 0x93, 0x1e, 0x43, 0xfe, 0x30, 0x56,
11504 0xfe, 0x00, 0x5c, 0x04,
11505 0x0f, 0x71, 0xff, 0x02, 0x00, 0x57, 0x52, 0x93, 0x04, 0x0f, 0x71, 0xff,
11506 0x02, 0x00, 0x57, 0x52,
11507 0x93, 0xfe, 0x0b, 0x58, 0x04, 0x09, 0x5c, 0x01, 0x87, 0x09, 0x45, 0x01,
11508 0x87, 0x04, 0xfe, 0x03,
11509 0xa1, 0x1e, 0x11, 0xff, 0x03, 0x00, 0x54, 0xfe, 0x00, 0xf4, 0x1f, 0x52,
11510 0xfe, 0x00, 0x7d, 0xfe,
11511 0x01, 0x7d, 0xfe, 0x02, 0x7d, 0xfe, 0x03, 0x7c, 0x6a, 0x2a, 0x0c, 0x5e,
11512 0x14, 0x5f, 0x57, 0x3f,
11513 0x7d, 0x40, 0x04, 0xdd, 0xfe, 0x82, 0x4a, 0xfe, 0xe1, 0x1a, 0xfe, 0x83,
11514 0x5a, 0x8d, 0x04, 0x01,
11515 0xfe, 0x0c, 0x19, 0xfe, 0x42, 0x48, 0x50, 0x51, 0x91, 0x01, 0x0b, 0x1d,
11516 0xfe, 0x96, 0x15, 0x33,
11517 0x31, 0xe1, 0x01, 0x0b, 0x1d, 0xfe, 0x96, 0x15, 0x33, 0x31, 0xfe, 0xe8,
11518 0x0a, 0xfe, 0xc1, 0x59,
11519 0x03, 0xcd, 0x28, 0xfe, 0xcc, 0x12, 0x53, 0x05, 0x1a, 0xfe, 0xc4, 0x13,
11520 0x21, 0x69, 0x1a, 0xee,
11521 0x55, 0xca, 0x6b, 0xfe, 0xdc, 0x14, 0x4d, 0x0f, 0x06, 0x18, 0xca, 0x7c,
11522 0x30, 0xfe, 0x78, 0x10,
11523 0xff, 0x02, 0x83, 0x55, 0xab, 0xff, 0x02, 0x83, 0x55, 0x69, 0x19, 0xae,
11524 0x98, 0xfe, 0x30, 0x00,
11525 0x96, 0xf2, 0x18, 0x6d, 0x0f, 0x06, 0xfe, 0x56, 0x10, 0x69, 0x0a, 0xed,
11526 0x98, 0xfe, 0x64, 0x00,
11527 0x96, 0xf2, 0x09, 0xfe, 0x64, 0x00, 0x18, 0x9e, 0x0f, 0x06, 0xfe, 0x28,
11528 0x10, 0x69, 0x06, 0xfe,
11529 0x60, 0x13, 0x98, 0xfe, 0xc8, 0x00, 0x96, 0xf2, 0x09, 0xfe, 0xc8, 0x00,
11530 0x18, 0x59, 0x0f, 0x06,
11531 0x88, 0x98, 0xfe, 0x90, 0x01, 0x7a, 0xfe, 0x42, 0x15, 0x91, 0xe4, 0xfe,
11532 0x43, 0xf4, 0x9f, 0xfe,
11533 0x56, 0xf0, 0xfe, 0x54, 0x15, 0xfe, 0x04, 0xf4, 0x71, 0xfe, 0x43, 0xf4,
11534 0x9e, 0xfe, 0xf3, 0x10,
11535 0xfe, 0x40, 0x5c, 0x01, 0xfe, 0x16, 0x14, 0x1e, 0x43, 0xec, 0xfe, 0x00,
11536 0x17, 0xfe, 0x4d, 0xe4,
11537 0x6e, 0x7a, 0xfe, 0x90, 0x15, 0xc4, 0x6e, 0xfe, 0x1c, 0x10, 0xfe, 0x00,
11538 0x17, 0xfe, 0x4d, 0xe4,
11539 0xcc, 0x7a, 0xfe, 0x90, 0x15, 0xc4, 0xcc, 0x88, 0x51, 0x21, 0xfe, 0x4d,
11540 0xf4, 0x00, 0xe9, 0x91,
11541 0x0f, 0x06, 0xfe, 0xb4, 0x56, 0xfe, 0xc3, 0x58, 0x04, 0x51, 0x0f, 0x0a,
11542 0x04, 0x16, 0x06, 0x01,
11543 0x0b, 0x26, 0xf3, 0x16, 0x0a, 0x01, 0x0b, 0x26, 0xf3, 0x16, 0x19, 0x01,
11544 0x0b, 0x26, 0xf3, 0x76,
11545 0xfe, 0x89, 0x49, 0x01, 0x0b, 0x04, 0x16, 0x06, 0x01, 0x0b, 0x26, 0xb1,
11546 0x16, 0x19, 0x01, 0x0b,
11547 0x26, 0xb1, 0x16, 0x06, 0x01, 0x0b, 0x26, 0xb1, 0xfe, 0x89, 0x49, 0x01,
11548 0x0b, 0x26, 0xb1, 0x76,
11549 0xfe, 0x89, 0x4a, 0x01, 0x0b, 0x04, 0x51, 0x04, 0x22, 0xd3, 0x07, 0x06,
11550 0xfe, 0x48, 0x13, 0xb8,
11551 0x13, 0xd3, 0xfe, 0x49, 0xf4, 0x00, 0x4d, 0x76, 0xa9, 0x67, 0xfe, 0x01,
11552 0xec, 0xfe, 0x27, 0x01,
11553 0xfe, 0x89, 0x48, 0xff, 0x02, 0x00, 0x10, 0x27, 0xfe, 0x2e, 0x16, 0x32,
11554 0x07, 0xfe, 0xe3, 0x00,
11555 0xfe, 0x20, 0x13, 0x1d, 0xfe, 0x52, 0x16, 0x21, 0x13, 0xd4, 0x01, 0x4b,
11556 0x22, 0xd4, 0x07, 0x06,
11557 0x4e, 0x08, 0x54, 0x06, 0x37, 0x04, 0x09, 0x48, 0x01, 0x0e, 0xfb, 0x8e,
11558 0x07, 0x11, 0xae, 0x09,
11559 0x84, 0x01, 0x0e, 0x8e, 0x09, 0x5d, 0x01, 0xa8, 0x04, 0x09, 0x84, 0x01,
11560 0x0e, 0x8e, 0xfe, 0x80,
11561 0xe7, 0x11, 0x07, 0x11, 0x8a, 0xfe, 0x45, 0x58, 0x01, 0xf0, 0x8e, 0x04,
11562 0x09, 0x48, 0x01, 0x0e,
11563 0x8e, 0x09, 0x5d, 0x01, 0xa8, 0x04, 0x09, 0x48, 0x01, 0x0e, 0xfe, 0x80,
11564 0x80, 0xfe, 0x80, 0x4c,
11565 0xfe, 0x49, 0xe4, 0x11, 0xae, 0x09, 0x84, 0x01, 0x0e, 0xfe, 0x80, 0x4c,
11566 0x09, 0x5d, 0x01, 0x87,
11567 0x04, 0x18, 0x11, 0x75, 0x6c, 0xfe, 0x60, 0x01, 0xfe, 0x18, 0xdf, 0xfe,
11568 0x19, 0xde, 0xfe, 0x24,
11569 0x1c, 0xfe, 0x1d, 0xf7, 0x1b, 0x97, 0xfe, 0xee, 0x16, 0x01, 0xfe, 0xf4,
11570 0x17, 0xad, 0x9a, 0x1b,
11571 0x6c, 0xfe, 0x2c, 0x01, 0xfe, 0x2f, 0x19, 0x04, 0xb9, 0x23, 0xfe, 0xde,
11572 0x16, 0xfe, 0xda, 0x10,
11573 0x18, 0x11, 0x75, 0x03, 0xfe, 0x64, 0x01, 0xfe, 0x00, 0xf4, 0x1f, 0xfe,
11574 0x18, 0x58, 0x03, 0xfe,
11575 0x66, 0x01, 0xfe, 0x19, 0x58, 0x9a, 0x1f, 0xfe, 0x3c, 0x90, 0xfe, 0x30,
11576 0xf4, 0x06, 0xfe, 0x3c,
11577 0x50, 0x6c, 0xfe, 0x38, 0x00, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7, 0x1f,
11578 0x97, 0xfe, 0x38, 0x17,
11579 0xfe, 0xb6, 0x14, 0x35, 0x04, 0xb9, 0x23, 0xfe, 0x10, 0x17, 0xfe, 0x9c,
11580 0x10, 0x18, 0x11, 0x75,
11581 0xfe, 0x83, 0x5a, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, 0x1d, 0xf7,
11582 0x2e, 0x97, 0xfe, 0x5a,
11583 0x17, 0xfe, 0x94, 0x14, 0xec, 0x9a, 0x2e, 0x6c, 0x1a, 0xfe, 0xaf, 0x19,
11584 0xfe, 0x98, 0xe7, 0x00,
11585 0x04, 0xb9, 0x23, 0xfe, 0x4e, 0x17, 0xfe, 0x6c, 0x10, 0x18, 0x11, 0x75,
11586 0xfe, 0x30, 0xbc, 0xfe,
11587 0xb2, 0xbc, 0x9a, 0xcb, 0x6c, 0x1a, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7,
11588 0xcb, 0x97, 0xfe, 0x92,
11589 0x17, 0xfe, 0x5c, 0x14, 0x35, 0x04, 0xb9, 0x23, 0xfe, 0x7e, 0x17, 0xfe,
11590 0x42, 0x10, 0xfe, 0x02,
11591 0xf6, 0x11, 0x75, 0xfe, 0x18, 0xfe, 0x60, 0xfe, 0x19, 0xfe, 0x61, 0xfe,
11592 0x03, 0xa1, 0xfe, 0x1d,
11593 0xf7, 0x5b, 0x97, 0xfe, 0xb8, 0x17, 0xfe, 0x36, 0x14, 0xfe, 0x1c, 0x13,
11594 0x9a, 0x5b, 0x41, 0xfe,
11595 0x83, 0x58, 0xfe, 0xaf, 0x19, 0xfe, 0x80, 0xe7, 0x11, 0xfe, 0x81, 0xe7,
11596 0x11, 0x12, 0xfe, 0xdd,
11597 0x00, 0x6a, 0x2a, 0x04, 0x6a, 0x2a, 0xfe, 0x12, 0x45, 0x23, 0xfe, 0xa8,
11598 0x17, 0x15, 0x06, 0x39,
11599 0xa0, 0xb4, 0x02, 0x2b, 0xfe, 0x39, 0xf0, 0xfe, 0xfc, 0x17, 0x21, 0x04,
11600 0xfe, 0x7e, 0x18, 0x1e,
11601 0x19, 0x66, 0x0f, 0x0d, 0x04, 0x75, 0x03, 0xd2, 0x1e, 0x06, 0xfe, 0xef,
11602 0x12, 0xfe, 0xe1, 0x10,
11603 0x7c, 0x6f, 0x4f, 0x32, 0x07, 0x2f, 0xfe, 0x3c, 0x13, 0xf1, 0xfe, 0x42,
11604 0x13, 0x42, 0x92, 0x09,
11605 0x48, 0x01, 0x0e, 0xbb, 0xeb, 0xfe, 0x41, 0x48, 0xfe, 0x45, 0x48, 0x01,
11606 0xf0, 0xfe, 0x00, 0xcc,
11607 0xbb, 0xfe, 0xf3, 0x13, 0x43, 0x78, 0x07, 0x11, 0xac, 0x09, 0x84, 0x01,
11608 0x0e, 0xfe, 0x80, 0x4c,
11609 0x01, 0x73, 0xfe, 0x16, 0x10, 0x07, 0x82, 0x8b, 0xfe, 0x40, 0x14, 0xfe,
11610 0x24, 0x12, 0xfe, 0x14,
11611 0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0x1c, 0x18, 0x18, 0x0a, 0x04, 0xfe, 0x9c,
11612 0xe7, 0x0a, 0x10, 0xfe,
11613 0x15, 0x00, 0x64, 0x79, 0x2a, 0x01, 0xe3, 0x18, 0x06, 0x04, 0x42, 0x92,
11614 0x08, 0x54, 0x1b, 0x37,
11615 0x12, 0x2f, 0x01, 0x73, 0x18, 0x06, 0x04, 0xfe, 0x38, 0x90, 0xfe, 0xba,
11616 0x90, 0x3a, 0xce, 0x3b,
11617 0xcf, 0xfe, 0x48, 0x55, 0x35, 0xfe, 0xc9, 0x55, 0x04, 0x22, 0xa3, 0x77,
11618 0x13, 0xa3, 0x04, 0x09,
11619 0xa4, 0x01, 0x0e, 0xfe, 0x41, 0x48, 0x09, 0x46, 0x01, 0x0e, 0xfe, 0x49,
11620 0x44, 0x17, 0xfe, 0xe8,
11621 0x18, 0x77, 0x78, 0x04, 0x09, 0x48, 0x01, 0x0e, 0x07, 0x11, 0x4e, 0x09,
11622 0x5d, 0x01, 0xa8, 0x09,
11623 0x46, 0x01, 0x0e, 0x77, 0x78, 0x04, 0xfe, 0x4e, 0xe4, 0x19, 0x6b, 0xfe,
11624 0x1c, 0x19, 0x03, 0xfe,
11625 0x90, 0x00, 0xfe, 0x3a, 0x45, 0xfe, 0x2c, 0x10, 0xfe, 0x4e, 0xe4, 0xc9,
11626 0x6b, 0xfe, 0x2e, 0x19,
11627 0x03, 0xfe, 0x92, 0x00, 0xfe, 0x02, 0xe6, 0x1a, 0xe5, 0xfe, 0x4e, 0xe4,
11628 0xfe, 0x0b, 0x00, 0x6b,
11629 0xfe, 0x40, 0x19, 0x03, 0xfe, 0x94, 0x00, 0xfe, 0x02, 0xe6, 0x1f, 0xfe,
11630 0x08, 0x10, 0x03, 0xfe,
11631 0x96, 0x00, 0xfe, 0x02, 0xe6, 0x6d, 0xfe, 0x4e, 0x45, 0xea, 0xba, 0xff,
11632 0x04, 0x68, 0x54, 0xe7,
11633 0x1e, 0x6e, 0xfe, 0x08, 0x1c, 0xfe, 0x67, 0x19, 0xfe, 0x0a, 0x1c, 0xfe,
11634 0x1a, 0xf4, 0xfe, 0x00,
11635 0x04, 0xea, 0xfe, 0x48, 0xf4, 0x19, 0x7a, 0xfe, 0x74, 0x19, 0x0f, 0x19,
11636 0x04, 0x07, 0x7e, 0xfe,
11637 0x5a, 0xf0, 0xfe, 0x84, 0x19, 0x25, 0xfe, 0x09, 0x00, 0xfe, 0x34, 0x10,
11638 0x07, 0x1a, 0xfe, 0x5a,
11639 0xf0, 0xfe, 0x92, 0x19, 0x25, 0xca, 0xfe, 0x26, 0x10, 0x07, 0x19, 0x66,
11640 0x25, 0x6d, 0xe5, 0x07,
11641 0x0a, 0x66, 0x25, 0x9e, 0xfe, 0x0e, 0x10, 0x07, 0x06, 0x66, 0x25, 0x59,
11642 0xa9, 0xb8, 0x04, 0x15,
11643 0xfe, 0x09, 0x00, 0x01, 0x36, 0xfe, 0x04, 0xfe, 0x81, 0x03, 0x83, 0xfe,
11644 0x40, 0x5c, 0x04, 0x1c,
11645 0xf7, 0xfe, 0x14, 0xf0, 0x0b, 0x27, 0xfe, 0xd6, 0x19, 0x1c, 0xf7, 0x7b,
11646 0xf7, 0xfe, 0x82, 0xf0,
11647 0xfe, 0xda, 0x19, 0x04, 0xff, 0xcc, 0x00, 0x00,
11650 static unsigned short _adv_asc38C0800_size
= sizeof(_adv_asc38C0800_buf
); /* 0x14E1 */
11651 static ADV_DCNT _adv_asc38C0800_chksum
= 0x050D3FD8UL
; /* Expanded little-endian checksum. */
11653 /* Microcode buffer is kept after initialization for error recovery. */
11654 static unsigned char _adv_asc38C1600_buf
[] = {
11655 0x00, 0x00, 0x00, 0xf2, 0x00, 0x16, 0x00, 0xfc, 0x00, 0x10, 0x00, 0xf0,
11656 0x18, 0xe4, 0x01, 0x00,
11657 0x04, 0x1e, 0x48, 0xe4, 0x03, 0xf6, 0xf7, 0x13, 0x2e, 0x1e, 0x02, 0x00,
11658 0x07, 0x17, 0xc0, 0x5f,
11659 0x00, 0xfa, 0xff, 0xff, 0x04, 0x00, 0x00, 0xf6, 0x09, 0xe7, 0x82, 0xe7,
11660 0x85, 0xf0, 0x86, 0xf0,
11661 0x4e, 0x10, 0x9e, 0xe7, 0xff, 0x00, 0x55, 0xf0, 0x01, 0xf6, 0x03, 0x00,
11662 0x98, 0x57, 0x01, 0xe6,
11663 0x00, 0xea, 0x00, 0xec, 0x01, 0xfa, 0x18, 0xf4, 0x08, 0x00, 0xf0, 0x1d,
11664 0x38, 0x54, 0x32, 0xf0,
11665 0x10, 0x00, 0xc2, 0x0e, 0x1e, 0xf0, 0xd5, 0xf0, 0xbc, 0x00, 0x4b, 0xe4,
11666 0x00, 0xe6, 0xb1, 0xf0,
11667 0xb4, 0x00, 0x02, 0x13, 0x3e, 0x1c, 0xc8, 0x47, 0x3e, 0x00, 0xd8, 0x01,
11668 0x06, 0x13, 0x0c, 0x1c,
11669 0x5e, 0x1e, 0x00, 0x57, 0xc8, 0x57, 0x01, 0xfc, 0xbc, 0x0e, 0xa2, 0x12,
11670 0xb9, 0x54, 0x00, 0x80,
11671 0x62, 0x0a, 0x5a, 0x12, 0xc8, 0x15, 0x3e, 0x1e, 0x18, 0x40, 0xbd, 0x56,
11672 0x03, 0xe6, 0x01, 0xea,
11673 0x5c, 0xf0, 0x0f, 0x00, 0x20, 0x00, 0x6c, 0x01, 0x6e, 0x01, 0x04, 0x12,
11674 0x04, 0x13, 0xbb, 0x55,
11675 0x3c, 0x56, 0x3e, 0x57, 0x03, 0x58, 0x4a, 0xe4, 0x40, 0x00, 0xb6, 0x00,
11676 0xbb, 0x00, 0xc0, 0x00,
11677 0x00, 0x01, 0x01, 0x01, 0x3e, 0x01, 0x58, 0x0a, 0x44, 0x10, 0x0a, 0x12,
11678 0x4c, 0x1c, 0x4e, 0x1c,
11679 0x02, 0x4a, 0x30, 0xe4, 0x05, 0xe6, 0x0c, 0x00, 0x3c, 0x00, 0x80, 0x00,
11680 0x24, 0x01, 0x3c, 0x01,
11681 0x68, 0x01, 0x6a, 0x01, 0x70, 0x01, 0x72, 0x01, 0x74, 0x01, 0x76, 0x01,
11682 0x78, 0x01, 0x7c, 0x01,
11683 0xc6, 0x0e, 0x0c, 0x10, 0xac, 0x12, 0xae, 0x12, 0x16, 0x1a, 0x32, 0x1c,
11684 0x6e, 0x1e, 0x02, 0x48,
11685 0x3a, 0x55, 0xc9, 0x57, 0x02, 0xee, 0x5b, 0xf0, 0x03, 0xf7, 0x06, 0xf7,
11686 0x03, 0xfc, 0x06, 0x00,
11687 0x1e, 0x00, 0xbe, 0x00, 0xe1, 0x00, 0x0c, 0x12, 0x18, 0x1a, 0x70, 0x1a,
11688 0x30, 0x1c, 0x38, 0x1c,
11689 0x10, 0x44, 0x00, 0x4c, 0xb0, 0x57, 0x40, 0x5c, 0x4d, 0xe4, 0x04, 0xea,
11690 0x5d, 0xf0, 0xa7, 0xf0,
11691 0x04, 0xf6, 0x02, 0xfc, 0x05, 0x00, 0x09, 0x00, 0x19, 0x00, 0x32, 0x00,
11692 0x33, 0x00, 0x34, 0x00,
11693 0x36, 0x00, 0x98, 0x00, 0x9e, 0x00, 0xcc, 0x00, 0x20, 0x01, 0x4e, 0x01,
11694 0x79, 0x01, 0x3c, 0x09,
11695 0x68, 0x0d, 0x02, 0x10, 0x04, 0x10, 0x3a, 0x10, 0x08, 0x12, 0x0a, 0x13,
11696 0x40, 0x16, 0x50, 0x16,
11697 0x00, 0x17, 0x4a, 0x19, 0x00, 0x4e, 0x00, 0x54, 0x01, 0x58, 0x00, 0xdc,
11698 0x05, 0xf0, 0x09, 0xf0,
11699 0x59, 0xf0, 0xb8, 0xf0, 0x48, 0xf4, 0x0e, 0xf7, 0x0a, 0x00, 0x9b, 0x00,
11700 0x9c, 0x00, 0xa4, 0x00,
11701 0xb5, 0x00, 0xba, 0x00, 0xd0, 0x00, 0xe7, 0x00, 0xf0, 0x03, 0x69, 0x08,
11702 0xe9, 0x09, 0x5c, 0x0c,
11703 0xb6, 0x12, 0xbc, 0x19, 0xd8, 0x1b, 0x20, 0x1c, 0x34, 0x1c, 0x36, 0x1c,
11704 0x42, 0x1d, 0x08, 0x44,
11705 0x38, 0x44, 0x91, 0x44, 0x0a, 0x45, 0x48, 0x46, 0x89, 0x48, 0x68, 0x54,
11706 0x83, 0x55, 0x83, 0x59,
11707 0x31, 0xe4, 0x02, 0xe6, 0x07, 0xf0, 0x08, 0xf0, 0x0b, 0xf0, 0x0c, 0xf0,
11708 0x4b, 0xf4, 0x04, 0xf8,
11709 0x05, 0xf8, 0x02, 0xfa, 0x03, 0xfa, 0x04, 0xfc, 0x05, 0xfc, 0x07, 0x00,
11710 0xa8, 0x00, 0xaa, 0x00,
11711 0xb9, 0x00, 0xe0, 0x00, 0xe5, 0x00, 0x22, 0x01, 0x26, 0x01, 0x60, 0x01,
11712 0x7a, 0x01, 0x82, 0x01,
11713 0xc8, 0x01, 0xca, 0x01, 0x86, 0x02, 0x6a, 0x03, 0x18, 0x05, 0xb2, 0x07,
11714 0x68, 0x08, 0x10, 0x0d,
11715 0x06, 0x10, 0x0a, 0x10, 0x0e, 0x10, 0x12, 0x10, 0x60, 0x10, 0xed, 0x10,
11716 0xf3, 0x10, 0x06, 0x12,
11717 0x10, 0x12, 0x1e, 0x12, 0x0c, 0x13, 0x0e, 0x13, 0x10, 0x13, 0xfe, 0x9c,
11718 0xf0, 0x35, 0x05, 0xfe,
11719 0xec, 0x0e, 0xff, 0x10, 0x00, 0x00, 0xe9, 0xfe, 0x34, 0x1f, 0x00, 0xe8,
11720 0xfe, 0x88, 0x01, 0xff,
11721 0x03, 0x00, 0x00, 0xfe, 0x93, 0x15, 0xfe, 0x0f, 0x05, 0xff, 0x38, 0x00,
11722 0x00, 0xfe, 0x57, 0x24,
11723 0x00, 0xfe, 0x4c, 0x00, 0x65, 0xff, 0x04, 0x00, 0x00, 0x1a, 0xff, 0x09,
11724 0x00, 0x00, 0xff, 0x08,
11725 0x01, 0x01, 0xff, 0x08, 0xff, 0xff, 0xff, 0x27, 0x00, 0x00, 0xff, 0x10,
11726 0xff, 0xff, 0xff, 0x13,
11727 0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, 0x00, 0x00,
11728 0xfe, 0x04, 0xf7, 0xe8,
11729 0x37, 0x7d, 0x0d, 0x01, 0xfe, 0x4a, 0x11, 0xfe, 0x04, 0xf7, 0xe8, 0x7d,
11730 0x0d, 0x51, 0x37, 0xfe,
11731 0x3d, 0xf0, 0xfe, 0x0c, 0x02, 0xfe, 0x20, 0xf0, 0xbc, 0xfe, 0x91, 0xf0,
11732 0xfe, 0xf8, 0x01, 0xfe,
11733 0x90, 0xf0, 0xfe, 0xf8, 0x01, 0xfe, 0x8f, 0xf0, 0xbc, 0x03, 0x67, 0x4d,
11734 0x05, 0xfe, 0x08, 0x0f,
11735 0x01, 0xfe, 0x78, 0x0f, 0xfe, 0xdd, 0x12, 0x05, 0xfe, 0x0e, 0x03, 0xfe,
11736 0x28, 0x1c, 0x03, 0xfe,
11737 0xa6, 0x00, 0xfe, 0xd1, 0x12, 0x3e, 0x22, 0xfe, 0xa6, 0x00, 0xac, 0xfe,
11738 0x48, 0xf0, 0xfe, 0x90,
11739 0x02, 0xfe, 0x49, 0xf0, 0xfe, 0xaa, 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xc8,
11740 0x02, 0xfe, 0x46, 0xf0,
11741 0xfe, 0x5a, 0x02, 0xfe, 0x47, 0xf0, 0xfe, 0x60, 0x02, 0xfe, 0x43, 0xf0,
11742 0xfe, 0x4e, 0x02, 0xfe,
11743 0x44, 0xf0, 0xfe, 0x52, 0x02, 0xfe, 0x45, 0xf0, 0xfe, 0x56, 0x02, 0x1c,
11744 0x0d, 0xa2, 0x1c, 0x07,
11745 0x22, 0xb7, 0x05, 0x35, 0xfe, 0x00, 0x1c, 0xfe, 0xf1, 0x10, 0xfe, 0x02,
11746 0x1c, 0xf5, 0xfe, 0x1e,
11747 0x1c, 0xfe, 0xe9, 0x10, 0x01, 0x5f, 0xfe, 0xe7, 0x10, 0xfe, 0x06, 0xfc,
11748 0xde, 0x0a, 0x81, 0x01,
11749 0xa3, 0x05, 0x35, 0x1f, 0x95, 0x47, 0xb8, 0x01, 0xfe, 0xe4, 0x11, 0x0a,
11750 0x81, 0x01, 0x5c, 0xfe,
11751 0xbd, 0x10, 0x0a, 0x81, 0x01, 0x5c, 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c,
11752 0xfe, 0x58, 0x1c, 0x1c,
11753 0x07, 0x22, 0xb7, 0x37, 0x2a, 0x35, 0xfe, 0x3d, 0xf0, 0xfe, 0x0c, 0x02,
11754 0x2b, 0xfe, 0x9e, 0x02,
11755 0xfe, 0x5a, 0x1c, 0xfe, 0x12, 0x1c, 0xfe, 0x14, 0x1c, 0x1f, 0xfe, 0x30,
11756 0x00, 0x47, 0xb8, 0x01,
11757 0xfe, 0xd4, 0x11, 0x1c, 0x07, 0x22, 0xb7, 0x05, 0xe9, 0x21, 0x2c, 0x09,
11758 0x1a, 0x31, 0xfe, 0x69,
11759 0x10, 0x1c, 0x07, 0x22, 0xb7, 0xfe, 0x04, 0xec, 0x2c, 0x60, 0x01, 0xfe,
11760 0x1e, 0x1e, 0x20, 0x2c,
11761 0xfe, 0x05, 0xf6, 0xde, 0x01, 0xfe, 0x62, 0x1b, 0x01, 0x0c, 0x61, 0x4a,
11762 0x44, 0x15, 0x56, 0x51,
11763 0x01, 0xfe, 0x9e, 0x1e, 0x01, 0xfe, 0x96, 0x1a, 0x05, 0x35, 0x0a, 0x57,
11764 0x01, 0x18, 0x09, 0x00,
11765 0x36, 0x01, 0x85, 0xfe, 0x18, 0x10, 0xfe, 0x41, 0x58, 0x0a, 0xba, 0x01,
11766 0x18, 0xfe, 0xc8, 0x54,
11767 0x7b, 0xfe, 0x1c, 0x03, 0x01, 0xfe, 0x96, 0x1a, 0x05, 0x35, 0x37, 0x60,
11768 0xfe, 0x02, 0xe8, 0x30,
11769 0xfe, 0xbf, 0x57, 0xfe, 0x9e, 0x43, 0xfe, 0x77, 0x57, 0xfe, 0x27, 0xf0,
11770 0xfe, 0xe4, 0x01, 0xfe,
11771 0x07, 0x4b, 0xfe, 0x20, 0xf0, 0xbc, 0xfe, 0x40, 0x1c, 0x2a, 0xeb, 0xfe,
11772 0x26, 0xf0, 0xfe, 0x66,
11773 0x03, 0xfe, 0xa0, 0xf0, 0xfe, 0x54, 0x03, 0xfe, 0x11, 0xf0, 0xbc, 0xfe,
11774 0xef, 0x10, 0xfe, 0x9f,
11775 0xf0, 0xfe, 0x74, 0x03, 0xfe, 0x46, 0x1c, 0x19, 0xfe, 0x11, 0x00, 0x05,
11776 0x70, 0x37, 0xfe, 0x48,
11777 0x1c, 0xfe, 0x46, 0x1c, 0x01, 0x0c, 0x06, 0x28, 0xfe, 0x18, 0x13, 0x26,
11778 0x21, 0xb9, 0xc7, 0x20,
11779 0xb9, 0x0a, 0x57, 0x01, 0x18, 0xc7, 0x89, 0x01, 0xfe, 0xc8, 0x1a, 0x15,
11780 0xe1, 0x2a, 0xeb, 0xfe,
11781 0x01, 0xf0, 0xeb, 0xfe, 0x82, 0xf0, 0xfe, 0xa4, 0x03, 0xfe, 0x9c, 0x32,
11782 0x15, 0xfe, 0xe4, 0x00,
11783 0x2f, 0xfe, 0xb6, 0x03, 0x2a, 0x3c, 0x16, 0xfe, 0xc6, 0x03, 0x01, 0x41,
11784 0xfe, 0x06, 0xf0, 0xfe,
11785 0xd6, 0x03, 0xaf, 0xa0, 0xfe, 0x0a, 0xf0, 0xfe, 0xa2, 0x07, 0x05, 0x29,
11786 0x03, 0x81, 0x1e, 0x1b,
11787 0xfe, 0x24, 0x05, 0x1f, 0x63, 0x01, 0x42, 0x8f, 0xfe, 0x70, 0x02, 0x05,
11788 0xea, 0xfe, 0x46, 0x1c,
11789 0x37, 0x7d, 0x1d, 0xfe, 0x67, 0x1b, 0xfe, 0xbf, 0x57, 0xfe, 0x77, 0x57,
11790 0xfe, 0x48, 0x1c, 0x75,
11791 0x01, 0xa6, 0x86, 0x0a, 0x57, 0x01, 0x18, 0x09, 0x00, 0x1b, 0xec, 0x0a,
11792 0xe1, 0x01, 0x18, 0x77,
11793 0x50, 0x40, 0x8d, 0x30, 0x03, 0x81, 0x1e, 0xf8, 0x1f, 0x63, 0x01, 0x42,
11794 0x8f, 0xfe, 0x70, 0x02,
11795 0x05, 0xea, 0xd7, 0x99, 0xd8, 0x9c, 0x2a, 0x29, 0x2f, 0xfe, 0x4e, 0x04,
11796 0x16, 0xfe, 0x4a, 0x04,
11797 0x7e, 0xfe, 0xa0, 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x54, 0x12, 0x32, 0xff,
11798 0x02, 0x00, 0x10, 0x01,
11799 0x08, 0x16, 0xfe, 0x02, 0x05, 0x32, 0x01, 0x08, 0x16, 0x29, 0x27, 0x25,
11800 0xee, 0xfe, 0x4c, 0x44,
11801 0xfe, 0x58, 0x12, 0x50, 0xfe, 0x44, 0x48, 0x13, 0x34, 0xfe, 0x4c, 0x54,
11802 0x7b, 0xec, 0x60, 0x8d,
11803 0x30, 0x01, 0xfe, 0x4e, 0x1e, 0xfe, 0x48, 0x47, 0xfe, 0x7c, 0x13, 0x01,
11804 0x0c, 0x06, 0x28, 0xfe,
11805 0x32, 0x13, 0x01, 0x43, 0x09, 0x9b, 0xfe, 0x68, 0x13, 0xfe, 0x26, 0x10,
11806 0x13, 0x34, 0xfe, 0x4c,
11807 0x54, 0x7b, 0xec, 0x01, 0xfe, 0x4e, 0x1e, 0xfe, 0x48, 0x47, 0xfe, 0x54,
11808 0x13, 0x01, 0x0c, 0x06,
11809 0x28, 0xa5, 0x01, 0x43, 0x09, 0x9b, 0xfe, 0x40, 0x13, 0x01, 0x0c, 0x06,
11810 0x28, 0xf9, 0x1f, 0x7f,
11811 0x01, 0x0c, 0x06, 0x07, 0x4d, 0x1f, 0xfe, 0x0d, 0x00, 0x01, 0x42, 0x8f,
11812 0xfe, 0xa4, 0x0e, 0x05,
11813 0x29, 0x32, 0x15, 0xfe, 0xe6, 0x00, 0x0f, 0xfe, 0x1c, 0x90, 0x04, 0xfe,
11814 0x9c, 0x93, 0x3a, 0x0b,
11815 0x0e, 0x8b, 0x02, 0x1f, 0x7f, 0x01, 0x42, 0x05, 0x35, 0xfe, 0x42, 0x5b,
11816 0x7d, 0x1d, 0xfe, 0x46,
11817 0x59, 0xfe, 0xbf, 0x57, 0xfe, 0x77, 0x57, 0x0f, 0xfe, 0x87, 0x80, 0x04,
11818 0xfe, 0x87, 0x83, 0xfe,
11819 0xc9, 0x47, 0x0b, 0x0e, 0xd0, 0x65, 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x98,
11820 0x13, 0x0f, 0xfe, 0x20,
11821 0x80, 0x04, 0xfe, 0xa0, 0x83, 0x33, 0x0b, 0x0e, 0x09, 0x1d, 0xfe, 0x84,
11822 0x12, 0x01, 0x38, 0x06,
11823 0x07, 0xfe, 0x70, 0x13, 0x03, 0xfe, 0xa2, 0x00, 0x1e, 0x1b, 0xfe, 0xda,
11824 0x05, 0xd0, 0x54, 0x01,
11825 0x38, 0x06, 0x0d, 0xfe, 0x58, 0x13, 0x03, 0xfe, 0xa0, 0x00, 0x1e, 0xfe,
11826 0x50, 0x12, 0x5e, 0xff,
11827 0x02, 0x00, 0x10, 0x2f, 0xfe, 0x90, 0x05, 0x2a, 0x3c, 0xcc, 0xff, 0x02,
11828 0x00, 0x10, 0x2f, 0xfe,
11829 0x9e, 0x05, 0x17, 0xfe, 0xf4, 0x05, 0x15, 0xfe, 0xe3, 0x00, 0x26, 0x01,
11830 0x38, 0xfe, 0x4a, 0xf0,
11831 0xfe, 0xc0, 0x05, 0xfe, 0x49, 0xf0, 0xfe, 0xba, 0x05, 0x71, 0x2e, 0xfe,
11832 0x21, 0x00, 0xf1, 0x2e,
11833 0xfe, 0x22, 0x00, 0xa2, 0x2e, 0x4a, 0xfe, 0x09, 0x48, 0xff, 0x02, 0x00,
11834 0x10, 0x2f, 0xfe, 0xd0,
11835 0x05, 0x17, 0xfe, 0xf4, 0x05, 0xfe, 0xe2, 0x08, 0x01, 0x38, 0x06, 0xfe,
11836 0x1c, 0x00, 0x4d, 0x01,
11837 0xa7, 0x2e, 0x07, 0x20, 0xe4, 0x47, 0xfe, 0x27, 0x01, 0x01, 0x0c, 0x06,
11838 0x28, 0xfe, 0x24, 0x12,
11839 0x3e, 0x01, 0x84, 0x1f, 0x7f, 0x01, 0x0c, 0x06, 0x07, 0x4d, 0x1f, 0xfe,
11840 0x0d, 0x00, 0x01, 0x42,
11841 0x8f, 0xfe, 0xa4, 0x0e, 0x05, 0x29, 0x03, 0xe6, 0x1e, 0xfe, 0xca, 0x13,
11842 0x03, 0xb6, 0x1e, 0xfe,
11843 0x40, 0x12, 0x03, 0x66, 0x1e, 0xfe, 0x38, 0x13, 0x3e, 0x01, 0x84, 0x17,
11844 0xfe, 0x72, 0x06, 0x0a,
11845 0x07, 0x01, 0x38, 0x06, 0x24, 0xfe, 0x02, 0x12, 0x4f, 0x01, 0xfe, 0x56,
11846 0x19, 0x16, 0xfe, 0x68,
11847 0x06, 0x15, 0x82, 0x01, 0x41, 0x15, 0xe2, 0x03, 0x66, 0x8a, 0x10, 0x66,
11848 0x03, 0x9a, 0x1e, 0xfe,
11849 0x70, 0x12, 0x03, 0x55, 0x1e, 0xfe, 0x68, 0x13, 0x01, 0xc6, 0x09, 0x12,
11850 0x48, 0xfe, 0x92, 0x06,
11851 0x2e, 0x12, 0x01, 0xfe, 0xac, 0x1d, 0xfe, 0x43, 0x48, 0x62, 0x80, 0x13,
11852 0x58, 0xff, 0x02, 0x00,
11853 0x57, 0x52, 0xad, 0x23, 0x3f, 0x4e, 0x62, 0x49, 0x3e, 0x01, 0x84, 0x17,
11854 0xfe, 0xea, 0x06, 0x01,
11855 0x38, 0x06, 0x12, 0xf7, 0x45, 0x0a, 0x95, 0x01, 0xfe, 0x84, 0x19, 0x16,
11856 0xfe, 0xe0, 0x06, 0x15,
11857 0x82, 0x01, 0x41, 0x15, 0xe2, 0x03, 0x55, 0x8a, 0x10, 0x55, 0x1c, 0x07,
11858 0x01, 0x84, 0xfe, 0xae,
11859 0x10, 0x03, 0x6f, 0x1e, 0xfe, 0x9e, 0x13, 0x3e, 0x01, 0x84, 0x03, 0x9a,
11860 0x1e, 0xfe, 0x1a, 0x12,
11861 0x01, 0x38, 0x06, 0x12, 0xfc, 0x01, 0xc6, 0x01, 0xfe, 0xac, 0x1d, 0xfe,
11862 0x43, 0x48, 0x62, 0x80,
11863 0xf0, 0x45, 0x0a, 0x95, 0x03, 0xb6, 0x1e, 0xf8, 0x01, 0x38, 0x06, 0x24,
11864 0x36, 0xfe, 0x02, 0xf6,
11865 0x07, 0x71, 0x78, 0x8c, 0x00, 0x4d, 0x62, 0x49, 0x3e, 0x2d, 0x93, 0x4e,
11866 0xd0, 0x0d, 0x17, 0xfe,
11867 0x9a, 0x07, 0x01, 0xfe, 0xc0, 0x19, 0x16, 0xfe, 0x90, 0x07, 0x26, 0x20,
11868 0x9e, 0x15, 0x82, 0x01,
11869 0x41, 0x15, 0xe2, 0x21, 0x9e, 0x09, 0x07, 0xfb, 0x03, 0xe6, 0xfe, 0x58,
11870 0x57, 0x10, 0xe6, 0x05,
11871 0xfe, 0x2a, 0x06, 0x03, 0x6f, 0x8a, 0x10, 0x6f, 0x1c, 0x07, 0x01, 0x84,
11872 0xfe, 0x9c, 0x32, 0x5f,
11873 0x75, 0x01, 0xa6, 0x86, 0x15, 0xfe, 0xe2, 0x00, 0x2f, 0xed, 0x2a, 0x3c,
11874 0xfe, 0x0a, 0xf0, 0xfe,
11875 0xce, 0x07, 0xae, 0xfe, 0x96, 0x08, 0xfe, 0x06, 0xf0, 0xfe, 0x9e, 0x08,
11876 0xaf, 0xa0, 0x05, 0x29,
11877 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x2e, 0x12, 0x14, 0x1d, 0x01, 0x08, 0x14,
11878 0x00, 0x01, 0x08, 0x14,
11879 0x00, 0x01, 0x08, 0x14, 0x00, 0x01, 0x08, 0xfe, 0x99, 0xa4, 0x01, 0x08,
11880 0x14, 0x00, 0x05, 0xfe,
11881 0xc6, 0x09, 0x01, 0x76, 0x06, 0x12, 0xfe, 0x3a, 0x12, 0x01, 0x0c, 0x06,
11882 0x12, 0xfe, 0x30, 0x13,
11883 0x14, 0xfe, 0x1b, 0x00, 0x01, 0x08, 0x14, 0x00, 0x01, 0x08, 0x14, 0x00,
11884 0x01, 0x08, 0x14, 0x00,
11885 0x01, 0x08, 0x14, 0x07, 0x01, 0x08, 0x14, 0x00, 0x05, 0xef, 0x7c, 0x4a,
11886 0x78, 0x4f, 0x0f, 0xfe,
11887 0x9a, 0x81, 0x04, 0xfe, 0x9a, 0x83, 0xfe, 0xcb, 0x47, 0x0b, 0x0e, 0x2d,
11888 0x28, 0x48, 0xfe, 0x6c,
11889 0x08, 0x0a, 0x28, 0xfe, 0x09, 0x6f, 0xca, 0xfe, 0xca, 0x45, 0xfe, 0x32,
11890 0x12, 0x53, 0x63, 0x4e,
11891 0x7c, 0x97, 0x2f, 0xfe, 0x7e, 0x08, 0x2a, 0x3c, 0xfe, 0x0a, 0xf0, 0xfe,
11892 0x6c, 0x08, 0xaf, 0xa0,
11893 0xae, 0xfe, 0x96, 0x08, 0x05, 0x29, 0x01, 0x41, 0x05, 0xed, 0x14, 0x24,
11894 0x05, 0xed, 0xfe, 0x9c,
11895 0xf7, 0x9f, 0x01, 0xfe, 0xae, 0x1e, 0xfe, 0x18, 0x58, 0x01, 0xfe, 0xbe,
11896 0x1e, 0xfe, 0x99, 0x58,
11897 0xfe, 0x78, 0x18, 0xfe, 0xf9, 0x18, 0x8e, 0xfe, 0x16, 0x09, 0x10, 0x6a,
11898 0x22, 0x6b, 0x01, 0x0c,
11899 0x61, 0x54, 0x44, 0x21, 0x2c, 0x09, 0x1a, 0xf8, 0x77, 0x01, 0xfe, 0x7e,
11900 0x1e, 0x47, 0x2c, 0x7a,
11901 0x30, 0xf0, 0xfe, 0x83, 0xe7, 0xfe, 0x3f, 0x00, 0x71, 0xfe, 0x03, 0x40,
11902 0x01, 0x0c, 0x61, 0x65,
11903 0x44, 0x01, 0xc2, 0xc8, 0xfe, 0x1f, 0x40, 0x20, 0x6e, 0x01, 0xfe, 0x6a,
11904 0x16, 0xfe, 0x08, 0x50,
11905 0xfe, 0x8a, 0x50, 0xfe, 0x44, 0x51, 0xfe, 0xc6, 0x51, 0xfe, 0x10, 0x10,
11906 0x01, 0xfe, 0xce, 0x1e,
11907 0x01, 0xfe, 0xde, 0x1e, 0x10, 0x68, 0x22, 0x69, 0x01, 0xfe, 0xee, 0x1e,
11908 0x01, 0xfe, 0xfe, 0x1e,
11909 0xfe, 0x40, 0x50, 0xfe, 0xc2, 0x50, 0x10, 0x4b, 0x22, 0x4c, 0xfe, 0x8a,
11910 0x10, 0x01, 0x0c, 0x06,
11911 0x54, 0xfe, 0x50, 0x12, 0x01, 0xfe, 0xae, 0x1e, 0x01, 0xfe, 0xbe, 0x1e,
11912 0x10, 0x6a, 0x22, 0x6b,
11913 0x01, 0x0c, 0x06, 0x65, 0x4e, 0x01, 0xc2, 0x0f, 0xfe, 0x1f, 0x80, 0x04,
11914 0xfe, 0x9f, 0x83, 0x33,
11915 0x0b, 0x0e, 0x20, 0x6e, 0x0f, 0xfe, 0x44, 0x90, 0x04, 0xfe, 0xc4, 0x93,
11916 0x3a, 0x0b, 0xfe, 0xc6,
11917 0x90, 0x04, 0xfe, 0xc6, 0x93, 0x79, 0x0b, 0x0e, 0x10, 0x6c, 0x22, 0x6d,
11918 0x01, 0xfe, 0xce, 0x1e,
11919 0x01, 0xfe, 0xde, 0x1e, 0x10, 0x68, 0x22, 0x69, 0x0f, 0xfe, 0x40, 0x90,
11920 0x04, 0xfe, 0xc0, 0x93,
11921 0x3a, 0x0b, 0xfe, 0xc2, 0x90, 0x04, 0xfe, 0xc2, 0x93, 0x79, 0x0b, 0x0e,
11922 0x10, 0x4b, 0x22, 0x4c,
11923 0x10, 0x64, 0x22, 0x34, 0x01, 0x0c, 0x61, 0x24, 0x44, 0x37, 0x13, 0xfe,
11924 0x4e, 0x11, 0x2f, 0xfe,
11925 0xde, 0x09, 0xfe, 0x9e, 0xf0, 0xfe, 0xf2, 0x09, 0xfe, 0x01, 0x48, 0x1b,
11926 0x3c, 0x37, 0x88, 0xf5,
11927 0xd4, 0xfe, 0x1e, 0x0a, 0xd5, 0xfe, 0x42, 0x0a, 0xd2, 0xfe, 0x1e, 0x0a,
11928 0xd3, 0xfe, 0x42, 0x0a,
11929 0xae, 0xfe, 0x12, 0x0a, 0xfe, 0x06, 0xf0, 0xfe, 0x18, 0x0a, 0xaf, 0xa0,
11930 0x05, 0x29, 0x01, 0x41,
11931 0xfe, 0xc1, 0x10, 0x14, 0x24, 0xfe, 0xc1, 0x10, 0x01, 0x76, 0x06, 0x07,
11932 0xfe, 0x14, 0x12, 0x01,
11933 0x76, 0x06, 0x0d, 0x5d, 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x74, 0x12, 0xfe,
11934 0x2e, 0x1c, 0x05, 0xfe,
11935 0x1a, 0x0c, 0x01, 0x76, 0x06, 0x07, 0x5d, 0x01, 0x76, 0x06, 0x0d, 0x41,
11936 0xfe, 0x2c, 0x1c, 0xfe,
11937 0xaa, 0xf0, 0xfe, 0xce, 0x0a, 0xfe, 0xac, 0xf0, 0xfe, 0x66, 0x0a, 0xfe,
11938 0x92, 0x10, 0xc4, 0xf6,
11939 0xfe, 0xad, 0xf0, 0xfe, 0x72, 0x0a, 0x05, 0xfe, 0x1a, 0x0c, 0xc5, 0xfe,
11940 0xe7, 0x10, 0xfe, 0x2b,
11941 0xf0, 0xbf, 0xfe, 0x6b, 0x18, 0x23, 0xfe, 0x00, 0xfe, 0xfe, 0x1c, 0x12,
11942 0xac, 0xfe, 0xd2, 0xf0,
11943 0xbf, 0xfe, 0x76, 0x18, 0x23, 0x1d, 0x1b, 0xbf, 0x03, 0xe3, 0x23, 0x07,
11944 0x1b, 0xbf, 0xd4, 0x5b,
11945 0xd5, 0x5b, 0xd2, 0x5b, 0xd3, 0x5b, 0xc4, 0xc5, 0xfe, 0xa9, 0x10, 0x75,
11946 0x5e, 0x32, 0x1f, 0x7f,
11947 0x01, 0x42, 0x19, 0xfe, 0x35, 0x00, 0xfe, 0x01, 0xf0, 0x70, 0x19, 0x98,
11948 0x05, 0x70, 0xfe, 0x74,
11949 0x18, 0x23, 0xfe, 0x00, 0xf8, 0x1b, 0x5b, 0x7d, 0x12, 0x01, 0xfe, 0x78,
11950 0x0f, 0x4d, 0x01, 0xfe,
11951 0x96, 0x1a, 0x21, 0x30, 0x77, 0x7d, 0x1d, 0x05, 0x5b, 0x01, 0x0c, 0x06,
11952 0x0d, 0x2b, 0xfe, 0xe2,
11953 0x0b, 0x01, 0x0c, 0x06, 0x54, 0xfe, 0xa6, 0x12, 0x01, 0x0c, 0x06, 0x24,
11954 0xfe, 0x88, 0x13, 0x21,
11955 0x6e, 0xc7, 0x01, 0xfe, 0x1e, 0x1f, 0x0f, 0xfe, 0x83, 0x80, 0x04, 0xfe,
11956 0x83, 0x83, 0xfe, 0xc9,
11957 0x47, 0x0b, 0x0e, 0xfe, 0xc8, 0x44, 0xfe, 0x42, 0x13, 0x0f, 0xfe, 0x04,
11958 0x91, 0x04, 0xfe, 0x84,
11959 0x93, 0xfe, 0xca, 0x57, 0x0b, 0xfe, 0x86, 0x91, 0x04, 0xfe, 0x86, 0x93,
11960 0xfe, 0xcb, 0x57, 0x0b,
11961 0x0e, 0x7a, 0x30, 0xfe, 0x40, 0x59, 0xfe, 0xc1, 0x59, 0x8e, 0x40, 0x03,
11962 0x6a, 0x3b, 0x6b, 0x10,
11963 0x97, 0x22, 0x98, 0xd9, 0x6a, 0xda, 0x6b, 0x01, 0xc2, 0xc8, 0x7a, 0x30,
11964 0x20, 0x6e, 0xdb, 0x64,
11965 0xdc, 0x34, 0x91, 0x6c, 0x7e, 0x6d, 0xfe, 0x44, 0x55, 0xfe, 0xe5, 0x55,
11966 0xfe, 0x04, 0xfa, 0x64,
11967 0xfe, 0x05, 0xfa, 0x34, 0x01, 0xfe, 0x6a, 0x16, 0xa3, 0x26, 0x10, 0x97,
11968 0x10, 0x98, 0x91, 0x6c,
11969 0x7e, 0x6d, 0xfe, 0x14, 0x10, 0x01, 0x0c, 0x06, 0x24, 0x1b, 0x40, 0x91,
11970 0x4b, 0x7e, 0x4c, 0x01,
11971 0x0c, 0x06, 0xfe, 0xf7, 0x00, 0x44, 0x03, 0x68, 0x3b, 0x69, 0xfe, 0x10,
11972 0x58, 0xfe, 0x91, 0x58,
11973 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0x05, 0x5b, 0x01, 0x0c, 0x06, 0x24,
11974 0x1b, 0x40, 0x01, 0x0c,
11975 0x06, 0xfe, 0xf7, 0x00, 0x44, 0x78, 0x01, 0xfe, 0x8e, 0x1e, 0x4f, 0x0f,
11976 0xfe, 0x10, 0x90, 0x04,
11977 0xfe, 0x90, 0x93, 0x3a, 0x0b, 0xfe, 0x92, 0x90, 0x04, 0xfe, 0x92, 0x93,
11978 0x79, 0x0b, 0x0e, 0xfe,
11979 0xbd, 0x10, 0x01, 0x43, 0x09, 0xbb, 0x1b, 0xfe, 0x6e, 0x0a, 0x15, 0xbb,
11980 0x01, 0x0c, 0x06, 0x0d,
11981 0xfe, 0x14, 0x13, 0x03, 0x4b, 0x3b, 0x4c, 0x8e, 0xfe, 0x6e, 0x0a, 0xfe,
11982 0x0c, 0x58, 0xfe, 0x8d,
11983 0x58, 0x05, 0x5b, 0x26, 0x3e, 0x0f, 0xfe, 0x19, 0x80, 0x04, 0xfe, 0x99,
11984 0x83, 0x33, 0x0b, 0x0e,
11985 0xfe, 0xe5, 0x10, 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x1a, 0x12, 0xfe, 0x6c,
11986 0x19, 0xfe, 0x19, 0x41,
11987 0xfe, 0x6b, 0x18, 0xac, 0xfe, 0xd1, 0xf0, 0xef, 0x1f, 0x92, 0x01, 0x42,
11988 0x19, 0xfe, 0x44, 0x00,
11989 0xfe, 0x90, 0x10, 0xfe, 0x6c, 0x19, 0xd9, 0x4b, 0xfe, 0xed, 0x19, 0xda,
11990 0x4c, 0xfe, 0x0c, 0x51,
11991 0xfe, 0x8e, 0x51, 0xfe, 0x6b, 0x18, 0x23, 0xfe, 0x00, 0xff, 0x31, 0xfe,
11992 0x76, 0x10, 0xac, 0xfe,
11993 0xd2, 0xf0, 0xfe, 0xba, 0x0c, 0xfe, 0x76, 0x18, 0x23, 0x1d, 0x5d, 0x03,
11994 0xe3, 0x23, 0x07, 0xfe,
11995 0x08, 0x13, 0x19, 0xfe, 0x16, 0x00, 0x05, 0x70, 0xfe, 0xd1, 0xf0, 0xfe,
11996 0xcc, 0x0c, 0x1f, 0x92,
11997 0x01, 0x42, 0x19, 0xfe, 0x17, 0x00, 0x5c, 0xfe, 0xce, 0xf0, 0xfe, 0xd2,
11998 0x0c, 0xfe, 0x3e, 0x10,
11999 0xfe, 0xcd, 0xf0, 0xfe, 0xde, 0x0c, 0x19, 0xfe, 0x22, 0x00, 0x05, 0x70,
12000 0xfe, 0xcb, 0xf0, 0xfe,
12001 0xea, 0x0c, 0x19, 0xfe, 0x24, 0x00, 0x05, 0x70, 0xfe, 0xd0, 0xf0, 0xfe,
12002 0xf4, 0x0c, 0x19, 0x94,
12003 0xfe, 0x1c, 0x10, 0xfe, 0xcf, 0xf0, 0xfe, 0xfe, 0x0c, 0x19, 0x4a, 0xf3,
12004 0xfe, 0xcc, 0xf0, 0xef,
12005 0x01, 0x76, 0x06, 0x24, 0x4d, 0x19, 0xfe, 0x12, 0x00, 0x37, 0x13, 0xfe,
12006 0x4e, 0x11, 0x2f, 0xfe,
12007 0x16, 0x0d, 0xfe, 0x9e, 0xf0, 0xfe, 0x2a, 0x0d, 0xfe, 0x01, 0x48, 0x1b,
12008 0x3c, 0x37, 0x88, 0xf5,
12009 0xd4, 0x29, 0xd5, 0x29, 0xd2, 0x29, 0xd3, 0x29, 0x37, 0xfe, 0x9c, 0x32,
12010 0x2f, 0xfe, 0x3e, 0x0d,
12011 0x2a, 0x3c, 0xae, 0xfe, 0x62, 0x0d, 0xaf, 0xa0, 0xd4, 0x9f, 0xd5, 0x9f,
12012 0xd2, 0x9f, 0xd3, 0x9f,
12013 0x05, 0x29, 0x01, 0x41, 0xfe, 0xd3, 0x10, 0x15, 0xfe, 0xe8, 0x00, 0xc4,
12014 0xc5, 0x75, 0xd7, 0x99,
12015 0xd8, 0x9c, 0xfe, 0x89, 0xf0, 0x29, 0x27, 0x25, 0xbe, 0xd7, 0x99, 0xd8,
12016 0x9c, 0x2f, 0xfe, 0x8c,
12017 0x0d, 0x16, 0x29, 0x27, 0x25, 0xbd, 0xfe, 0x01, 0x48, 0xa4, 0x19, 0xfe,
12018 0x42, 0x00, 0x05, 0x70,
12019 0x90, 0x07, 0xfe, 0x81, 0x49, 0x1b, 0xfe, 0x64, 0x0e, 0x01, 0x0c, 0x06,
12020 0x0d, 0xfe, 0x44, 0x13,
12021 0x19, 0x00, 0x2d, 0x0d, 0xfe, 0x54, 0x12, 0x2d, 0xfe, 0x28, 0x00, 0x2b,
12022 0xfe, 0xda, 0x0e, 0x0a,
12023 0x57, 0x01, 0x18, 0x09, 0x00, 0x36, 0x46, 0xfe, 0x28, 0x00, 0xfe, 0xfa,
12024 0x10, 0x01, 0xfe, 0xf4,
12025 0x1c, 0x01, 0xfe, 0x00, 0x1d, 0x0a, 0xba, 0x01, 0xfe, 0x58, 0x10, 0x40,
12026 0x15, 0x56, 0x01, 0x85,
12027 0x05, 0x35, 0x19, 0xfe, 0x44, 0x00, 0x2d, 0x0d, 0xf7, 0x46, 0x0d, 0xfe,
12028 0xcc, 0x10, 0x01, 0xa7,
12029 0x46, 0x0d, 0xfe, 0xc2, 0x10, 0x01, 0xa7, 0x0f, 0xfe, 0x19, 0x82, 0x04,
12030 0xfe, 0x99, 0x83, 0xfe,
12031 0xcc, 0x47, 0x0b, 0x0e, 0xfe, 0x34, 0x46, 0xa5, 0x46, 0x0d, 0x19, 0xfe,
12032 0x43, 0x00, 0xfe, 0xa2,
12033 0x10, 0x01, 0x0c, 0x61, 0x0d, 0x44, 0x01, 0xfe, 0xf4, 0x1c, 0x01, 0xfe,
12034 0x00, 0x1d, 0x40, 0x15,
12035 0x56, 0x01, 0x85, 0x7d, 0x0d, 0x40, 0x51, 0x01, 0xfe, 0x9e, 0x1e, 0x05,
12036 0xfe, 0x3a, 0x03, 0x01,
12037 0x0c, 0x06, 0x0d, 0x5d, 0x46, 0x0d, 0x19, 0x00, 0xfe, 0x62, 0x10, 0x01,
12038 0x76, 0x06, 0x12, 0xfe,
12039 0x5c, 0x12, 0x01, 0x0c, 0x06, 0x12, 0xfe, 0x52, 0x13, 0xfe, 0x1c, 0x1c,
12040 0xfe, 0x9d, 0xf0, 0xfe,
12041 0x8e, 0x0e, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x94, 0x0e, 0x01,
12042 0x0c, 0x61, 0x12, 0x44,
12043 0xfe, 0x9f, 0x10, 0x19, 0xfe, 0x15, 0x00, 0xfe, 0x04, 0xe6, 0x0d, 0x4f,
12044 0xfe, 0x2e, 0x10, 0x19,
12045 0xfe, 0x13, 0x00, 0xfe, 0x10, 0x10, 0x19, 0xfe, 0x47, 0x00, 0xf1, 0x19,
12046 0xfe, 0x41, 0x00, 0xa2,
12047 0x19, 0xfe, 0x24, 0x00, 0x86, 0xc4, 0xc5, 0x75, 0x03, 0x81, 0x1e, 0x2b,
12048 0xea, 0x4f, 0xfe, 0x04,
12049 0xe6, 0x12, 0xfe, 0x9d, 0x41, 0xfe, 0x1c, 0x42, 0x40, 0x01, 0xf4, 0x05,
12050 0x35, 0xfe, 0x12, 0x1c,
12051 0x1f, 0x0d, 0x47, 0xb5, 0xc3, 0x1f, 0xfe, 0x31, 0x00, 0x47, 0xb8, 0x01,
12052 0xfe, 0xd4, 0x11, 0x05,
12053 0xe9, 0x51, 0xfe, 0x06, 0xec, 0xe0, 0xfe, 0x0e, 0x47, 0x46, 0x28, 0xfe,
12054 0xce, 0x45, 0x31, 0x51,
12055 0xfe, 0x06, 0xea, 0xe0, 0xfe, 0x47, 0x4b, 0x45, 0xfe, 0x75, 0x57, 0x03,
12056 0x67, 0xfe, 0x98, 0x56,
12057 0xfe, 0x38, 0x12, 0x0a, 0x5a, 0x01, 0x18, 0xfe, 0x44, 0x48, 0x60, 0x01,
12058 0x0c, 0x06, 0x28, 0xfe,
12059 0x18, 0x13, 0x0a, 0x57, 0x01, 0x18, 0x3e, 0xfe, 0x41, 0x58, 0x0a, 0xba,
12060 0xfe, 0xfa, 0x14, 0xfe,
12061 0x49, 0x54, 0xb0, 0xfe, 0x5e, 0x0f, 0x05, 0xfe, 0x3a, 0x03, 0x0a, 0x67,
12062 0xfe, 0xe0, 0x14, 0xfe,
12063 0x0e, 0x47, 0x46, 0x28, 0xfe, 0xce, 0x45, 0x31, 0x51, 0xfe, 0xce, 0x47,
12064 0xfe, 0xad, 0x13, 0x05,
12065 0x35, 0x21, 0x2c, 0x09, 0x1a, 0xfe, 0x98, 0x12, 0x26, 0x20, 0x96, 0x20,
12066 0xe7, 0xfe, 0x08, 0x1c,
12067 0xfe, 0x7c, 0x19, 0xfe, 0xfd, 0x19, 0xfe, 0x0a, 0x1c, 0x03, 0xe5, 0xfe,
12068 0x48, 0x55, 0xa5, 0x3b,
12069 0xfe, 0x62, 0x01, 0xfe, 0xc9, 0x55, 0x31, 0xfe, 0x74, 0x10, 0x01, 0xfe,
12070 0xf0, 0x1a, 0x03, 0xfe,
12071 0x38, 0x01, 0x3b, 0xfe, 0x3a, 0x01, 0x8e, 0xfe, 0x1e, 0x10, 0xfe, 0x02,
12072 0xec, 0xe7, 0x53, 0x00,
12073 0x36, 0xfe, 0x04, 0xec, 0x2c, 0x60, 0xfe, 0x05, 0xf6, 0xfe, 0x34, 0x01,
12074 0x01, 0xfe, 0x62, 0x1b,
12075 0x01, 0xfe, 0xce, 0x1e, 0xb2, 0x11, 0xfe, 0x18, 0x13, 0xca, 0xfe, 0x02,
12076 0xea, 0xe7, 0x53, 0x92,
12077 0xfe, 0xc3, 0x13, 0x1f, 0x12, 0x47, 0xb5, 0xc3, 0xfe, 0x2a, 0x10, 0x03,
12078 0xfe, 0x38, 0x01, 0x23,
12079 0xfe, 0xf0, 0xff, 0x10, 0xe5, 0x03, 0xfe, 0x3a, 0x01, 0x10, 0xfe, 0x62,
12080 0x01, 0x01, 0xfe, 0x1e,
12081 0x1e, 0x20, 0x2c, 0x15, 0x56, 0x01, 0xfe, 0x9e, 0x1e, 0x13, 0x07, 0x02,
12082 0x26, 0x02, 0x21, 0x96,
12083 0xc7, 0x20, 0x96, 0x09, 0x92, 0xfe, 0x79, 0x13, 0x1f, 0x1d, 0x47, 0xb5,
12084 0xc3, 0xfe, 0xe1, 0x10,
12085 0xcf, 0xfe, 0x03, 0xdc, 0xfe, 0x73, 0x57, 0xfe, 0x80, 0x5d, 0x02, 0xcf,
12086 0xfe, 0x03, 0xdc, 0xfe,
12087 0x5b, 0x57, 0xfe, 0x80, 0x5d, 0x02, 0xfe, 0x03, 0x57, 0xcf, 0x26, 0xfe,
12088 0x00, 0xcc, 0x02, 0xfe,
12089 0x03, 0x57, 0xcf, 0x89, 0x02, 0x01, 0x0c, 0x06, 0x4a, 0xfe, 0x4e, 0x13,
12090 0x0f, 0xfe, 0x1c, 0x80,
12091 0x04, 0xfe, 0x9c, 0x83, 0x33, 0x0b, 0x0e, 0x09, 0x07, 0xfe, 0x3a, 0x13,
12092 0x0f, 0xfe, 0x1e, 0x80,
12093 0x04, 0xfe, 0x9e, 0x83, 0x33, 0x0b, 0x0e, 0xfe, 0x2a, 0x13, 0x0f, 0xfe,
12094 0x1d, 0x80, 0x04, 0xfe,
12095 0x9d, 0x83, 0xfe, 0xf9, 0x13, 0x0e, 0xfe, 0x1c, 0x13, 0x01, 0xfe, 0xee,
12096 0x1e, 0xac, 0xfe, 0x14,
12097 0x13, 0x01, 0xfe, 0xfe, 0x1e, 0xfe, 0x81, 0x58, 0xfa, 0x01, 0xfe, 0x0e,
12098 0x1f, 0xfe, 0x30, 0xf4,
12099 0x0d, 0xfe, 0x3c, 0x50, 0xa2, 0x01, 0xfe, 0x92, 0x1b, 0x01, 0x43, 0x09,
12100 0x56, 0xfb, 0x01, 0xfe,
12101 0xc8, 0x1a, 0x01, 0x0c, 0x06, 0x28, 0xa4, 0x01, 0xfe, 0xf4, 0x1c, 0x01,
12102 0xfe, 0x00, 0x1d, 0x15,
12103 0xfe, 0xe9, 0x00, 0x01, 0x0c, 0x06, 0x4a, 0xfe, 0x4e, 0x13, 0x01, 0xfe,
12104 0x22, 0x1b, 0xfe, 0x1e,
12105 0x1c, 0x0f, 0xfe, 0x14, 0x90, 0x04, 0xfe, 0x94, 0x93, 0x3a, 0x0b, 0xfe,
12106 0x96, 0x90, 0x04, 0xfe,
12107 0x96, 0x93, 0x79, 0x0b, 0x0e, 0x10, 0xfe, 0x64, 0x01, 0x22, 0xfe, 0x66,
12108 0x01, 0x01, 0x0c, 0x06,
12109 0x65, 0xf9, 0x0f, 0xfe, 0x03, 0x80, 0x04, 0xfe, 0x83, 0x83, 0x33, 0x0b,
12110 0x0e, 0x77, 0xfe, 0x01,
12111 0xec, 0x2c, 0xfe, 0x80, 0x40, 0x20, 0x2c, 0x7a, 0x30, 0x15, 0xdf, 0x40,
12112 0x21, 0x2c, 0xfe, 0x00,
12113 0x40, 0x8d, 0x2c, 0x02, 0xfe, 0x08, 0x1c, 0x03, 0xfe, 0xac, 0x00, 0xfe,
12114 0x06, 0x58, 0x03, 0xfe,
12115 0xae, 0x00, 0xfe, 0x07, 0x58, 0x03, 0xfe, 0xb0, 0x00, 0xfe, 0x08, 0x58,
12116 0x03, 0xfe, 0xb2, 0x00,
12117 0xfe, 0x09, 0x58, 0xfe, 0x0a, 0x1c, 0x2e, 0x49, 0x20, 0xe0, 0x26, 0x10,
12118 0x66, 0x10, 0x55, 0x10,
12119 0x6f, 0x13, 0x57, 0x52, 0x4f, 0x1c, 0x28, 0xfe, 0x90, 0x4d, 0xfe, 0x91,
12120 0x54, 0x2b, 0xfe, 0x88,
12121 0x11, 0x46, 0x1a, 0x13, 0x5a, 0x52, 0x1c, 0x4a, 0xfe, 0x90, 0x4d, 0xfe,
12122 0x91, 0x54, 0x2b, 0xfe,
12123 0x9e, 0x11, 0x2e, 0x1a, 0x20, 0x2c, 0x90, 0x34, 0x60, 0x21, 0x2c, 0xfe,
12124 0x00, 0x40, 0x8d, 0x2c,
12125 0x15, 0xdf, 0xfe, 0x14, 0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0xb2, 0x11, 0xfe,
12126 0x12, 0x1c, 0x75, 0xfe,
12127 0x14, 0x1c, 0xfe, 0x10, 0x1c, 0xfe, 0x18, 0x1c, 0x02, 0x51, 0xfe, 0x0c,
12128 0x14, 0xfe, 0x0e, 0x47,
12129 0xfe, 0x07, 0xe6, 0x28, 0xfe, 0xce, 0x47, 0xfe, 0xf5, 0x13, 0x02, 0x01,
12130 0xa7, 0x90, 0x34, 0x60,
12131 0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x42, 0x13, 0xfe, 0x02, 0x80,
12132 0x09, 0x56, 0xfe, 0x34,
12133 0x13, 0x0a, 0x5a, 0x01, 0x18, 0xcb, 0xfe, 0x36, 0x12, 0xfe, 0x41, 0x48,
12134 0xfe, 0x45, 0x48, 0x01,
12135 0xfe, 0xb2, 0x16, 0xfe, 0x00, 0xcc, 0xcb, 0xfe, 0xf3, 0x13, 0x3f, 0x89,
12136 0x09, 0x1a, 0xa5, 0x0a,
12137 0x9d, 0x01, 0x18, 0xfe, 0x80, 0x5c, 0x01, 0x85, 0xf2, 0x09, 0x9b, 0xa4,
12138 0xfe, 0x14, 0x56, 0xfe,
12139 0xd6, 0xf0, 0xfe, 0xec, 0x11, 0x02, 0xfe, 0x44, 0x58, 0x77, 0xfe, 0x01,
12140 0xec, 0xb8, 0xfe, 0x9e,
12141 0x40, 0xfe, 0x9d, 0xe7, 0x00, 0xfe, 0x9c, 0xe7, 0x12, 0x8d, 0x30, 0x01,
12142 0xf4, 0xfe, 0xdd, 0x10,
12143 0x37, 0xd7, 0x99, 0xd8, 0x9c, 0x27, 0x25, 0xee, 0x09, 0x12, 0xfe, 0x48,
12144 0x12, 0x09, 0x0d, 0xfe,
12145 0x56, 0x12, 0x09, 0x1d, 0xfe, 0x30, 0x12, 0x09, 0xdd, 0x1b, 0xfe, 0xc4,
12146 0x13, 0x09, 0xfe, 0x23,
12147 0x00, 0x1b, 0xfe, 0xd0, 0x13, 0x09, 0x07, 0x1b, 0xfe, 0x34, 0x14, 0x09,
12148 0x24, 0xfe, 0x12, 0x12,
12149 0x09, 0x00, 0x1b, 0x29, 0x1f, 0xdd, 0x01, 0x42, 0xa1, 0x32, 0x01, 0x08,
12150 0xae, 0x41, 0x02, 0x32,
12151 0xfe, 0x62, 0x08, 0x0a, 0xe1, 0x01, 0xfe, 0x58, 0x10, 0x15, 0x9b, 0x05,
12152 0x35, 0x32, 0x01, 0x43,
12153 0x09, 0xbb, 0xfe, 0xd7, 0x13, 0x91, 0x4b, 0x7e, 0x4c, 0x8e, 0xfe, 0x80,
12154 0x13, 0x01, 0x0c, 0x06,
12155 0x54, 0xfe, 0x72, 0x12, 0xdb, 0x64, 0xdc, 0x34, 0xfe, 0x44, 0x55, 0xfe,
12156 0xe5, 0x55, 0xb0, 0xfe,
12157 0x4a, 0x13, 0x21, 0x6e, 0xfe, 0x26, 0x13, 0x03, 0x97, 0x3b, 0x98, 0x8e,
12158 0xfe, 0xb6, 0x0e, 0x10,
12159 0x6a, 0x22, 0x6b, 0x26, 0x10, 0x97, 0x10, 0x98, 0x01, 0xc2, 0x2e, 0x49,
12160 0x88, 0x20, 0x6e, 0x01,
12161 0xfe, 0x6a, 0x16, 0xdb, 0x64, 0xdc, 0x34, 0xfe, 0x04, 0x55, 0xfe, 0xa5,
12162 0x55, 0xfe, 0x04, 0xfa,
12163 0x64, 0xfe, 0x05, 0xfa, 0x34, 0xfe, 0x8f, 0x10, 0x03, 0x6c, 0x3b, 0x6d,
12164 0xfe, 0x40, 0x56, 0xfe,
12165 0xe1, 0x56, 0x10, 0x6c, 0x22, 0x6d, 0x71, 0xdb, 0x64, 0xdc, 0x34, 0xfe,
12166 0x44, 0x55, 0xfe, 0xe5,
12167 0x55, 0x03, 0x68, 0x3b, 0x69, 0xfe, 0x00, 0x56, 0xfe, 0xa1, 0x56, 0x10,
12168 0x68, 0x22, 0x69, 0x01,
12169 0x0c, 0x06, 0x54, 0xf9, 0x21, 0x6e, 0xfe, 0x1f, 0x40, 0x03, 0x6a, 0x3b,
12170 0x6b, 0xfe, 0x2c, 0x50,
12171 0xfe, 0xae, 0x50, 0x03, 0x6c, 0x3b, 0x6d, 0xfe, 0x44, 0x50, 0xfe, 0xc6,
12172 0x50, 0x03, 0x68, 0x3b,
12173 0x69, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0x03, 0x4b, 0x3b, 0x4c, 0xfe,
12174 0x40, 0x50, 0xfe, 0xc2,
12175 0x50, 0x05, 0x73, 0x2e, 0x07, 0x20, 0x9e, 0x05, 0x72, 0x32, 0x01, 0x08,
12176 0x16, 0x3d, 0x27, 0x25,
12177 0xee, 0x09, 0x07, 0x2b, 0x3d, 0x01, 0x43, 0x09, 0xbb, 0x2b, 0x72, 0x01,
12178 0xa6, 0x23, 0x3f, 0x1b,
12179 0x3d, 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x1e, 0x13, 0x91, 0x4b, 0x7e, 0x4c,
12180 0xfe, 0x0a, 0x55, 0x31,
12181 0xfe, 0x8b, 0x55, 0xd9, 0x4b, 0xda, 0x4c, 0xfe, 0x0c, 0x51, 0xfe, 0x8e,
12182 0x51, 0x05, 0x72, 0x01,
12183 0xfe, 0x8e, 0x1e, 0xca, 0xfe, 0x19, 0x41, 0x05, 0x72, 0x32, 0x01, 0x08,
12184 0x2a, 0x3c, 0x16, 0xc0,
12185 0x27, 0x25, 0xbe, 0x2d, 0x1d, 0xc0, 0x2d, 0x0d, 0x83, 0x2d, 0x7f, 0x1b,
12186 0xfe, 0x66, 0x15, 0x05,
12187 0x3d, 0x01, 0x08, 0x2a, 0x3c, 0x16, 0xc0, 0x27, 0x25, 0xbd, 0x09, 0x1d,
12188 0x2b, 0x3d, 0x01, 0x08,
12189 0x16, 0xc0, 0x27, 0x25, 0xfe, 0xe8, 0x09, 0xfe, 0xc2, 0x49, 0x50, 0x03,
12190 0xb6, 0x1e, 0x83, 0x01,
12191 0x38, 0x06, 0x24, 0x31, 0xa1, 0xfe, 0xbb, 0x45, 0x2d, 0x00, 0xa4, 0x46,
12192 0x07, 0x90, 0x3f, 0x01,
12193 0xfe, 0xf8, 0x15, 0x01, 0xa6, 0x86, 0xfe, 0x4b, 0x45, 0xfe, 0x20, 0x13,
12194 0x01, 0x43, 0x09, 0x82,
12195 0xfe, 0x16, 0x13, 0x03, 0x9a, 0x1e, 0x5d, 0x03, 0x55, 0x1e, 0x31, 0x5e,
12196 0x05, 0x72, 0xfe, 0xc0,
12197 0x5d, 0x01, 0xa7, 0xfe, 0x03, 0x17, 0x03, 0x66, 0x8a, 0x10, 0x66, 0x5e,
12198 0x32, 0x01, 0x08, 0x17,
12199 0x73, 0x01, 0xfe, 0x56, 0x19, 0x05, 0x73, 0x01, 0x08, 0x2a, 0x3c, 0x16,
12200 0x3d, 0x27, 0x25, 0xbd,
12201 0x09, 0x07, 0x2b, 0x3d, 0x01, 0xfe, 0xbe, 0x16, 0xfe, 0x42, 0x58, 0xfe,
12202 0xe8, 0x14, 0x01, 0xa6,
12203 0x86, 0xfe, 0x4a, 0xf4, 0x0d, 0x1b, 0x3d, 0xfe, 0x4a, 0xf4, 0x07, 0xfe,
12204 0x0e, 0x12, 0x01, 0x43,
12205 0x09, 0x82, 0x4e, 0x05, 0x72, 0x03, 0x55, 0x8a, 0x10, 0x55, 0x5e, 0x32,
12206 0x01, 0x08, 0x17, 0x73,
12207 0x01, 0xfe, 0x84, 0x19, 0x05, 0x73, 0x01, 0x08, 0x2a, 0x3c, 0x16, 0x3d,
12208 0x27, 0x25, 0xbd, 0x09,
12209 0x12, 0x2b, 0x3d, 0x01, 0xfe, 0xe8, 0x17, 0x8b, 0xfe, 0xaa, 0x14, 0xfe,
12210 0xb6, 0x14, 0x86, 0xa8,
12211 0xb2, 0x0d, 0x1b, 0x3d, 0xb2, 0x07, 0xfe, 0x0e, 0x12, 0x01, 0x43, 0x09,
12212 0x82, 0x4e, 0x05, 0x72,
12213 0x03, 0x6f, 0x8a, 0x10, 0x6f, 0x5e, 0x32, 0x01, 0x08, 0x17, 0x73, 0x01,
12214 0xfe, 0xc0, 0x19, 0x05,
12215 0x73, 0x13, 0x07, 0x2f, 0xfe, 0xcc, 0x15, 0x17, 0xfe, 0xe2, 0x15, 0x5f,
12216 0xcc, 0x01, 0x08, 0x26,
12217 0x5f, 0x02, 0x8f, 0xfe, 0xde, 0x15, 0x2a, 0xfe, 0xde, 0x15, 0x16, 0xfe,
12218 0xcc, 0x15, 0x5e, 0x32,
12219 0x01, 0x08, 0xfe, 0xd5, 0x10, 0x13, 0x58, 0xff, 0x02, 0x00, 0x57, 0x52,
12220 0xad, 0x23, 0xfe, 0xff,
12221 0x7f, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x02, 0x13, 0x58, 0xff, 0x02,
12222 0x00, 0x57, 0x52, 0xad,
12223 0x23, 0x3f, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x02, 0x13, 0x58, 0xff,
12224 0x02, 0x00, 0x57, 0x52,
12225 0xad, 0x02, 0x13, 0x58, 0xff, 0x02, 0x00, 0x57, 0x52, 0xfe, 0x00, 0x5e,
12226 0x02, 0x13, 0x58, 0xff,
12227 0x02, 0x00, 0x57, 0x52, 0xad, 0xfe, 0x0b, 0x58, 0x02, 0x0a, 0x66, 0x01,
12228 0x5c, 0x0a, 0x55, 0x01,
12229 0x5c, 0x0a, 0x6f, 0x01, 0x5c, 0x02, 0x01, 0xfe, 0x1e, 0x1f, 0x23, 0x1a,
12230 0xff, 0x03, 0x00, 0x54,
12231 0xfe, 0x00, 0xf4, 0x24, 0x52, 0x0f, 0xfe, 0x00, 0x7c, 0x04, 0xfe, 0x07,
12232 0x7c, 0x3a, 0x0b, 0x0e,
12233 0xfe, 0x00, 0x71, 0xfe, 0xf9, 0x18, 0xfe, 0x7a, 0x19, 0xfe, 0xfb, 0x19,
12234 0xfe, 0x1a, 0xf7, 0x00,
12235 0xfe, 0x1b, 0xf7, 0x00, 0x7a, 0x30, 0x10, 0x68, 0x22, 0x69, 0xd9, 0x6c,
12236 0xda, 0x6d, 0x02, 0xfe,
12237 0x62, 0x08, 0xfe, 0x82, 0x4a, 0xfe, 0xe1, 0x1a, 0xfe, 0x83, 0x5a, 0x77,
12238 0x02, 0x01, 0xc6, 0xfe,
12239 0x42, 0x48, 0x4f, 0x50, 0x45, 0x01, 0x08, 0x16, 0xfe, 0xe0, 0x17, 0x27,
12240 0x25, 0xbe, 0x01, 0x08,
12241 0x16, 0xfe, 0xe0, 0x17, 0x27, 0x25, 0xfe, 0xe8, 0x0a, 0xfe, 0xc1, 0x59,
12242 0x03, 0x9a, 0x1e, 0xfe,
12243 0xda, 0x12, 0x01, 0x38, 0x06, 0x12, 0xfe, 0xd0, 0x13, 0x26, 0x53, 0x12,
12244 0x48, 0xfe, 0x08, 0x17,
12245 0xd1, 0x12, 0x53, 0x12, 0xfe, 0x1e, 0x13, 0x2d, 0xb4, 0x7b, 0xfe, 0x26,
12246 0x17, 0x4d, 0x13, 0x07,
12247 0x1c, 0xb4, 0x90, 0x04, 0xfe, 0x78, 0x10, 0xff, 0x02, 0x83, 0x55, 0xf1,
12248 0xff, 0x02, 0x83, 0x55,
12249 0x53, 0x1d, 0xfe, 0x12, 0x13, 0xd6, 0xfe, 0x30, 0x00, 0xb0, 0xfe, 0x80,
12250 0x17, 0x1c, 0x63, 0x13,
12251 0x07, 0xfe, 0x56, 0x10, 0x53, 0x0d, 0xfe, 0x16, 0x13, 0xd6, 0xfe, 0x64,
12252 0x00, 0xb0, 0xfe, 0x80,
12253 0x17, 0x0a, 0xfe, 0x64, 0x00, 0x1c, 0x94, 0x13, 0x07, 0xfe, 0x28, 0x10,
12254 0x53, 0x07, 0xfe, 0x60,
12255 0x13, 0xd6, 0xfe, 0xc8, 0x00, 0xb0, 0xfe, 0x80, 0x17, 0x0a, 0xfe, 0xc8,
12256 0x00, 0x1c, 0x95, 0x13,
12257 0x07, 0x71, 0xd6, 0xfe, 0x90, 0x01, 0x48, 0xfe, 0x8c, 0x17, 0x45, 0xf3,
12258 0xfe, 0x43, 0xf4, 0x96,
12259 0xfe, 0x56, 0xf0, 0xfe, 0x9e, 0x17, 0xfe, 0x04, 0xf4, 0x58, 0xfe, 0x43,
12260 0xf4, 0x94, 0xf6, 0x8b,
12261 0x01, 0xfe, 0x24, 0x16, 0x23, 0x3f, 0xfc, 0xa8, 0x8c, 0x49, 0x48, 0xfe,
12262 0xda, 0x17, 0x62, 0x49,
12263 0xfe, 0x1c, 0x10, 0xa8, 0x8c, 0x80, 0x48, 0xfe, 0xda, 0x17, 0x62, 0x80,
12264 0x71, 0x50, 0x26, 0xfe,
12265 0x4d, 0xf4, 0x00, 0xf7, 0x45, 0x13, 0x07, 0xfe, 0xb4, 0x56, 0xfe, 0xc3,
12266 0x58, 0x02, 0x50, 0x13,
12267 0x0d, 0x02, 0x50, 0x3e, 0x78, 0x4f, 0x45, 0x01, 0x08, 0x16, 0xa9, 0x27,
12268 0x25, 0xbe, 0xfe, 0x03,
12269 0xea, 0xfe, 0x7e, 0x01, 0x01, 0x08, 0x16, 0xa9, 0x27, 0x25, 0xfe, 0xe9,
12270 0x0a, 0x01, 0x08, 0x16,
12271 0xa9, 0x27, 0x25, 0xfe, 0xe9, 0x0a, 0xfe, 0x05, 0xea, 0xfe, 0x7f, 0x01,
12272 0x01, 0x08, 0x16, 0xa9,
12273 0x27, 0x25, 0xfe, 0x69, 0x09, 0xfe, 0x02, 0xea, 0xfe, 0x80, 0x01, 0x01,
12274 0x08, 0x16, 0xa9, 0x27,
12275 0x25, 0xfe, 0xe8, 0x08, 0x47, 0xfe, 0x81, 0x01, 0x03, 0xb6, 0x1e, 0x83,
12276 0x01, 0x38, 0x06, 0x24,
12277 0x31, 0xa2, 0x78, 0xf2, 0x53, 0x07, 0x36, 0xfe, 0x34, 0xf4, 0x3f, 0xa1,
12278 0x78, 0x03, 0x9a, 0x1e,
12279 0x83, 0x01, 0x38, 0x06, 0x12, 0x31, 0xf0, 0x4f, 0x45, 0xfe, 0x90, 0x10,
12280 0xfe, 0x40, 0x5a, 0x23,
12281 0x3f, 0xfb, 0x8c, 0x49, 0x48, 0xfe, 0xaa, 0x18, 0x62, 0x49, 0x71, 0x8c,
12282 0x80, 0x48, 0xfe, 0xaa,
12283 0x18, 0x62, 0x80, 0xfe, 0xb4, 0x56, 0xfe, 0x40, 0x5d, 0x01, 0xc6, 0x01,
12284 0xfe, 0xac, 0x1d, 0xfe,
12285 0x02, 0x17, 0xfe, 0xc8, 0x45, 0xfe, 0x5a, 0xf0, 0xfe, 0xc0, 0x18, 0xfe,
12286 0x43, 0x48, 0x2d, 0x93,
12287 0x36, 0xfe, 0x34, 0xf4, 0xfe, 0x00, 0x11, 0xfe, 0x40, 0x10, 0x2d, 0xb4,
12288 0x36, 0xfe, 0x34, 0xf4,
12289 0x04, 0xfe, 0x34, 0x10, 0x2d, 0xfe, 0x0b, 0x00, 0x36, 0x46, 0x63, 0xfe,
12290 0x28, 0x10, 0xfe, 0xc0,
12291 0x49, 0xff, 0x02, 0x00, 0x54, 0xb2, 0xfe, 0x90, 0x01, 0x48, 0xfe, 0xfa,
12292 0x18, 0x45, 0xfe, 0x1c,
12293 0xf4, 0x3f, 0xf3, 0xfe, 0x40, 0xf4, 0x96, 0xfe, 0x56, 0xf0, 0xfe, 0x0c,
12294 0x19, 0xfe, 0x04, 0xf4,
12295 0x58, 0xfe, 0x40, 0xf4, 0x94, 0xf6, 0x3e, 0x2d, 0x93, 0x4e, 0xd0, 0x0d,
12296 0x21, 0xfe, 0x7f, 0x01,
12297 0xfe, 0xc8, 0x46, 0xfe, 0x24, 0x13, 0x8c, 0x00, 0x5d, 0x26, 0x21, 0xfe,
12298 0x7e, 0x01, 0xfe, 0xc8,
12299 0x45, 0xfe, 0x14, 0x13, 0x21, 0xfe, 0x80, 0x01, 0xfe, 0x48, 0x45, 0xfa,
12300 0x21, 0xfe, 0x81, 0x01,
12301 0xfe, 0xc8, 0x44, 0x4e, 0x26, 0x02, 0x13, 0x07, 0x02, 0x78, 0x45, 0x50,
12302 0x13, 0x0d, 0x02, 0x14,
12303 0x07, 0x01, 0x08, 0x17, 0xfe, 0x82, 0x19, 0x14, 0x0d, 0x01, 0x08, 0x17,
12304 0xfe, 0x82, 0x19, 0x14,
12305 0x1d, 0x01, 0x08, 0x17, 0xfe, 0x82, 0x19, 0x5f, 0xfe, 0x89, 0x49, 0x01,
12306 0x08, 0x02, 0x14, 0x07,
12307 0x01, 0x08, 0x17, 0xc1, 0x14, 0x1d, 0x01, 0x08, 0x17, 0xc1, 0x14, 0x07,
12308 0x01, 0x08, 0x17, 0xc1,
12309 0xfe, 0x89, 0x49, 0x01, 0x08, 0x17, 0xc1, 0x5f, 0xfe, 0x89, 0x4a, 0x01,
12310 0x08, 0x02, 0x50, 0x02,
12311 0x14, 0x07, 0x01, 0x08, 0x17, 0x74, 0x14, 0x7f, 0x01, 0x08, 0x17, 0x74,
12312 0x14, 0x12, 0x01, 0x08,
12313 0x17, 0x74, 0xfe, 0x89, 0x49, 0x01, 0x08, 0x17, 0x74, 0x14, 0x00, 0x01,
12314 0x08, 0x17, 0x74, 0xfe,
12315 0x89, 0x4a, 0x01, 0x08, 0x17, 0x74, 0xfe, 0x09, 0x49, 0x01, 0x08, 0x17,
12316 0x74, 0x5f, 0xcc, 0x01,
12317 0x08, 0x02, 0x21, 0xe4, 0x09, 0x07, 0xfe, 0x4c, 0x13, 0xc8, 0x20, 0xe4,
12318 0xfe, 0x49, 0xf4, 0x00,
12319 0x4d, 0x5f, 0xa1, 0x5e, 0xfe, 0x01, 0xec, 0xfe, 0x27, 0x01, 0xcc, 0xff,
12320 0x02, 0x00, 0x10, 0x2f,
12321 0xfe, 0x3e, 0x1a, 0x01, 0x43, 0x09, 0xfe, 0xe3, 0x00, 0xfe, 0x22, 0x13,
12322 0x16, 0xfe, 0x64, 0x1a,
12323 0x26, 0x20, 0x9e, 0x01, 0x41, 0x21, 0x9e, 0x09, 0x07, 0x5d, 0x01, 0x0c,
12324 0x61, 0x07, 0x44, 0x02,
12325 0x0a, 0x5a, 0x01, 0x18, 0xfe, 0x00, 0x40, 0xaa, 0x09, 0x1a, 0xfe, 0x12,
12326 0x13, 0x0a, 0x9d, 0x01,
12327 0x18, 0xaa, 0x0a, 0x67, 0x01, 0xa3, 0x02, 0x0a, 0x9d, 0x01, 0x18, 0xaa,
12328 0xfe, 0x80, 0xe7, 0x1a,
12329 0x09, 0x1a, 0x5d, 0xfe, 0x45, 0x58, 0x01, 0xfe, 0xb2, 0x16, 0xaa, 0x02,
12330 0x0a, 0x5a, 0x01, 0x18,
12331 0xaa, 0x0a, 0x67, 0x01, 0xa3, 0x02, 0x0a, 0x5a, 0x01, 0x18, 0x01, 0xfe,
12332 0x7e, 0x1e, 0xfe, 0x80,
12333 0x4c, 0xfe, 0x49, 0xe4, 0x1a, 0xfe, 0x12, 0x13, 0x0a, 0x9d, 0x01, 0x18,
12334 0xfe, 0x80, 0x4c, 0x0a,
12335 0x67, 0x01, 0x5c, 0x02, 0x1c, 0x1a, 0x87, 0x7c, 0xe5, 0xfe, 0x18, 0xdf,
12336 0xfe, 0x19, 0xde, 0xfe,
12337 0x24, 0x1c, 0xfe, 0x1d, 0xf7, 0x28, 0xb1, 0xfe, 0x04, 0x1b, 0x01, 0xfe,
12338 0x2a, 0x1c, 0xfa, 0xb3,
12339 0x28, 0x7c, 0xfe, 0x2c, 0x01, 0xfe, 0x2f, 0x19, 0x02, 0xc9, 0x2b, 0xfe,
12340 0xf4, 0x1a, 0xfe, 0xfa,
12341 0x10, 0x1c, 0x1a, 0x87, 0x03, 0xfe, 0x64, 0x01, 0xfe, 0x00, 0xf4, 0x24,
12342 0xfe, 0x18, 0x58, 0x03,
12343 0xfe, 0x66, 0x01, 0xfe, 0x19, 0x58, 0xb3, 0x24, 0x01, 0xfe, 0x0e, 0x1f,
12344 0xfe, 0x30, 0xf4, 0x07,
12345 0xfe, 0x3c, 0x50, 0x7c, 0xfe, 0x38, 0x00, 0xfe, 0x0f, 0x79, 0xfe, 0x1c,
12346 0xf7, 0x24, 0xb1, 0xfe,
12347 0x50, 0x1b, 0xfe, 0xd4, 0x14, 0x31, 0x02, 0xc9, 0x2b, 0xfe, 0x26, 0x1b,
12348 0xfe, 0xba, 0x10, 0x1c,
12349 0x1a, 0x87, 0xfe, 0x83, 0x5a, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe,
12350 0x1d, 0xf7, 0x54, 0xb1,
12351 0xfe, 0x72, 0x1b, 0xfe, 0xb2, 0x14, 0xfc, 0xb3, 0x54, 0x7c, 0x12, 0xfe,
12352 0xaf, 0x19, 0xfe, 0x98,
12353 0xe7, 0x00, 0x02, 0xc9, 0x2b, 0xfe, 0x66, 0x1b, 0xfe, 0x8a, 0x10, 0x1c,
12354 0x1a, 0x87, 0x8b, 0x0f,
12355 0xfe, 0x30, 0x90, 0x04, 0xfe, 0xb0, 0x93, 0x3a, 0x0b, 0xfe, 0x18, 0x58,
12356 0xfe, 0x32, 0x90, 0x04,
12357 0xfe, 0xb2, 0x93, 0x3a, 0x0b, 0xfe, 0x19, 0x58, 0x0e, 0xa8, 0xb3, 0x4a,
12358 0x7c, 0x12, 0xfe, 0x0f,
12359 0x79, 0xfe, 0x1c, 0xf7, 0x4a, 0xb1, 0xfe, 0xc6, 0x1b, 0xfe, 0x5e, 0x14,
12360 0x31, 0x02, 0xc9, 0x2b,
12361 0xfe, 0x96, 0x1b, 0x5c, 0xfe, 0x02, 0xf6, 0x1a, 0x87, 0xfe, 0x18, 0xfe,
12362 0x6a, 0xfe, 0x19, 0xfe,
12363 0x6b, 0x01, 0xfe, 0x1e, 0x1f, 0xfe, 0x1d, 0xf7, 0x65, 0xb1, 0xfe, 0xee,
12364 0x1b, 0xfe, 0x36, 0x14,
12365 0xfe, 0x1c, 0x13, 0xb3, 0x65, 0x3e, 0xfe, 0x83, 0x58, 0xfe, 0xaf, 0x19,
12366 0xfe, 0x80, 0xe7, 0x1a,
12367 0xfe, 0x81, 0xe7, 0x1a, 0x15, 0xfe, 0xdd, 0x00, 0x7a, 0x30, 0x02, 0x7a,
12368 0x30, 0xfe, 0x12, 0x45,
12369 0x2b, 0xfe, 0xdc, 0x1b, 0x1f, 0x07, 0x47, 0xb5, 0xc3, 0x05, 0x35, 0xfe,
12370 0x39, 0xf0, 0x75, 0x26,
12371 0x02, 0xfe, 0x7e, 0x18, 0x23, 0x1d, 0x36, 0x13, 0x11, 0x02, 0x87, 0x03,
12372 0xe3, 0x23, 0x07, 0xfe,
12373 0xef, 0x12, 0xfe, 0xe1, 0x10, 0x90, 0x34, 0x60, 0xfe, 0x02, 0x80, 0x09,
12374 0x56, 0xfe, 0x3c, 0x13,
12375 0xfe, 0x82, 0x14, 0xfe, 0x42, 0x13, 0x51, 0xfe, 0x06, 0x83, 0x0a, 0x5a,
12376 0x01, 0x18, 0xcb, 0xfe,
12377 0x3e, 0x12, 0xfe, 0x41, 0x48, 0xfe, 0x45, 0x48, 0x01, 0xfe, 0xb2, 0x16,
12378 0xfe, 0x00, 0xcc, 0xcb,
12379 0xfe, 0xf3, 0x13, 0x3f, 0x89, 0x09, 0x1a, 0xa5, 0x0a, 0x9d, 0x01, 0x18,
12380 0xfe, 0x80, 0x4c, 0x01,
12381 0x85, 0xfe, 0x16, 0x10, 0x09, 0x9b, 0x4e, 0xfe, 0x40, 0x14, 0xfe, 0x24,
12382 0x12, 0xfe, 0x14, 0x56,
12383 0xfe, 0xd6, 0xf0, 0xfe, 0x52, 0x1c, 0x1c, 0x0d, 0x02, 0xfe, 0x9c, 0xe7,
12384 0x0d, 0x19, 0xfe, 0x15,
12385 0x00, 0x40, 0x8d, 0x30, 0x01, 0xf4, 0x1c, 0x07, 0x02, 0x51, 0xfe, 0x06,
12386 0x83, 0xfe, 0x18, 0x80,
12387 0x61, 0x28, 0x44, 0x15, 0x56, 0x01, 0x85, 0x1c, 0x07, 0x02, 0xfe, 0x38,
12388 0x90, 0xfe, 0xba, 0x90,
12389 0x91, 0xde, 0x7e, 0xdf, 0xfe, 0x48, 0x55, 0x31, 0xfe, 0xc9, 0x55, 0x02,
12390 0x21, 0xb9, 0x88, 0x20,
12391 0xb9, 0x02, 0x0a, 0xba, 0x01, 0x18, 0xfe, 0x41, 0x48, 0x0a, 0x57, 0x01,
12392 0x18, 0xfe, 0x49, 0x44,
12393 0x1b, 0xfe, 0x1e, 0x1d, 0x88, 0x89, 0x02, 0x0a, 0x5a, 0x01, 0x18, 0x09,
12394 0x1a, 0xa4, 0x0a, 0x67,
12395 0x01, 0xa3, 0x0a, 0x57, 0x01, 0x18, 0x88, 0x89, 0x02, 0xfe, 0x4e, 0xe4,
12396 0x1d, 0x7b, 0xfe, 0x52,
12397 0x1d, 0x03, 0xfe, 0x90, 0x00, 0xfe, 0x3a, 0x45, 0xfe, 0x2c, 0x10, 0xfe,
12398 0x4e, 0xe4, 0xdd, 0x7b,
12399 0xfe, 0x64, 0x1d, 0x03, 0xfe, 0x92, 0x00, 0xd1, 0x12, 0xfe, 0x1a, 0x10,
12400 0xfe, 0x4e, 0xe4, 0xfe,
12401 0x0b, 0x00, 0x7b, 0xfe, 0x76, 0x1d, 0x03, 0xfe, 0x94, 0x00, 0xd1, 0x24,
12402 0xfe, 0x08, 0x10, 0x03,
12403 0xfe, 0x96, 0x00, 0xd1, 0x63, 0xfe, 0x4e, 0x45, 0x83, 0xca, 0xff, 0x04,
12404 0x68, 0x54, 0xfe, 0xf1,
12405 0x10, 0x23, 0x49, 0xfe, 0x08, 0x1c, 0xfe, 0x67, 0x19, 0xfe, 0x0a, 0x1c,
12406 0xfe, 0x1a, 0xf4, 0xfe,
12407 0x00, 0x04, 0x83, 0xb2, 0x1d, 0x48, 0xfe, 0xaa, 0x1d, 0x13, 0x1d, 0x02,
12408 0x09, 0x92, 0xfe, 0x5a,
12409 0xf0, 0xfe, 0xba, 0x1d, 0x2e, 0x93, 0xfe, 0x34, 0x10, 0x09, 0x12, 0xfe,
12410 0x5a, 0xf0, 0xfe, 0xc8,
12411 0x1d, 0x2e, 0xb4, 0xfe, 0x26, 0x10, 0x09, 0x1d, 0x36, 0x2e, 0x63, 0xfe,
12412 0x1a, 0x10, 0x09, 0x0d,
12413 0x36, 0x2e, 0x94, 0xf2, 0x09, 0x07, 0x36, 0x2e, 0x95, 0xa1, 0xc8, 0x02,
12414 0x1f, 0x93, 0x01, 0x42,
12415 0xfe, 0x04, 0xfe, 0x99, 0x03, 0x9c, 0x8b, 0x02, 0x2a, 0xfe, 0x1c, 0x1e,
12416 0xfe, 0x14, 0xf0, 0x08,
12417 0x2f, 0xfe, 0x0c, 0x1e, 0x2a, 0xfe, 0x1c, 0x1e, 0x8f, 0xfe, 0x1c, 0x1e,
12418 0xfe, 0x82, 0xf0, 0xfe,
12419 0x10, 0x1e, 0x02, 0x0f, 0x3f, 0x04, 0xfe, 0x80, 0x83, 0x33, 0x0b, 0x0e,
12420 0x02, 0x0f, 0xfe, 0x18,
12421 0x80, 0x04, 0xfe, 0x98, 0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x02,
12422 0x80, 0x04, 0xfe, 0x82,
12423 0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x06, 0x80, 0x04, 0xfe, 0x86,
12424 0x83, 0x33, 0x0b, 0x0e,
12425 0x02, 0x0f, 0xfe, 0x1b, 0x80, 0x04, 0xfe, 0x9b, 0x83, 0x33, 0x0b, 0x0e,
12426 0x02, 0x0f, 0xfe, 0x04,
12427 0x80, 0x04, 0xfe, 0x84, 0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x80,
12428 0x80, 0x04, 0xfe, 0x80,
12429 0x83, 0xfe, 0xc9, 0x47, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x19, 0x81, 0x04,
12430 0xfe, 0x99, 0x83, 0xfe,
12431 0xca, 0x47, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x06, 0x83, 0x04, 0xfe, 0x86,
12432 0x83, 0xfe, 0xce, 0x47,
12433 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x2c, 0x90, 0x04, 0xfe, 0xac, 0x93, 0x3a,
12434 0x0b, 0x0e, 0x02, 0x0f,
12435 0xfe, 0xae, 0x90, 0x04, 0xfe, 0xae, 0x93, 0x79, 0x0b, 0x0e, 0x02, 0x0f,
12436 0xfe, 0x08, 0x90, 0x04,
12437 0xfe, 0x88, 0x93, 0x3a, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x8a, 0x90, 0x04,
12438 0xfe, 0x8a, 0x93, 0x79,
12439 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x0c, 0x90, 0x04, 0xfe, 0x8c, 0x93, 0x3a,
12440 0x0b, 0x0e, 0x02, 0x0f,
12441 0xfe, 0x8e, 0x90, 0x04, 0xfe, 0x8e, 0x93, 0x79, 0x0b, 0x0e, 0x02, 0x0f,
12442 0xfe, 0x3c, 0x90, 0x04,
12443 0xfe, 0xbc, 0x93, 0x3a, 0x0b, 0x0e, 0x02, 0x8b, 0x0f, 0xfe, 0x03, 0x80,
12444 0x04, 0xfe, 0x83, 0x83,
12445 0x33, 0x0b, 0x77, 0x0e, 0xa8, 0x02, 0xff, 0x66, 0x00, 0x00,
12448 static unsigned short _adv_asc38C1600_size
= sizeof(_adv_asc38C1600_buf
); /* 0x1673 */
12449 static ADV_DCNT _adv_asc38C1600_chksum
= 0x0604EF77UL
; /* Expanded little-endian checksum. */
12452 * EEPROM Configuration.
12454 * All drivers should use this structure to set the default EEPROM
12455 * configuration. The BIOS now uses this structure when it is built.
12456 * Additional structure information can be found in a_condor.h where
12457 * the structure is defined.
12459 * The *_Field_IsChar structs are needed to correct for endianness.
12460 * These values are read from the board 16 bits at a time directly
12461 * into the structs. Because some fields are char, the values will be
12462 * in the wrong order. The *_Field_IsChar tells when to flip the
12463 * bytes. Data read and written to PCI memory is automatically swapped
12464 * on big-endian platforms so char fields read as words are actually being
12465 * unswapped on big-endian platforms.
12467 static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config __devinitdata
= {
12468 ADV_EEPROM_BIOS_ENABLE
, /* cfg_lsw */
12469 0x0000, /* cfg_msw */
12470 0xFFFF, /* disc_enable */
12471 0xFFFF, /* wdtr_able */
12472 0xFFFF, /* sdtr_able */
12473 0xFFFF, /* start_motor */
12474 0xFFFF, /* tagqng_able */
12475 0xFFFF, /* bios_scan */
12476 0, /* scam_tolerant */
12477 7, /* adapter_scsi_id */
12478 0, /* bios_boot_delay */
12479 3, /* scsi_reset_delay */
12480 0, /* bios_id_lun */
12481 0, /* termination */
12483 0xFFE7, /* bios_ctrl */
12484 0xFFFF, /* ultra_able */
12486 ASC_DEF_MAX_HOST_QNG
, /* max_host_qng */
12487 ASC_DEF_MAX_DVC_QNG
, /* max_dvc_qng */
12490 0, /* serial_number_word1 */
12491 0, /* serial_number_word2 */
12492 0, /* serial_number_word3 */
12494 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
12495 , /* oem_name[16] */
12496 0, /* dvc_err_code */
12497 0, /* adv_err_code */
12498 0, /* adv_err_addr */
12499 0, /* saved_dvc_err_code */
12500 0, /* saved_adv_err_code */
12501 0, /* saved_adv_err_addr */
12505 static ADVEEP_3550_CONFIG ADVEEP_3550_Config_Field_IsChar __devinitdata
= {
12508 0, /* -disc_enable */
12511 0, /* start_motor */
12512 0, /* tagqng_able */
12514 0, /* scam_tolerant */
12515 1, /* adapter_scsi_id */
12516 1, /* bios_boot_delay */
12517 1, /* scsi_reset_delay */
12518 1, /* bios_id_lun */
12519 1, /* termination */
12522 0, /* ultra_able */
12524 1, /* max_host_qng */
12525 1, /* max_dvc_qng */
12528 0, /* serial_number_word1 */
12529 0, /* serial_number_word2 */
12530 0, /* serial_number_word3 */
12532 {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
12533 , /* oem_name[16] */
12534 0, /* dvc_err_code */
12535 0, /* adv_err_code */
12536 0, /* adv_err_addr */
12537 0, /* saved_dvc_err_code */
12538 0, /* saved_adv_err_code */
12539 0, /* saved_adv_err_addr */
12543 static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config __devinitdata
= {
12544 ADV_EEPROM_BIOS_ENABLE
, /* 00 cfg_lsw */
12545 0x0000, /* 01 cfg_msw */
12546 0xFFFF, /* 02 disc_enable */
12547 0xFFFF, /* 03 wdtr_able */
12548 0x4444, /* 04 sdtr_speed1 */
12549 0xFFFF, /* 05 start_motor */
12550 0xFFFF, /* 06 tagqng_able */
12551 0xFFFF, /* 07 bios_scan */
12552 0, /* 08 scam_tolerant */
12553 7, /* 09 adapter_scsi_id */
12554 0, /* bios_boot_delay */
12555 3, /* 10 scsi_reset_delay */
12556 0, /* bios_id_lun */
12557 0, /* 11 termination_se */
12558 0, /* termination_lvd */
12559 0xFFE7, /* 12 bios_ctrl */
12560 0x4444, /* 13 sdtr_speed2 */
12561 0x4444, /* 14 sdtr_speed3 */
12562 ASC_DEF_MAX_HOST_QNG
, /* 15 max_host_qng */
12563 ASC_DEF_MAX_DVC_QNG
, /* max_dvc_qng */
12564 0, /* 16 dvc_cntl */
12565 0x4444, /* 17 sdtr_speed4 */
12566 0, /* 18 serial_number_word1 */
12567 0, /* 19 serial_number_word2 */
12568 0, /* 20 serial_number_word3 */
12569 0, /* 21 check_sum */
12570 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
12571 , /* 22-29 oem_name[16] */
12572 0, /* 30 dvc_err_code */
12573 0, /* 31 adv_err_code */
12574 0, /* 32 adv_err_addr */
12575 0, /* 33 saved_dvc_err_code */
12576 0, /* 34 saved_adv_err_code */
12577 0, /* 35 saved_adv_err_addr */
12578 0, /* 36 reserved */
12579 0, /* 37 reserved */
12580 0, /* 38 reserved */
12581 0, /* 39 reserved */
12582 0, /* 40 reserved */
12583 0, /* 41 reserved */
12584 0, /* 42 reserved */
12585 0, /* 43 reserved */
12586 0, /* 44 reserved */
12587 0, /* 45 reserved */
12588 0, /* 46 reserved */
12589 0, /* 47 reserved */
12590 0, /* 48 reserved */
12591 0, /* 49 reserved */
12592 0, /* 50 reserved */
12593 0, /* 51 reserved */
12594 0, /* 52 reserved */
12595 0, /* 53 reserved */
12596 0, /* 54 reserved */
12597 0, /* 55 reserved */
12598 0, /* 56 cisptr_lsw */
12599 0, /* 57 cisprt_msw */
12600 PCI_VENDOR_ID_ASP
, /* 58 subsysvid */
12601 PCI_DEVICE_ID_38C0800_REV1
, /* 59 subsysid */
12602 0, /* 60 reserved */
12603 0, /* 61 reserved */
12604 0, /* 62 reserved */
12605 0 /* 63 reserved */
12608 static ADVEEP_38C0800_CONFIG ADVEEP_38C0800_Config_Field_IsChar __devinitdata
= {
12609 0, /* 00 cfg_lsw */
12610 0, /* 01 cfg_msw */
12611 0, /* 02 disc_enable */
12612 0, /* 03 wdtr_able */
12613 0, /* 04 sdtr_speed1 */
12614 0, /* 05 start_motor */
12615 0, /* 06 tagqng_able */
12616 0, /* 07 bios_scan */
12617 0, /* 08 scam_tolerant */
12618 1, /* 09 adapter_scsi_id */
12619 1, /* bios_boot_delay */
12620 1, /* 10 scsi_reset_delay */
12621 1, /* bios_id_lun */
12622 1, /* 11 termination_se */
12623 1, /* termination_lvd */
12624 0, /* 12 bios_ctrl */
12625 0, /* 13 sdtr_speed2 */
12626 0, /* 14 sdtr_speed3 */
12627 1, /* 15 max_host_qng */
12628 1, /* max_dvc_qng */
12629 0, /* 16 dvc_cntl */
12630 0, /* 17 sdtr_speed4 */
12631 0, /* 18 serial_number_word1 */
12632 0, /* 19 serial_number_word2 */
12633 0, /* 20 serial_number_word3 */
12634 0, /* 21 check_sum */
12635 {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
12636 , /* 22-29 oem_name[16] */
12637 0, /* 30 dvc_err_code */
12638 0, /* 31 adv_err_code */
12639 0, /* 32 adv_err_addr */
12640 0, /* 33 saved_dvc_err_code */
12641 0, /* 34 saved_adv_err_code */
12642 0, /* 35 saved_adv_err_addr */
12643 0, /* 36 reserved */
12644 0, /* 37 reserved */
12645 0, /* 38 reserved */
12646 0, /* 39 reserved */
12647 0, /* 40 reserved */
12648 0, /* 41 reserved */
12649 0, /* 42 reserved */
12650 0, /* 43 reserved */
12651 0, /* 44 reserved */
12652 0, /* 45 reserved */
12653 0, /* 46 reserved */
12654 0, /* 47 reserved */
12655 0, /* 48 reserved */
12656 0, /* 49 reserved */
12657 0, /* 50 reserved */
12658 0, /* 51 reserved */
12659 0, /* 52 reserved */
12660 0, /* 53 reserved */
12661 0, /* 54 reserved */
12662 0, /* 55 reserved */
12663 0, /* 56 cisptr_lsw */
12664 0, /* 57 cisprt_msw */
12665 0, /* 58 subsysvid */
12666 0, /* 59 subsysid */
12667 0, /* 60 reserved */
12668 0, /* 61 reserved */
12669 0, /* 62 reserved */
12670 0 /* 63 reserved */
12673 static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config __devinitdata
= {
12674 ADV_EEPROM_BIOS_ENABLE
, /* 00 cfg_lsw */
12675 0x0000, /* 01 cfg_msw */
12676 0xFFFF, /* 02 disc_enable */
12677 0xFFFF, /* 03 wdtr_able */
12678 0x5555, /* 04 sdtr_speed1 */
12679 0xFFFF, /* 05 start_motor */
12680 0xFFFF, /* 06 tagqng_able */
12681 0xFFFF, /* 07 bios_scan */
12682 0, /* 08 scam_tolerant */
12683 7, /* 09 adapter_scsi_id */
12684 0, /* bios_boot_delay */
12685 3, /* 10 scsi_reset_delay */
12686 0, /* bios_id_lun */
12687 0, /* 11 termination_se */
12688 0, /* termination_lvd */
12689 0xFFE7, /* 12 bios_ctrl */
12690 0x5555, /* 13 sdtr_speed2 */
12691 0x5555, /* 14 sdtr_speed3 */
12692 ASC_DEF_MAX_HOST_QNG
, /* 15 max_host_qng */
12693 ASC_DEF_MAX_DVC_QNG
, /* max_dvc_qng */
12694 0, /* 16 dvc_cntl */
12695 0x5555, /* 17 sdtr_speed4 */
12696 0, /* 18 serial_number_word1 */
12697 0, /* 19 serial_number_word2 */
12698 0, /* 20 serial_number_word3 */
12699 0, /* 21 check_sum */
12700 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
12701 , /* 22-29 oem_name[16] */
12702 0, /* 30 dvc_err_code */
12703 0, /* 31 adv_err_code */
12704 0, /* 32 adv_err_addr */
12705 0, /* 33 saved_dvc_err_code */
12706 0, /* 34 saved_adv_err_code */
12707 0, /* 35 saved_adv_err_addr */
12708 0, /* 36 reserved */
12709 0, /* 37 reserved */
12710 0, /* 38 reserved */
12711 0, /* 39 reserved */
12712 0, /* 40 reserved */
12713 0, /* 41 reserved */
12714 0, /* 42 reserved */
12715 0, /* 43 reserved */
12716 0, /* 44 reserved */
12717 0, /* 45 reserved */
12718 0, /* 46 reserved */
12719 0, /* 47 reserved */
12720 0, /* 48 reserved */
12721 0, /* 49 reserved */
12722 0, /* 50 reserved */
12723 0, /* 51 reserved */
12724 0, /* 52 reserved */
12725 0, /* 53 reserved */
12726 0, /* 54 reserved */
12727 0, /* 55 reserved */
12728 0, /* 56 cisptr_lsw */
12729 0, /* 57 cisprt_msw */
12730 PCI_VENDOR_ID_ASP
, /* 58 subsysvid */
12731 PCI_DEVICE_ID_38C1600_REV1
, /* 59 subsysid */
12732 0, /* 60 reserved */
12733 0, /* 61 reserved */
12734 0, /* 62 reserved */
12735 0 /* 63 reserved */
12738 static ADVEEP_38C1600_CONFIG ADVEEP_38C1600_Config_Field_IsChar __devinitdata
= {
12739 0, /* 00 cfg_lsw */
12740 0, /* 01 cfg_msw */
12741 0, /* 02 disc_enable */
12742 0, /* 03 wdtr_able */
12743 0, /* 04 sdtr_speed1 */
12744 0, /* 05 start_motor */
12745 0, /* 06 tagqng_able */
12746 0, /* 07 bios_scan */
12747 0, /* 08 scam_tolerant */
12748 1, /* 09 adapter_scsi_id */
12749 1, /* bios_boot_delay */
12750 1, /* 10 scsi_reset_delay */
12751 1, /* bios_id_lun */
12752 1, /* 11 termination_se */
12753 1, /* termination_lvd */
12754 0, /* 12 bios_ctrl */
12755 0, /* 13 sdtr_speed2 */
12756 0, /* 14 sdtr_speed3 */
12757 1, /* 15 max_host_qng */
12758 1, /* max_dvc_qng */
12759 0, /* 16 dvc_cntl */
12760 0, /* 17 sdtr_speed4 */
12761 0, /* 18 serial_number_word1 */
12762 0, /* 19 serial_number_word2 */
12763 0, /* 20 serial_number_word3 */
12764 0, /* 21 check_sum */
12765 {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
12766 , /* 22-29 oem_name[16] */
12767 0, /* 30 dvc_err_code */
12768 0, /* 31 adv_err_code */
12769 0, /* 32 adv_err_addr */
12770 0, /* 33 saved_dvc_err_code */
12771 0, /* 34 saved_adv_err_code */
12772 0, /* 35 saved_adv_err_addr */
12773 0, /* 36 reserved */
12774 0, /* 37 reserved */
12775 0, /* 38 reserved */
12776 0, /* 39 reserved */
12777 0, /* 40 reserved */
12778 0, /* 41 reserved */
12779 0, /* 42 reserved */
12780 0, /* 43 reserved */
12781 0, /* 44 reserved */
12782 0, /* 45 reserved */
12783 0, /* 46 reserved */
12784 0, /* 47 reserved */
12785 0, /* 48 reserved */
12786 0, /* 49 reserved */
12787 0, /* 50 reserved */
12788 0, /* 51 reserved */
12789 0, /* 52 reserved */
12790 0, /* 53 reserved */
12791 0, /* 54 reserved */
12792 0, /* 55 reserved */
12793 0, /* 56 cisptr_lsw */
12794 0, /* 57 cisprt_msw */
12795 0, /* 58 subsysvid */
12796 0, /* 59 subsysid */
12797 0, /* 60 reserved */
12798 0, /* 61 reserved */
12799 0, /* 62 reserved */
12800 0 /* 63 reserved */
12804 * Initialize the ADV_DVC_VAR structure.
12806 * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR.
12808 * For a non-fatal error return a warning code. If there are no warnings
12809 * then 0 is returned.
12811 static int __devinit
12812 AdvInitGetConfig(struct pci_dev
*pdev
, ADV_DVC_VAR
*asc_dvc
)
12814 unsigned short warn_code
= 0;
12815 AdvPortAddr iop_base
= asc_dvc
->iop_base
;
12819 asc_dvc
->err_code
= 0;
12822 * Save the state of the PCI Configuration Command Register
12823 * "Parity Error Response Control" Bit. If the bit is clear (0),
12824 * in AdvInitAsc3550/38C0800Driver() tell the microcode to ignore
12825 * DMA parity errors.
12827 asc_dvc
->cfg
->control_flag
= 0;
12828 pci_read_config_word(pdev
, PCI_COMMAND
, &cmd
);
12829 if ((cmd
& PCI_COMMAND_PARITY
) == 0)
12830 asc_dvc
->cfg
->control_flag
|= CONTROL_FLAG_IGNORE_PERR
;
12832 asc_dvc
->cfg
->lib_version
= (ADV_LIB_VERSION_MAJOR
<< 8) |
12833 ADV_LIB_VERSION_MINOR
;
12834 asc_dvc
->cfg
->chip_version
=
12835 AdvGetChipVersion(iop_base
, asc_dvc
->bus_type
);
12837 ASC_DBG2(1, "AdvInitGetConfig: iopb_chip_id_1: 0x%x 0x%x\n",
12838 (ushort
)AdvReadByteRegister(iop_base
, IOPB_CHIP_ID_1
),
12839 (ushort
)ADV_CHIP_ID_BYTE
);
12841 ASC_DBG2(1, "AdvInitGetConfig: iopw_chip_id_0: 0x%x 0x%x\n",
12842 (ushort
)AdvReadWordRegister(iop_base
, IOPW_CHIP_ID_0
),
12843 (ushort
)ADV_CHIP_ID_WORD
);
12846 * Reset the chip to start and allow register writes.
12848 if (AdvFindSignature(iop_base
) == 0) {
12849 asc_dvc
->err_code
= ASC_IERR_BAD_SIGNATURE
;
12853 * The caller must set 'chip_type' to a valid setting.
12855 if (asc_dvc
->chip_type
!= ADV_CHIP_ASC3550
&&
12856 asc_dvc
->chip_type
!= ADV_CHIP_ASC38C0800
&&
12857 asc_dvc
->chip_type
!= ADV_CHIP_ASC38C1600
) {
12858 asc_dvc
->err_code
|= ASC_IERR_BAD_CHIPTYPE
;
12865 AdvWriteWordRegister(iop_base
, IOPW_CTRL_REG
,
12866 ADV_CTRL_REG_CMD_RESET
);
12867 DvcSleepMilliSecond(100);
12868 AdvWriteWordRegister(iop_base
, IOPW_CTRL_REG
,
12869 ADV_CTRL_REG_CMD_WR_IO_REG
);
12871 if (asc_dvc
->chip_type
== ADV_CHIP_ASC38C1600
) {
12872 status
= AdvInitFrom38C1600EEP(asc_dvc
);
12873 } else if (asc_dvc
->chip_type
== ADV_CHIP_ASC38C0800
) {
12874 status
= AdvInitFrom38C0800EEP(asc_dvc
);
12876 status
= AdvInitFrom3550EEP(asc_dvc
);
12878 warn_code
|= status
;
12885 * Initialize the ASC-3550.
12887 * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR.
12889 * For a non-fatal error return a warning code. If there are no warnings
12890 * then 0 is returned.
12892 * Needed after initialization for error recovery.
12894 static int AdvInitAsc3550Driver(ADV_DVC_VAR
*asc_dvc
)
12896 AdvPortAddr iop_base
;
12904 int adv_asc3550_expanded_size
;
12906 ADV_DCNT contig_len
;
12907 ADV_SDCNT buf_size
;
12908 ADV_PADDR carr_paddr
;
12912 ushort bios_mem
[ASC_MC_BIOSLEN
/ 2]; /* BIOS RISC Memory 0x40-0x8F. */
12913 ushort wdtr_able
= 0, sdtr_able
, tagqng_able
;
12914 uchar max_cmd
[ADV_MAX_TID
+ 1];
12916 /* If there is already an error, don't continue. */
12917 if (asc_dvc
->err_code
!= 0) {
12922 * The caller must set 'chip_type' to ADV_CHIP_ASC3550.
12924 if (asc_dvc
->chip_type
!= ADV_CHIP_ASC3550
) {
12925 asc_dvc
->err_code
|= ASC_IERR_BAD_CHIPTYPE
;
12930 iop_base
= asc_dvc
->iop_base
;
12933 * Save the RISC memory BIOS region before writing the microcode.
12934 * The BIOS may already be loaded and using its RISC LRAM region
12935 * so its region must be saved and restored.
12937 * Note: This code makes the assumption, which is currently true,
12938 * that a chip reset does not clear RISC LRAM.
12940 for (i
= 0; i
< ASC_MC_BIOSLEN
/ 2; i
++) {
12941 AdvReadWordLram(iop_base
, ASC_MC_BIOSMEM
+ (2 * i
),
12946 * Save current per TID negotiated values.
12948 if (bios_mem
[(ASC_MC_BIOS_SIGNATURE
- ASC_MC_BIOSMEM
) / 2] == 0x55AA) {
12949 ushort bios_version
, major
, minor
;
12952 bios_mem
[(ASC_MC_BIOS_VERSION
- ASC_MC_BIOSMEM
) / 2];
12953 major
= (bios_version
>> 12) & 0xF;
12954 minor
= (bios_version
>> 8) & 0xF;
12955 if (major
< 3 || (major
== 3 && minor
== 1)) {
12956 /* BIOS 3.1 and earlier location of 'wdtr_able' variable. */
12957 AdvReadWordLram(iop_base
, 0x120, wdtr_able
);
12959 AdvReadWordLram(iop_base
, ASC_MC_WDTR_ABLE
, wdtr_able
);
12962 AdvReadWordLram(iop_base
, ASC_MC_SDTR_ABLE
, sdtr_able
);
12963 AdvReadWordLram(iop_base
, ASC_MC_TAGQNG_ABLE
, tagqng_able
);
12964 for (tid
= 0; tid
<= ADV_MAX_TID
; tid
++) {
12965 AdvReadByteLram(iop_base
, ASC_MC_NUMBER_OF_MAX_CMD
+ tid
,
12970 * Load the Microcode
12972 * Write the microcode image to RISC memory starting at address 0.
12974 AdvWriteWordRegister(iop_base
, IOPW_RAM_ADDR
, 0);
12975 /* Assume the following compressed format of the microcode buffer:
12977 * 254 word (508 byte) table indexed by byte code followed
12978 * by the following byte codes:
12981 * 00: Emit word 0 in table.
12982 * 01: Emit word 1 in table.
12984 * FD: Emit word 253 in table.
12987 * FE WW WW: (3 byte code) Word to emit is the next word WW WW.
12988 * FF BB WW WW: (4 byte code) Emit BB count times next word WW WW.
12991 for (i
= 253 * 2; i
< _adv_asc3550_size
; i
++) {
12992 if (_adv_asc3550_buf
[i
] == 0xff) {
12993 for (j
= 0; j
< _adv_asc3550_buf
[i
+ 1]; j
++) {
12994 AdvWriteWordAutoIncLram(iop_base
, (((ushort
)
13003 } else if (_adv_asc3550_buf
[i
] == 0xfe) {
13004 AdvWriteWordAutoIncLram(iop_base
, (((ushort
)
13005 _adv_asc3550_buf
[i
+
13008 _adv_asc3550_buf
[i
+
13013 AdvWriteWordAutoIncLram(iop_base
, (((ushort
)
13014 _adv_asc3550_buf
[(_adv_asc3550_buf
[i
] * 2) + 1] << 8) | _adv_asc3550_buf
[_adv_asc3550_buf
[i
] * 2]));
13020 * Set 'word' for later use to clear the rest of memory and save
13021 * the expanded mcode size.
13024 adv_asc3550_expanded_size
= word
;
13027 * Clear the rest of ASC-3550 Internal RAM (8KB).
13029 for (; word
< ADV_3550_MEMSIZE
; word
+= 2) {
13030 AdvWriteWordAutoIncLram(iop_base
, 0);
13034 * Verify the microcode checksum.
13037 AdvWriteWordRegister(iop_base
, IOPW_RAM_ADDR
, 0);
13039 for (word
= 0; word
< adv_asc3550_expanded_size
; word
+= 2) {
13040 sum
+= AdvReadWordAutoIncLram(iop_base
);
13043 if (sum
!= _adv_asc3550_chksum
) {
13044 asc_dvc
->err_code
|= ASC_IERR_MCODE_CHKSUM
;
13049 * Restore the RISC memory BIOS region.
13051 for (i
= 0; i
< ASC_MC_BIOSLEN
/ 2; i
++) {
13052 AdvWriteWordLram(iop_base
, ASC_MC_BIOSMEM
+ (2 * i
),
13057 * Calculate and write the microcode code checksum to the microcode
13058 * code checksum location ASC_MC_CODE_CHK_SUM (0x2C).
13060 AdvReadWordLram(iop_base
, ASC_MC_CODE_BEGIN_ADDR
, begin_addr
);
13061 AdvReadWordLram(iop_base
, ASC_MC_CODE_END_ADDR
, end_addr
);
13063 AdvWriteWordRegister(iop_base
, IOPW_RAM_ADDR
, begin_addr
);
13064 for (word
= begin_addr
; word
< end_addr
; word
+= 2) {
13065 code_sum
+= AdvReadWordAutoIncLram(iop_base
);
13067 AdvWriteWordLram(iop_base
, ASC_MC_CODE_CHK_SUM
, code_sum
);
13070 * Read and save microcode version and date.
13072 AdvReadWordLram(iop_base
, ASC_MC_VERSION_DATE
,
13073 asc_dvc
->cfg
->mcode_date
);
13074 AdvReadWordLram(iop_base
, ASC_MC_VERSION_NUM
,
13075 asc_dvc
->cfg
->mcode_version
);
13078 * Set the chip type to indicate the ASC3550.
13080 AdvWriteWordLram(iop_base
, ASC_MC_CHIP_TYPE
, ADV_CHIP_ASC3550
);
13083 * If the PCI Configuration Command Register "Parity Error Response
13084 * Control" Bit was clear (0), then set the microcode variable
13085 * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
13086 * to ignore DMA parity errors.
13088 if (asc_dvc
->cfg
->control_flag
& CONTROL_FLAG_IGNORE_PERR
) {
13089 AdvReadWordLram(iop_base
, ASC_MC_CONTROL_FLAG
, word
);
13090 word
|= CONTROL_FLAG_IGNORE_PERR
;
13091 AdvWriteWordLram(iop_base
, ASC_MC_CONTROL_FLAG
, word
);
13095 * For ASC-3550, setting the START_CTL_EMFU [3:2] bits sets a FIFO
13096 * threshold of 128 bytes. This register is only accessible to the host.
13098 AdvWriteByteRegister(iop_base
, IOPB_DMA_CFG0
,
13099 START_CTL_EMFU
| READ_CMD_MRM
);
13102 * Microcode operating variables for WDTR, SDTR, and command tag
13103 * queuing will be set in slave_configure() based on what a
13104 * device reports it is capable of in Inquiry byte 7.
13106 * If SCSI Bus Resets have been disabled, then directly set
13107 * SDTR and WDTR from the EEPROM configuration. This will allow
13108 * the BIOS and warm boot to work without a SCSI bus hang on
13109 * the Inquiry caused by host and target mismatched DTR values.
13110 * Without the SCSI Bus Reset, before an Inquiry a device can't
13111 * be assumed to be in Asynchronous, Narrow mode.
13113 if ((asc_dvc
->bios_ctrl
& BIOS_CTRL_RESET_SCSI_BUS
) == 0) {
13114 AdvWriteWordLram(iop_base
, ASC_MC_WDTR_ABLE
,
13115 asc_dvc
->wdtr_able
);
13116 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_ABLE
,
13117 asc_dvc
->sdtr_able
);
13121 * Set microcode operating variables for SDTR_SPEED1, SDTR_SPEED2,
13122 * SDTR_SPEED3, and SDTR_SPEED4 based on the ULTRA EEPROM per TID
13123 * bitmask. These values determine the maximum SDTR speed negotiated
13126 * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2,
13127 * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them
13128 * without determining here whether the device supports SDTR.
13130 * 4-bit speed SDTR speed name
13131 * =========== ===============
13132 * 0000b (0x0) SDTR disabled
13133 * 0001b (0x1) 5 Mhz
13134 * 0010b (0x2) 10 Mhz
13135 * 0011b (0x3) 20 Mhz (Ultra)
13136 * 0100b (0x4) 40 Mhz (LVD/Ultra2)
13137 * 0101b (0x5) 80 Mhz (LVD2/Ultra3)
13138 * 0110b (0x6) Undefined
13140 * 1111b (0xF) Undefined
13143 for (tid
= 0; tid
<= ADV_MAX_TID
; tid
++) {
13144 if (ADV_TID_TO_TIDMASK(tid
) & asc_dvc
->ultra_able
) {
13145 /* Set Ultra speed for TID 'tid'. */
13146 word
|= (0x3 << (4 * (tid
% 4)));
13148 /* Set Fast speed for TID 'tid'. */
13149 word
|= (0x2 << (4 * (tid
% 4)));
13151 if (tid
== 3) { /* Check if done with sdtr_speed1. */
13152 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED1
, word
);
13154 } else if (tid
== 7) { /* Check if done with sdtr_speed2. */
13155 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED2
, word
);
13157 } else if (tid
== 11) { /* Check if done with sdtr_speed3. */
13158 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED3
, word
);
13160 } else if (tid
== 15) { /* Check if done with sdtr_speed4. */
13161 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED4
, word
);
13167 * Set microcode operating variable for the disconnect per TID bitmask.
13169 AdvWriteWordLram(iop_base
, ASC_MC_DISC_ENABLE
,
13170 asc_dvc
->cfg
->disc_enable
);
13173 * Set SCSI_CFG0 Microcode Default Value.
13175 * The microcode will set the SCSI_CFG0 register using this value
13176 * after it is started below.
13178 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_SCSI_CFG0
,
13179 PARITY_EN
| QUEUE_128
| SEL_TMO_LONG
| OUR_ID_EN
|
13180 asc_dvc
->chip_scsi_id
);
13183 * Determine SCSI_CFG1 Microcode Default Value.
13185 * The microcode will set the SCSI_CFG1 register using this value
13186 * after it is started below.
13189 /* Read current SCSI_CFG1 Register value. */
13190 scsi_cfg1
= AdvReadWordRegister(iop_base
, IOPW_SCSI_CFG1
);
13193 * If all three connectors are in use, return an error.
13195 if ((scsi_cfg1
& CABLE_ILLEGAL_A
) == 0 ||
13196 (scsi_cfg1
& CABLE_ILLEGAL_B
) == 0) {
13197 asc_dvc
->err_code
|= ASC_IERR_ILLEGAL_CONNECTION
;
13202 * If the internal narrow cable is reversed all of the SCSI_CTRL
13203 * register signals will be set. Check for and return an error if
13204 * this condition is found.
13206 if ((AdvReadWordRegister(iop_base
, IOPW_SCSI_CTRL
) & 0x3F07) == 0x3F07) {
13207 asc_dvc
->err_code
|= ASC_IERR_REVERSED_CABLE
;
13212 * If this is a differential board and a single-ended device
13213 * is attached to one of the connectors, return an error.
13215 if ((scsi_cfg1
& DIFF_MODE
) && (scsi_cfg1
& DIFF_SENSE
) == 0) {
13216 asc_dvc
->err_code
|= ASC_IERR_SINGLE_END_DEVICE
;
13221 * If automatic termination control is enabled, then set the
13222 * termination value based on a table listed in a_condor.h.
13224 * If manual termination was specified with an EEPROM setting
13225 * then 'termination' was set-up in AdvInitFrom3550EEPROM() and
13226 * is ready to be 'ored' into SCSI_CFG1.
13228 if (asc_dvc
->cfg
->termination
== 0) {
13230 * The software always controls termination by setting TERM_CTL_SEL.
13231 * If TERM_CTL_SEL were set to 0, the hardware would set termination.
13233 asc_dvc
->cfg
->termination
|= TERM_CTL_SEL
;
13235 switch (scsi_cfg1
& CABLE_DETECT
) {
13236 /* TERM_CTL_H: on, TERM_CTL_L: on */
13243 asc_dvc
->cfg
->termination
|= (TERM_CTL_H
| TERM_CTL_L
);
13246 /* TERM_CTL_H: on, TERM_CTL_L: off */
13252 asc_dvc
->cfg
->termination
|= TERM_CTL_H
;
13255 /* TERM_CTL_H: off, TERM_CTL_L: off */
13263 * Clear any set TERM_CTL_H and TERM_CTL_L bits.
13265 scsi_cfg1
&= ~TERM_CTL
;
13268 * Invert the TERM_CTL_H and TERM_CTL_L bits and then
13269 * set 'scsi_cfg1'. The TERM_POL bit does not need to be
13270 * referenced, because the hardware internally inverts
13271 * the Termination High and Low bits if TERM_POL is set.
13273 scsi_cfg1
|= (TERM_CTL_SEL
| (~asc_dvc
->cfg
->termination
& TERM_CTL
));
13276 * Set SCSI_CFG1 Microcode Default Value
13278 * Set filter value and possibly modified termination control
13279 * bits in the Microcode SCSI_CFG1 Register Value.
13281 * The microcode will set the SCSI_CFG1 register using this value
13282 * after it is started below.
13284 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_SCSI_CFG1
,
13285 FLTR_DISABLE
| scsi_cfg1
);
13288 * Set MEM_CFG Microcode Default Value
13290 * The microcode will set the MEM_CFG register using this value
13291 * after it is started below.
13293 * MEM_CFG may be accessed as a word or byte, but only bits 0-7
13296 * ASC-3550 has 8KB internal memory.
13298 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_MEM_CFG
,
13299 BIOS_EN
| RAM_SZ_8KB
);
13302 * Set SEL_MASK Microcode Default Value
13304 * The microcode will set the SEL_MASK register using this value
13305 * after it is started below.
13307 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_SEL_MASK
,
13308 ADV_TID_TO_TIDMASK(asc_dvc
->chip_scsi_id
));
13311 * Build carrier freelist.
13313 * Driver must have already allocated memory and set 'carrier_buf'.
13315 ASC_ASSERT(asc_dvc
->carrier_buf
!= NULL
);
13317 carrp
= (ADV_CARR_T
*) ADV_16BALIGN(asc_dvc
->carrier_buf
);
13318 asc_dvc
->carr_freelist
= NULL
;
13319 if (carrp
== (ADV_CARR_T
*) asc_dvc
->carrier_buf
) {
13320 buf_size
= ADV_CARRIER_BUFSIZE
;
13322 buf_size
= ADV_CARRIER_BUFSIZE
- sizeof(ADV_CARR_T
);
13327 * Get physical address of the carrier 'carrp'.
13329 contig_len
= sizeof(ADV_CARR_T
);
13331 cpu_to_le32(DvcGetPhyAddr
13332 (asc_dvc
, NULL
, (uchar
*)carrp
,
13333 (ADV_SDCNT
*)&contig_len
,
13334 ADV_IS_CARRIER_FLAG
));
13336 buf_size
-= sizeof(ADV_CARR_T
);
13339 * If the current carrier is not physically contiguous, then
13340 * maybe there was a page crossing. Try the next carrier aligned
13343 if (contig_len
< sizeof(ADV_CARR_T
)) {
13348 carrp
->carr_pa
= carr_paddr
;
13349 carrp
->carr_va
= cpu_to_le32(ADV_VADDR_TO_U32(carrp
));
13352 * Insert the carrier at the beginning of the freelist.
13355 cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc
->carr_freelist
));
13356 asc_dvc
->carr_freelist
= carrp
;
13360 while (buf_size
> 0);
13363 * Set-up the Host->RISC Initiator Command Queue (ICQ).
13366 if ((asc_dvc
->icq_sp
= asc_dvc
->carr_freelist
) == NULL
) {
13367 asc_dvc
->err_code
|= ASC_IERR_NO_CARRIER
;
13370 asc_dvc
->carr_freelist
= (ADV_CARR_T
*)
13371 ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc
->icq_sp
->next_vpa
));
13374 * The first command issued will be placed in the stopper carrier.
13376 asc_dvc
->icq_sp
->next_vpa
= cpu_to_le32(ASC_CQ_STOPPER
);
13379 * Set RISC ICQ physical address start value.
13381 AdvWriteDWordLramNoSwap(iop_base
, ASC_MC_ICQ
, asc_dvc
->icq_sp
->carr_pa
);
13384 * Set-up the RISC->Host Initiator Response Queue (IRQ).
13386 if ((asc_dvc
->irq_sp
= asc_dvc
->carr_freelist
) == NULL
) {
13387 asc_dvc
->err_code
|= ASC_IERR_NO_CARRIER
;
13390 asc_dvc
->carr_freelist
= (ADV_CARR_T
*)
13391 ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc
->irq_sp
->next_vpa
));
13394 * The first command completed by the RISC will be placed in
13397 * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is
13398 * completed the RISC will set the ASC_RQ_STOPPER bit.
13400 asc_dvc
->irq_sp
->next_vpa
= cpu_to_le32(ASC_CQ_STOPPER
);
13403 * Set RISC IRQ physical address start value.
13405 AdvWriteDWordLramNoSwap(iop_base
, ASC_MC_IRQ
, asc_dvc
->irq_sp
->carr_pa
);
13406 asc_dvc
->carr_pending_cnt
= 0;
13408 AdvWriteByteRegister(iop_base
, IOPB_INTR_ENABLES
,
13409 (ADV_INTR_ENABLE_HOST_INTR
|
13410 ADV_INTR_ENABLE_GLOBAL_INTR
));
13412 AdvReadWordLram(iop_base
, ASC_MC_CODE_BEGIN_ADDR
, word
);
13413 AdvWriteWordRegister(iop_base
, IOPW_PC
, word
);
13415 /* finally, finally, gentlemen, start your engine */
13416 AdvWriteWordRegister(iop_base
, IOPW_RISC_CSR
, ADV_RISC_CSR_RUN
);
13419 * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus
13420 * Resets should be performed. The RISC has to be running
13421 * to issue a SCSI Bus Reset.
13423 if (asc_dvc
->bios_ctrl
& BIOS_CTRL_RESET_SCSI_BUS
) {
13425 * If the BIOS Signature is present in memory, restore the
13426 * BIOS Handshake Configuration Table and do not perform
13427 * a SCSI Bus Reset.
13429 if (bios_mem
[(ASC_MC_BIOS_SIGNATURE
- ASC_MC_BIOSMEM
) / 2] ==
13432 * Restore per TID negotiated values.
13434 AdvWriteWordLram(iop_base
, ASC_MC_WDTR_ABLE
, wdtr_able
);
13435 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_ABLE
, sdtr_able
);
13436 AdvWriteWordLram(iop_base
, ASC_MC_TAGQNG_ABLE
,
13438 for (tid
= 0; tid
<= ADV_MAX_TID
; tid
++) {
13439 AdvWriteByteLram(iop_base
,
13440 ASC_MC_NUMBER_OF_MAX_CMD
+ tid
,
13444 if (AdvResetSB(asc_dvc
) != ADV_TRUE
) {
13445 warn_code
= ASC_WARN_BUSRESET_ERROR
;
13454 * Initialize the ASC-38C0800.
13456 * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR.
13458 * For a non-fatal error return a warning code. If there are no warnings
13459 * then 0 is returned.
13461 * Needed after initialization for error recovery.
13463 static int AdvInitAsc38C0800Driver(ADV_DVC_VAR
*asc_dvc
)
13465 AdvPortAddr iop_base
;
13473 int adv_asc38C0800_expanded_size
;
13475 ADV_DCNT contig_len
;
13476 ADV_SDCNT buf_size
;
13477 ADV_PADDR carr_paddr
;
13482 ushort bios_mem
[ASC_MC_BIOSLEN
/ 2]; /* BIOS RISC Memory 0x40-0x8F. */
13483 ushort wdtr_able
, sdtr_able
, tagqng_able
;
13484 uchar max_cmd
[ADV_MAX_TID
+ 1];
13486 /* If there is already an error, don't continue. */
13487 if (asc_dvc
->err_code
!= 0) {
13492 * The caller must set 'chip_type' to ADV_CHIP_ASC38C0800.
13494 if (asc_dvc
->chip_type
!= ADV_CHIP_ASC38C0800
) {
13495 asc_dvc
->err_code
= ASC_IERR_BAD_CHIPTYPE
;
13500 iop_base
= asc_dvc
->iop_base
;
13503 * Save the RISC memory BIOS region before writing the microcode.
13504 * The BIOS may already be loaded and using its RISC LRAM region
13505 * so its region must be saved and restored.
13507 * Note: This code makes the assumption, which is currently true,
13508 * that a chip reset does not clear RISC LRAM.
13510 for (i
= 0; i
< ASC_MC_BIOSLEN
/ 2; i
++) {
13511 AdvReadWordLram(iop_base
, ASC_MC_BIOSMEM
+ (2 * i
),
13516 * Save current per TID negotiated values.
13518 AdvReadWordLram(iop_base
, ASC_MC_WDTR_ABLE
, wdtr_able
);
13519 AdvReadWordLram(iop_base
, ASC_MC_SDTR_ABLE
, sdtr_able
);
13520 AdvReadWordLram(iop_base
, ASC_MC_TAGQNG_ABLE
, tagqng_able
);
13521 for (tid
= 0; tid
<= ADV_MAX_TID
; tid
++) {
13522 AdvReadByteLram(iop_base
, ASC_MC_NUMBER_OF_MAX_CMD
+ tid
,
13527 * RAM BIST (RAM Built-In Self Test)
13529 * Address : I/O base + offset 0x38h register (byte).
13530 * Function: Bit 7-6(RW) : RAM mode
13531 * Normal Mode : 0x00
13532 * Pre-test Mode : 0x40
13533 * RAM Test Mode : 0x80
13535 * Bit 4(RO) : Done bit
13536 * Bit 3-0(RO) : Status
13537 * Host Error : 0x08
13538 * Int_RAM Error : 0x04
13539 * RISC Error : 0x02
13540 * SCSI Error : 0x01
13543 * Note: RAM BIST code should be put right here, before loading the
13544 * microcode and after saving the RISC memory BIOS region.
13550 * Write PRE_TEST_MODE (0x40) to register and wait for 10 milliseconds.
13551 * If Done bit not set or low nibble not PRE_TEST_VALUE (0x05), return
13552 * an error. Reset to NORMAL_MODE (0x00) and do again. If cannot reset
13553 * to NORMAL_MODE, return an error too.
13555 for (i
= 0; i
< 2; i
++) {
13556 AdvWriteByteRegister(iop_base
, IOPB_RAM_BIST
, PRE_TEST_MODE
);
13557 DvcSleepMilliSecond(10); /* Wait for 10ms before reading back. */
13558 byte
= AdvReadByteRegister(iop_base
, IOPB_RAM_BIST
);
13559 if ((byte
& RAM_TEST_DONE
) == 0
13560 || (byte
& 0x0F) != PRE_TEST_VALUE
) {
13561 asc_dvc
->err_code
|= ASC_IERR_BIST_PRE_TEST
;
13565 AdvWriteByteRegister(iop_base
, IOPB_RAM_BIST
, NORMAL_MODE
);
13566 DvcSleepMilliSecond(10); /* Wait for 10ms before reading back. */
13567 if (AdvReadByteRegister(iop_base
, IOPB_RAM_BIST
)
13569 asc_dvc
->err_code
|= ASC_IERR_BIST_PRE_TEST
;
13575 * LRAM Test - It takes about 1.5 ms to run through the test.
13577 * Write RAM_TEST_MODE (0x80) to register and wait for 10 milliseconds.
13578 * If Done bit not set or Status not 0, save register byte, set the
13579 * err_code, and return an error.
13581 AdvWriteByteRegister(iop_base
, IOPB_RAM_BIST
, RAM_TEST_MODE
);
13582 DvcSleepMilliSecond(10); /* Wait for 10ms before checking status. */
13584 byte
= AdvReadByteRegister(iop_base
, IOPB_RAM_BIST
);
13585 if ((byte
& RAM_TEST_DONE
) == 0 || (byte
& RAM_TEST_STATUS
) != 0) {
13586 /* Get here if Done bit not set or Status not 0. */
13587 asc_dvc
->bist_err_code
= byte
; /* for BIOS display message */
13588 asc_dvc
->err_code
|= ASC_IERR_BIST_RAM_TEST
;
13592 /* We need to reset back to normal mode after LRAM test passes. */
13593 AdvWriteByteRegister(iop_base
, IOPB_RAM_BIST
, NORMAL_MODE
);
13596 * Load the Microcode
13598 * Write the microcode image to RISC memory starting at address 0.
13601 AdvWriteWordRegister(iop_base
, IOPW_RAM_ADDR
, 0);
13603 /* Assume the following compressed format of the microcode buffer:
13605 * 254 word (508 byte) table indexed by byte code followed
13606 * by the following byte codes:
13609 * 00: Emit word 0 in table.
13610 * 01: Emit word 1 in table.
13612 * FD: Emit word 253 in table.
13615 * FE WW WW: (3 byte code) Word to emit is the next word WW WW.
13616 * FF BB WW WW: (4 byte code) Emit BB count times next word WW WW.
13619 for (i
= 253 * 2; i
< _adv_asc38C0800_size
; i
++) {
13620 if (_adv_asc38C0800_buf
[i
] == 0xff) {
13621 for (j
= 0; j
< _adv_asc38C0800_buf
[i
+ 1]; j
++) {
13622 AdvWriteWordAutoIncLram(iop_base
, (((ushort
)
13623 _adv_asc38C0800_buf
13626 _adv_asc38C0800_buf
13631 } else if (_adv_asc38C0800_buf
[i
] == 0xfe) {
13632 AdvWriteWordAutoIncLram(iop_base
, (((ushort
)
13633 _adv_asc38C0800_buf
13636 _adv_asc38C0800_buf
[i
13642 AdvWriteWordAutoIncLram(iop_base
, (((ushort
)
13643 _adv_asc38C0800_buf
[(_adv_asc38C0800_buf
[i
] * 2) + 1] << 8) | _adv_asc38C0800_buf
[_adv_asc38C0800_buf
[i
] * 2]));
13649 * Set 'word' for later use to clear the rest of memory and save
13650 * the expanded mcode size.
13653 adv_asc38C0800_expanded_size
= word
;
13656 * Clear the rest of ASC-38C0800 Internal RAM (16KB).
13658 for (; word
< ADV_38C0800_MEMSIZE
; word
+= 2) {
13659 AdvWriteWordAutoIncLram(iop_base
, 0);
13663 * Verify the microcode checksum.
13666 AdvWriteWordRegister(iop_base
, IOPW_RAM_ADDR
, 0);
13668 for (word
= 0; word
< adv_asc38C0800_expanded_size
; word
+= 2) {
13669 sum
+= AdvReadWordAutoIncLram(iop_base
);
13671 ASC_DBG2(1, "AdvInitAsc38C0800Driver: word %d, i %d\n", word
, i
);
13674 "AdvInitAsc38C0800Driver: sum 0x%lx, _adv_asc38C0800_chksum 0x%lx\n",
13675 (ulong
)sum
, (ulong
)_adv_asc38C0800_chksum
);
13677 if (sum
!= _adv_asc38C0800_chksum
) {
13678 asc_dvc
->err_code
|= ASC_IERR_MCODE_CHKSUM
;
13683 * Restore the RISC memory BIOS region.
13685 for (i
= 0; i
< ASC_MC_BIOSLEN
/ 2; i
++) {
13686 AdvWriteWordLram(iop_base
, ASC_MC_BIOSMEM
+ (2 * i
),
13691 * Calculate and write the microcode code checksum to the microcode
13692 * code checksum location ASC_MC_CODE_CHK_SUM (0x2C).
13694 AdvReadWordLram(iop_base
, ASC_MC_CODE_BEGIN_ADDR
, begin_addr
);
13695 AdvReadWordLram(iop_base
, ASC_MC_CODE_END_ADDR
, end_addr
);
13697 AdvWriteWordRegister(iop_base
, IOPW_RAM_ADDR
, begin_addr
);
13698 for (word
= begin_addr
; word
< end_addr
; word
+= 2) {
13699 code_sum
+= AdvReadWordAutoIncLram(iop_base
);
13701 AdvWriteWordLram(iop_base
, ASC_MC_CODE_CHK_SUM
, code_sum
);
13704 * Read microcode version and date.
13706 AdvReadWordLram(iop_base
, ASC_MC_VERSION_DATE
,
13707 asc_dvc
->cfg
->mcode_date
);
13708 AdvReadWordLram(iop_base
, ASC_MC_VERSION_NUM
,
13709 asc_dvc
->cfg
->mcode_version
);
13712 * Set the chip type to indicate the ASC38C0800.
13714 AdvWriteWordLram(iop_base
, ASC_MC_CHIP_TYPE
, ADV_CHIP_ASC38C0800
);
13717 * Write 1 to bit 14 'DIS_TERM_DRV' in the SCSI_CFG1 register.
13718 * When DIS_TERM_DRV set to 1, C_DET[3:0] will reflect current
13719 * cable detection and then we are able to read C_DET[3:0].
13721 * Note: We will reset DIS_TERM_DRV to 0 in the 'Set SCSI_CFG1
13722 * Microcode Default Value' section below.
13724 scsi_cfg1
= AdvReadWordRegister(iop_base
, IOPW_SCSI_CFG1
);
13725 AdvWriteWordRegister(iop_base
, IOPW_SCSI_CFG1
,
13726 scsi_cfg1
| DIS_TERM_DRV
);
13729 * If the PCI Configuration Command Register "Parity Error Response
13730 * Control" Bit was clear (0), then set the microcode variable
13731 * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
13732 * to ignore DMA parity errors.
13734 if (asc_dvc
->cfg
->control_flag
& CONTROL_FLAG_IGNORE_PERR
) {
13735 AdvReadWordLram(iop_base
, ASC_MC_CONTROL_FLAG
, word
);
13736 word
|= CONTROL_FLAG_IGNORE_PERR
;
13737 AdvWriteWordLram(iop_base
, ASC_MC_CONTROL_FLAG
, word
);
13741 * For ASC-38C0800, set FIFO_THRESH_80B [6:4] bits and START_CTL_TH [3:2]
13742 * bits for the default FIFO threshold.
13744 * Note: ASC-38C0800 FIFO threshold has been changed to 256 bytes.
13746 * For DMA Errata #4 set the BC_THRESH_ENB bit.
13748 AdvWriteByteRegister(iop_base
, IOPB_DMA_CFG0
,
13749 BC_THRESH_ENB
| FIFO_THRESH_80B
| START_CTL_TH
|
13753 * Microcode operating variables for WDTR, SDTR, and command tag
13754 * queuing will be set in slave_configure() based on what a
13755 * device reports it is capable of in Inquiry byte 7.
13757 * If SCSI Bus Resets have been disabled, then directly set
13758 * SDTR and WDTR from the EEPROM configuration. This will allow
13759 * the BIOS and warm boot to work without a SCSI bus hang on
13760 * the Inquiry caused by host and target mismatched DTR values.
13761 * Without the SCSI Bus Reset, before an Inquiry a device can't
13762 * be assumed to be in Asynchronous, Narrow mode.
13764 if ((asc_dvc
->bios_ctrl
& BIOS_CTRL_RESET_SCSI_BUS
) == 0) {
13765 AdvWriteWordLram(iop_base
, ASC_MC_WDTR_ABLE
,
13766 asc_dvc
->wdtr_able
);
13767 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_ABLE
,
13768 asc_dvc
->sdtr_able
);
13772 * Set microcode operating variables for DISC and SDTR_SPEED1,
13773 * SDTR_SPEED2, SDTR_SPEED3, and SDTR_SPEED4 based on the EEPROM
13774 * configuration values.
13776 * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2,
13777 * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them
13778 * without determining here whether the device supports SDTR.
13780 AdvWriteWordLram(iop_base
, ASC_MC_DISC_ENABLE
,
13781 asc_dvc
->cfg
->disc_enable
);
13782 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED1
, asc_dvc
->sdtr_speed1
);
13783 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED2
, asc_dvc
->sdtr_speed2
);
13784 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED3
, asc_dvc
->sdtr_speed3
);
13785 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED4
, asc_dvc
->sdtr_speed4
);
13788 * Set SCSI_CFG0 Microcode Default Value.
13790 * The microcode will set the SCSI_CFG0 register using this value
13791 * after it is started below.
13793 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_SCSI_CFG0
,
13794 PARITY_EN
| QUEUE_128
| SEL_TMO_LONG
| OUR_ID_EN
|
13795 asc_dvc
->chip_scsi_id
);
13798 * Determine SCSI_CFG1 Microcode Default Value.
13800 * The microcode will set the SCSI_CFG1 register using this value
13801 * after it is started below.
13804 /* Read current SCSI_CFG1 Register value. */
13805 scsi_cfg1
= AdvReadWordRegister(iop_base
, IOPW_SCSI_CFG1
);
13808 * If the internal narrow cable is reversed all of the SCSI_CTRL
13809 * register signals will be set. Check for and return an error if
13810 * this condition is found.
13812 if ((AdvReadWordRegister(iop_base
, IOPW_SCSI_CTRL
) & 0x3F07) == 0x3F07) {
13813 asc_dvc
->err_code
|= ASC_IERR_REVERSED_CABLE
;
13818 * All kind of combinations of devices attached to one of four connectors
13819 * are acceptable except HVD device attached. For example, LVD device can
13820 * be attached to SE connector while SE device attached to LVD connector.
13821 * If LVD device attached to SE connector, it only runs up to Ultra speed.
13823 * If an HVD device is attached to one of LVD connectors, return an error.
13824 * However, there is no way to detect HVD device attached to SE connectors.
13826 if (scsi_cfg1
& HVD
) {
13827 asc_dvc
->err_code
|= ASC_IERR_HVD_DEVICE
;
13832 * If either SE or LVD automatic termination control is enabled, then
13833 * set the termination value based on a table listed in a_condor.h.
13835 * If manual termination was specified with an EEPROM setting then
13836 * 'termination' was set-up in AdvInitFrom38C0800EEPROM() and is ready to
13837 * be 'ored' into SCSI_CFG1.
13839 if ((asc_dvc
->cfg
->termination
& TERM_SE
) == 0) {
13840 /* SE automatic termination control is enabled. */
13841 switch (scsi_cfg1
& C_DET_SE
) {
13842 /* TERM_SE_HI: on, TERM_SE_LO: on */
13846 asc_dvc
->cfg
->termination
|= TERM_SE
;
13849 /* TERM_SE_HI: on, TERM_SE_LO: off */
13851 asc_dvc
->cfg
->termination
|= TERM_SE_HI
;
13856 if ((asc_dvc
->cfg
->termination
& TERM_LVD
) == 0) {
13857 /* LVD automatic termination control is enabled. */
13858 switch (scsi_cfg1
& C_DET_LVD
) {
13859 /* TERM_LVD_HI: on, TERM_LVD_LO: on */
13863 asc_dvc
->cfg
->termination
|= TERM_LVD
;
13866 /* TERM_LVD_HI: off, TERM_LVD_LO: off */
13873 * Clear any set TERM_SE and TERM_LVD bits.
13875 scsi_cfg1
&= (~TERM_SE
& ~TERM_LVD
);
13878 * Invert the TERM_SE and TERM_LVD bits and then set 'scsi_cfg1'.
13880 scsi_cfg1
|= (~asc_dvc
->cfg
->termination
& 0xF0);
13883 * Clear BIG_ENDIAN, DIS_TERM_DRV, Terminator Polarity and HVD/LVD/SE bits
13884 * and set possibly modified termination control bits in the Microcode
13885 * SCSI_CFG1 Register Value.
13887 scsi_cfg1
&= (~BIG_ENDIAN
& ~DIS_TERM_DRV
& ~TERM_POL
& ~HVD_LVD_SE
);
13890 * Set SCSI_CFG1 Microcode Default Value
13892 * Set possibly modified termination control and reset DIS_TERM_DRV
13893 * bits in the Microcode SCSI_CFG1 Register Value.
13895 * The microcode will set the SCSI_CFG1 register using this value
13896 * after it is started below.
13898 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_SCSI_CFG1
, scsi_cfg1
);
13901 * Set MEM_CFG Microcode Default Value
13903 * The microcode will set the MEM_CFG register using this value
13904 * after it is started below.
13906 * MEM_CFG may be accessed as a word or byte, but only bits 0-7
13909 * ASC-38C0800 has 16KB internal memory.
13911 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_MEM_CFG
,
13912 BIOS_EN
| RAM_SZ_16KB
);
13915 * Set SEL_MASK Microcode Default Value
13917 * The microcode will set the SEL_MASK register using this value
13918 * after it is started below.
13920 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_SEL_MASK
,
13921 ADV_TID_TO_TIDMASK(asc_dvc
->chip_scsi_id
));
13924 * Build the carrier freelist.
13926 * Driver must have already allocated memory and set 'carrier_buf'.
13928 ASC_ASSERT(asc_dvc
->carrier_buf
!= NULL
);
13930 carrp
= (ADV_CARR_T
*) ADV_16BALIGN(asc_dvc
->carrier_buf
);
13931 asc_dvc
->carr_freelist
= NULL
;
13932 if (carrp
== (ADV_CARR_T
*) asc_dvc
->carrier_buf
) {
13933 buf_size
= ADV_CARRIER_BUFSIZE
;
13935 buf_size
= ADV_CARRIER_BUFSIZE
- sizeof(ADV_CARR_T
);
13940 * Get physical address for the carrier 'carrp'.
13942 contig_len
= sizeof(ADV_CARR_T
);
13944 cpu_to_le32(DvcGetPhyAddr
13945 (asc_dvc
, NULL
, (uchar
*)carrp
,
13946 (ADV_SDCNT
*)&contig_len
,
13947 ADV_IS_CARRIER_FLAG
));
13949 buf_size
-= sizeof(ADV_CARR_T
);
13952 * If the current carrier is not physically contiguous, then
13953 * maybe there was a page crossing. Try the next carrier aligned
13956 if (contig_len
< sizeof(ADV_CARR_T
)) {
13961 carrp
->carr_pa
= carr_paddr
;
13962 carrp
->carr_va
= cpu_to_le32(ADV_VADDR_TO_U32(carrp
));
13965 * Insert the carrier at the beginning of the freelist.
13968 cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc
->carr_freelist
));
13969 asc_dvc
->carr_freelist
= carrp
;
13973 while (buf_size
> 0);
13976 * Set-up the Host->RISC Initiator Command Queue (ICQ).
13979 if ((asc_dvc
->icq_sp
= asc_dvc
->carr_freelist
) == NULL
) {
13980 asc_dvc
->err_code
|= ASC_IERR_NO_CARRIER
;
13983 asc_dvc
->carr_freelist
= (ADV_CARR_T
*)
13984 ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc
->icq_sp
->next_vpa
));
13987 * The first command issued will be placed in the stopper carrier.
13989 asc_dvc
->icq_sp
->next_vpa
= cpu_to_le32(ASC_CQ_STOPPER
);
13992 * Set RISC ICQ physical address start value.
13993 * carr_pa is LE, must be native before write
13995 AdvWriteDWordLramNoSwap(iop_base
, ASC_MC_ICQ
, asc_dvc
->icq_sp
->carr_pa
);
13998 * Set-up the RISC->Host Initiator Response Queue (IRQ).
14000 if ((asc_dvc
->irq_sp
= asc_dvc
->carr_freelist
) == NULL
) {
14001 asc_dvc
->err_code
|= ASC_IERR_NO_CARRIER
;
14004 asc_dvc
->carr_freelist
= (ADV_CARR_T
*)
14005 ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc
->irq_sp
->next_vpa
));
14008 * The first command completed by the RISC will be placed in
14011 * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is
14012 * completed the RISC will set the ASC_RQ_STOPPER bit.
14014 asc_dvc
->irq_sp
->next_vpa
= cpu_to_le32(ASC_CQ_STOPPER
);
14017 * Set RISC IRQ physical address start value.
14019 * carr_pa is LE, must be native before write *
14021 AdvWriteDWordLramNoSwap(iop_base
, ASC_MC_IRQ
, asc_dvc
->irq_sp
->carr_pa
);
14022 asc_dvc
->carr_pending_cnt
= 0;
14024 AdvWriteByteRegister(iop_base
, IOPB_INTR_ENABLES
,
14025 (ADV_INTR_ENABLE_HOST_INTR
|
14026 ADV_INTR_ENABLE_GLOBAL_INTR
));
14028 AdvReadWordLram(iop_base
, ASC_MC_CODE_BEGIN_ADDR
, word
);
14029 AdvWriteWordRegister(iop_base
, IOPW_PC
, word
);
14031 /* finally, finally, gentlemen, start your engine */
14032 AdvWriteWordRegister(iop_base
, IOPW_RISC_CSR
, ADV_RISC_CSR_RUN
);
14035 * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus
14036 * Resets should be performed. The RISC has to be running
14037 * to issue a SCSI Bus Reset.
14039 if (asc_dvc
->bios_ctrl
& BIOS_CTRL_RESET_SCSI_BUS
) {
14041 * If the BIOS Signature is present in memory, restore the
14042 * BIOS Handshake Configuration Table and do not perform
14043 * a SCSI Bus Reset.
14045 if (bios_mem
[(ASC_MC_BIOS_SIGNATURE
- ASC_MC_BIOSMEM
) / 2] ==
14048 * Restore per TID negotiated values.
14050 AdvWriteWordLram(iop_base
, ASC_MC_WDTR_ABLE
, wdtr_able
);
14051 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_ABLE
, sdtr_able
);
14052 AdvWriteWordLram(iop_base
, ASC_MC_TAGQNG_ABLE
,
14054 for (tid
= 0; tid
<= ADV_MAX_TID
; tid
++) {
14055 AdvWriteByteLram(iop_base
,
14056 ASC_MC_NUMBER_OF_MAX_CMD
+ tid
,
14060 if (AdvResetSB(asc_dvc
) != ADV_TRUE
) {
14061 warn_code
= ASC_WARN_BUSRESET_ERROR
;
14070 * Initialize the ASC-38C1600.
14072 * On failure set the ASC_DVC_VAR field 'err_code' and return ADV_ERROR.
14074 * For a non-fatal error return a warning code. If there are no warnings
14075 * then 0 is returned.
14077 * Needed after initialization for error recovery.
14079 static int AdvInitAsc38C1600Driver(ADV_DVC_VAR
*asc_dvc
)
14081 AdvPortAddr iop_base
;
14089 int adv_asc38C1600_expanded_size
;
14091 ADV_DCNT contig_len
;
14092 ADV_SDCNT buf_size
;
14093 ADV_PADDR carr_paddr
;
14098 ushort bios_mem
[ASC_MC_BIOSLEN
/ 2]; /* BIOS RISC Memory 0x40-0x8F. */
14099 ushort wdtr_able
, sdtr_able
, ppr_able
, tagqng_able
;
14100 uchar max_cmd
[ASC_MAX_TID
+ 1];
14102 /* If there is already an error, don't continue. */
14103 if (asc_dvc
->err_code
!= 0) {
14108 * The caller must set 'chip_type' to ADV_CHIP_ASC38C1600.
14110 if (asc_dvc
->chip_type
!= ADV_CHIP_ASC38C1600
) {
14111 asc_dvc
->err_code
= ASC_IERR_BAD_CHIPTYPE
;
14116 iop_base
= asc_dvc
->iop_base
;
14119 * Save the RISC memory BIOS region before writing the microcode.
14120 * The BIOS may already be loaded and using its RISC LRAM region
14121 * so its region must be saved and restored.
14123 * Note: This code makes the assumption, which is currently true,
14124 * that a chip reset does not clear RISC LRAM.
14126 for (i
= 0; i
< ASC_MC_BIOSLEN
/ 2; i
++) {
14127 AdvReadWordLram(iop_base
, ASC_MC_BIOSMEM
+ (2 * i
),
14132 * Save current per TID negotiated values.
14134 AdvReadWordLram(iop_base
, ASC_MC_WDTR_ABLE
, wdtr_able
);
14135 AdvReadWordLram(iop_base
, ASC_MC_SDTR_ABLE
, sdtr_able
);
14136 AdvReadWordLram(iop_base
, ASC_MC_PPR_ABLE
, ppr_able
);
14137 AdvReadWordLram(iop_base
, ASC_MC_TAGQNG_ABLE
, tagqng_able
);
14138 for (tid
= 0; tid
<= ASC_MAX_TID
; tid
++) {
14139 AdvReadByteLram(iop_base
, ASC_MC_NUMBER_OF_MAX_CMD
+ tid
,
14144 * RAM BIST (Built-In Self Test)
14146 * Address : I/O base + offset 0x38h register (byte).
14147 * Function: Bit 7-6(RW) : RAM mode
14148 * Normal Mode : 0x00
14149 * Pre-test Mode : 0x40
14150 * RAM Test Mode : 0x80
14152 * Bit 4(RO) : Done bit
14153 * Bit 3-0(RO) : Status
14154 * Host Error : 0x08
14155 * Int_RAM Error : 0x04
14156 * RISC Error : 0x02
14157 * SCSI Error : 0x01
14160 * Note: RAM BIST code should be put right here, before loading the
14161 * microcode and after saving the RISC memory BIOS region.
14167 * Write PRE_TEST_MODE (0x40) to register and wait for 10 milliseconds.
14168 * If Done bit not set or low nibble not PRE_TEST_VALUE (0x05), return
14169 * an error. Reset to NORMAL_MODE (0x00) and do again. If cannot reset
14170 * to NORMAL_MODE, return an error too.
14172 for (i
= 0; i
< 2; i
++) {
14173 AdvWriteByteRegister(iop_base
, IOPB_RAM_BIST
, PRE_TEST_MODE
);
14174 DvcSleepMilliSecond(10); /* Wait for 10ms before reading back. */
14175 byte
= AdvReadByteRegister(iop_base
, IOPB_RAM_BIST
);
14176 if ((byte
& RAM_TEST_DONE
) == 0
14177 || (byte
& 0x0F) != PRE_TEST_VALUE
) {
14178 asc_dvc
->err_code
|= ASC_IERR_BIST_PRE_TEST
;
14182 AdvWriteByteRegister(iop_base
, IOPB_RAM_BIST
, NORMAL_MODE
);
14183 DvcSleepMilliSecond(10); /* Wait for 10ms before reading back. */
14184 if (AdvReadByteRegister(iop_base
, IOPB_RAM_BIST
)
14186 asc_dvc
->err_code
|= ASC_IERR_BIST_PRE_TEST
;
14192 * LRAM Test - It takes about 1.5 ms to run through the test.
14194 * Write RAM_TEST_MODE (0x80) to register and wait for 10 milliseconds.
14195 * If Done bit not set or Status not 0, save register byte, set the
14196 * err_code, and return an error.
14198 AdvWriteByteRegister(iop_base
, IOPB_RAM_BIST
, RAM_TEST_MODE
);
14199 DvcSleepMilliSecond(10); /* Wait for 10ms before checking status. */
14201 byte
= AdvReadByteRegister(iop_base
, IOPB_RAM_BIST
);
14202 if ((byte
& RAM_TEST_DONE
) == 0 || (byte
& RAM_TEST_STATUS
) != 0) {
14203 /* Get here if Done bit not set or Status not 0. */
14204 asc_dvc
->bist_err_code
= byte
; /* for BIOS display message */
14205 asc_dvc
->err_code
|= ASC_IERR_BIST_RAM_TEST
;
14209 /* We need to reset back to normal mode after LRAM test passes. */
14210 AdvWriteByteRegister(iop_base
, IOPB_RAM_BIST
, NORMAL_MODE
);
14213 * Load the Microcode
14215 * Write the microcode image to RISC memory starting at address 0.
14218 AdvWriteWordRegister(iop_base
, IOPW_RAM_ADDR
, 0);
14221 * Assume the following compressed format of the microcode buffer:
14223 * 254 word (508 byte) table indexed by byte code followed
14224 * by the following byte codes:
14227 * 00: Emit word 0 in table.
14228 * 01: Emit word 1 in table.
14230 * FD: Emit word 253 in table.
14233 * FE WW WW: (3 byte code) Word to emit is the next word WW WW.
14234 * FF BB WW WW: (4 byte code) Emit BB count times next word WW WW.
14237 for (i
= 253 * 2; i
< _adv_asc38C1600_size
; i
++) {
14238 if (_adv_asc38C1600_buf
[i
] == 0xff) {
14239 for (j
= 0; j
< _adv_asc38C1600_buf
[i
+ 1]; j
++) {
14240 AdvWriteWordAutoIncLram(iop_base
, (((ushort
)
14241 _adv_asc38C1600_buf
14244 _adv_asc38C1600_buf
14249 } else if (_adv_asc38C1600_buf
[i
] == 0xfe) {
14250 AdvWriteWordAutoIncLram(iop_base
, (((ushort
)
14251 _adv_asc38C1600_buf
14254 _adv_asc38C1600_buf
[i
14260 AdvWriteWordAutoIncLram(iop_base
, (((ushort
)
14261 _adv_asc38C1600_buf
[(_adv_asc38C1600_buf
[i
] * 2) + 1] << 8) | _adv_asc38C1600_buf
[_adv_asc38C1600_buf
[i
] * 2]));
14267 * Set 'word' for later use to clear the rest of memory and save
14268 * the expanded mcode size.
14271 adv_asc38C1600_expanded_size
= word
;
14274 * Clear the rest of ASC-38C1600 Internal RAM (32KB).
14276 for (; word
< ADV_38C1600_MEMSIZE
; word
+= 2) {
14277 AdvWriteWordAutoIncLram(iop_base
, 0);
14281 * Verify the microcode checksum.
14284 AdvWriteWordRegister(iop_base
, IOPW_RAM_ADDR
, 0);
14286 for (word
= 0; word
< adv_asc38C1600_expanded_size
; word
+= 2) {
14287 sum
+= AdvReadWordAutoIncLram(iop_base
);
14290 if (sum
!= _adv_asc38C1600_chksum
) {
14291 asc_dvc
->err_code
|= ASC_IERR_MCODE_CHKSUM
;
14296 * Restore the RISC memory BIOS region.
14298 for (i
= 0; i
< ASC_MC_BIOSLEN
/ 2; i
++) {
14299 AdvWriteWordLram(iop_base
, ASC_MC_BIOSMEM
+ (2 * i
),
14304 * Calculate and write the microcode code checksum to the microcode
14305 * code checksum location ASC_MC_CODE_CHK_SUM (0x2C).
14307 AdvReadWordLram(iop_base
, ASC_MC_CODE_BEGIN_ADDR
, begin_addr
);
14308 AdvReadWordLram(iop_base
, ASC_MC_CODE_END_ADDR
, end_addr
);
14310 AdvWriteWordRegister(iop_base
, IOPW_RAM_ADDR
, begin_addr
);
14311 for (word
= begin_addr
; word
< end_addr
; word
+= 2) {
14312 code_sum
+= AdvReadWordAutoIncLram(iop_base
);
14314 AdvWriteWordLram(iop_base
, ASC_MC_CODE_CHK_SUM
, code_sum
);
14317 * Read microcode version and date.
14319 AdvReadWordLram(iop_base
, ASC_MC_VERSION_DATE
,
14320 asc_dvc
->cfg
->mcode_date
);
14321 AdvReadWordLram(iop_base
, ASC_MC_VERSION_NUM
,
14322 asc_dvc
->cfg
->mcode_version
);
14325 * Set the chip type to indicate the ASC38C1600.
14327 AdvWriteWordLram(iop_base
, ASC_MC_CHIP_TYPE
, ADV_CHIP_ASC38C1600
);
14330 * Write 1 to bit 14 'DIS_TERM_DRV' in the SCSI_CFG1 register.
14331 * When DIS_TERM_DRV set to 1, C_DET[3:0] will reflect current
14332 * cable detection and then we are able to read C_DET[3:0].
14334 * Note: We will reset DIS_TERM_DRV to 0 in the 'Set SCSI_CFG1
14335 * Microcode Default Value' section below.
14337 scsi_cfg1
= AdvReadWordRegister(iop_base
, IOPW_SCSI_CFG1
);
14338 AdvWriteWordRegister(iop_base
, IOPW_SCSI_CFG1
,
14339 scsi_cfg1
| DIS_TERM_DRV
);
14342 * If the PCI Configuration Command Register "Parity Error Response
14343 * Control" Bit was clear (0), then set the microcode variable
14344 * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
14345 * to ignore DMA parity errors.
14347 if (asc_dvc
->cfg
->control_flag
& CONTROL_FLAG_IGNORE_PERR
) {
14348 AdvReadWordLram(iop_base
, ASC_MC_CONTROL_FLAG
, word
);
14349 word
|= CONTROL_FLAG_IGNORE_PERR
;
14350 AdvWriteWordLram(iop_base
, ASC_MC_CONTROL_FLAG
, word
);
14354 * If the BIOS control flag AIPP (Asynchronous Information
14355 * Phase Protection) disable bit is not set, then set the firmware
14356 * 'control_flag' CONTROL_FLAG_ENABLE_AIPP bit to enable
14357 * AIPP checking and encoding.
14359 if ((asc_dvc
->bios_ctrl
& BIOS_CTRL_AIPP_DIS
) == 0) {
14360 AdvReadWordLram(iop_base
, ASC_MC_CONTROL_FLAG
, word
);
14361 word
|= CONTROL_FLAG_ENABLE_AIPP
;
14362 AdvWriteWordLram(iop_base
, ASC_MC_CONTROL_FLAG
, word
);
14366 * For ASC-38C1600 use DMA_CFG0 default values: FIFO_THRESH_80B [6:4],
14367 * and START_CTL_TH [3:2].
14369 AdvWriteByteRegister(iop_base
, IOPB_DMA_CFG0
,
14370 FIFO_THRESH_80B
| START_CTL_TH
| READ_CMD_MRM
);
14373 * Microcode operating variables for WDTR, SDTR, and command tag
14374 * queuing will be set in slave_configure() based on what a
14375 * device reports it is capable of in Inquiry byte 7.
14377 * If SCSI Bus Resets have been disabled, then directly set
14378 * SDTR and WDTR from the EEPROM configuration. This will allow
14379 * the BIOS and warm boot to work without a SCSI bus hang on
14380 * the Inquiry caused by host and target mismatched DTR values.
14381 * Without the SCSI Bus Reset, before an Inquiry a device can't
14382 * be assumed to be in Asynchronous, Narrow mode.
14384 if ((asc_dvc
->bios_ctrl
& BIOS_CTRL_RESET_SCSI_BUS
) == 0) {
14385 AdvWriteWordLram(iop_base
, ASC_MC_WDTR_ABLE
,
14386 asc_dvc
->wdtr_able
);
14387 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_ABLE
,
14388 asc_dvc
->sdtr_able
);
14392 * Set microcode operating variables for DISC and SDTR_SPEED1,
14393 * SDTR_SPEED2, SDTR_SPEED3, and SDTR_SPEED4 based on the EEPROM
14394 * configuration values.
14396 * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2,
14397 * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them
14398 * without determining here whether the device supports SDTR.
14400 AdvWriteWordLram(iop_base
, ASC_MC_DISC_ENABLE
,
14401 asc_dvc
->cfg
->disc_enable
);
14402 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED1
, asc_dvc
->sdtr_speed1
);
14403 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED2
, asc_dvc
->sdtr_speed2
);
14404 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED3
, asc_dvc
->sdtr_speed3
);
14405 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_SPEED4
, asc_dvc
->sdtr_speed4
);
14408 * Set SCSI_CFG0 Microcode Default Value.
14410 * The microcode will set the SCSI_CFG0 register using this value
14411 * after it is started below.
14413 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_SCSI_CFG0
,
14414 PARITY_EN
| QUEUE_128
| SEL_TMO_LONG
| OUR_ID_EN
|
14415 asc_dvc
->chip_scsi_id
);
14418 * Calculate SCSI_CFG1 Microcode Default Value.
14420 * The microcode will set the SCSI_CFG1 register using this value
14421 * after it is started below.
14423 * Each ASC-38C1600 function has only two cable detect bits.
14424 * The bus mode override bits are in IOPB_SOFT_OVER_WR.
14426 scsi_cfg1
= AdvReadWordRegister(iop_base
, IOPW_SCSI_CFG1
);
14429 * If the cable is reversed all of the SCSI_CTRL register signals
14430 * will be set. Check for and return an error if this condition is
14433 if ((AdvReadWordRegister(iop_base
, IOPW_SCSI_CTRL
) & 0x3F07) == 0x3F07) {
14434 asc_dvc
->err_code
|= ASC_IERR_REVERSED_CABLE
;
14439 * Each ASC-38C1600 function has two connectors. Only an HVD device
14440 * can not be connected to either connector. An LVD device or SE device
14441 * may be connected to either connecor. If an SE device is connected,
14442 * then at most Ultra speed (20 Mhz) can be used on both connectors.
14444 * If an HVD device is attached, return an error.
14446 if (scsi_cfg1
& HVD
) {
14447 asc_dvc
->err_code
|= ASC_IERR_HVD_DEVICE
;
14452 * Each function in the ASC-38C1600 uses only the SE cable detect and
14453 * termination because there are two connectors for each function. Each
14454 * function may use either LVD or SE mode. Corresponding the SE automatic
14455 * termination control EEPROM bits are used for each function. Each
14456 * function has its own EEPROM. If SE automatic control is enabled for
14457 * the function, then set the termination value based on a table listed
14460 * If manual termination is specified in the EEPROM for the function,
14461 * then 'termination' was set-up in AscInitFrom38C1600EEPROM() and is
14462 * ready to be 'ored' into SCSI_CFG1.
14464 if ((asc_dvc
->cfg
->termination
& TERM_SE
) == 0) {
14465 struct pci_dev
*pdev
= adv_dvc_to_pdev(asc_dvc
);
14466 /* SE automatic termination control is enabled. */
14467 switch (scsi_cfg1
& C_DET_SE
) {
14468 /* TERM_SE_HI: on, TERM_SE_LO: on */
14472 asc_dvc
->cfg
->termination
|= TERM_SE
;
14476 if (PCI_FUNC(pdev
->devfn
) == 0) {
14477 /* Function 0 - TERM_SE_HI: off, TERM_SE_LO: off */
14479 /* Function 1 - TERM_SE_HI: on, TERM_SE_LO: off */
14480 asc_dvc
->cfg
->termination
|= TERM_SE_HI
;
14487 * Clear any set TERM_SE bits.
14489 scsi_cfg1
&= ~TERM_SE
;
14492 * Invert the TERM_SE bits and then set 'scsi_cfg1'.
14494 scsi_cfg1
|= (~asc_dvc
->cfg
->termination
& TERM_SE
);
14497 * Clear Big Endian and Terminator Polarity bits and set possibly
14498 * modified termination control bits in the Microcode SCSI_CFG1
14501 * Big Endian bit is not used even on big endian machines.
14503 scsi_cfg1
&= (~BIG_ENDIAN
& ~DIS_TERM_DRV
& ~TERM_POL
);
14506 * Set SCSI_CFG1 Microcode Default Value
14508 * Set possibly modified termination control bits in the Microcode
14509 * SCSI_CFG1 Register Value.
14511 * The microcode will set the SCSI_CFG1 register using this value
14512 * after it is started below.
14514 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_SCSI_CFG1
, scsi_cfg1
);
14517 * Set MEM_CFG Microcode Default Value
14519 * The microcode will set the MEM_CFG register using this value
14520 * after it is started below.
14522 * MEM_CFG may be accessed as a word or byte, but only bits 0-7
14525 * ASC-38C1600 has 32KB internal memory.
14527 * XXX - Since ASC38C1600 Rev.3 has a Local RAM failure issue, we come
14528 * out a special 16K Adv Library and Microcode version. After the issue
14529 * resolved, we should turn back to the 32K support. Both a_condor.h and
14530 * mcode.sas files also need to be updated.
14532 * AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG,
14533 * BIOS_EN | RAM_SZ_32KB);
14535 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_MEM_CFG
,
14536 BIOS_EN
| RAM_SZ_16KB
);
14539 * Set SEL_MASK Microcode Default Value
14541 * The microcode will set the SEL_MASK register using this value
14542 * after it is started below.
14544 AdvWriteWordLram(iop_base
, ASC_MC_DEFAULT_SEL_MASK
,
14545 ADV_TID_TO_TIDMASK(asc_dvc
->chip_scsi_id
));
14548 * Build the carrier freelist.
14550 * Driver must have already allocated memory and set 'carrier_buf'.
14553 ASC_ASSERT(asc_dvc
->carrier_buf
!= NULL
);
14555 carrp
= (ADV_CARR_T
*) ADV_16BALIGN(asc_dvc
->carrier_buf
);
14556 asc_dvc
->carr_freelist
= NULL
;
14557 if (carrp
== (ADV_CARR_T
*) asc_dvc
->carrier_buf
) {
14558 buf_size
= ADV_CARRIER_BUFSIZE
;
14560 buf_size
= ADV_CARRIER_BUFSIZE
- sizeof(ADV_CARR_T
);
14565 * Get physical address for the carrier 'carrp'.
14567 contig_len
= sizeof(ADV_CARR_T
);
14569 cpu_to_le32(DvcGetPhyAddr
14570 (asc_dvc
, NULL
, (uchar
*)carrp
,
14571 (ADV_SDCNT
*)&contig_len
,
14572 ADV_IS_CARRIER_FLAG
));
14574 buf_size
-= sizeof(ADV_CARR_T
);
14577 * If the current carrier is not physically contiguous, then
14578 * maybe there was a page crossing. Try the next carrier aligned
14581 if (contig_len
< sizeof(ADV_CARR_T
)) {
14586 carrp
->carr_pa
= carr_paddr
;
14587 carrp
->carr_va
= cpu_to_le32(ADV_VADDR_TO_U32(carrp
));
14590 * Insert the carrier at the beginning of the freelist.
14593 cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc
->carr_freelist
));
14594 asc_dvc
->carr_freelist
= carrp
;
14598 while (buf_size
> 0);
14601 * Set-up the Host->RISC Initiator Command Queue (ICQ).
14603 if ((asc_dvc
->icq_sp
= asc_dvc
->carr_freelist
) == NULL
) {
14604 asc_dvc
->err_code
|= ASC_IERR_NO_CARRIER
;
14607 asc_dvc
->carr_freelist
= (ADV_CARR_T
*)
14608 ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc
->icq_sp
->next_vpa
));
14611 * The first command issued will be placed in the stopper carrier.
14613 asc_dvc
->icq_sp
->next_vpa
= cpu_to_le32(ASC_CQ_STOPPER
);
14616 * Set RISC ICQ physical address start value. Initialize the
14617 * COMMA register to the same value otherwise the RISC will
14618 * prematurely detect a command is available.
14620 AdvWriteDWordLramNoSwap(iop_base
, ASC_MC_ICQ
, asc_dvc
->icq_sp
->carr_pa
);
14621 AdvWriteDWordRegister(iop_base
, IOPDW_COMMA
,
14622 le32_to_cpu(asc_dvc
->icq_sp
->carr_pa
));
14625 * Set-up the RISC->Host Initiator Response Queue (IRQ).
14627 if ((asc_dvc
->irq_sp
= asc_dvc
->carr_freelist
) == NULL
) {
14628 asc_dvc
->err_code
|= ASC_IERR_NO_CARRIER
;
14631 asc_dvc
->carr_freelist
= (ADV_CARR_T
*)
14632 ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc
->irq_sp
->next_vpa
));
14635 * The first command completed by the RISC will be placed in
14638 * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is
14639 * completed the RISC will set the ASC_RQ_STOPPER bit.
14641 asc_dvc
->irq_sp
->next_vpa
= cpu_to_le32(ASC_CQ_STOPPER
);
14644 * Set RISC IRQ physical address start value.
14646 AdvWriteDWordLramNoSwap(iop_base
, ASC_MC_IRQ
, asc_dvc
->irq_sp
->carr_pa
);
14647 asc_dvc
->carr_pending_cnt
= 0;
14649 AdvWriteByteRegister(iop_base
, IOPB_INTR_ENABLES
,
14650 (ADV_INTR_ENABLE_HOST_INTR
|
14651 ADV_INTR_ENABLE_GLOBAL_INTR
));
14652 AdvReadWordLram(iop_base
, ASC_MC_CODE_BEGIN_ADDR
, word
);
14653 AdvWriteWordRegister(iop_base
, IOPW_PC
, word
);
14655 /* finally, finally, gentlemen, start your engine */
14656 AdvWriteWordRegister(iop_base
, IOPW_RISC_CSR
, ADV_RISC_CSR_RUN
);
14659 * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus
14660 * Resets should be performed. The RISC has to be running
14661 * to issue a SCSI Bus Reset.
14663 if (asc_dvc
->bios_ctrl
& BIOS_CTRL_RESET_SCSI_BUS
) {
14665 * If the BIOS Signature is present in memory, restore the
14666 * per TID microcode operating variables.
14668 if (bios_mem
[(ASC_MC_BIOS_SIGNATURE
- ASC_MC_BIOSMEM
) / 2] ==
14671 * Restore per TID negotiated values.
14673 AdvWriteWordLram(iop_base
, ASC_MC_WDTR_ABLE
, wdtr_able
);
14674 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_ABLE
, sdtr_able
);
14675 AdvWriteWordLram(iop_base
, ASC_MC_PPR_ABLE
, ppr_able
);
14676 AdvWriteWordLram(iop_base
, ASC_MC_TAGQNG_ABLE
,
14678 for (tid
= 0; tid
<= ASC_MAX_TID
; tid
++) {
14679 AdvWriteByteLram(iop_base
,
14680 ASC_MC_NUMBER_OF_MAX_CMD
+ tid
,
14684 if (AdvResetSB(asc_dvc
) != ADV_TRUE
) {
14685 warn_code
= ASC_WARN_BUSRESET_ERROR
;
14694 * Read the board's EEPROM configuration. Set fields in ADV_DVC_VAR and
14695 * ADV_DVC_CFG based on the EEPROM settings. The chip is stopped while
14696 * all of this is done.
14698 * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR.
14700 * For a non-fatal error return a warning code. If there are no warnings
14701 * then 0 is returned.
14703 * Note: Chip is stopped on entry.
14705 static int __devinit
AdvInitFrom3550EEP(ADV_DVC_VAR
*asc_dvc
)
14707 AdvPortAddr iop_base
;
14709 ADVEEP_3550_CONFIG eep_config
;
14711 iop_base
= asc_dvc
->iop_base
;
14716 * Read the board's EEPROM configuration.
14718 * Set default values if a bad checksum is found.
14720 if (AdvGet3550EEPConfig(iop_base
, &eep_config
) != eep_config
.check_sum
) {
14721 warn_code
|= ASC_WARN_EEPROM_CHKSUM
;
14724 * Set EEPROM default values.
14726 memcpy(&eep_config
, &Default_3550_EEPROM_Config
,
14727 sizeof(ADVEEP_3550_CONFIG
));
14730 * Assume the 6 byte board serial number that was read from
14731 * EEPROM is correct even if the EEPROM checksum failed.
14733 eep_config
.serial_number_word3
=
14734 AdvReadEEPWord(iop_base
, ADV_EEP_DVC_CFG_END
- 1);
14736 eep_config
.serial_number_word2
=
14737 AdvReadEEPWord(iop_base
, ADV_EEP_DVC_CFG_END
- 2);
14739 eep_config
.serial_number_word1
=
14740 AdvReadEEPWord(iop_base
, ADV_EEP_DVC_CFG_END
- 3);
14742 AdvSet3550EEPConfig(iop_base
, &eep_config
);
14745 * Set ASC_DVC_VAR and ASC_DVC_CFG variables from the
14746 * EEPROM configuration that was read.
14748 * This is the mapping of EEPROM fields to Adv Library fields.
14750 asc_dvc
->wdtr_able
= eep_config
.wdtr_able
;
14751 asc_dvc
->sdtr_able
= eep_config
.sdtr_able
;
14752 asc_dvc
->ultra_able
= eep_config
.ultra_able
;
14753 asc_dvc
->tagqng_able
= eep_config
.tagqng_able
;
14754 asc_dvc
->cfg
->disc_enable
= eep_config
.disc_enable
;
14755 asc_dvc
->max_host_qng
= eep_config
.max_host_qng
;
14756 asc_dvc
->max_dvc_qng
= eep_config
.max_dvc_qng
;
14757 asc_dvc
->chip_scsi_id
= (eep_config
.adapter_scsi_id
& ADV_MAX_TID
);
14758 asc_dvc
->start_motor
= eep_config
.start_motor
;
14759 asc_dvc
->scsi_reset_wait
= eep_config
.scsi_reset_delay
;
14760 asc_dvc
->bios_ctrl
= eep_config
.bios_ctrl
;
14761 asc_dvc
->no_scam
= eep_config
.scam_tolerant
;
14762 asc_dvc
->cfg
->serial1
= eep_config
.serial_number_word1
;
14763 asc_dvc
->cfg
->serial2
= eep_config
.serial_number_word2
;
14764 asc_dvc
->cfg
->serial3
= eep_config
.serial_number_word3
;
14767 * Set the host maximum queuing (max. 253, min. 16) and the per device
14768 * maximum queuing (max. 63, min. 4).
14770 if (eep_config
.max_host_qng
> ASC_DEF_MAX_HOST_QNG
) {
14771 eep_config
.max_host_qng
= ASC_DEF_MAX_HOST_QNG
;
14772 } else if (eep_config
.max_host_qng
< ASC_DEF_MIN_HOST_QNG
) {
14773 /* If the value is zero, assume it is uninitialized. */
14774 if (eep_config
.max_host_qng
== 0) {
14775 eep_config
.max_host_qng
= ASC_DEF_MAX_HOST_QNG
;
14777 eep_config
.max_host_qng
= ASC_DEF_MIN_HOST_QNG
;
14781 if (eep_config
.max_dvc_qng
> ASC_DEF_MAX_DVC_QNG
) {
14782 eep_config
.max_dvc_qng
= ASC_DEF_MAX_DVC_QNG
;
14783 } else if (eep_config
.max_dvc_qng
< ASC_DEF_MIN_DVC_QNG
) {
14784 /* If the value is zero, assume it is uninitialized. */
14785 if (eep_config
.max_dvc_qng
== 0) {
14786 eep_config
.max_dvc_qng
= ASC_DEF_MAX_DVC_QNG
;
14788 eep_config
.max_dvc_qng
= ASC_DEF_MIN_DVC_QNG
;
14793 * If 'max_dvc_qng' is greater than 'max_host_qng', then
14794 * set 'max_dvc_qng' to 'max_host_qng'.
14796 if (eep_config
.max_dvc_qng
> eep_config
.max_host_qng
) {
14797 eep_config
.max_dvc_qng
= eep_config
.max_host_qng
;
14801 * Set ADV_DVC_VAR 'max_host_qng' and ADV_DVC_VAR 'max_dvc_qng'
14802 * values based on possibly adjusted EEPROM values.
14804 asc_dvc
->max_host_qng
= eep_config
.max_host_qng
;
14805 asc_dvc
->max_dvc_qng
= eep_config
.max_dvc_qng
;
14808 * If the EEPROM 'termination' field is set to automatic (0), then set
14809 * the ADV_DVC_CFG 'termination' field to automatic also.
14811 * If the termination is specified with a non-zero 'termination'
14812 * value check that a legal value is set and set the ADV_DVC_CFG
14813 * 'termination' field appropriately.
14815 if (eep_config
.termination
== 0) {
14816 asc_dvc
->cfg
->termination
= 0; /* auto termination */
14818 /* Enable manual control with low off / high off. */
14819 if (eep_config
.termination
== 1) {
14820 asc_dvc
->cfg
->termination
= TERM_CTL_SEL
;
14822 /* Enable manual control with low off / high on. */
14823 } else if (eep_config
.termination
== 2) {
14824 asc_dvc
->cfg
->termination
= TERM_CTL_SEL
| TERM_CTL_H
;
14826 /* Enable manual control with low on / high on. */
14827 } else if (eep_config
.termination
== 3) {
14828 asc_dvc
->cfg
->termination
=
14829 TERM_CTL_SEL
| TERM_CTL_H
| TERM_CTL_L
;
14832 * The EEPROM 'termination' field contains a bad value. Use
14833 * automatic termination instead.
14835 asc_dvc
->cfg
->termination
= 0;
14836 warn_code
|= ASC_WARN_EEPROM_TERMINATION
;
14844 * Read the board's EEPROM configuration. Set fields in ADV_DVC_VAR and
14845 * ADV_DVC_CFG based on the EEPROM settings. The chip is stopped while
14846 * all of this is done.
14848 * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR.
14850 * For a non-fatal error return a warning code. If there are no warnings
14851 * then 0 is returned.
14853 * Note: Chip is stopped on entry.
14855 static int __devinit
AdvInitFrom38C0800EEP(ADV_DVC_VAR
*asc_dvc
)
14857 AdvPortAddr iop_base
;
14859 ADVEEP_38C0800_CONFIG eep_config
;
14860 uchar tid
, termination
;
14861 ushort sdtr_speed
= 0;
14863 iop_base
= asc_dvc
->iop_base
;
14868 * Read the board's EEPROM configuration.
14870 * Set default values if a bad checksum is found.
14872 if (AdvGet38C0800EEPConfig(iop_base
, &eep_config
) !=
14873 eep_config
.check_sum
) {
14874 warn_code
|= ASC_WARN_EEPROM_CHKSUM
;
14877 * Set EEPROM default values.
14879 memcpy(&eep_config
, &Default_38C0800_EEPROM_Config
,
14880 sizeof(ADVEEP_38C0800_CONFIG
));
14883 * Assume the 6 byte board serial number that was read from
14884 * EEPROM is correct even if the EEPROM checksum failed.
14886 eep_config
.serial_number_word3
=
14887 AdvReadEEPWord(iop_base
, ADV_EEP_DVC_CFG_END
- 1);
14889 eep_config
.serial_number_word2
=
14890 AdvReadEEPWord(iop_base
, ADV_EEP_DVC_CFG_END
- 2);
14892 eep_config
.serial_number_word1
=
14893 AdvReadEEPWord(iop_base
, ADV_EEP_DVC_CFG_END
- 3);
14895 AdvSet38C0800EEPConfig(iop_base
, &eep_config
);
14898 * Set ADV_DVC_VAR and ADV_DVC_CFG variables from the
14899 * EEPROM configuration that was read.
14901 * This is the mapping of EEPROM fields to Adv Library fields.
14903 asc_dvc
->wdtr_able
= eep_config
.wdtr_able
;
14904 asc_dvc
->sdtr_speed1
= eep_config
.sdtr_speed1
;
14905 asc_dvc
->sdtr_speed2
= eep_config
.sdtr_speed2
;
14906 asc_dvc
->sdtr_speed3
= eep_config
.sdtr_speed3
;
14907 asc_dvc
->sdtr_speed4
= eep_config
.sdtr_speed4
;
14908 asc_dvc
->tagqng_able
= eep_config
.tagqng_able
;
14909 asc_dvc
->cfg
->disc_enable
= eep_config
.disc_enable
;
14910 asc_dvc
->max_host_qng
= eep_config
.max_host_qng
;
14911 asc_dvc
->max_dvc_qng
= eep_config
.max_dvc_qng
;
14912 asc_dvc
->chip_scsi_id
= (eep_config
.adapter_scsi_id
& ADV_MAX_TID
);
14913 asc_dvc
->start_motor
= eep_config
.start_motor
;
14914 asc_dvc
->scsi_reset_wait
= eep_config
.scsi_reset_delay
;
14915 asc_dvc
->bios_ctrl
= eep_config
.bios_ctrl
;
14916 asc_dvc
->no_scam
= eep_config
.scam_tolerant
;
14917 asc_dvc
->cfg
->serial1
= eep_config
.serial_number_word1
;
14918 asc_dvc
->cfg
->serial2
= eep_config
.serial_number_word2
;
14919 asc_dvc
->cfg
->serial3
= eep_config
.serial_number_word3
;
14922 * For every Target ID if any of its 'sdtr_speed[1234]' bits
14923 * are set, then set an 'sdtr_able' bit for it.
14925 asc_dvc
->sdtr_able
= 0;
14926 for (tid
= 0; tid
<= ADV_MAX_TID
; tid
++) {
14928 sdtr_speed
= asc_dvc
->sdtr_speed1
;
14929 } else if (tid
== 4) {
14930 sdtr_speed
= asc_dvc
->sdtr_speed2
;
14931 } else if (tid
== 8) {
14932 sdtr_speed
= asc_dvc
->sdtr_speed3
;
14933 } else if (tid
== 12) {
14934 sdtr_speed
= asc_dvc
->sdtr_speed4
;
14936 if (sdtr_speed
& ADV_MAX_TID
) {
14937 asc_dvc
->sdtr_able
|= (1 << tid
);
14943 * Set the host maximum queuing (max. 253, min. 16) and the per device
14944 * maximum queuing (max. 63, min. 4).
14946 if (eep_config
.max_host_qng
> ASC_DEF_MAX_HOST_QNG
) {
14947 eep_config
.max_host_qng
= ASC_DEF_MAX_HOST_QNG
;
14948 } else if (eep_config
.max_host_qng
< ASC_DEF_MIN_HOST_QNG
) {
14949 /* If the value is zero, assume it is uninitialized. */
14950 if (eep_config
.max_host_qng
== 0) {
14951 eep_config
.max_host_qng
= ASC_DEF_MAX_HOST_QNG
;
14953 eep_config
.max_host_qng
= ASC_DEF_MIN_HOST_QNG
;
14957 if (eep_config
.max_dvc_qng
> ASC_DEF_MAX_DVC_QNG
) {
14958 eep_config
.max_dvc_qng
= ASC_DEF_MAX_DVC_QNG
;
14959 } else if (eep_config
.max_dvc_qng
< ASC_DEF_MIN_DVC_QNG
) {
14960 /* If the value is zero, assume it is uninitialized. */
14961 if (eep_config
.max_dvc_qng
== 0) {
14962 eep_config
.max_dvc_qng
= ASC_DEF_MAX_DVC_QNG
;
14964 eep_config
.max_dvc_qng
= ASC_DEF_MIN_DVC_QNG
;
14969 * If 'max_dvc_qng' is greater than 'max_host_qng', then
14970 * set 'max_dvc_qng' to 'max_host_qng'.
14972 if (eep_config
.max_dvc_qng
> eep_config
.max_host_qng
) {
14973 eep_config
.max_dvc_qng
= eep_config
.max_host_qng
;
14977 * Set ADV_DVC_VAR 'max_host_qng' and ADV_DVC_VAR 'max_dvc_qng'
14978 * values based on possibly adjusted EEPROM values.
14980 asc_dvc
->max_host_qng
= eep_config
.max_host_qng
;
14981 asc_dvc
->max_dvc_qng
= eep_config
.max_dvc_qng
;
14984 * If the EEPROM 'termination' field is set to automatic (0), then set
14985 * the ADV_DVC_CFG 'termination' field to automatic also.
14987 * If the termination is specified with a non-zero 'termination'
14988 * value check that a legal value is set and set the ADV_DVC_CFG
14989 * 'termination' field appropriately.
14991 if (eep_config
.termination_se
== 0) {
14992 termination
= 0; /* auto termination for SE */
14994 /* Enable manual control with low off / high off. */
14995 if (eep_config
.termination_se
== 1) {
14998 /* Enable manual control with low off / high on. */
14999 } else if (eep_config
.termination_se
== 2) {
15000 termination
= TERM_SE_HI
;
15002 /* Enable manual control with low on / high on. */
15003 } else if (eep_config
.termination_se
== 3) {
15004 termination
= TERM_SE
;
15007 * The EEPROM 'termination_se' field contains a bad value.
15008 * Use automatic termination instead.
15011 warn_code
|= ASC_WARN_EEPROM_TERMINATION
;
15015 if (eep_config
.termination_lvd
== 0) {
15016 asc_dvc
->cfg
->termination
= termination
; /* auto termination for LVD */
15018 /* Enable manual control with low off / high off. */
15019 if (eep_config
.termination_lvd
== 1) {
15020 asc_dvc
->cfg
->termination
= termination
;
15022 /* Enable manual control with low off / high on. */
15023 } else if (eep_config
.termination_lvd
== 2) {
15024 asc_dvc
->cfg
->termination
= termination
| TERM_LVD_HI
;
15026 /* Enable manual control with low on / high on. */
15027 } else if (eep_config
.termination_lvd
== 3) {
15028 asc_dvc
->cfg
->termination
= termination
| TERM_LVD
;
15031 * The EEPROM 'termination_lvd' field contains a bad value.
15032 * Use automatic termination instead.
15034 asc_dvc
->cfg
->termination
= termination
;
15035 warn_code
|= ASC_WARN_EEPROM_TERMINATION
;
15043 * Read the board's EEPROM configuration. Set fields in ASC_DVC_VAR and
15044 * ASC_DVC_CFG based on the EEPROM settings. The chip is stopped while
15045 * all of this is done.
15047 * On failure set the ASC_DVC_VAR field 'err_code' and return ADV_ERROR.
15049 * For a non-fatal error return a warning code. If there are no warnings
15050 * then 0 is returned.
15052 * Note: Chip is stopped on entry.
15054 static int __devinit
AdvInitFrom38C1600EEP(ADV_DVC_VAR
*asc_dvc
)
15056 AdvPortAddr iop_base
;
15058 ADVEEP_38C1600_CONFIG eep_config
;
15059 uchar tid
, termination
;
15060 ushort sdtr_speed
= 0;
15062 iop_base
= asc_dvc
->iop_base
;
15067 * Read the board's EEPROM configuration.
15069 * Set default values if a bad checksum is found.
15071 if (AdvGet38C1600EEPConfig(iop_base
, &eep_config
) !=
15072 eep_config
.check_sum
) {
15073 struct pci_dev
*pdev
= adv_dvc_to_pdev(asc_dvc
);
15074 warn_code
|= ASC_WARN_EEPROM_CHKSUM
;
15077 * Set EEPROM default values.
15079 memcpy(&eep_config
, &Default_38C1600_EEPROM_Config
,
15080 sizeof(ADVEEP_38C1600_CONFIG
));
15082 if (PCI_FUNC(pdev
->devfn
) != 0) {
15085 * Disable Bit 14 (BIOS_ENABLE) to fix SPARC Ultra 60
15086 * and old Mac system booting problem. The Expansion
15087 * ROM must be disabled in Function 1 for these systems
15089 eep_config
.cfg_lsw
&= ~ADV_EEPROM_BIOS_ENABLE
;
15091 * Clear the INTAB (bit 11) if the GPIO 0 input
15092 * indicates the Function 1 interrupt line is wired
15095 * Set/Clear Bit 11 (INTAB) from the GPIO bit 0 input:
15096 * 1 - Function 1 interrupt line wired to INT A.
15097 * 0 - Function 1 interrupt line wired to INT B.
15099 * Note: Function 0 is always wired to INTA.
15100 * Put all 5 GPIO bits in input mode and then read
15101 * their input values.
15103 AdvWriteByteRegister(iop_base
, IOPB_GPIO_CNTL
, 0);
15104 ints
= AdvReadByteRegister(iop_base
, IOPB_GPIO_DATA
);
15105 if ((ints
& 0x01) == 0)
15106 eep_config
.cfg_lsw
&= ~ADV_EEPROM_INTAB
;
15110 * Assume the 6 byte board serial number that was read from
15111 * EEPROM is correct even if the EEPROM checksum failed.
15113 eep_config
.serial_number_word3
=
15114 AdvReadEEPWord(iop_base
, ADV_EEP_DVC_CFG_END
- 1);
15115 eep_config
.serial_number_word2
=
15116 AdvReadEEPWord(iop_base
, ADV_EEP_DVC_CFG_END
- 2);
15117 eep_config
.serial_number_word1
=
15118 AdvReadEEPWord(iop_base
, ADV_EEP_DVC_CFG_END
- 3);
15120 AdvSet38C1600EEPConfig(iop_base
, &eep_config
);
15124 * Set ASC_DVC_VAR and ASC_DVC_CFG variables from the
15125 * EEPROM configuration that was read.
15127 * This is the mapping of EEPROM fields to Adv Library fields.
15129 asc_dvc
->wdtr_able
= eep_config
.wdtr_able
;
15130 asc_dvc
->sdtr_speed1
= eep_config
.sdtr_speed1
;
15131 asc_dvc
->sdtr_speed2
= eep_config
.sdtr_speed2
;
15132 asc_dvc
->sdtr_speed3
= eep_config
.sdtr_speed3
;
15133 asc_dvc
->sdtr_speed4
= eep_config
.sdtr_speed4
;
15134 asc_dvc
->ppr_able
= 0;
15135 asc_dvc
->tagqng_able
= eep_config
.tagqng_able
;
15136 asc_dvc
->cfg
->disc_enable
= eep_config
.disc_enable
;
15137 asc_dvc
->max_host_qng
= eep_config
.max_host_qng
;
15138 asc_dvc
->max_dvc_qng
= eep_config
.max_dvc_qng
;
15139 asc_dvc
->chip_scsi_id
= (eep_config
.adapter_scsi_id
& ASC_MAX_TID
);
15140 asc_dvc
->start_motor
= eep_config
.start_motor
;
15141 asc_dvc
->scsi_reset_wait
= eep_config
.scsi_reset_delay
;
15142 asc_dvc
->bios_ctrl
= eep_config
.bios_ctrl
;
15143 asc_dvc
->no_scam
= eep_config
.scam_tolerant
;
15146 * For every Target ID if any of its 'sdtr_speed[1234]' bits
15147 * are set, then set an 'sdtr_able' bit for it.
15149 asc_dvc
->sdtr_able
= 0;
15150 for (tid
= 0; tid
<= ASC_MAX_TID
; tid
++) {
15152 sdtr_speed
= asc_dvc
->sdtr_speed1
;
15153 } else if (tid
== 4) {
15154 sdtr_speed
= asc_dvc
->sdtr_speed2
;
15155 } else if (tid
== 8) {
15156 sdtr_speed
= asc_dvc
->sdtr_speed3
;
15157 } else if (tid
== 12) {
15158 sdtr_speed
= asc_dvc
->sdtr_speed4
;
15160 if (sdtr_speed
& ASC_MAX_TID
) {
15161 asc_dvc
->sdtr_able
|= (1 << tid
);
15167 * Set the host maximum queuing (max. 253, min. 16) and the per device
15168 * maximum queuing (max. 63, min. 4).
15170 if (eep_config
.max_host_qng
> ASC_DEF_MAX_HOST_QNG
) {
15171 eep_config
.max_host_qng
= ASC_DEF_MAX_HOST_QNG
;
15172 } else if (eep_config
.max_host_qng
< ASC_DEF_MIN_HOST_QNG
) {
15173 /* If the value is zero, assume it is uninitialized. */
15174 if (eep_config
.max_host_qng
== 0) {
15175 eep_config
.max_host_qng
= ASC_DEF_MAX_HOST_QNG
;
15177 eep_config
.max_host_qng
= ASC_DEF_MIN_HOST_QNG
;
15181 if (eep_config
.max_dvc_qng
> ASC_DEF_MAX_DVC_QNG
) {
15182 eep_config
.max_dvc_qng
= ASC_DEF_MAX_DVC_QNG
;
15183 } else if (eep_config
.max_dvc_qng
< ASC_DEF_MIN_DVC_QNG
) {
15184 /* If the value is zero, assume it is uninitialized. */
15185 if (eep_config
.max_dvc_qng
== 0) {
15186 eep_config
.max_dvc_qng
= ASC_DEF_MAX_DVC_QNG
;
15188 eep_config
.max_dvc_qng
= ASC_DEF_MIN_DVC_QNG
;
15193 * If 'max_dvc_qng' is greater than 'max_host_qng', then
15194 * set 'max_dvc_qng' to 'max_host_qng'.
15196 if (eep_config
.max_dvc_qng
> eep_config
.max_host_qng
) {
15197 eep_config
.max_dvc_qng
= eep_config
.max_host_qng
;
15201 * Set ASC_DVC_VAR 'max_host_qng' and ASC_DVC_VAR 'max_dvc_qng'
15202 * values based on possibly adjusted EEPROM values.
15204 asc_dvc
->max_host_qng
= eep_config
.max_host_qng
;
15205 asc_dvc
->max_dvc_qng
= eep_config
.max_dvc_qng
;
15208 * If the EEPROM 'termination' field is set to automatic (0), then set
15209 * the ASC_DVC_CFG 'termination' field to automatic also.
15211 * If the termination is specified with a non-zero 'termination'
15212 * value check that a legal value is set and set the ASC_DVC_CFG
15213 * 'termination' field appropriately.
15215 if (eep_config
.termination_se
== 0) {
15216 termination
= 0; /* auto termination for SE */
15218 /* Enable manual control with low off / high off. */
15219 if (eep_config
.termination_se
== 1) {
15222 /* Enable manual control with low off / high on. */
15223 } else if (eep_config
.termination_se
== 2) {
15224 termination
= TERM_SE_HI
;
15226 /* Enable manual control with low on / high on. */
15227 } else if (eep_config
.termination_se
== 3) {
15228 termination
= TERM_SE
;
15231 * The EEPROM 'termination_se' field contains a bad value.
15232 * Use automatic termination instead.
15235 warn_code
|= ASC_WARN_EEPROM_TERMINATION
;
15239 if (eep_config
.termination_lvd
== 0) {
15240 asc_dvc
->cfg
->termination
= termination
; /* auto termination for LVD */
15242 /* Enable manual control with low off / high off. */
15243 if (eep_config
.termination_lvd
== 1) {
15244 asc_dvc
->cfg
->termination
= termination
;
15246 /* Enable manual control with low off / high on. */
15247 } else if (eep_config
.termination_lvd
== 2) {
15248 asc_dvc
->cfg
->termination
= termination
| TERM_LVD_HI
;
15250 /* Enable manual control with low on / high on. */
15251 } else if (eep_config
.termination_lvd
== 3) {
15252 asc_dvc
->cfg
->termination
= termination
| TERM_LVD
;
15255 * The EEPROM 'termination_lvd' field contains a bad value.
15256 * Use automatic termination instead.
15258 asc_dvc
->cfg
->termination
= termination
;
15259 warn_code
|= ASC_WARN_EEPROM_TERMINATION
;
15267 * Read EEPROM configuration into the specified buffer.
15269 * Return a checksum based on the EEPROM configuration read.
15271 static ushort __devinit
15272 AdvGet3550EEPConfig(AdvPortAddr iop_base
, ADVEEP_3550_CONFIG
*cfg_buf
)
15274 ushort wval
, chksum
;
15277 ushort
*charfields
;
15279 charfields
= (ushort
*)&ADVEEP_3550_Config_Field_IsChar
;
15280 wbuf
= (ushort
*)cfg_buf
;
15283 for (eep_addr
= ADV_EEP_DVC_CFG_BEGIN
;
15284 eep_addr
< ADV_EEP_DVC_CFG_END
; eep_addr
++, wbuf
++) {
15285 wval
= AdvReadEEPWord(iop_base
, eep_addr
);
15286 chksum
+= wval
; /* Checksum is calculated from word values. */
15287 if (*charfields
++) {
15288 *wbuf
= le16_to_cpu(wval
);
15293 /* Read checksum word. */
15294 *wbuf
= AdvReadEEPWord(iop_base
, eep_addr
);
15298 /* Read rest of EEPROM not covered by the checksum. */
15299 for (eep_addr
= ADV_EEP_DVC_CTL_BEGIN
;
15300 eep_addr
< ADV_EEP_MAX_WORD_ADDR
; eep_addr
++, wbuf
++) {
15301 *wbuf
= AdvReadEEPWord(iop_base
, eep_addr
);
15302 if (*charfields
++) {
15303 *wbuf
= le16_to_cpu(*wbuf
);
15310 * Read EEPROM configuration into the specified buffer.
15312 * Return a checksum based on the EEPROM configuration read.
15314 static ushort __devinit
15315 AdvGet38C0800EEPConfig(AdvPortAddr iop_base
, ADVEEP_38C0800_CONFIG
*cfg_buf
)
15317 ushort wval
, chksum
;
15320 ushort
*charfields
;
15322 charfields
= (ushort
*)&ADVEEP_38C0800_Config_Field_IsChar
;
15323 wbuf
= (ushort
*)cfg_buf
;
15326 for (eep_addr
= ADV_EEP_DVC_CFG_BEGIN
;
15327 eep_addr
< ADV_EEP_DVC_CFG_END
; eep_addr
++, wbuf
++) {
15328 wval
= AdvReadEEPWord(iop_base
, eep_addr
);
15329 chksum
+= wval
; /* Checksum is calculated from word values. */
15330 if (*charfields
++) {
15331 *wbuf
= le16_to_cpu(wval
);
15336 /* Read checksum word. */
15337 *wbuf
= AdvReadEEPWord(iop_base
, eep_addr
);
15341 /* Read rest of EEPROM not covered by the checksum. */
15342 for (eep_addr
= ADV_EEP_DVC_CTL_BEGIN
;
15343 eep_addr
< ADV_EEP_MAX_WORD_ADDR
; eep_addr
++, wbuf
++) {
15344 *wbuf
= AdvReadEEPWord(iop_base
, eep_addr
);
15345 if (*charfields
++) {
15346 *wbuf
= le16_to_cpu(*wbuf
);
15353 * Read EEPROM configuration into the specified buffer.
15355 * Return a checksum based on the EEPROM configuration read.
15357 static ushort __devinit
15358 AdvGet38C1600EEPConfig(AdvPortAddr iop_base
, ADVEEP_38C1600_CONFIG
*cfg_buf
)
15360 ushort wval
, chksum
;
15363 ushort
*charfields
;
15365 charfields
= (ushort
*)&ADVEEP_38C1600_Config_Field_IsChar
;
15366 wbuf
= (ushort
*)cfg_buf
;
15369 for (eep_addr
= ADV_EEP_DVC_CFG_BEGIN
;
15370 eep_addr
< ADV_EEP_DVC_CFG_END
; eep_addr
++, wbuf
++) {
15371 wval
= AdvReadEEPWord(iop_base
, eep_addr
);
15372 chksum
+= wval
; /* Checksum is calculated from word values. */
15373 if (*charfields
++) {
15374 *wbuf
= le16_to_cpu(wval
);
15379 /* Read checksum word. */
15380 *wbuf
= AdvReadEEPWord(iop_base
, eep_addr
);
15384 /* Read rest of EEPROM not covered by the checksum. */
15385 for (eep_addr
= ADV_EEP_DVC_CTL_BEGIN
;
15386 eep_addr
< ADV_EEP_MAX_WORD_ADDR
; eep_addr
++, wbuf
++) {
15387 *wbuf
= AdvReadEEPWord(iop_base
, eep_addr
);
15388 if (*charfields
++) {
15389 *wbuf
= le16_to_cpu(*wbuf
);
15396 * Read the EEPROM from specified location
15398 static ushort __devinit
AdvReadEEPWord(AdvPortAddr iop_base
, int eep_word_addr
)
15400 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
,
15401 ASC_EEP_CMD_READ
| eep_word_addr
);
15402 AdvWaitEEPCmd(iop_base
);
15403 return AdvReadWordRegister(iop_base
, IOPW_EE_DATA
);
15407 * Wait for EEPROM command to complete
15409 static void __devinit
AdvWaitEEPCmd(AdvPortAddr iop_base
)
15413 for (eep_delay_ms
= 0; eep_delay_ms
< ADV_EEP_DELAY_MS
; eep_delay_ms
++) {
15414 if (AdvReadWordRegister(iop_base
, IOPW_EE_CMD
) &
15415 ASC_EEP_CMD_DONE
) {
15418 DvcSleepMilliSecond(1);
15420 if ((AdvReadWordRegister(iop_base
, IOPW_EE_CMD
) & ASC_EEP_CMD_DONE
) ==
15428 * Write the EEPROM from 'cfg_buf'.
15431 AdvSet3550EEPConfig(AdvPortAddr iop_base
, ADVEEP_3550_CONFIG
*cfg_buf
)
15434 ushort addr
, chksum
;
15435 ushort
*charfields
;
15437 wbuf
= (ushort
*)cfg_buf
;
15438 charfields
= (ushort
*)&ADVEEP_3550_Config_Field_IsChar
;
15441 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
, ASC_EEP_CMD_WRITE_ABLE
);
15442 AdvWaitEEPCmd(iop_base
);
15445 * Write EEPROM from word 0 to word 20.
15447 for (addr
= ADV_EEP_DVC_CFG_BEGIN
;
15448 addr
< ADV_EEP_DVC_CFG_END
; addr
++, wbuf
++) {
15451 if (*charfields
++) {
15452 word
= cpu_to_le16(*wbuf
);
15456 chksum
+= *wbuf
; /* Checksum is calculated from word values. */
15457 AdvWriteWordRegister(iop_base
, IOPW_EE_DATA
, word
);
15458 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
,
15459 ASC_EEP_CMD_WRITE
| addr
);
15460 AdvWaitEEPCmd(iop_base
);
15461 DvcSleepMilliSecond(ADV_EEP_DELAY_MS
);
15465 * Write EEPROM checksum at word 21.
15467 AdvWriteWordRegister(iop_base
, IOPW_EE_DATA
, chksum
);
15468 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
, ASC_EEP_CMD_WRITE
| addr
);
15469 AdvWaitEEPCmd(iop_base
);
15474 * Write EEPROM OEM name at words 22 to 29.
15476 for (addr
= ADV_EEP_DVC_CTL_BEGIN
;
15477 addr
< ADV_EEP_MAX_WORD_ADDR
; addr
++, wbuf
++) {
15480 if (*charfields
++) {
15481 word
= cpu_to_le16(*wbuf
);
15485 AdvWriteWordRegister(iop_base
, IOPW_EE_DATA
, word
);
15486 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
,
15487 ASC_EEP_CMD_WRITE
| addr
);
15488 AdvWaitEEPCmd(iop_base
);
15490 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
, ASC_EEP_CMD_WRITE_DISABLE
);
15491 AdvWaitEEPCmd(iop_base
);
15496 * Write the EEPROM from 'cfg_buf'.
15499 AdvSet38C0800EEPConfig(AdvPortAddr iop_base
, ADVEEP_38C0800_CONFIG
*cfg_buf
)
15502 ushort
*charfields
;
15503 ushort addr
, chksum
;
15505 wbuf
= (ushort
*)cfg_buf
;
15506 charfields
= (ushort
*)&ADVEEP_38C0800_Config_Field_IsChar
;
15509 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
, ASC_EEP_CMD_WRITE_ABLE
);
15510 AdvWaitEEPCmd(iop_base
);
15513 * Write EEPROM from word 0 to word 20.
15515 for (addr
= ADV_EEP_DVC_CFG_BEGIN
;
15516 addr
< ADV_EEP_DVC_CFG_END
; addr
++, wbuf
++) {
15519 if (*charfields
++) {
15520 word
= cpu_to_le16(*wbuf
);
15524 chksum
+= *wbuf
; /* Checksum is calculated from word values. */
15525 AdvWriteWordRegister(iop_base
, IOPW_EE_DATA
, word
);
15526 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
,
15527 ASC_EEP_CMD_WRITE
| addr
);
15528 AdvWaitEEPCmd(iop_base
);
15529 DvcSleepMilliSecond(ADV_EEP_DELAY_MS
);
15533 * Write EEPROM checksum at word 21.
15535 AdvWriteWordRegister(iop_base
, IOPW_EE_DATA
, chksum
);
15536 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
, ASC_EEP_CMD_WRITE
| addr
);
15537 AdvWaitEEPCmd(iop_base
);
15542 * Write EEPROM OEM name at words 22 to 29.
15544 for (addr
= ADV_EEP_DVC_CTL_BEGIN
;
15545 addr
< ADV_EEP_MAX_WORD_ADDR
; addr
++, wbuf
++) {
15548 if (*charfields
++) {
15549 word
= cpu_to_le16(*wbuf
);
15553 AdvWriteWordRegister(iop_base
, IOPW_EE_DATA
, word
);
15554 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
,
15555 ASC_EEP_CMD_WRITE
| addr
);
15556 AdvWaitEEPCmd(iop_base
);
15558 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
, ASC_EEP_CMD_WRITE_DISABLE
);
15559 AdvWaitEEPCmd(iop_base
);
15564 * Write the EEPROM from 'cfg_buf'.
15567 AdvSet38C1600EEPConfig(AdvPortAddr iop_base
, ADVEEP_38C1600_CONFIG
*cfg_buf
)
15570 ushort
*charfields
;
15571 ushort addr
, chksum
;
15573 wbuf
= (ushort
*)cfg_buf
;
15574 charfields
= (ushort
*)&ADVEEP_38C1600_Config_Field_IsChar
;
15577 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
, ASC_EEP_CMD_WRITE_ABLE
);
15578 AdvWaitEEPCmd(iop_base
);
15581 * Write EEPROM from word 0 to word 20.
15583 for (addr
= ADV_EEP_DVC_CFG_BEGIN
;
15584 addr
< ADV_EEP_DVC_CFG_END
; addr
++, wbuf
++) {
15587 if (*charfields
++) {
15588 word
= cpu_to_le16(*wbuf
);
15592 chksum
+= *wbuf
; /* Checksum is calculated from word values. */
15593 AdvWriteWordRegister(iop_base
, IOPW_EE_DATA
, word
);
15594 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
,
15595 ASC_EEP_CMD_WRITE
| addr
);
15596 AdvWaitEEPCmd(iop_base
);
15597 DvcSleepMilliSecond(ADV_EEP_DELAY_MS
);
15601 * Write EEPROM checksum at word 21.
15603 AdvWriteWordRegister(iop_base
, IOPW_EE_DATA
, chksum
);
15604 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
, ASC_EEP_CMD_WRITE
| addr
);
15605 AdvWaitEEPCmd(iop_base
);
15610 * Write EEPROM OEM name at words 22 to 29.
15612 for (addr
= ADV_EEP_DVC_CTL_BEGIN
;
15613 addr
< ADV_EEP_MAX_WORD_ADDR
; addr
++, wbuf
++) {
15616 if (*charfields
++) {
15617 word
= cpu_to_le16(*wbuf
);
15621 AdvWriteWordRegister(iop_base
, IOPW_EE_DATA
, word
);
15622 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
,
15623 ASC_EEP_CMD_WRITE
| addr
);
15624 AdvWaitEEPCmd(iop_base
);
15626 AdvWriteWordRegister(iop_base
, IOPW_EE_CMD
, ASC_EEP_CMD_WRITE_DISABLE
);
15627 AdvWaitEEPCmd(iop_base
);
15633 * AdvExeScsiQueue() - Send a request to the RISC microcode program.
15635 * Allocate a carrier structure, point the carrier to the ADV_SCSI_REQ_Q,
15636 * add the carrier to the ICQ (Initiator Command Queue), and tickle the
15637 * RISC to notify it a new command is ready to be executed.
15639 * If 'done_status' is not set to QD_DO_RETRY, then 'error_retry' will be
15640 * set to SCSI_MAX_RETRY.
15642 * Multi-byte fields in the ASC_SCSI_REQ_Q that are used by the microcode
15643 * for DMA addresses or math operations are byte swapped to little-endian
15647 * ADV_SUCCESS(1) - The request was successfully queued.
15648 * ADV_BUSY(0) - Resource unavailable; Retry again after pending
15649 * request completes.
15650 * ADV_ERROR(-1) - Invalid ADV_SCSI_REQ_Q request structure
15653 static int AdvExeScsiQueue(ADV_DVC_VAR
*asc_dvc
, ADV_SCSI_REQ_Q
*scsiq
)
15655 ulong last_int_level
;
15656 AdvPortAddr iop_base
;
15658 ADV_PADDR req_paddr
;
15659 ADV_CARR_T
*new_carrp
;
15661 ASC_ASSERT(scsiq
!= NULL
); /* 'scsiq' should never be NULL. */
15664 * The ADV_SCSI_REQ_Q 'target_id' field should never exceed ADV_MAX_TID.
15666 if (scsiq
->target_id
> ADV_MAX_TID
) {
15667 scsiq
->host_status
= QHSTA_M_INVALID_DEVICE
;
15668 scsiq
->done_status
= QD_WITH_ERROR
;
15672 iop_base
= asc_dvc
->iop_base
;
15674 last_int_level
= DvcEnterCritical();
15677 * Allocate a carrier ensuring at least one carrier always
15678 * remains on the freelist and initialize fields.
15680 if ((new_carrp
= asc_dvc
->carr_freelist
) == NULL
) {
15681 DvcLeaveCritical(last_int_level
);
15684 asc_dvc
->carr_freelist
= (ADV_CARR_T
*)
15685 ADV_U32_TO_VADDR(le32_to_cpu(new_carrp
->next_vpa
));
15686 asc_dvc
->carr_pending_cnt
++;
15689 * Set the carrier to be a stopper by setting 'next_vpa'
15690 * to the stopper value. The current stopper will be changed
15691 * below to point to the new stopper.
15693 new_carrp
->next_vpa
= cpu_to_le32(ASC_CQ_STOPPER
);
15696 * Clear the ADV_SCSI_REQ_Q done flag.
15698 scsiq
->a_flag
&= ~ADV_SCSIQ_DONE
;
15700 req_size
= sizeof(ADV_SCSI_REQ_Q
);
15701 req_paddr
= DvcGetPhyAddr(asc_dvc
, scsiq
, (uchar
*)scsiq
,
15702 (ADV_SDCNT
*)&req_size
, ADV_IS_SCSIQ_FLAG
);
15704 ASC_ASSERT(ADV_32BALIGN(req_paddr
) == req_paddr
);
15705 ASC_ASSERT(req_size
>= sizeof(ADV_SCSI_REQ_Q
));
15707 /* Wait for assertion before making little-endian */
15708 req_paddr
= cpu_to_le32(req_paddr
);
15710 /* Save virtual and physical address of ADV_SCSI_REQ_Q and carrier. */
15711 scsiq
->scsiq_ptr
= cpu_to_le32(ADV_VADDR_TO_U32(scsiq
));
15712 scsiq
->scsiq_rptr
= req_paddr
;
15714 scsiq
->carr_va
= cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc
->icq_sp
));
15716 * Every ADV_CARR_T.carr_pa is byte swapped to little-endian
15717 * order during initialization.
15719 scsiq
->carr_pa
= asc_dvc
->icq_sp
->carr_pa
;
15722 * Use the current stopper to send the ADV_SCSI_REQ_Q command to
15723 * the microcode. The newly allocated stopper will become the new
15726 asc_dvc
->icq_sp
->areq_vpa
= req_paddr
;
15729 * Set the 'next_vpa' pointer for the old stopper to be the
15730 * physical address of the new stopper. The RISC can only
15731 * follow physical addresses.
15733 asc_dvc
->icq_sp
->next_vpa
= new_carrp
->carr_pa
;
15736 * Set the host adapter stopper pointer to point to the new carrier.
15738 asc_dvc
->icq_sp
= new_carrp
;
15740 if (asc_dvc
->chip_type
== ADV_CHIP_ASC3550
||
15741 asc_dvc
->chip_type
== ADV_CHIP_ASC38C0800
) {
15743 * Tickle the RISC to tell it to read its Command Queue Head pointer.
15745 AdvWriteByteRegister(iop_base
, IOPB_TICKLE
, ADV_TICKLE_A
);
15746 if (asc_dvc
->chip_type
== ADV_CHIP_ASC3550
) {
15748 * Clear the tickle value. In the ASC-3550 the RISC flag
15749 * command 'clr_tickle_a' does not work unless the host
15750 * value is cleared.
15752 AdvWriteByteRegister(iop_base
, IOPB_TICKLE
,
15755 } else if (asc_dvc
->chip_type
== ADV_CHIP_ASC38C1600
) {
15757 * Notify the RISC a carrier is ready by writing the physical
15758 * address of the new carrier stopper to the COMMA register.
15760 AdvWriteDWordRegister(iop_base
, IOPDW_COMMA
,
15761 le32_to_cpu(new_carrp
->carr_pa
));
15764 DvcLeaveCritical(last_int_level
);
15766 return ADV_SUCCESS
;
15770 * Reset SCSI Bus and purge all outstanding requests.
15773 * ADV_TRUE(1) - All requests are purged and SCSI Bus is reset.
15774 * ADV_FALSE(0) - Microcode command failed.
15775 * ADV_ERROR(-1) - Microcode command timed-out. Microcode or IC
15776 * may be hung which requires driver recovery.
15778 static int AdvResetSB(ADV_DVC_VAR
*asc_dvc
)
15783 * Send the SCSI Bus Reset idle start idle command which asserts
15784 * the SCSI Bus Reset signal.
15786 status
= AdvSendIdleCmd(asc_dvc
, (ushort
)IDLE_CMD_SCSI_RESET_START
, 0L);
15787 if (status
!= ADV_TRUE
) {
15792 * Delay for the specified SCSI Bus Reset hold time.
15794 * The hold time delay is done on the host because the RISC has no
15795 * microsecond accurate timer.
15797 DvcDelayMicroSecond(asc_dvc
, (ushort
)ASC_SCSI_RESET_HOLD_TIME_US
);
15800 * Send the SCSI Bus Reset end idle command which de-asserts
15801 * the SCSI Bus Reset signal and purges any pending requests.
15803 status
= AdvSendIdleCmd(asc_dvc
, (ushort
)IDLE_CMD_SCSI_RESET_END
, 0L);
15804 if (status
!= ADV_TRUE
) {
15808 DvcSleepMilliSecond((ADV_DCNT
)asc_dvc
->scsi_reset_wait
* 1000);
15814 * Reset chip and SCSI Bus.
15817 * ADV_TRUE(1) - Chip re-initialization and SCSI Bus Reset successful.
15818 * ADV_FALSE(0) - Chip re-initialization and SCSI Bus Reset failure.
15820 static int AdvResetChipAndSB(ADV_DVC_VAR
*asc_dvc
)
15823 ushort wdtr_able
, sdtr_able
, tagqng_able
;
15824 ushort ppr_able
= 0;
15825 uchar tid
, max_cmd
[ADV_MAX_TID
+ 1];
15826 AdvPortAddr iop_base
;
15829 iop_base
= asc_dvc
->iop_base
;
15832 * Save current per TID negotiated values.
15834 AdvReadWordLram(iop_base
, ASC_MC_WDTR_ABLE
, wdtr_able
);
15835 AdvReadWordLram(iop_base
, ASC_MC_SDTR_ABLE
, sdtr_able
);
15836 if (asc_dvc
->chip_type
== ADV_CHIP_ASC38C1600
) {
15837 AdvReadWordLram(iop_base
, ASC_MC_PPR_ABLE
, ppr_able
);
15839 AdvReadWordLram(iop_base
, ASC_MC_TAGQNG_ABLE
, tagqng_able
);
15840 for (tid
= 0; tid
<= ADV_MAX_TID
; tid
++) {
15841 AdvReadByteLram(iop_base
, ASC_MC_NUMBER_OF_MAX_CMD
+ tid
,
15846 * Force the AdvInitAsc3550/38C0800Driver() function to
15847 * perform a SCSI Bus Reset by clearing the BIOS signature word.
15848 * The initialization functions assumes a SCSI Bus Reset is not
15849 * needed if the BIOS signature word is present.
15851 AdvReadWordLram(iop_base
, ASC_MC_BIOS_SIGNATURE
, bios_sig
);
15852 AdvWriteWordLram(iop_base
, ASC_MC_BIOS_SIGNATURE
, 0);
15855 * Stop chip and reset it.
15857 AdvWriteWordRegister(iop_base
, IOPW_RISC_CSR
, ADV_RISC_CSR_STOP
);
15858 AdvWriteWordRegister(iop_base
, IOPW_CTRL_REG
, ADV_CTRL_REG_CMD_RESET
);
15859 DvcSleepMilliSecond(100);
15860 AdvWriteWordRegister(iop_base
, IOPW_CTRL_REG
,
15861 ADV_CTRL_REG_CMD_WR_IO_REG
);
15864 * Reset Adv Library error code, if any, and try
15865 * re-initializing the chip.
15867 asc_dvc
->err_code
= 0;
15868 if (asc_dvc
->chip_type
== ADV_CHIP_ASC38C1600
) {
15869 status
= AdvInitAsc38C1600Driver(asc_dvc
);
15870 } else if (asc_dvc
->chip_type
== ADV_CHIP_ASC38C0800
) {
15871 status
= AdvInitAsc38C0800Driver(asc_dvc
);
15873 status
= AdvInitAsc3550Driver(asc_dvc
);
15876 /* Translate initialization return value to status value. */
15880 status
= ADV_FALSE
;
15884 * Restore the BIOS signature word.
15886 AdvWriteWordLram(iop_base
, ASC_MC_BIOS_SIGNATURE
, bios_sig
);
15889 * Restore per TID negotiated values.
15891 AdvWriteWordLram(iop_base
, ASC_MC_WDTR_ABLE
, wdtr_able
);
15892 AdvWriteWordLram(iop_base
, ASC_MC_SDTR_ABLE
, sdtr_able
);
15893 if (asc_dvc
->chip_type
== ADV_CHIP_ASC38C1600
) {
15894 AdvWriteWordLram(iop_base
, ASC_MC_PPR_ABLE
, ppr_able
);
15896 AdvWriteWordLram(iop_base
, ASC_MC_TAGQNG_ABLE
, tagqng_able
);
15897 for (tid
= 0; tid
<= ADV_MAX_TID
; tid
++) {
15898 AdvWriteByteLram(iop_base
, ASC_MC_NUMBER_OF_MAX_CMD
+ tid
,
15906 * Adv Library Interrupt Service Routine
15908 * This function is called by a driver's interrupt service routine.
15909 * The function disables and re-enables interrupts.
15911 * When a microcode idle command is completed, the ADV_DVC_VAR
15912 * 'idle_cmd_done' field is set to ADV_TRUE.
15914 * Note: AdvISR() can be called when interrupts are disabled or even
15915 * when there is no hardware interrupt condition present. It will
15916 * always check for completed idle commands and microcode requests.
15917 * This is an important feature that shouldn't be changed because it
15918 * allows commands to be completed from polling mode loops.
15921 * ADV_TRUE(1) - interrupt was pending
15922 * ADV_FALSE(0) - no interrupt was pending
15924 static int AdvISR(ADV_DVC_VAR
*asc_dvc
)
15926 AdvPortAddr iop_base
;
15929 ADV_CARR_T
*free_carrp
;
15930 ADV_VADDR irq_next_vpa
;
15932 ADV_SCSI_REQ_Q
*scsiq
;
15934 flags
= DvcEnterCritical();
15936 iop_base
= asc_dvc
->iop_base
;
15938 /* Reading the register clears the interrupt. */
15939 int_stat
= AdvReadByteRegister(iop_base
, IOPB_INTR_STATUS_REG
);
15941 if ((int_stat
& (ADV_INTR_STATUS_INTRA
| ADV_INTR_STATUS_INTRB
|
15942 ADV_INTR_STATUS_INTRC
)) == 0) {
15943 DvcLeaveCritical(flags
);
15948 * Notify the driver of an asynchronous microcode condition by
15949 * calling the adv_async_callback function. The function
15950 * is passed the microcode ASC_MC_INTRB_CODE byte value.
15952 if (int_stat
& ADV_INTR_STATUS_INTRB
) {
15955 AdvReadByteLram(iop_base
, ASC_MC_INTRB_CODE
, intrb_code
);
15957 if (asc_dvc
->chip_type
== ADV_CHIP_ASC3550
||
15958 asc_dvc
->chip_type
== ADV_CHIP_ASC38C0800
) {
15959 if (intrb_code
== ADV_ASYNC_CARRIER_READY_FAILURE
&&
15960 asc_dvc
->carr_pending_cnt
!= 0) {
15961 AdvWriteByteRegister(iop_base
, IOPB_TICKLE
,
15963 if (asc_dvc
->chip_type
== ADV_CHIP_ASC3550
) {
15964 AdvWriteByteRegister(iop_base
,
15971 adv_async_callback(asc_dvc
, intrb_code
);
15975 * Check if the IRQ stopper carrier contains a completed request.
15977 while (((irq_next_vpa
=
15978 le32_to_cpu(asc_dvc
->irq_sp
->next_vpa
)) & ASC_RQ_DONE
) != 0) {
15980 * Get a pointer to the newly completed ADV_SCSI_REQ_Q structure.
15981 * The RISC will have set 'areq_vpa' to a virtual address.
15983 * The firmware will have copied the ASC_SCSI_REQ_Q.scsiq_ptr
15984 * field to the carrier ADV_CARR_T.areq_vpa field. The conversion
15985 * below complements the conversion of ASC_SCSI_REQ_Q.scsiq_ptr'
15986 * in AdvExeScsiQueue().
15988 scsiq
= (ADV_SCSI_REQ_Q
*)
15989 ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc
->irq_sp
->areq_vpa
));
15992 * Request finished with good status and the queue was not
15993 * DMAed to host memory by the firmware. Set all status fields
15994 * to indicate good status.
15996 if ((irq_next_vpa
& ASC_RQ_GOOD
) != 0) {
15997 scsiq
->done_status
= QD_NO_ERROR
;
15998 scsiq
->host_status
= scsiq
->scsi_status
= 0;
15999 scsiq
->data_cnt
= 0L;
16003 * Advance the stopper pointer to the next carrier
16004 * ignoring the lower four bits. Free the previous
16007 free_carrp
= asc_dvc
->irq_sp
;
16008 asc_dvc
->irq_sp
= (ADV_CARR_T
*)
16009 ADV_U32_TO_VADDR(ASC_GET_CARRP(irq_next_vpa
));
16011 free_carrp
->next_vpa
=
16012 cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc
->carr_freelist
));
16013 asc_dvc
->carr_freelist
= free_carrp
;
16014 asc_dvc
->carr_pending_cnt
--;
16016 ASC_ASSERT(scsiq
!= NULL
);
16017 target_bit
= ADV_TID_TO_TIDMASK(scsiq
->target_id
);
16020 * Clear request microcode control flag.
16025 * Notify the driver of the completed request by passing
16026 * the ADV_SCSI_REQ_Q pointer to its callback function.
16028 scsiq
->a_flag
|= ADV_SCSIQ_DONE
;
16029 adv_isr_callback(asc_dvc
, scsiq
);
16031 * Note: After the driver callback function is called, 'scsiq'
16032 * can no longer be referenced.
16034 * Fall through and continue processing other completed
16039 * Disable interrupts again in case the driver inadvertently
16040 * enabled interrupts in its callback function.
16042 * The DvcEnterCritical() return value is ignored, because
16043 * the 'flags' saved when AdvISR() was first entered will be
16044 * used to restore the interrupt flag on exit.
16046 (void)DvcEnterCritical();
16048 DvcLeaveCritical(flags
);
16053 * Send an idle command to the chip and wait for completion.
16055 * Command completion is polled for once per microsecond.
16057 * The function can be called from anywhere including an interrupt handler.
16058 * But the function is not re-entrant, so it uses the DvcEnter/LeaveCritical()
16059 * functions to prevent reentrancy.
16062 * ADV_TRUE - command completed successfully
16063 * ADV_FALSE - command failed
16064 * ADV_ERROR - command timed out
16067 AdvSendIdleCmd(ADV_DVC_VAR
*asc_dvc
,
16068 ushort idle_cmd
, ADV_DCNT idle_cmd_parameter
)
16070 ulong last_int_level
;
16073 AdvPortAddr iop_base
;
16075 last_int_level
= DvcEnterCritical();
16077 iop_base
= asc_dvc
->iop_base
;
16080 * Clear the idle command status which is set by the microcode
16081 * to a non-zero value to indicate when the command is completed.
16082 * The non-zero result is one of the IDLE_CMD_STATUS_* values
16083 * defined in a_advlib.h.
16085 AdvWriteWordLram(iop_base
, ASC_MC_IDLE_CMD_STATUS
, (ushort
)0);
16088 * Write the idle command value after the idle command parameter
16089 * has been written to avoid a race condition. If the order is not
16090 * followed, the microcode may process the idle command before the
16091 * parameters have been written to LRAM.
16093 AdvWriteDWordLramNoSwap(iop_base
, ASC_MC_IDLE_CMD_PARAMETER
,
16094 cpu_to_le32(idle_cmd_parameter
));
16095 AdvWriteWordLram(iop_base
, ASC_MC_IDLE_CMD
, idle_cmd
);
16098 * Tickle the RISC to tell it to process the idle command.
16100 AdvWriteByteRegister(iop_base
, IOPB_TICKLE
, ADV_TICKLE_B
);
16101 if (asc_dvc
->chip_type
== ADV_CHIP_ASC3550
) {
16103 * Clear the tickle value. In the ASC-3550 the RISC flag
16104 * command 'clr_tickle_b' does not work unless the host
16105 * value is cleared.
16107 AdvWriteByteRegister(iop_base
, IOPB_TICKLE
, ADV_TICKLE_NOP
);
16110 /* Wait for up to 100 millisecond for the idle command to timeout. */
16111 for (i
= 0; i
< SCSI_WAIT_100_MSEC
; i
++) {
16112 /* Poll once each microsecond for command completion. */
16113 for (j
= 0; j
< SCSI_US_PER_MSEC
; j
++) {
16114 AdvReadWordLram(iop_base
, ASC_MC_IDLE_CMD_STATUS
,
16117 DvcLeaveCritical(last_int_level
);
16120 DvcDelayMicroSecond(asc_dvc
, (ushort
)1);
16124 ASC_ASSERT(0); /* The idle command should never timeout. */
16125 DvcLeaveCritical(last_int_level
);
16129 static int __devinit
16130 advansys_wide_init_chip(asc_board_t
*boardp
, ADV_DVC_VAR
*adv_dvc_varp
)
16133 adv_req_t
*reqp
= NULL
;
16136 int warn_code
, err_code
;
16139 * Allocate buffer carrier structures. The total size
16140 * is about 4 KB, so allocate all at once.
16142 boardp
->carrp
= kmalloc(ADV_CARRIER_BUFSIZE
, GFP_KERNEL
);
16143 ASC_DBG1(1, "advansys_wide_init_chip: carrp 0x%p\n", boardp
->carrp
);
16145 if (!boardp
->carrp
)
16146 goto kmalloc_failed
;
16149 * Allocate up to 'max_host_qng' request structures for the Wide
16150 * board. The total size is about 16 KB, so allocate all at once.
16151 * If the allocation fails decrement and try again.
16153 for (req_cnt
= adv_dvc_varp
->max_host_qng
; req_cnt
> 0; req_cnt
--) {
16154 reqp
= kmalloc(sizeof(adv_req_t
) * req_cnt
, GFP_KERNEL
);
16156 ASC_DBG3(1, "advansys_wide_init_chip: reqp 0x%p, req_cnt %d, "
16157 "bytes %lu\n", reqp
, req_cnt
,
16158 (ulong
)sizeof(adv_req_t
) * req_cnt
);
16165 goto kmalloc_failed
;
16167 boardp
->orig_reqp
= reqp
;
16170 * Allocate up to ADV_TOT_SG_BLOCK request structures for
16171 * the Wide board. Each structure is about 136 bytes.
16173 boardp
->adv_sgblkp
= NULL
;
16174 for (sg_cnt
= 0; sg_cnt
< ADV_TOT_SG_BLOCK
; sg_cnt
++) {
16175 sgp
= kmalloc(sizeof(adv_sgblk_t
), GFP_KERNEL
);
16180 sgp
->next_sgblkp
= boardp
->adv_sgblkp
;
16181 boardp
->adv_sgblkp
= sgp
;
16185 ASC_DBG3(1, "advansys_wide_init_chip: sg_cnt %d * %u = %u bytes\n",
16186 sg_cnt
, sizeof(adv_sgblk_t
),
16187 (unsigned)(sizeof(adv_sgblk_t
) * sg_cnt
));
16189 if (!boardp
->adv_sgblkp
)
16190 goto kmalloc_failed
;
16192 adv_dvc_varp
->carrier_buf
= boardp
->carrp
;
16195 * Point 'adv_reqp' to the request structures and
16196 * link them together.
16199 reqp
[req_cnt
].next_reqp
= NULL
;
16200 for (; req_cnt
> 0; req_cnt
--) {
16201 reqp
[req_cnt
- 1].next_reqp
= &reqp
[req_cnt
];
16203 boardp
->adv_reqp
= &reqp
[0];
16205 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
16206 ASC_DBG(2, "advansys_wide_init_chip: AdvInitAsc3550Driver()\n");
16207 warn_code
= AdvInitAsc3550Driver(adv_dvc_varp
);
16208 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
16209 ASC_DBG(2, "advansys_wide_init_chip: AdvInitAsc38C0800Driver()"
16211 warn_code
= AdvInitAsc38C0800Driver(adv_dvc_varp
);
16213 ASC_DBG(2, "advansys_wide_init_chip: AdvInitAsc38C1600Driver()"
16215 warn_code
= AdvInitAsc38C1600Driver(adv_dvc_varp
);
16217 err_code
= adv_dvc_varp
->err_code
;
16219 if (warn_code
|| err_code
) {
16220 ASC_PRINT3("advansys_wide_init_chip: board %d error: warn 0x%x,"
16221 " error 0x%x\n", boardp
->id
, warn_code
, err_code
);
16227 ASC_PRINT1("advansys_wide_init_chip: board %d error: kmalloc() "
16228 "failed\n", boardp
->id
);
16229 err_code
= ADV_ERROR
;
16234 static void advansys_wide_free_mem(asc_board_t
*boardp
)
16236 kfree(boardp
->carrp
);
16237 boardp
->carrp
= NULL
;
16238 kfree(boardp
->orig_reqp
);
16239 boardp
->orig_reqp
= boardp
->adv_reqp
= NULL
;
16240 while (boardp
->adv_sgblkp
) {
16241 adv_sgblk_t
*sgp
= boardp
->adv_sgblkp
;
16242 boardp
->adv_sgblkp
= sgp
->next_sgblkp
;
16247 static struct Scsi_Host
*__devinit
16248 advansys_board_found(int iop
, struct device
*dev
, int bus_type
)
16250 struct Scsi_Host
*shost
;
16251 struct pci_dev
*pdev
= bus_type
== ASC_IS_PCI
? to_pci_dev(dev
) : NULL
;
16252 asc_board_t
*boardp
;
16253 ASC_DVC_VAR
*asc_dvc_varp
= NULL
;
16254 ADV_DVC_VAR
*adv_dvc_varp
= NULL
;
16256 int warn_code
, err_code
;
16260 * Register the adapter, get its configuration, and
16263 ASC_DBG(2, "advansys_board_found: scsi_host_alloc()\n");
16264 shost
= scsi_host_alloc(&advansys_template
, sizeof(asc_board_t
));
16268 /* Initialize private per board data */
16269 boardp
= ASC_BOARDP(shost
);
16270 memset(boardp
, 0, sizeof(asc_board_t
));
16271 boardp
->id
= asc_board_count
++;
16272 spin_lock_init(&boardp
->lock
);
16276 * Handle both narrow and wide boards.
16278 * If a Wide board was detected, set the board structure
16279 * wide board flag. Set-up the board structure based on
16283 if (bus_type
== ASC_IS_PCI
&&
16284 (pdev
->device
== PCI_DEVICE_ID_ASP_ABP940UW
||
16285 pdev
->device
== PCI_DEVICE_ID_38C0800_REV1
||
16286 pdev
->device
== PCI_DEVICE_ID_38C1600_REV1
)) {
16287 boardp
->flags
|= ASC_IS_WIDE_BOARD
;
16289 #endif /* CONFIG_PCI */
16291 if (ASC_NARROW_BOARD(boardp
)) {
16292 ASC_DBG(1, "advansys_board_found: narrow board\n");
16293 asc_dvc_varp
= &boardp
->dvc_var
.asc_dvc_var
;
16294 asc_dvc_varp
->bus_type
= bus_type
;
16295 asc_dvc_varp
->drv_ptr
= boardp
;
16296 asc_dvc_varp
->cfg
= &boardp
->dvc_cfg
.asc_dvc_cfg
;
16297 asc_dvc_varp
->cfg
->overrun_buf
= &overrun_buf
[0];
16298 asc_dvc_varp
->iop_base
= iop
;
16301 ASC_DBG(1, "advansys_board_found: wide board\n");
16302 adv_dvc_varp
= &boardp
->dvc_var
.adv_dvc_var
;
16303 adv_dvc_varp
->drv_ptr
= boardp
;
16304 adv_dvc_varp
->cfg
= &boardp
->dvc_cfg
.adv_dvc_cfg
;
16305 if (pdev
->device
== PCI_DEVICE_ID_ASP_ABP940UW
) {
16306 ASC_DBG(1, "advansys_board_found: ASC-3550\n");
16307 adv_dvc_varp
->chip_type
= ADV_CHIP_ASC3550
;
16308 } else if (pdev
->device
== PCI_DEVICE_ID_38C0800_REV1
) {
16309 ASC_DBG(1, "advansys_board_found: ASC-38C0800\n");
16310 adv_dvc_varp
->chip_type
= ADV_CHIP_ASC38C0800
;
16312 ASC_DBG(1, "advansys_board_found: ASC-38C1600\n");
16313 adv_dvc_varp
->chip_type
= ADV_CHIP_ASC38C1600
;
16316 boardp
->asc_n_io_port
= pci_resource_len(pdev
, 1);
16317 boardp
->ioremap_addr
= ioremap(pci_resource_start(pdev
, 1),
16318 boardp
->asc_n_io_port
);
16319 if (!boardp
->ioremap_addr
) {
16321 ("advansys_board_found: board %d: ioremap(%x, %d) returned NULL\n",
16322 boardp
->id
, pci_resource_start(pdev
, 1),
16323 boardp
->asc_n_io_port
);
16326 adv_dvc_varp
->iop_base
= (AdvPortAddr
)boardp
->ioremap_addr
16327 ASC_DBG1(1, "advansys_board_found: iop_base: 0x%lx\n",
16328 adv_dvc_varp
->iop_base
);
16331 * Even though it isn't used to access wide boards, other
16332 * than for the debug line below, save I/O Port address so
16333 * that it can be reported.
16335 boardp
->ioport
= iop
;
16337 ASC_DBG2(1, "advansys_board_found: iopb_chip_id_1 0x%x, "
16338 "iopw_chip_id_0 0x%x\n", (ushort
)inp(iop
+ 1),
16339 (ushort
)inpw(iop
));
16340 #endif /* CONFIG_PCI */
16343 #ifdef CONFIG_PROC_FS
16345 * Allocate buffer for printing information from
16346 * /proc/scsi/advansys/[0...].
16348 boardp
->prtbuf
= kmalloc(ASC_PRTBUF_SIZE
, GFP_KERNEL
);
16349 if (!boardp
->prtbuf
) {
16350 ASC_PRINT2("advansys_board_found: board %d: kmalloc(%d) "
16351 "returned NULL\n", boardp
->id
, ASC_PRTBUF_SIZE
);
16354 #endif /* CONFIG_PROC_FS */
16356 if (ASC_NARROW_BOARD(boardp
)) {
16358 * Set the board bus type and PCI IRQ before
16359 * calling AscInitGetConfig().
16361 switch (asc_dvc_varp
->bus_type
) {
16364 shost
->unchecked_isa_dma
= TRUE
;
16368 shost
->unchecked_isa_dma
= FALSE
;
16372 shost
->unchecked_isa_dma
= FALSE
;
16373 share_irq
= IRQF_SHARED
;
16375 #endif /* CONFIG_ISA */
16378 shost
->irq
= asc_dvc_varp
->irq_no
= pdev
->irq
;
16379 shost
->unchecked_isa_dma
= FALSE
;
16380 share_irq
= IRQF_SHARED
;
16382 #endif /* CONFIG_PCI */
16385 ("advansys_board_found: board %d: unknown adapter type: %d\n",
16386 boardp
->id
, asc_dvc_varp
->bus_type
);
16387 shost
->unchecked_isa_dma
= TRUE
;
16393 * For Wide boards set PCI information before calling
16394 * AdvInitGetConfig().
16397 shost
->irq
= adv_dvc_varp
->irq_no
= pdev
->irq
;
16398 shost
->unchecked_isa_dma
= FALSE
;
16399 share_irq
= IRQF_SHARED
;
16400 #endif /* CONFIG_PCI */
16404 * Read the board configuration.
16406 if (ASC_NARROW_BOARD(boardp
)) {
16408 * NOTE: AscInitGetConfig() may change the board's
16409 * bus_type value. The bus_type value should no
16410 * longer be used. If the bus_type field must be
16411 * referenced only use the bit-wise AND operator "&".
16413 ASC_DBG(2, "advansys_board_found: AscInitGetConfig()\n");
16414 switch (ret
= AscInitGetConfig(asc_dvc_varp
)) {
16415 case 0: /* No error */
16417 case ASC_WARN_IO_PORT_ROTATE
:
16419 ("AscInitGetConfig: board %d: I/O port address modified\n",
16422 case ASC_WARN_AUTO_CONFIG
:
16424 ("AscInitGetConfig: board %d: I/O port increment switch enabled\n",
16427 case ASC_WARN_EEPROM_CHKSUM
:
16429 ("AscInitGetConfig: board %d: EEPROM checksum error\n",
16432 case ASC_WARN_IRQ_MODIFIED
:
16434 ("AscInitGetConfig: board %d: IRQ modified\n",
16437 case ASC_WARN_CMD_QNG_CONFLICT
:
16439 ("AscInitGetConfig: board %d: tag queuing enabled w/o disconnects\n",
16444 ("AscInitGetConfig: board %d: unknown warning: 0x%x\n",
16448 if ((err_code
= asc_dvc_varp
->err_code
) != 0) {
16450 ("AscInitGetConfig: board %d error: init_state 0x%x, err_code 0x%x\n",
16452 asc_dvc_varp
->init_state
, asc_dvc_varp
->err_code
);
16455 ASC_DBG(2, "advansys_board_found: AdvInitGetConfig()\n");
16457 ret
= AdvInitGetConfig(pdev
, adv_dvc_varp
);
16460 ("AdvInitGetConfig: board %d: warning: 0x%x\n",
16463 if ((err_code
= adv_dvc_varp
->err_code
) != 0) {
16465 ("AdvInitGetConfig: board %d error: err_code 0x%x\n",
16466 boardp
->id
, adv_dvc_varp
->err_code
);
16471 goto err_free_proc
;
16474 * Save the EEPROM configuration so that it can be displayed
16475 * from /proc/scsi/advansys/[0...].
16477 if (ASC_NARROW_BOARD(boardp
)) {
16482 * Set the adapter's target id bit in the 'init_tidmask' field.
16484 boardp
->init_tidmask
|=
16485 ADV_TID_TO_TIDMASK(asc_dvc_varp
->cfg
->chip_scsi_id
);
16488 * Save EEPROM settings for the board.
16490 ep
= &boardp
->eep_config
.asc_eep
;
16492 ep
->init_sdtr
= asc_dvc_varp
->cfg
->sdtr_enable
;
16493 ep
->disc_enable
= asc_dvc_varp
->cfg
->disc_enable
;
16494 ep
->use_cmd_qng
= asc_dvc_varp
->cfg
->cmd_qng_enabled
;
16495 ASC_EEP_SET_DMA_SPD(ep
, asc_dvc_varp
->cfg
->isa_dma_speed
);
16496 ep
->start_motor
= asc_dvc_varp
->start_motor
;
16497 ep
->cntl
= asc_dvc_varp
->dvc_cntl
;
16498 ep
->no_scam
= asc_dvc_varp
->no_scam
;
16499 ep
->max_total_qng
= asc_dvc_varp
->max_total_qng
;
16500 ASC_EEP_SET_CHIP_ID(ep
, asc_dvc_varp
->cfg
->chip_scsi_id
);
16501 /* 'max_tag_qng' is set to the same value for every device. */
16502 ep
->max_tag_qng
= asc_dvc_varp
->cfg
->max_tag_qng
[0];
16503 ep
->adapter_info
[0] = asc_dvc_varp
->cfg
->adapter_info
[0];
16504 ep
->adapter_info
[1] = asc_dvc_varp
->cfg
->adapter_info
[1];
16505 ep
->adapter_info
[2] = asc_dvc_varp
->cfg
->adapter_info
[2];
16506 ep
->adapter_info
[3] = asc_dvc_varp
->cfg
->adapter_info
[3];
16507 ep
->adapter_info
[4] = asc_dvc_varp
->cfg
->adapter_info
[4];
16508 ep
->adapter_info
[5] = asc_dvc_varp
->cfg
->adapter_info
[5];
16511 * Modify board configuration.
16513 ASC_DBG(2, "advansys_board_found: AscInitSetConfig()\n");
16514 switch (ret
= AscInitSetConfig(pdev
, asc_dvc_varp
)) {
16515 case 0: /* No error. */
16517 case ASC_WARN_IO_PORT_ROTATE
:
16519 ("AscInitSetConfig: board %d: I/O port address modified\n",
16522 case ASC_WARN_AUTO_CONFIG
:
16524 ("AscInitSetConfig: board %d: I/O port increment switch enabled\n",
16527 case ASC_WARN_EEPROM_CHKSUM
:
16529 ("AscInitSetConfig: board %d: EEPROM checksum error\n",
16532 case ASC_WARN_IRQ_MODIFIED
:
16534 ("AscInitSetConfig: board %d: IRQ modified\n",
16537 case ASC_WARN_CMD_QNG_CONFLICT
:
16539 ("AscInitSetConfig: board %d: tag queuing w/o disconnects\n",
16544 ("AscInitSetConfig: board %d: unknown warning: 0x%x\n",
16548 if (asc_dvc_varp
->err_code
!= 0) {
16550 ("AscInitSetConfig: board %d error: init_state 0x%x, err_code 0x%x\n",
16552 asc_dvc_varp
->init_state
, asc_dvc_varp
->err_code
);
16553 goto err_free_proc
;
16557 * Finish initializing the 'Scsi_Host' structure.
16559 /* AscInitSetConfig() will set the IRQ for non-PCI boards. */
16560 if ((asc_dvc_varp
->bus_type
& ASC_IS_PCI
) == 0) {
16561 shost
->irq
= asc_dvc_varp
->irq_no
;
16564 ADVEEP_3550_CONFIG
*ep_3550
;
16565 ADVEEP_38C0800_CONFIG
*ep_38C0800
;
16566 ADVEEP_38C1600_CONFIG
*ep_38C1600
;
16569 * Save Wide EEP Configuration Information.
16571 if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC3550
) {
16572 ep_3550
= &boardp
->eep_config
.adv_3550_eep
;
16574 ep_3550
->adapter_scsi_id
= adv_dvc_varp
->chip_scsi_id
;
16575 ep_3550
->max_host_qng
= adv_dvc_varp
->max_host_qng
;
16576 ep_3550
->max_dvc_qng
= adv_dvc_varp
->max_dvc_qng
;
16577 ep_3550
->termination
= adv_dvc_varp
->cfg
->termination
;
16578 ep_3550
->disc_enable
= adv_dvc_varp
->cfg
->disc_enable
;
16579 ep_3550
->bios_ctrl
= adv_dvc_varp
->bios_ctrl
;
16580 ep_3550
->wdtr_able
= adv_dvc_varp
->wdtr_able
;
16581 ep_3550
->sdtr_able
= adv_dvc_varp
->sdtr_able
;
16582 ep_3550
->ultra_able
= adv_dvc_varp
->ultra_able
;
16583 ep_3550
->tagqng_able
= adv_dvc_varp
->tagqng_able
;
16584 ep_3550
->start_motor
= adv_dvc_varp
->start_motor
;
16585 ep_3550
->scsi_reset_delay
=
16586 adv_dvc_varp
->scsi_reset_wait
;
16587 ep_3550
->serial_number_word1
=
16588 adv_dvc_varp
->cfg
->serial1
;
16589 ep_3550
->serial_number_word2
=
16590 adv_dvc_varp
->cfg
->serial2
;
16591 ep_3550
->serial_number_word3
=
16592 adv_dvc_varp
->cfg
->serial3
;
16593 } else if (adv_dvc_varp
->chip_type
== ADV_CHIP_ASC38C0800
) {
16594 ep_38C0800
= &boardp
->eep_config
.adv_38C0800_eep
;
16596 ep_38C0800
->adapter_scsi_id
=
16597 adv_dvc_varp
->chip_scsi_id
;
16598 ep_38C0800
->max_host_qng
= adv_dvc_varp
->max_host_qng
;
16599 ep_38C0800
->max_dvc_qng
= adv_dvc_varp
->max_dvc_qng
;
16600 ep_38C0800
->termination_lvd
=
16601 adv_dvc_varp
->cfg
->termination
;
16602 ep_38C0800
->disc_enable
=
16603 adv_dvc_varp
->cfg
->disc_enable
;
16604 ep_38C0800
->bios_ctrl
= adv_dvc_varp
->bios_ctrl
;
16605 ep_38C0800
->wdtr_able
= adv_dvc_varp
->wdtr_able
;
16606 ep_38C0800
->tagqng_able
= adv_dvc_varp
->tagqng_able
;
16607 ep_38C0800
->sdtr_speed1
= adv_dvc_varp
->sdtr_speed1
;
16608 ep_38C0800
->sdtr_speed2
= adv_dvc_varp
->sdtr_speed2
;
16609 ep_38C0800
->sdtr_speed3
= adv_dvc_varp
->sdtr_speed3
;
16610 ep_38C0800
->sdtr_speed4
= adv_dvc_varp
->sdtr_speed4
;
16611 ep_38C0800
->tagqng_able
= adv_dvc_varp
->tagqng_able
;
16612 ep_38C0800
->start_motor
= adv_dvc_varp
->start_motor
;
16613 ep_38C0800
->scsi_reset_delay
=
16614 adv_dvc_varp
->scsi_reset_wait
;
16615 ep_38C0800
->serial_number_word1
=
16616 adv_dvc_varp
->cfg
->serial1
;
16617 ep_38C0800
->serial_number_word2
=
16618 adv_dvc_varp
->cfg
->serial2
;
16619 ep_38C0800
->serial_number_word3
=
16620 adv_dvc_varp
->cfg
->serial3
;
16622 ep_38C1600
= &boardp
->eep_config
.adv_38C1600_eep
;
16624 ep_38C1600
->adapter_scsi_id
=
16625 adv_dvc_varp
->chip_scsi_id
;
16626 ep_38C1600
->max_host_qng
= adv_dvc_varp
->max_host_qng
;
16627 ep_38C1600
->max_dvc_qng
= adv_dvc_varp
->max_dvc_qng
;
16628 ep_38C1600
->termination_lvd
=
16629 adv_dvc_varp
->cfg
->termination
;
16630 ep_38C1600
->disc_enable
=
16631 adv_dvc_varp
->cfg
->disc_enable
;
16632 ep_38C1600
->bios_ctrl
= adv_dvc_varp
->bios_ctrl
;
16633 ep_38C1600
->wdtr_able
= adv_dvc_varp
->wdtr_able
;
16634 ep_38C1600
->tagqng_able
= adv_dvc_varp
->tagqng_able
;
16635 ep_38C1600
->sdtr_speed1
= adv_dvc_varp
->sdtr_speed1
;
16636 ep_38C1600
->sdtr_speed2
= adv_dvc_varp
->sdtr_speed2
;
16637 ep_38C1600
->sdtr_speed3
= adv_dvc_varp
->sdtr_speed3
;
16638 ep_38C1600
->sdtr_speed4
= adv_dvc_varp
->sdtr_speed4
;
16639 ep_38C1600
->tagqng_able
= adv_dvc_varp
->tagqng_able
;
16640 ep_38C1600
->start_motor
= adv_dvc_varp
->start_motor
;
16641 ep_38C1600
->scsi_reset_delay
=
16642 adv_dvc_varp
->scsi_reset_wait
;
16643 ep_38C1600
->serial_number_word1
=
16644 adv_dvc_varp
->cfg
->serial1
;
16645 ep_38C1600
->serial_number_word2
=
16646 adv_dvc_varp
->cfg
->serial2
;
16647 ep_38C1600
->serial_number_word3
=
16648 adv_dvc_varp
->cfg
->serial3
;
16652 * Set the adapter's target id bit in the 'init_tidmask' field.
16654 boardp
->init_tidmask
|=
16655 ADV_TID_TO_TIDMASK(adv_dvc_varp
->chip_scsi_id
);
16659 * Channels are numbered beginning with 0. For AdvanSys one host
16660 * structure supports one channel. Multi-channel boards have a
16661 * separate host structure for each channel.
16663 shost
->max_channel
= 0;
16664 if (ASC_NARROW_BOARD(boardp
)) {
16665 shost
->max_id
= ASC_MAX_TID
+ 1;
16666 shost
->max_lun
= ASC_MAX_LUN
+ 1;
16668 shost
->io_port
= asc_dvc_varp
->iop_base
;
16669 boardp
->asc_n_io_port
= ASC_IOADR_GAP
;
16670 shost
->this_id
= asc_dvc_varp
->cfg
->chip_scsi_id
;
16672 /* Set maximum number of queues the adapter can handle. */
16673 shost
->can_queue
= asc_dvc_varp
->max_total_qng
;
16675 shost
->max_id
= ADV_MAX_TID
+ 1;
16676 shost
->max_lun
= ADV_MAX_LUN
+ 1;
16679 * Save the I/O Port address and length even though
16680 * I/O ports are not used to access Wide boards.
16681 * Instead the Wide boards are accessed with
16682 * PCI Memory Mapped I/O.
16684 shost
->io_port
= iop
;
16686 shost
->this_id
= adv_dvc_varp
->chip_scsi_id
;
16688 /* Set maximum number of queues the adapter can handle. */
16689 shost
->can_queue
= adv_dvc_varp
->max_host_qng
;
16693 * Following v1.3.89, 'cmd_per_lun' is no longer needed
16694 * and should be set to zero.
16696 * But because of a bug introduced in v1.3.89 if the driver is
16697 * compiled as a module and 'cmd_per_lun' is zero, the Mid-Level
16698 * SCSI function 'allocate_device' will panic. To allow the driver
16699 * to work as a module in these kernels set 'cmd_per_lun' to 1.
16701 * Note: This is wrong. cmd_per_lun should be set to the depth
16702 * you want on untagged devices always.
16705 shost
->cmd_per_lun
= 1;
16707 shost->cmd_per_lun = 0;
16711 * Set the maximum number of scatter-gather elements the
16712 * adapter can handle.
16714 if (ASC_NARROW_BOARD(boardp
)) {
16716 * Allow two commands with 'sg_tablesize' scatter-gather
16717 * elements to be executed simultaneously. This value is
16718 * the theoretical hardware limit. It may be decreased
16721 shost
->sg_tablesize
=
16722 (((asc_dvc_varp
->max_total_qng
- 2) / 2) *
16723 ASC_SG_LIST_PER_Q
) + 1;
16725 shost
->sg_tablesize
= ADV_MAX_SG_LIST
;
16729 * The value of 'sg_tablesize' can not exceed the SCSI
16730 * mid-level driver definition of SG_ALL. SG_ALL also
16731 * must not be exceeded, because it is used to define the
16732 * size of the scatter-gather table in 'struct asc_sg_head'.
16734 if (shost
->sg_tablesize
> SG_ALL
) {
16735 shost
->sg_tablesize
= SG_ALL
;
16738 ASC_DBG1(1, "advansys_board_found: sg_tablesize: %d\n", shost
->sg_tablesize
);
16740 /* BIOS start address. */
16741 if (ASC_NARROW_BOARD(boardp
)) {
16742 shost
->base
= AscGetChipBiosAddress(asc_dvc_varp
->iop_base
,
16743 asc_dvc_varp
->bus_type
);
16746 * Fill-in BIOS board variables. The Wide BIOS saves
16747 * information in LRAM that is used by the driver.
16749 AdvReadWordLram(adv_dvc_varp
->iop_base
,
16750 BIOS_SIGNATURE
, boardp
->bios_signature
);
16751 AdvReadWordLram(adv_dvc_varp
->iop_base
,
16752 BIOS_VERSION
, boardp
->bios_version
);
16753 AdvReadWordLram(adv_dvc_varp
->iop_base
,
16754 BIOS_CODESEG
, boardp
->bios_codeseg
);
16755 AdvReadWordLram(adv_dvc_varp
->iop_base
,
16756 BIOS_CODELEN
, boardp
->bios_codelen
);
16759 "advansys_board_found: bios_signature 0x%x, bios_version 0x%x\n",
16760 boardp
->bios_signature
, boardp
->bios_version
);
16763 "advansys_board_found: bios_codeseg 0x%x, bios_codelen 0x%x\n",
16764 boardp
->bios_codeseg
, boardp
->bios_codelen
);
16767 * If the BIOS saved a valid signature, then fill in
16768 * the BIOS code segment base address.
16770 if (boardp
->bios_signature
== 0x55AA) {
16772 * Convert x86 realmode code segment to a linear
16773 * address by shifting left 4.
16775 shost
->base
= ((ulong
)boardp
->bios_codeseg
<< 4);
16782 * Register Board Resources - I/O Port, DMA, IRQ
16785 /* Register DMA Channel for Narrow boards. */
16786 shost
->dma_channel
= NO_ISA_DMA
; /* Default to no ISA DMA. */
16788 if (ASC_NARROW_BOARD(boardp
)) {
16789 /* Register DMA channel for ISA bus. */
16790 if (asc_dvc_varp
->bus_type
& ASC_IS_ISA
) {
16791 shost
->dma_channel
= asc_dvc_varp
->cfg
->isa_dma_channel
;
16792 ret
= request_dma(shost
->dma_channel
, "advansys");
16795 ("advansys_board_found: board %d: request_dma() %d failed %d\n",
16796 boardp
->id
, shost
->dma_channel
, ret
);
16797 goto err_free_proc
;
16799 AscEnableIsaDma(shost
->dma_channel
);
16802 #endif /* CONFIG_ISA */
16804 /* Register IRQ Number. */
16805 ASC_DBG1(2, "advansys_board_found: request_irq() %d\n", shost
->irq
);
16807 ret
= request_irq(shost
->irq
, advansys_interrupt
, share_irq
,
16808 "advansys", shost
);
16811 if (ret
== -EBUSY
) {
16813 ("advansys_board_found: board %d: request_irq(): IRQ 0x%x already in use.\n",
16814 boardp
->id
, shost
->irq
);
16815 } else if (ret
== -EINVAL
) {
16817 ("advansys_board_found: board %d: request_irq(): IRQ 0x%x not valid.\n",
16818 boardp
->id
, shost
->irq
);
16821 ("advansys_board_found: board %d: request_irq(): IRQ 0x%x failed with %d\n",
16822 boardp
->id
, shost
->irq
, ret
);
16828 * Initialize board RISC chip and enable interrupts.
16830 if (ASC_NARROW_BOARD(boardp
)) {
16831 ASC_DBG(2, "advansys_board_found: AscInitAsc1000Driver()\n");
16832 warn_code
= AscInitAsc1000Driver(asc_dvc_varp
);
16833 err_code
= asc_dvc_varp
->err_code
;
16835 if (warn_code
|| err_code
) {
16837 ("advansys_board_found: board %d error: init_state 0x%x, warn 0x%x, error 0x%x\n",
16839 asc_dvc_varp
->init_state
, warn_code
, err_code
);
16842 err_code
= advansys_wide_init_chip(boardp
, adv_dvc_varp
);
16846 goto err_free_wide_mem
;
16848 ASC_DBG_PRT_SCSI_HOST(2, shost
);
16850 ret
= scsi_add_host(shost
, dev
);
16852 goto err_free_wide_mem
;
16854 scsi_scan_host(shost
);
16858 advansys_wide_free_mem(boardp
);
16859 free_irq(shost
->irq
, shost
);
16861 if (shost
->dma_channel
!= NO_ISA_DMA
)
16862 free_dma(shost
->dma_channel
);
16864 kfree(boardp
->prtbuf
);
16866 if (boardp
->ioremap_addr
)
16867 iounmap(boardp
->ioremap_addr
);
16869 scsi_host_put(shost
);
16874 * advansys_release()
16876 * Release resources allocated for a single AdvanSys adapter.
16878 static int advansys_release(struct Scsi_Host
*shost
)
16880 asc_board_t
*boardp
;
16882 ASC_DBG(1, "advansys_release: begin\n");
16883 scsi_remove_host(shost
);
16884 boardp
= ASC_BOARDP(shost
);
16885 free_irq(shost
->irq
, shost
);
16886 if (shost
->dma_channel
!= NO_ISA_DMA
) {
16887 ASC_DBG(1, "advansys_release: free_dma()\n");
16888 free_dma(shost
->dma_channel
);
16890 if (ASC_WIDE_BOARD(boardp
)) {
16891 iounmap(boardp
->ioremap_addr
);
16892 advansys_wide_free_mem(boardp
);
16894 kfree(boardp
->prtbuf
);
16895 scsi_host_put(shost
);
16896 ASC_DBG(1, "advansys_release: end\n");
16900 static PortAddr _asc_def_iop_base
[ASC_IOADR_TABLE_MAX_IX
] __devinitdata
= {
16901 0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190,
16902 0x0210, 0x0230, 0x0250, 0x0330
16905 static int __devinit
advansys_isa_probe(struct device
*dev
, unsigned int id
)
16907 PortAddr iop_base
= _asc_def_iop_base
[id
];
16908 struct Scsi_Host
*shost
;
16910 if (!request_region(iop_base
, ASC_IOADR_GAP
, "advansys")) {
16911 ASC_DBG1(1, "advansys_isa_match: I/O port 0x%x busy\n",
16915 ASC_DBG1(1, "advansys_isa_match: probing I/O port 0x%x\n", iop_base
);
16916 if (!AscFindSignature(iop_base
))
16918 if (!(AscGetChipVersion(iop_base
, ASC_IS_ISA
) & ASC_CHIP_VER_ISA_BIT
))
16921 shost
= advansys_board_found(iop_base
, dev
, ASC_IS_ISA
);
16925 dev_set_drvdata(dev
, shost
);
16929 release_region(iop_base
, ASC_IOADR_GAP
);
16933 static int __devexit
advansys_isa_remove(struct device
*dev
, unsigned int id
)
16935 int ioport
= _asc_def_iop_base
[id
];
16936 advansys_release(dev_get_drvdata(dev
));
16937 release_region(ioport
, ASC_IOADR_GAP
);
16941 static struct isa_driver advansys_isa_driver
= {
16942 .probe
= advansys_isa_probe
,
16943 .remove
= __devexit_p(advansys_isa_remove
),
16945 .owner
= THIS_MODULE
,
16946 .name
= "advansys",
16950 static int __devinit
advansys_vlb_probe(struct device
*dev
, unsigned int id
)
16952 PortAddr iop_base
= _asc_def_iop_base
[id
];
16953 struct Scsi_Host
*shost
;
16955 if (!request_region(iop_base
, ASC_IOADR_GAP
, "advansys")) {
16956 ASC_DBG1(1, "advansys_vlb_match: I/O port 0x%x busy\n",
16960 ASC_DBG1(1, "advansys_vlb_match: probing I/O port 0x%x\n", iop_base
);
16961 if (!AscFindSignature(iop_base
))
16964 * I don't think this condition can actually happen, but the old
16965 * driver did it, and the chances of finding a VLB setup in 2007
16966 * to do testing with is slight to none.
16968 if (AscGetChipVersion(iop_base
, ASC_IS_VL
) > ASC_CHIP_MAX_VER_VL
)
16971 shost
= advansys_board_found(iop_base
, dev
, ASC_IS_VL
);
16975 dev_set_drvdata(dev
, shost
);
16979 release_region(iop_base
, ASC_IOADR_GAP
);
16983 static struct isa_driver advansys_vlb_driver
= {
16984 .probe
= advansys_vlb_probe
,
16985 .remove
= __devexit_p(advansys_isa_remove
),
16987 .owner
= THIS_MODULE
,
16988 .name
= "advansys",
16992 static struct eisa_device_id advansys_eisa_table
[] __devinitdata
= {
16998 MODULE_DEVICE_TABLE(eisa
, advansys_eisa_table
);
17001 * EISA is a little more tricky than PCI; each EISA device may have two
17002 * channels, and this driver is written to make each channel its own Scsi_Host
17004 struct eisa_scsi_data
{
17005 struct Scsi_Host
*host
[2];
17008 static int __devinit
advansys_eisa_probe(struct device
*dev
)
17012 struct eisa_device
*edev
= to_eisa_device(dev
);
17013 struct eisa_scsi_data
*data
;
17016 data
= kzalloc(sizeof(*data
), GFP_KERNEL
);
17019 ioport
= edev
->base_addr
+ 0xc30;
17022 for (i
= 0; i
< 2; i
++, ioport
+= 0x20) {
17023 if (!request_region(ioport
, ASC_IOADR_GAP
, "advansys")) {
17024 printk(KERN_WARNING
"Region %x-%x busy\n", ioport
,
17025 ioport
+ ASC_IOADR_GAP
- 1);
17028 if (!AscFindSignature(ioport
)) {
17029 release_region(ioport
, ASC_IOADR_GAP
);
17034 * I don't know why we need to do this for EISA chips, but
17035 * not for any others. It looks to be equivalent to
17036 * AscGetChipCfgMsw, but I may have overlooked something,
17037 * so I'm not converting it until I get an EISA board to
17041 data
->host
[i
] = advansys_board_found(ioport
, dev
, ASC_IS_EISA
);
17042 if (data
->host
[i
]) {
17045 release_region(ioport
, ASC_IOADR_GAP
);
17052 dev_set_drvdata(dev
, data
);
17059 static __devexit
int advansys_eisa_remove(struct device
*dev
)
17062 struct eisa_scsi_data
*data
= dev_get_drvdata(dev
);
17064 for (i
= 0; i
< 2; i
++) {
17066 struct Scsi_Host
*shost
= data
->host
[i
];
17069 ioport
= shost
->io_port
;
17070 advansys_release(shost
);
17071 release_region(ioport
, ASC_IOADR_GAP
);
17078 static struct eisa_driver advansys_eisa_driver
= {
17079 .id_table
= advansys_eisa_table
,
17081 .name
= "advansys",
17082 .probe
= advansys_eisa_probe
,
17083 .remove
= __devexit_p(advansys_eisa_remove
),
17087 /* PCI Devices supported by this driver */
17088 static struct pci_device_id advansys_pci_tbl
[] __devinitdata
= {
17089 {PCI_VENDOR_ID_ASP
, PCI_DEVICE_ID_ASP_1200A
,
17090 PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, 0},
17091 {PCI_VENDOR_ID_ASP
, PCI_DEVICE_ID_ASP_ABP940
,
17092 PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, 0},
17093 {PCI_VENDOR_ID_ASP
, PCI_DEVICE_ID_ASP_ABP940U
,
17094 PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, 0},
17095 {PCI_VENDOR_ID_ASP
, PCI_DEVICE_ID_ASP_ABP940UW
,
17096 PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, 0},
17097 {PCI_VENDOR_ID_ASP
, PCI_DEVICE_ID_38C0800_REV1
,
17098 PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, 0},
17099 {PCI_VENDOR_ID_ASP
, PCI_DEVICE_ID_38C1600_REV1
,
17100 PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, 0},
17104 MODULE_DEVICE_TABLE(pci
, advansys_pci_tbl
);
17106 static void __devinit
advansys_set_latency(struct pci_dev
*pdev
)
17108 if ((pdev
->device
== PCI_DEVICE_ID_ASP_1200A
) ||
17109 (pdev
->device
== PCI_DEVICE_ID_ASP_ABP940
)) {
17110 pci_write_config_byte(pdev
, PCI_LATENCY_TIMER
, 0);
17113 pci_read_config_byte(pdev
, PCI_LATENCY_TIMER
, &latency
);
17114 if (latency
< 0x20)
17115 pci_write_config_byte(pdev
, PCI_LATENCY_TIMER
, 0x20);
17119 static int __devinit
17120 advansys_pci_probe(struct pci_dev
*pdev
, const struct pci_device_id
*ent
)
17123 struct Scsi_Host
*shost
;
17125 err
= pci_enable_device(pdev
);
17128 err
= pci_request_regions(pdev
, "advansys");
17130 goto disable_device
;
17131 pci_set_master(pdev
);
17132 advansys_set_latency(pdev
);
17134 if (pci_resource_len(pdev
, 0) == 0)
17137 ioport
= pci_resource_start(pdev
, 0);
17138 shost
= advansys_board_found(ioport
, &pdev
->dev
, ASC_IS_PCI
);
17143 pci_set_drvdata(pdev
, shost
);
17148 pci_release_regions(pdev
);
17150 pci_disable_device(pdev
);
17155 static void __devexit
advansys_pci_remove(struct pci_dev
*pdev
)
17157 advansys_release(pci_get_drvdata(pdev
));
17158 pci_release_regions(pdev
);
17159 pci_disable_device(pdev
);
17162 static struct pci_driver advansys_pci_driver
= {
17163 .name
= "advansys",
17164 .id_table
= advansys_pci_tbl
,
17165 .probe
= advansys_pci_probe
,
17166 .remove
= __devexit_p(advansys_pci_remove
),
17169 static int __init
advansys_init(void)
17173 error
= isa_register_driver(&advansys_isa_driver
,
17174 ASC_IOADR_TABLE_MAX_IX
);
17178 error
= isa_register_driver(&advansys_vlb_driver
,
17179 ASC_IOADR_TABLE_MAX_IX
);
17181 goto unregister_isa
;
17183 error
= eisa_driver_register(&advansys_eisa_driver
);
17185 goto unregister_vlb
;
17187 error
= pci_register_driver(&advansys_pci_driver
);
17189 goto unregister_eisa
;
17194 eisa_driver_unregister(&advansys_eisa_driver
);
17196 isa_unregister_driver(&advansys_vlb_driver
);
17198 isa_unregister_driver(&advansys_isa_driver
);
17203 static void __exit
advansys_exit(void)
17205 pci_unregister_driver(&advansys_pci_driver
);
17206 eisa_driver_unregister(&advansys_eisa_driver
);
17207 isa_unregister_driver(&advansys_vlb_driver
);
17208 isa_unregister_driver(&advansys_isa_driver
);
17211 module_init(advansys_init
);
17212 module_exit(advansys_exit
);
17214 MODULE_LICENSE("GPL");