Matthew Wilcox | 01fbfe0 | 2007-09-09 08:56:40 -0600 | [diff] [blame] | 1 | #define DRV_NAME "advansys" |
Matthew Wilcox | 8c6af9e | 2007-07-26 11:03:19 -0400 | [diff] [blame] | 2 | #define ASC_VERSION "3.4" /* AdvanSys Driver Version */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | |
| 4 | /* |
| 5 | * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters |
| 6 | * |
| 7 | * Copyright (c) 1995-2000 Advanced System Products, Inc. |
| 8 | * Copyright (c) 2000-2001 ConnectCom Solutions, Inc. |
Matthew Wilcox | 8c6af9e | 2007-07-26 11:03:19 -0400 | [diff] [blame] | 9 | * Copyright (c) 2007 Matthew Wilcox <matthew@wil.cx> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * All Rights Reserved. |
| 11 | * |
Matthew Wilcox | 8c6af9e | 2007-07-26 11:03:19 -0400 | [diff] [blame] | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | */ |
| 17 | |
| 18 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | * As of March 8, 2000 Advanced System Products, Inc. (AdvanSys) |
| 20 | * changed its name to ConnectCom Solutions, Inc. |
Matthew Wilcox | 8c6af9e | 2007-07-26 11:03:19 -0400 | [diff] [blame] | 21 | * On June 18, 2001 Initio Corp. acquired ConnectCom's SCSI assets |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | */ |
| 23 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include <linux/string.h> |
| 26 | #include <linux/kernel.h> |
| 27 | #include <linux/types.h> |
| 28 | #include <linux/ioport.h> |
| 29 | #include <linux/interrupt.h> |
| 30 | #include <linux/delay.h> |
| 31 | #include <linux/slab.h> |
| 32 | #include <linux/mm.h> |
| 33 | #include <linux/proc_fs.h> |
| 34 | #include <linux/init.h> |
| 35 | #include <linux/blkdev.h> |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 36 | #include <linux/isa.h> |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 37 | #include <linux/eisa.h> |
Matthew Wilcox | 8c6af9e | 2007-07-26 11:03:19 -0400 | [diff] [blame] | 38 | #include <linux/pci.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | #include <linux/spinlock.h> |
| 40 | #include <linux/dma-mapping.h> |
| 41 | |
| 42 | #include <asm/io.h> |
| 43 | #include <asm/system.h> |
| 44 | #include <asm/dma.h> |
| 45 | |
Matthew Wilcox | 8c6af9e | 2007-07-26 11:03:19 -0400 | [diff] [blame] | 46 | #include <scsi/scsi_cmnd.h> |
| 47 | #include <scsi/scsi_device.h> |
| 48 | #include <scsi/scsi_tcq.h> |
| 49 | #include <scsi/scsi.h> |
| 50 | #include <scsi/scsi_host.h> |
| 51 | |
Matthew Wilcox | 4bd6d7f | 2007-07-30 08:41:03 -0600 | [diff] [blame] | 52 | /* FIXME: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | * |
Matthew Wilcox | 4bd6d7f | 2007-07-30 08:41:03 -0600 | [diff] [blame] | 54 | * 1. Although all of the necessary command mapping places have the |
| 55 | * appropriate dma_map.. APIs, the driver still processes its internal |
| 56 | * queue using bus_to_virt() and virt_to_bus() which are illegal under |
| 57 | * the API. The entire queue processing structure will need to be |
| 58 | * altered to fix this. |
| 59 | * 2. Need to add memory mapping workaround. Test the memory mapping. |
| 60 | * If it doesn't work revert to I/O port access. Can a test be done |
| 61 | * safely? |
| 62 | * 3. Handle an interrupt not working. Keep an interrupt counter in |
| 63 | * the interrupt handler. In the timeout function if the interrupt |
| 64 | * has not occurred then print a message and run in polled mode. |
| 65 | * 4. Need to add support for target mode commands, cf. CAM XPT. |
| 66 | * 5. check DMA mapping functions for failure |
Matthew Wilcox | 349d2c4 | 2007-09-09 08:56:34 -0600 | [diff] [blame] | 67 | * 6. Use scsi_transport_spi |
| 68 | * 7. advansys_info is not safe against multiple simultaneous callers |
| 69 | * 8. Kill boardp->id |
| 70 | * 9. Add module_param to override ISA/VLB ioport array |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | */ |
| 72 | #warning this driver is still not properly converted to the DMA API |
| 73 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | /* Enable driver /proc statistics. */ |
| 75 | #define ADVANSYS_STATS |
| 76 | |
| 77 | /* Enable driver tracing. */ |
| 78 | /* #define ADVANSYS_DEBUG */ |
| 79 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | #define ASC_LIB_VERSION_MAJOR 1 |
| 81 | #define ASC_LIB_VERSION_MINOR 24 |
| 82 | #define ASC_LIB_SERIAL_NUMBER 123 |
| 83 | |
| 84 | /* |
| 85 | * Portable Data Types |
| 86 | * |
| 87 | * Any instance where a 32-bit long or pointer type is assumed |
| 88 | * for precision or HW defined structures, the following define |
| 89 | * types must be used. In Linux the char, short, and int types |
| 90 | * are all consistent at 8, 16, and 32 bits respectively. Pointers |
| 91 | * and long types are 64 bits on Alpha and UltraSPARC. |
| 92 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 93 | #define ASC_PADDR __u32 /* Physical/Bus address data type. */ |
| 94 | #define ASC_VADDR __u32 /* Virtual address data type. */ |
| 95 | #define ASC_DCNT __u32 /* Unsigned Data count type. */ |
| 96 | #define ASC_SDCNT __s32 /* Signed Data count type. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | |
| 98 | /* |
| 99 | * These macros are used to convert a virtual address to a |
| 100 | * 32-bit value. This currently can be used on Linux Alpha |
| 101 | * which uses 64-bit virtual address but a 32-bit bus address. |
| 102 | * This is likely to break in the future, but doing this now |
| 103 | * will give us time to change the HW and FW to handle 64-bit |
| 104 | * addresses. |
| 105 | */ |
| 106 | #define ASC_VADDR_TO_U32 virt_to_bus |
| 107 | #define ASC_U32_TO_VADDR bus_to_virt |
| 108 | |
| 109 | typedef unsigned char uchar; |
| 110 | |
| 111 | #ifndef TRUE |
| 112 | #define TRUE (1) |
| 113 | #endif |
| 114 | #ifndef FALSE |
| 115 | #define FALSE (0) |
| 116 | #endif |
| 117 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | #define ERR (-1) |
| 119 | #define UW_ERR (uint)(0xFFFF) |
| 120 | #define isodd_word(val) ((((uint)val) & (uint)0x0001) != 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | |
Dave Jones | 2672ea8 | 2006-08-02 17:11:49 -0400 | [diff] [blame] | 122 | #define PCI_VENDOR_ID_ASP 0x10cd |
| 123 | #define PCI_DEVICE_ID_ASP_1200A 0x1100 |
| 124 | #define PCI_DEVICE_ID_ASP_ABP940 0x1200 |
| 125 | #define PCI_DEVICE_ID_ASP_ABP940U 0x1300 |
| 126 | #define PCI_DEVICE_ID_ASP_ABP940UW 0x2300 |
| 127 | #define PCI_DEVICE_ID_38C0800_REV1 0x2500 |
| 128 | #define PCI_DEVICE_ID_38C1600_REV1 0x2700 |
| 129 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | /* |
| 131 | * Enable CC_VERY_LONG_SG_LIST to support up to 64K element SG lists. |
| 132 | * The SRB structure will have to be changed and the ASC_SRB2SCSIQ() |
| 133 | * macro re-defined to be able to obtain a ASC_SCSI_Q pointer from the |
| 134 | * SRB structure. |
| 135 | */ |
| 136 | #define CC_VERY_LONG_SG_LIST 0 |
| 137 | #define ASC_SRB2SCSIQ(srb_ptr) (srb_ptr) |
| 138 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 139 | #define PortAddr unsigned short /* port address size */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | #define inp(port) inb(port) |
| 141 | #define outp(port, byte) outb((byte), (port)) |
| 142 | |
| 143 | #define inpw(port) inw(port) |
| 144 | #define outpw(port, word) outw((word), (port)) |
| 145 | |
| 146 | #define ASC_MAX_SG_QUEUE 7 |
| 147 | #define ASC_MAX_SG_LIST 255 |
| 148 | |
| 149 | #define ASC_CS_TYPE unsigned short |
| 150 | |
| 151 | #define ASC_IS_ISA (0x0001) |
| 152 | #define ASC_IS_ISAPNP (0x0081) |
| 153 | #define ASC_IS_EISA (0x0002) |
| 154 | #define ASC_IS_PCI (0x0004) |
| 155 | #define ASC_IS_PCI_ULTRA (0x0104) |
| 156 | #define ASC_IS_PCMCIA (0x0008) |
| 157 | #define ASC_IS_MCA (0x0020) |
| 158 | #define ASC_IS_VL (0x0040) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | #define ASC_IS_WIDESCSI_16 (0x0100) |
| 160 | #define ASC_IS_WIDESCSI_32 (0x0200) |
| 161 | #define ASC_IS_BIG_ENDIAN (0x8000) |
Matthew Wilcox | 95c9f16 | 2007-09-09 08:56:39 -0600 | [diff] [blame] | 162 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | #define ASC_CHIP_MIN_VER_VL (0x01) |
| 164 | #define ASC_CHIP_MAX_VER_VL (0x07) |
| 165 | #define ASC_CHIP_MIN_VER_PCI (0x09) |
| 166 | #define ASC_CHIP_MAX_VER_PCI (0x0F) |
| 167 | #define ASC_CHIP_VER_PCI_BIT (0x08) |
| 168 | #define ASC_CHIP_MIN_VER_ISA (0x11) |
| 169 | #define ASC_CHIP_MIN_VER_ISA_PNP (0x21) |
| 170 | #define ASC_CHIP_MAX_VER_ISA (0x27) |
| 171 | #define ASC_CHIP_VER_ISA_BIT (0x30) |
| 172 | #define ASC_CHIP_VER_ISAPNP_BIT (0x20) |
| 173 | #define ASC_CHIP_VER_ASYN_BUG (0x21) |
| 174 | #define ASC_CHIP_VER_PCI 0x08 |
| 175 | #define ASC_CHIP_VER_PCI_ULTRA_3150 (ASC_CHIP_VER_PCI | 0x02) |
| 176 | #define ASC_CHIP_VER_PCI_ULTRA_3050 (ASC_CHIP_VER_PCI | 0x03) |
| 177 | #define ASC_CHIP_MIN_VER_EISA (0x41) |
| 178 | #define ASC_CHIP_MAX_VER_EISA (0x47) |
| 179 | #define ASC_CHIP_VER_EISA_BIT (0x40) |
| 180 | #define ASC_CHIP_LATEST_VER_EISA ((ASC_CHIP_MIN_VER_EISA - 1) + 3) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | #define ASC_MAX_VL_DMA_COUNT (0x07FFFFFFL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | #define ASC_MAX_PCI_DMA_COUNT (0xFFFFFFFFL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | #define ASC_MAX_ISA_DMA_COUNT (0x00FFFFFFL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | |
| 185 | #define ASC_SCSI_ID_BITS 3 |
| 186 | #define ASC_SCSI_TIX_TYPE uchar |
| 187 | #define ASC_ALL_DEVICE_BIT_SET 0xFF |
| 188 | #define ASC_SCSI_BIT_ID_TYPE uchar |
| 189 | #define ASC_MAX_TID 7 |
| 190 | #define ASC_MAX_LUN 7 |
| 191 | #define ASC_SCSI_WIDTH_BIT_SET 0xFF |
| 192 | #define ASC_MAX_SENSE_LEN 32 |
| 193 | #define ASC_MIN_SENSE_LEN 14 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | #define ASC_SCSI_RESET_HOLD_TIME_US 60 |
| 195 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | /* |
Matthew Wilcox | f05ec59 | 2007-09-09 08:56:36 -0600 | [diff] [blame] | 197 | * Narrow boards only support 12-byte commands, while wide boards |
| 198 | * extend to 16-byte commands. |
| 199 | */ |
| 200 | #define ASC_MAX_CDB_LEN 12 |
| 201 | #define ADV_MAX_CDB_LEN 16 |
| 202 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | #define MS_SDTR_LEN 0x03 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | #define MS_WDTR_LEN 0x02 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
| 206 | #define ASC_SG_LIST_PER_Q 7 |
| 207 | #define QS_FREE 0x00 |
| 208 | #define QS_READY 0x01 |
| 209 | #define QS_DISC1 0x02 |
| 210 | #define QS_DISC2 0x04 |
| 211 | #define QS_BUSY 0x08 |
| 212 | #define QS_ABORTED 0x40 |
| 213 | #define QS_DONE 0x80 |
| 214 | #define QC_NO_CALLBACK 0x01 |
| 215 | #define QC_SG_SWAP_QUEUE 0x02 |
| 216 | #define QC_SG_HEAD 0x04 |
| 217 | #define QC_DATA_IN 0x08 |
| 218 | #define QC_DATA_OUT 0x10 |
| 219 | #define QC_URGENT 0x20 |
| 220 | #define QC_MSG_OUT 0x40 |
| 221 | #define QC_REQ_SENSE 0x80 |
| 222 | #define QCSG_SG_XFER_LIST 0x02 |
| 223 | #define QCSG_SG_XFER_MORE 0x04 |
| 224 | #define QCSG_SG_XFER_END 0x08 |
| 225 | #define QD_IN_PROGRESS 0x00 |
| 226 | #define QD_NO_ERROR 0x01 |
| 227 | #define QD_ABORTED_BY_HOST 0x02 |
| 228 | #define QD_WITH_ERROR 0x04 |
| 229 | #define QD_INVALID_REQUEST 0x80 |
| 230 | #define QD_INVALID_HOST_NUM 0x81 |
| 231 | #define QD_INVALID_DEVICE 0x82 |
| 232 | #define QD_ERR_INTERNAL 0xFF |
| 233 | #define QHSTA_NO_ERROR 0x00 |
| 234 | #define QHSTA_M_SEL_TIMEOUT 0x11 |
| 235 | #define QHSTA_M_DATA_OVER_RUN 0x12 |
| 236 | #define QHSTA_M_DATA_UNDER_RUN 0x12 |
| 237 | #define QHSTA_M_UNEXPECTED_BUS_FREE 0x13 |
| 238 | #define QHSTA_M_BAD_BUS_PHASE_SEQ 0x14 |
| 239 | #define QHSTA_D_QDONE_SG_LIST_CORRUPTED 0x21 |
| 240 | #define QHSTA_D_ASC_DVC_ERROR_CODE_SET 0x22 |
| 241 | #define QHSTA_D_HOST_ABORT_FAILED 0x23 |
| 242 | #define QHSTA_D_EXE_SCSI_Q_FAILED 0x24 |
| 243 | #define QHSTA_D_EXE_SCSI_Q_BUSY_TIMEOUT 0x25 |
| 244 | #define QHSTA_D_ASPI_NO_BUF_POOL 0x26 |
| 245 | #define QHSTA_M_WTM_TIMEOUT 0x41 |
| 246 | #define QHSTA_M_BAD_CMPL_STATUS_IN 0x42 |
| 247 | #define QHSTA_M_NO_AUTO_REQ_SENSE 0x43 |
| 248 | #define QHSTA_M_AUTO_REQ_SENSE_FAIL 0x44 |
| 249 | #define QHSTA_M_TARGET_STATUS_BUSY 0x45 |
| 250 | #define QHSTA_M_BAD_TAG_CODE 0x46 |
| 251 | #define QHSTA_M_BAD_QUEUE_FULL_OR_BUSY 0x47 |
| 252 | #define QHSTA_M_HUNG_REQ_SCSI_BUS_RESET 0x48 |
| 253 | #define QHSTA_D_LRAM_CMP_ERROR 0x81 |
| 254 | #define QHSTA_M_MICRO_CODE_ERROR_HALT 0xA1 |
| 255 | #define ASC_FLAG_SCSIQ_REQ 0x01 |
| 256 | #define ASC_FLAG_BIOS_SCSIQ_REQ 0x02 |
| 257 | #define ASC_FLAG_BIOS_ASYNC_IO 0x04 |
| 258 | #define ASC_FLAG_SRB_LINEAR_ADDR 0x08 |
| 259 | #define ASC_FLAG_WIN16 0x10 |
| 260 | #define ASC_FLAG_WIN32 0x20 |
| 261 | #define ASC_FLAG_ISA_OVER_16MB 0x40 |
| 262 | #define ASC_FLAG_DOS_VM_CALLBACK 0x80 |
| 263 | #define ASC_TAG_FLAG_EXTRA_BYTES 0x10 |
| 264 | #define ASC_TAG_FLAG_DISABLE_DISCONNECT 0x04 |
| 265 | #define ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX 0x08 |
| 266 | #define ASC_TAG_FLAG_DISABLE_CHK_COND_INT_HOST 0x40 |
| 267 | #define ASC_SCSIQ_CPY_BEG 4 |
| 268 | #define ASC_SCSIQ_SGHD_CPY_BEG 2 |
| 269 | #define ASC_SCSIQ_B_FWD 0 |
| 270 | #define ASC_SCSIQ_B_BWD 1 |
| 271 | #define ASC_SCSIQ_B_STATUS 2 |
| 272 | #define ASC_SCSIQ_B_QNO 3 |
| 273 | #define ASC_SCSIQ_B_CNTL 4 |
| 274 | #define ASC_SCSIQ_B_SG_QUEUE_CNT 5 |
| 275 | #define ASC_SCSIQ_D_DATA_ADDR 8 |
| 276 | #define ASC_SCSIQ_D_DATA_CNT 12 |
| 277 | #define ASC_SCSIQ_B_SENSE_LEN 20 |
| 278 | #define ASC_SCSIQ_DONE_INFO_BEG 22 |
| 279 | #define ASC_SCSIQ_D_SRBPTR 22 |
| 280 | #define ASC_SCSIQ_B_TARGET_IX 26 |
| 281 | #define ASC_SCSIQ_B_CDB_LEN 28 |
| 282 | #define ASC_SCSIQ_B_TAG_CODE 29 |
| 283 | #define ASC_SCSIQ_W_VM_ID 30 |
| 284 | #define ASC_SCSIQ_DONE_STATUS 32 |
| 285 | #define ASC_SCSIQ_HOST_STATUS 33 |
| 286 | #define ASC_SCSIQ_SCSI_STATUS 34 |
| 287 | #define ASC_SCSIQ_CDB_BEG 36 |
| 288 | #define ASC_SCSIQ_DW_REMAIN_XFER_ADDR 56 |
| 289 | #define ASC_SCSIQ_DW_REMAIN_XFER_CNT 60 |
| 290 | #define ASC_SCSIQ_B_FIRST_SG_WK_QP 48 |
| 291 | #define ASC_SCSIQ_B_SG_WK_QP 49 |
| 292 | #define ASC_SCSIQ_B_SG_WK_IX 50 |
| 293 | #define ASC_SCSIQ_W_ALT_DC1 52 |
| 294 | #define ASC_SCSIQ_B_LIST_CNT 6 |
| 295 | #define ASC_SCSIQ_B_CUR_LIST_CNT 7 |
| 296 | #define ASC_SGQ_B_SG_CNTL 4 |
| 297 | #define ASC_SGQ_B_SG_HEAD_QP 5 |
| 298 | #define ASC_SGQ_B_SG_LIST_CNT 6 |
| 299 | #define ASC_SGQ_B_SG_CUR_LIST_CNT 7 |
| 300 | #define ASC_SGQ_LIST_BEG 8 |
| 301 | #define ASC_DEF_SCSI1_QNG 4 |
| 302 | #define ASC_MAX_SCSI1_QNG 4 |
| 303 | #define ASC_DEF_SCSI2_QNG 16 |
| 304 | #define ASC_MAX_SCSI2_QNG 32 |
| 305 | #define ASC_TAG_CODE_MASK 0x23 |
| 306 | #define ASC_STOP_REQ_RISC_STOP 0x01 |
| 307 | #define ASC_STOP_ACK_RISC_STOP 0x03 |
| 308 | #define ASC_STOP_CLEAN_UP_BUSY_Q 0x10 |
| 309 | #define ASC_STOP_CLEAN_UP_DISC_Q 0x20 |
| 310 | #define ASC_STOP_HOST_REQ_RISC_HALT 0x40 |
| 311 | #define ASC_TIDLUN_TO_IX(tid, lun) (ASC_SCSI_TIX_TYPE)((tid) + ((lun)<<ASC_SCSI_ID_BITS)) |
| 312 | #define ASC_TID_TO_TARGET_ID(tid) (ASC_SCSI_BIT_ID_TYPE)(0x01 << (tid)) |
| 313 | #define ASC_TIX_TO_TARGET_ID(tix) (0x01 << ((tix) & ASC_MAX_TID)) |
| 314 | #define ASC_TIX_TO_TID(tix) ((tix) & ASC_MAX_TID) |
| 315 | #define ASC_TID_TO_TIX(tid) ((tid) & ASC_MAX_TID) |
| 316 | #define ASC_TIX_TO_LUN(tix) (((tix) >> ASC_SCSI_ID_BITS) & ASC_MAX_LUN) |
| 317 | #define ASC_QNO_TO_QADDR(q_no) ((ASC_QADR_BEG)+((int)(q_no) << 6)) |
| 318 | |
| 319 | typedef struct asc_scsiq_1 { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 320 | uchar status; |
| 321 | uchar q_no; |
| 322 | uchar cntl; |
| 323 | uchar sg_queue_cnt; |
| 324 | uchar target_id; |
| 325 | uchar target_lun; |
| 326 | ASC_PADDR data_addr; |
| 327 | ASC_DCNT data_cnt; |
| 328 | ASC_PADDR sense_addr; |
| 329 | uchar sense_len; |
| 330 | uchar extra_bytes; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | } ASC_SCSIQ_1; |
| 332 | |
| 333 | typedef struct asc_scsiq_2 { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 334 | ASC_VADDR srb_ptr; |
| 335 | uchar target_ix; |
| 336 | uchar flag; |
| 337 | uchar cdb_len; |
| 338 | uchar tag_code; |
| 339 | ushort vm_id; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | } ASC_SCSIQ_2; |
| 341 | |
| 342 | typedef struct asc_scsiq_3 { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 343 | uchar done_stat; |
| 344 | uchar host_stat; |
| 345 | uchar scsi_stat; |
| 346 | uchar scsi_msg; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | } ASC_SCSIQ_3; |
| 348 | |
| 349 | typedef struct asc_scsiq_4 { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 350 | uchar cdb[ASC_MAX_CDB_LEN]; |
| 351 | uchar y_first_sg_list_qp; |
| 352 | uchar y_working_sg_qp; |
| 353 | uchar y_working_sg_ix; |
| 354 | uchar y_res; |
| 355 | ushort x_req_count; |
| 356 | ushort x_reconnect_rtn; |
| 357 | ASC_PADDR x_saved_data_addr; |
| 358 | ASC_DCNT x_saved_data_cnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | } ASC_SCSIQ_4; |
| 360 | |
| 361 | typedef struct asc_q_done_info { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 362 | ASC_SCSIQ_2 d2; |
| 363 | ASC_SCSIQ_3 d3; |
| 364 | uchar q_status; |
| 365 | uchar q_no; |
| 366 | uchar cntl; |
| 367 | uchar sense_len; |
| 368 | uchar extra_bytes; |
| 369 | uchar res; |
| 370 | ASC_DCNT remain_bytes; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | } ASC_QDONE_INFO; |
| 372 | |
| 373 | typedef struct asc_sg_list { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 374 | ASC_PADDR addr; |
| 375 | ASC_DCNT bytes; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | } ASC_SG_LIST; |
| 377 | |
| 378 | typedef struct asc_sg_head { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 379 | ushort entry_cnt; |
| 380 | ushort queue_cnt; |
| 381 | ushort entry_to_copy; |
| 382 | ushort res; |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 383 | ASC_SG_LIST sg_list[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | } ASC_SG_HEAD; |
| 385 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | typedef struct asc_scsi_q { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 387 | ASC_SCSIQ_1 q1; |
| 388 | ASC_SCSIQ_2 q2; |
| 389 | uchar *cdbptr; |
| 390 | ASC_SG_HEAD *sg_head; |
| 391 | ushort remain_sg_entry_cnt; |
| 392 | ushort next_sg_index; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 | } ASC_SCSI_Q; |
| 394 | |
| 395 | typedef struct asc_scsi_req_q { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 396 | ASC_SCSIQ_1 r1; |
| 397 | ASC_SCSIQ_2 r2; |
| 398 | uchar *cdbptr; |
| 399 | ASC_SG_HEAD *sg_head; |
| 400 | uchar *sense_ptr; |
| 401 | ASC_SCSIQ_3 r3; |
| 402 | uchar cdb[ASC_MAX_CDB_LEN]; |
| 403 | uchar sense[ASC_MIN_SENSE_LEN]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | } ASC_SCSI_REQ_Q; |
| 405 | |
| 406 | typedef struct asc_scsi_bios_req_q { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 407 | ASC_SCSIQ_1 r1; |
| 408 | ASC_SCSIQ_2 r2; |
| 409 | uchar *cdbptr; |
| 410 | ASC_SG_HEAD *sg_head; |
| 411 | uchar *sense_ptr; |
| 412 | ASC_SCSIQ_3 r3; |
| 413 | uchar cdb[ASC_MAX_CDB_LEN]; |
| 414 | uchar sense[ASC_MIN_SENSE_LEN]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | } ASC_SCSI_BIOS_REQ_Q; |
| 416 | |
| 417 | typedef struct asc_risc_q { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 418 | uchar fwd; |
| 419 | uchar bwd; |
| 420 | ASC_SCSIQ_1 i1; |
| 421 | ASC_SCSIQ_2 i2; |
| 422 | ASC_SCSIQ_3 i3; |
| 423 | ASC_SCSIQ_4 i4; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 424 | } ASC_RISC_Q; |
| 425 | |
| 426 | typedef struct asc_sg_list_q { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 427 | uchar seq_no; |
| 428 | uchar q_no; |
| 429 | uchar cntl; |
| 430 | uchar sg_head_qp; |
| 431 | uchar sg_list_cnt; |
| 432 | uchar sg_cur_list_cnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | } ASC_SG_LIST_Q; |
| 434 | |
| 435 | typedef struct asc_risc_sg_list_q { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 436 | uchar fwd; |
| 437 | uchar bwd; |
| 438 | ASC_SG_LIST_Q sg; |
| 439 | ASC_SG_LIST sg_list[7]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 | } ASC_RISC_SG_LIST_Q; |
| 441 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | #define ASCQ_ERR_Q_STATUS 0x0D |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | #define ASCQ_ERR_CUR_QNG 0x17 |
| 444 | #define ASCQ_ERR_SG_Q_LINKS 0x18 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | #define ASCQ_ERR_ISR_RE_ENTRY 0x1A |
| 446 | #define ASCQ_ERR_CRITICAL_RE_ENTRY 0x1B |
| 447 | #define ASCQ_ERR_ISR_ON_CRITICAL 0x1C |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | |
| 449 | /* |
| 450 | * Warning code values are set in ASC_DVC_VAR 'warn_code'. |
| 451 | */ |
| 452 | #define ASC_WARN_NO_ERROR 0x0000 |
| 453 | #define ASC_WARN_IO_PORT_ROTATE 0x0001 |
| 454 | #define ASC_WARN_EEPROM_CHKSUM 0x0002 |
| 455 | #define ASC_WARN_IRQ_MODIFIED 0x0004 |
| 456 | #define ASC_WARN_AUTO_CONFIG 0x0008 |
| 457 | #define ASC_WARN_CMD_QNG_CONFLICT 0x0010 |
| 458 | #define ASC_WARN_EEPROM_RECOVER 0x0020 |
| 459 | #define ASC_WARN_CFG_MSW_RECOVER 0x0040 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | |
| 461 | /* |
| 462 | * Error code values are set in ASC_DVC_VAR 'err_code'. |
| 463 | */ |
| 464 | #define ASC_IERR_WRITE_EEPROM 0x0001 |
| 465 | #define ASC_IERR_MCODE_CHKSUM 0x0002 |
| 466 | #define ASC_IERR_SET_PC_ADDR 0x0004 |
| 467 | #define ASC_IERR_START_STOP_CHIP 0x0008 |
| 468 | #define ASC_IERR_IRQ_NO 0x0010 |
| 469 | #define ASC_IERR_SET_IRQ_NO 0x0020 |
| 470 | #define ASC_IERR_CHIP_VERSION 0x0040 |
| 471 | #define ASC_IERR_SET_SCSI_ID 0x0080 |
| 472 | #define ASC_IERR_GET_PHY_ADDR 0x0100 |
| 473 | #define ASC_IERR_BAD_SIGNATURE 0x0200 |
| 474 | #define ASC_IERR_NO_BUS_TYPE 0x0400 |
| 475 | #define ASC_IERR_SCAM 0x0800 |
| 476 | #define ASC_IERR_SET_SDTR 0x1000 |
| 477 | #define ASC_IERR_RW_LRAM 0x8000 |
| 478 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | #define ASC_MAX_IRQ_NO 15 |
| 480 | #define ASC_MIN_IRQ_NO 10 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | #define ASC_DEF_MAX_TOTAL_QNG (0xF0) |
| 482 | #define ASC_MIN_TAG_Q_PER_DVC (0x04) |
Matthew Wilcox | 95c9f16 | 2007-09-09 08:56:39 -0600 | [diff] [blame] | 483 | #define ASC_MIN_FREE_Q (0x02) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | #define ASC_MIN_TOTAL_QNG ((ASC_MAX_SG_QUEUE)+(ASC_MIN_FREE_Q)) |
| 485 | #define ASC_MAX_TOTAL_QNG 240 |
| 486 | #define ASC_MAX_PCI_ULTRA_INRAM_TOTAL_QNG 16 |
| 487 | #define ASC_MAX_PCI_ULTRA_INRAM_TAG_QNG 8 |
| 488 | #define ASC_MAX_PCI_INRAM_TOTAL_QNG 20 |
| 489 | #define ASC_MAX_INRAM_TAG_QNG 16 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 490 | #define ASC_IOADR_GAP 0x10 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | #define ASC_MAX_SYN_XFER_NO 16 |
| 492 | #define ASC_SYN_MAX_OFFSET 0x0F |
| 493 | #define ASC_DEF_SDTR_OFFSET 0x0F |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | #define ASC_SDTR_ULTRA_PCI_10MB_INDEX 0x02 |
| 495 | #define SYN_XFER_NS_0 25 |
| 496 | #define SYN_XFER_NS_1 30 |
| 497 | #define SYN_XFER_NS_2 35 |
| 498 | #define SYN_XFER_NS_3 40 |
| 499 | #define SYN_XFER_NS_4 50 |
| 500 | #define SYN_XFER_NS_5 60 |
| 501 | #define SYN_XFER_NS_6 70 |
| 502 | #define SYN_XFER_NS_7 85 |
| 503 | #define SYN_ULTRA_XFER_NS_0 12 |
| 504 | #define SYN_ULTRA_XFER_NS_1 19 |
| 505 | #define SYN_ULTRA_XFER_NS_2 25 |
| 506 | #define SYN_ULTRA_XFER_NS_3 32 |
| 507 | #define SYN_ULTRA_XFER_NS_4 38 |
| 508 | #define SYN_ULTRA_XFER_NS_5 44 |
| 509 | #define SYN_ULTRA_XFER_NS_6 50 |
| 510 | #define SYN_ULTRA_XFER_NS_7 57 |
| 511 | #define SYN_ULTRA_XFER_NS_8 63 |
| 512 | #define SYN_ULTRA_XFER_NS_9 69 |
| 513 | #define SYN_ULTRA_XFER_NS_10 75 |
| 514 | #define SYN_ULTRA_XFER_NS_11 82 |
| 515 | #define SYN_ULTRA_XFER_NS_12 88 |
| 516 | #define SYN_ULTRA_XFER_NS_13 94 |
| 517 | #define SYN_ULTRA_XFER_NS_14 100 |
| 518 | #define SYN_ULTRA_XFER_NS_15 107 |
| 519 | |
| 520 | typedef struct ext_msg { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 521 | uchar msg_type; |
| 522 | uchar msg_len; |
| 523 | uchar msg_req; |
| 524 | union { |
| 525 | struct { |
| 526 | uchar sdtr_xfer_period; |
| 527 | uchar sdtr_req_ack_offset; |
| 528 | } sdtr; |
| 529 | struct { |
| 530 | uchar wdtr_width; |
| 531 | } wdtr; |
| 532 | struct { |
| 533 | uchar mdp_b3; |
| 534 | uchar mdp_b2; |
| 535 | uchar mdp_b1; |
| 536 | uchar mdp_b0; |
| 537 | } mdp; |
| 538 | } u_ext_msg; |
| 539 | uchar res; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | } EXT_MSG; |
| 541 | |
| 542 | #define xfer_period u_ext_msg.sdtr.sdtr_xfer_period |
| 543 | #define req_ack_offset u_ext_msg.sdtr.sdtr_req_ack_offset |
| 544 | #define wdtr_width u_ext_msg.wdtr.wdtr_width |
| 545 | #define mdp_b3 u_ext_msg.mdp_b3 |
| 546 | #define mdp_b2 u_ext_msg.mdp_b2 |
| 547 | #define mdp_b1 u_ext_msg.mdp_b1 |
| 548 | #define mdp_b0 u_ext_msg.mdp_b0 |
| 549 | |
| 550 | typedef struct asc_dvc_cfg { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 551 | ASC_SCSI_BIT_ID_TYPE can_tagged_qng; |
| 552 | ASC_SCSI_BIT_ID_TYPE cmd_qng_enabled; |
| 553 | ASC_SCSI_BIT_ID_TYPE disc_enable; |
| 554 | ASC_SCSI_BIT_ID_TYPE sdtr_enable; |
| 555 | uchar chip_scsi_id; |
| 556 | uchar isa_dma_speed; |
| 557 | uchar isa_dma_channel; |
| 558 | uchar chip_version; |
| 559 | ushort lib_serial_no; |
| 560 | ushort lib_version; |
| 561 | ushort mcode_date; |
| 562 | ushort mcode_version; |
| 563 | uchar max_tag_qng[ASC_MAX_TID + 1]; |
| 564 | uchar *overrun_buf; |
| 565 | uchar sdtr_period_offset[ASC_MAX_TID + 1]; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 566 | uchar adapter_info[6]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | } ASC_DVC_CFG; |
| 568 | |
| 569 | #define ASC_DEF_DVC_CNTL 0xFFFF |
| 570 | #define ASC_DEF_CHIP_SCSI_ID 7 |
| 571 | #define ASC_DEF_ISA_DMA_SPEED 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | #define ASC_INIT_STATE_BEG_GET_CFG 0x0001 |
| 573 | #define ASC_INIT_STATE_END_GET_CFG 0x0002 |
| 574 | #define ASC_INIT_STATE_BEG_SET_CFG 0x0004 |
| 575 | #define ASC_INIT_STATE_END_SET_CFG 0x0008 |
| 576 | #define ASC_INIT_STATE_BEG_LOAD_MC 0x0010 |
| 577 | #define ASC_INIT_STATE_END_LOAD_MC 0x0020 |
| 578 | #define ASC_INIT_STATE_BEG_INQUIRY 0x0040 |
| 579 | #define ASC_INIT_STATE_END_INQUIRY 0x0080 |
| 580 | #define ASC_INIT_RESET_SCSI_DONE 0x0100 |
| 581 | #define ASC_INIT_STATE_WITHOUT_EEP 0x8000 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 582 | #define ASC_BUG_FIX_IF_NOT_DWB 0x0001 |
| 583 | #define ASC_BUG_FIX_ASYN_USE_SYN 0x0002 |
| 584 | #define ASYN_SDTR_DATA_FIX_PCI_REV_AB 0x41 |
| 585 | #define ASC_MIN_TAGGED_CMD 7 |
| 586 | #define ASC_MAX_SCSI_RESET_WAIT 30 |
| 587 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 588 | struct asc_dvc_var; /* Forward Declaration. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 589 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 590 | typedef struct asc_dvc_var { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 591 | PortAddr iop_base; |
| 592 | ushort err_code; |
| 593 | ushort dvc_cntl; |
| 594 | ushort bug_fix_cntl; |
| 595 | ushort bus_type; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 596 | ASC_SCSI_BIT_ID_TYPE init_sdtr; |
| 597 | ASC_SCSI_BIT_ID_TYPE sdtr_done; |
| 598 | ASC_SCSI_BIT_ID_TYPE use_tagged_qng; |
| 599 | ASC_SCSI_BIT_ID_TYPE unit_not_ready; |
| 600 | ASC_SCSI_BIT_ID_TYPE queue_full_or_busy; |
| 601 | ASC_SCSI_BIT_ID_TYPE start_motor; |
| 602 | uchar scsi_reset_wait; |
| 603 | uchar chip_no; |
| 604 | char is_in_int; |
| 605 | uchar max_total_qng; |
| 606 | uchar cur_total_qng; |
| 607 | uchar in_critical_cnt; |
| 608 | uchar irq_no; |
| 609 | uchar last_q_shortage; |
| 610 | ushort init_state; |
| 611 | uchar cur_dvc_qng[ASC_MAX_TID + 1]; |
| 612 | uchar max_dvc_qng[ASC_MAX_TID + 1]; |
| 613 | ASC_SCSI_Q *scsiq_busy_head[ASC_MAX_TID + 1]; |
| 614 | ASC_SCSI_Q *scsiq_busy_tail[ASC_MAX_TID + 1]; |
| 615 | uchar sdtr_period_tbl[ASC_MAX_SYN_XFER_NO]; |
| 616 | ASC_DVC_CFG *cfg; |
| 617 | ASC_SCSI_BIT_ID_TYPE pci_fix_asyn_xfer_always; |
| 618 | char redo_scam; |
| 619 | ushort res2; |
| 620 | uchar dos_int13_table[ASC_MAX_TID + 1]; |
| 621 | ASC_DCNT max_dma_count; |
| 622 | ASC_SCSI_BIT_ID_TYPE no_scam; |
| 623 | ASC_SCSI_BIT_ID_TYPE pci_fix_asyn_xfer; |
| 624 | uchar max_sdtr_index; |
| 625 | uchar host_init_sdtr_index; |
| 626 | struct asc_board *drv_ptr; |
| 627 | ASC_DCNT uc_break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 628 | } ASC_DVC_VAR; |
| 629 | |
| 630 | typedef struct asc_dvc_inq_info { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 631 | uchar type[ASC_MAX_TID + 1][ASC_MAX_LUN + 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 632 | } ASC_DVC_INQ_INFO; |
| 633 | |
| 634 | typedef struct asc_cap_info { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 635 | ASC_DCNT lba; |
| 636 | ASC_DCNT blk_size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 637 | } ASC_CAP_INFO; |
| 638 | |
| 639 | typedef struct asc_cap_info_array { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 640 | ASC_CAP_INFO cap_info[ASC_MAX_TID + 1][ASC_MAX_LUN + 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 641 | } ASC_CAP_INFO_ARRAY; |
| 642 | |
| 643 | #define ASC_MCNTL_NO_SEL_TIMEOUT (ushort)0x0001 |
| 644 | #define ASC_MCNTL_NULL_TARGET (ushort)0x0002 |
| 645 | #define ASC_CNTL_INITIATOR (ushort)0x0001 |
| 646 | #define ASC_CNTL_BIOS_GT_1GB (ushort)0x0002 |
| 647 | #define ASC_CNTL_BIOS_GT_2_DISK (ushort)0x0004 |
| 648 | #define ASC_CNTL_BIOS_REMOVABLE (ushort)0x0008 |
| 649 | #define ASC_CNTL_NO_SCAM (ushort)0x0010 |
| 650 | #define ASC_CNTL_INT_MULTI_Q (ushort)0x0080 |
| 651 | #define ASC_CNTL_NO_LUN_SUPPORT (ushort)0x0040 |
| 652 | #define ASC_CNTL_NO_VERIFY_COPY (ushort)0x0100 |
| 653 | #define ASC_CNTL_RESET_SCSI (ushort)0x0200 |
| 654 | #define ASC_CNTL_INIT_INQUIRY (ushort)0x0400 |
| 655 | #define ASC_CNTL_INIT_VERBOSE (ushort)0x0800 |
| 656 | #define ASC_CNTL_SCSI_PARITY (ushort)0x1000 |
| 657 | #define ASC_CNTL_BURST_MODE (ushort)0x2000 |
| 658 | #define ASC_CNTL_SDTR_ENABLE_ULTRA (ushort)0x4000 |
| 659 | #define ASC_EEP_DVC_CFG_BEG_VL 2 |
| 660 | #define ASC_EEP_MAX_DVC_ADDR_VL 15 |
| 661 | #define ASC_EEP_DVC_CFG_BEG 32 |
| 662 | #define ASC_EEP_MAX_DVC_ADDR 45 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 663 | #define ASC_EEP_MAX_RETRY 20 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | |
| 665 | /* |
| 666 | * These macros keep the chip SCSI id and ISA DMA speed |
| 667 | * bitfields in board order. C bitfields aren't portable |
| 668 | * between big and little-endian platforms so they are |
| 669 | * not used. |
| 670 | */ |
| 671 | |
| 672 | #define ASC_EEP_GET_CHIP_ID(cfg) ((cfg)->id_speed & 0x0f) |
| 673 | #define ASC_EEP_GET_DMA_SPD(cfg) (((cfg)->id_speed & 0xf0) >> 4) |
| 674 | #define ASC_EEP_SET_CHIP_ID(cfg, sid) \ |
| 675 | ((cfg)->id_speed = ((cfg)->id_speed & 0xf0) | ((sid) & ASC_MAX_TID)) |
| 676 | #define ASC_EEP_SET_DMA_SPD(cfg, spd) \ |
| 677 | ((cfg)->id_speed = ((cfg)->id_speed & 0x0f) | ((spd) & 0x0f) << 4) |
| 678 | |
| 679 | typedef struct asceep_config { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 680 | ushort cfg_lsw; |
| 681 | ushort cfg_msw; |
| 682 | uchar init_sdtr; |
| 683 | uchar disc_enable; |
| 684 | uchar use_cmd_qng; |
| 685 | uchar start_motor; |
| 686 | uchar max_total_qng; |
| 687 | uchar max_tag_qng; |
| 688 | uchar bios_scan; |
| 689 | uchar power_up_wait; |
| 690 | uchar no_scam; |
| 691 | uchar id_speed; /* low order 4 bits is chip scsi id */ |
| 692 | /* high order 4 bits is isa dma speed */ |
| 693 | uchar dos_int13_table[ASC_MAX_TID + 1]; |
| 694 | uchar adapter_info[6]; |
| 695 | ushort cntl; |
| 696 | ushort chksum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 697 | } ASCEEP_CONFIG; |
| 698 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 699 | #define ASC_EEP_CMD_READ 0x80 |
| 700 | #define ASC_EEP_CMD_WRITE 0x40 |
| 701 | #define ASC_EEP_CMD_WRITE_ABLE 0x30 |
| 702 | #define ASC_EEP_CMD_WRITE_DISABLE 0x00 |
| 703 | #define ASC_OVERRUN_BSIZE 0x00000048UL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 704 | #define ASCV_MSGOUT_BEG 0x0000 |
| 705 | #define ASCV_MSGOUT_SDTR_PERIOD (ASCV_MSGOUT_BEG+3) |
| 706 | #define ASCV_MSGOUT_SDTR_OFFSET (ASCV_MSGOUT_BEG+4) |
| 707 | #define ASCV_BREAK_SAVED_CODE (ushort)0x0006 |
| 708 | #define ASCV_MSGIN_BEG (ASCV_MSGOUT_BEG+8) |
| 709 | #define ASCV_MSGIN_SDTR_PERIOD (ASCV_MSGIN_BEG+3) |
| 710 | #define ASCV_MSGIN_SDTR_OFFSET (ASCV_MSGIN_BEG+4) |
| 711 | #define ASCV_SDTR_DATA_BEG (ASCV_MSGIN_BEG+8) |
| 712 | #define ASCV_SDTR_DONE_BEG (ASCV_SDTR_DATA_BEG+8) |
| 713 | #define ASCV_MAX_DVC_QNG_BEG (ushort)0x0020 |
| 714 | #define ASCV_BREAK_ADDR (ushort)0x0028 |
| 715 | #define ASCV_BREAK_NOTIFY_COUNT (ushort)0x002A |
| 716 | #define ASCV_BREAK_CONTROL (ushort)0x002C |
| 717 | #define ASCV_BREAK_HIT_COUNT (ushort)0x002E |
| 718 | |
| 719 | #define ASCV_ASCDVC_ERR_CODE_W (ushort)0x0030 |
| 720 | #define ASCV_MCODE_CHKSUM_W (ushort)0x0032 |
| 721 | #define ASCV_MCODE_SIZE_W (ushort)0x0034 |
| 722 | #define ASCV_STOP_CODE_B (ushort)0x0036 |
| 723 | #define ASCV_DVC_ERR_CODE_B (ushort)0x0037 |
| 724 | #define ASCV_OVERRUN_PADDR_D (ushort)0x0038 |
| 725 | #define ASCV_OVERRUN_BSIZE_D (ushort)0x003C |
| 726 | #define ASCV_HALTCODE_W (ushort)0x0040 |
| 727 | #define ASCV_CHKSUM_W (ushort)0x0042 |
| 728 | #define ASCV_MC_DATE_W (ushort)0x0044 |
| 729 | #define ASCV_MC_VER_W (ushort)0x0046 |
| 730 | #define ASCV_NEXTRDY_B (ushort)0x0048 |
| 731 | #define ASCV_DONENEXT_B (ushort)0x0049 |
| 732 | #define ASCV_USE_TAGGED_QNG_B (ushort)0x004A |
| 733 | #define ASCV_SCSIBUSY_B (ushort)0x004B |
| 734 | #define ASCV_Q_DONE_IN_PROGRESS_B (ushort)0x004C |
| 735 | #define ASCV_CURCDB_B (ushort)0x004D |
| 736 | #define ASCV_RCLUN_B (ushort)0x004E |
| 737 | #define ASCV_BUSY_QHEAD_B (ushort)0x004F |
| 738 | #define ASCV_DISC1_QHEAD_B (ushort)0x0050 |
| 739 | #define ASCV_DISC_ENABLE_B (ushort)0x0052 |
| 740 | #define ASCV_CAN_TAGGED_QNG_B (ushort)0x0053 |
| 741 | #define ASCV_HOSTSCSI_ID_B (ushort)0x0055 |
| 742 | #define ASCV_MCODE_CNTL_B (ushort)0x0056 |
| 743 | #define ASCV_NULL_TARGET_B (ushort)0x0057 |
| 744 | #define ASCV_FREE_Q_HEAD_W (ushort)0x0058 |
| 745 | #define ASCV_DONE_Q_TAIL_W (ushort)0x005A |
| 746 | #define ASCV_FREE_Q_HEAD_B (ushort)(ASCV_FREE_Q_HEAD_W+1) |
| 747 | #define ASCV_DONE_Q_TAIL_B (ushort)(ASCV_DONE_Q_TAIL_W+1) |
| 748 | #define ASCV_HOST_FLAG_B (ushort)0x005D |
| 749 | #define ASCV_TOTAL_READY_Q_B (ushort)0x0064 |
| 750 | #define ASCV_VER_SERIAL_B (ushort)0x0065 |
| 751 | #define ASCV_HALTCODE_SAVED_W (ushort)0x0066 |
| 752 | #define ASCV_WTM_FLAG_B (ushort)0x0068 |
| 753 | #define ASCV_RISC_FLAG_B (ushort)0x006A |
| 754 | #define ASCV_REQ_SG_LIST_QP (ushort)0x006B |
| 755 | #define ASC_HOST_FLAG_IN_ISR 0x01 |
| 756 | #define ASC_HOST_FLAG_ACK_INT 0x02 |
| 757 | #define ASC_RISC_FLAG_GEN_INT 0x01 |
| 758 | #define ASC_RISC_FLAG_REQ_SG_LIST 0x02 |
| 759 | #define IOP_CTRL (0x0F) |
| 760 | #define IOP_STATUS (0x0E) |
| 761 | #define IOP_INT_ACK IOP_STATUS |
| 762 | #define IOP_REG_IFC (0x0D) |
| 763 | #define IOP_SYN_OFFSET (0x0B) |
| 764 | #define IOP_EXTRA_CONTROL (0x0D) |
| 765 | #define IOP_REG_PC (0x0C) |
| 766 | #define IOP_RAM_ADDR (0x0A) |
| 767 | #define IOP_RAM_DATA (0x08) |
| 768 | #define IOP_EEP_DATA (0x06) |
| 769 | #define IOP_EEP_CMD (0x07) |
| 770 | #define IOP_VERSION (0x03) |
| 771 | #define IOP_CONFIG_HIGH (0x04) |
| 772 | #define IOP_CONFIG_LOW (0x02) |
| 773 | #define IOP_SIG_BYTE (0x01) |
| 774 | #define IOP_SIG_WORD (0x00) |
| 775 | #define IOP_REG_DC1 (0x0E) |
| 776 | #define IOP_REG_DC0 (0x0C) |
| 777 | #define IOP_REG_SB (0x0B) |
| 778 | #define IOP_REG_DA1 (0x0A) |
| 779 | #define IOP_REG_DA0 (0x08) |
| 780 | #define IOP_REG_SC (0x09) |
| 781 | #define IOP_DMA_SPEED (0x07) |
| 782 | #define IOP_REG_FLAG (0x07) |
| 783 | #define IOP_FIFO_H (0x06) |
| 784 | #define IOP_FIFO_L (0x04) |
| 785 | #define IOP_REG_ID (0x05) |
| 786 | #define IOP_REG_QP (0x03) |
| 787 | #define IOP_REG_IH (0x02) |
| 788 | #define IOP_REG_IX (0x01) |
| 789 | #define IOP_REG_AX (0x00) |
| 790 | #define IFC_REG_LOCK (0x00) |
| 791 | #define IFC_REG_UNLOCK (0x09) |
| 792 | #define IFC_WR_EN_FILTER (0x10) |
| 793 | #define IFC_RD_NO_EEPROM (0x10) |
| 794 | #define IFC_SLEW_RATE (0x20) |
| 795 | #define IFC_ACT_NEG (0x40) |
| 796 | #define IFC_INP_FILTER (0x80) |
| 797 | #define IFC_INIT_DEFAULT (IFC_ACT_NEG | IFC_REG_UNLOCK) |
| 798 | #define SC_SEL (uchar)(0x80) |
| 799 | #define SC_BSY (uchar)(0x40) |
| 800 | #define SC_ACK (uchar)(0x20) |
| 801 | #define SC_REQ (uchar)(0x10) |
| 802 | #define SC_ATN (uchar)(0x08) |
| 803 | #define SC_IO (uchar)(0x04) |
| 804 | #define SC_CD (uchar)(0x02) |
| 805 | #define SC_MSG (uchar)(0x01) |
| 806 | #define SEC_SCSI_CTL (uchar)(0x80) |
| 807 | #define SEC_ACTIVE_NEGATE (uchar)(0x40) |
| 808 | #define SEC_SLEW_RATE (uchar)(0x20) |
| 809 | #define SEC_ENABLE_FILTER (uchar)(0x10) |
| 810 | #define ASC_HALT_EXTMSG_IN (ushort)0x8000 |
| 811 | #define ASC_HALT_CHK_CONDITION (ushort)0x8100 |
| 812 | #define ASC_HALT_SS_QUEUE_FULL (ushort)0x8200 |
| 813 | #define ASC_HALT_DISABLE_ASYN_USE_SYN_FIX (ushort)0x8300 |
| 814 | #define ASC_HALT_ENABLE_ASYN_USE_SYN_FIX (ushort)0x8400 |
| 815 | #define ASC_HALT_SDTR_REJECTED (ushort)0x4000 |
| 816 | #define ASC_HALT_HOST_COPY_SG_LIST_TO_RISC ( ushort )0x2000 |
| 817 | #define ASC_MAX_QNO 0xF8 |
| 818 | #define ASC_DATA_SEC_BEG (ushort)0x0080 |
| 819 | #define ASC_DATA_SEC_END (ushort)0x0080 |
| 820 | #define ASC_CODE_SEC_BEG (ushort)0x0080 |
| 821 | #define ASC_CODE_SEC_END (ushort)0x0080 |
| 822 | #define ASC_QADR_BEG (0x4000) |
| 823 | #define ASC_QADR_USED (ushort)(ASC_MAX_QNO * 64) |
| 824 | #define ASC_QADR_END (ushort)0x7FFF |
| 825 | #define ASC_QLAST_ADR (ushort)0x7FC0 |
| 826 | #define ASC_QBLK_SIZE 0x40 |
| 827 | #define ASC_BIOS_DATA_QBEG 0xF8 |
| 828 | #define ASC_MIN_ACTIVE_QNO 0x01 |
| 829 | #define ASC_QLINK_END 0xFF |
| 830 | #define ASC_EEPROM_WORDS 0x10 |
| 831 | #define ASC_MAX_MGS_LEN 0x10 |
| 832 | #define ASC_BIOS_ADDR_DEF 0xDC00 |
| 833 | #define ASC_BIOS_SIZE 0x3800 |
| 834 | #define ASC_BIOS_RAM_OFF 0x3800 |
| 835 | #define ASC_BIOS_RAM_SIZE 0x800 |
| 836 | #define ASC_BIOS_MIN_ADDR 0xC000 |
| 837 | #define ASC_BIOS_MAX_ADDR 0xEC00 |
| 838 | #define ASC_BIOS_BANK_SIZE 0x0400 |
| 839 | #define ASC_MCODE_START_ADDR 0x0080 |
| 840 | #define ASC_CFG0_HOST_INT_ON 0x0020 |
| 841 | #define ASC_CFG0_BIOS_ON 0x0040 |
| 842 | #define ASC_CFG0_VERA_BURST_ON 0x0080 |
| 843 | #define ASC_CFG0_SCSI_PARITY_ON 0x0800 |
| 844 | #define ASC_CFG1_SCSI_TARGET_ON 0x0080 |
| 845 | #define ASC_CFG1_LRAM_8BITS_ON 0x0800 |
| 846 | #define ASC_CFG_MSW_CLR_MASK 0x3080 |
| 847 | #define CSW_TEST1 (ASC_CS_TYPE)0x8000 |
| 848 | #define CSW_AUTO_CONFIG (ASC_CS_TYPE)0x4000 |
| 849 | #define CSW_RESERVED1 (ASC_CS_TYPE)0x2000 |
| 850 | #define CSW_IRQ_WRITTEN (ASC_CS_TYPE)0x1000 |
| 851 | #define CSW_33MHZ_SELECTED (ASC_CS_TYPE)0x0800 |
| 852 | #define CSW_TEST2 (ASC_CS_TYPE)0x0400 |
| 853 | #define CSW_TEST3 (ASC_CS_TYPE)0x0200 |
| 854 | #define CSW_RESERVED2 (ASC_CS_TYPE)0x0100 |
| 855 | #define CSW_DMA_DONE (ASC_CS_TYPE)0x0080 |
| 856 | #define CSW_FIFO_RDY (ASC_CS_TYPE)0x0040 |
| 857 | #define CSW_EEP_READ_DONE (ASC_CS_TYPE)0x0020 |
| 858 | #define CSW_HALTED (ASC_CS_TYPE)0x0010 |
| 859 | #define CSW_SCSI_RESET_ACTIVE (ASC_CS_TYPE)0x0008 |
| 860 | #define CSW_PARITY_ERR (ASC_CS_TYPE)0x0004 |
| 861 | #define CSW_SCSI_RESET_LATCH (ASC_CS_TYPE)0x0002 |
| 862 | #define CSW_INT_PENDING (ASC_CS_TYPE)0x0001 |
| 863 | #define CIW_CLR_SCSI_RESET_INT (ASC_CS_TYPE)0x1000 |
| 864 | #define CIW_INT_ACK (ASC_CS_TYPE)0x0100 |
| 865 | #define CIW_TEST1 (ASC_CS_TYPE)0x0200 |
| 866 | #define CIW_TEST2 (ASC_CS_TYPE)0x0400 |
| 867 | #define CIW_SEL_33MHZ (ASC_CS_TYPE)0x0800 |
| 868 | #define CIW_IRQ_ACT (ASC_CS_TYPE)0x1000 |
| 869 | #define CC_CHIP_RESET (uchar)0x80 |
| 870 | #define CC_SCSI_RESET (uchar)0x40 |
| 871 | #define CC_HALT (uchar)0x20 |
| 872 | #define CC_SINGLE_STEP (uchar)0x10 |
| 873 | #define CC_DMA_ABLE (uchar)0x08 |
| 874 | #define CC_TEST (uchar)0x04 |
| 875 | #define CC_BANK_ONE (uchar)0x02 |
| 876 | #define CC_DIAG (uchar)0x01 |
| 877 | #define ASC_1000_ID0W 0x04C1 |
| 878 | #define ASC_1000_ID0W_FIX 0x00C1 |
| 879 | #define ASC_1000_ID1B 0x25 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 880 | #define ASC_EISA_REV_IOP_MASK (0x0C83) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 881 | #define ASC_EISA_CFG_IOP_MASK (0x0C86) |
| 882 | #define ASC_GET_EISA_SLOT(iop) (PortAddr)((iop) & 0xF000) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 883 | #define INS_HALTINT (ushort)0x6281 |
| 884 | #define INS_HALT (ushort)0x6280 |
| 885 | #define INS_SINT (ushort)0x6200 |
| 886 | #define INS_RFLAG_WTM (ushort)0x7380 |
| 887 | #define ASC_MC_SAVE_CODE_WSIZE 0x500 |
| 888 | #define ASC_MC_SAVE_DATA_WSIZE 0x40 |
| 889 | |
| 890 | typedef struct asc_mc_saved { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 891 | ushort data[ASC_MC_SAVE_DATA_WSIZE]; |
| 892 | ushort code[ASC_MC_SAVE_CODE_WSIZE]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 893 | } ASC_MC_SAVED; |
| 894 | |
| 895 | #define AscGetQDoneInProgress(port) AscReadLramByte((port), ASCV_Q_DONE_IN_PROGRESS_B) |
| 896 | #define AscPutQDoneInProgress(port, val) AscWriteLramByte((port), ASCV_Q_DONE_IN_PROGRESS_B, val) |
| 897 | #define AscGetVarFreeQHead(port) AscReadLramWord((port), ASCV_FREE_Q_HEAD_W) |
| 898 | #define AscGetVarDoneQTail(port) AscReadLramWord((port), ASCV_DONE_Q_TAIL_W) |
| 899 | #define AscPutVarFreeQHead(port, val) AscWriteLramWord((port), ASCV_FREE_Q_HEAD_W, val) |
| 900 | #define AscPutVarDoneQTail(port, val) AscWriteLramWord((port), ASCV_DONE_Q_TAIL_W, val) |
| 901 | #define AscGetRiscVarFreeQHead(port) AscReadLramByte((port), ASCV_NEXTRDY_B) |
| 902 | #define AscGetRiscVarDoneQTail(port) AscReadLramByte((port), ASCV_DONENEXT_B) |
| 903 | #define AscPutRiscVarFreeQHead(port, val) AscWriteLramByte((port), ASCV_NEXTRDY_B, val) |
| 904 | #define AscPutRiscVarDoneQTail(port, val) AscWriteLramByte((port), ASCV_DONENEXT_B, val) |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 905 | #define AscPutMCodeSDTRDoneAtID(port, id, data) AscWriteLramByte((port), (ushort)((ushort)ASCV_SDTR_DONE_BEG+(ushort)id), (data)) |
| 906 | #define AscGetMCodeSDTRDoneAtID(port, id) AscReadLramByte((port), (ushort)((ushort)ASCV_SDTR_DONE_BEG+(ushort)id)) |
| 907 | #define AscPutMCodeInitSDTRAtID(port, id, data) AscWriteLramByte((port), (ushort)((ushort)ASCV_SDTR_DATA_BEG+(ushort)id), data) |
| 908 | #define AscGetMCodeInitSDTRAtID(port, id) AscReadLramByte((port), (ushort)((ushort)ASCV_SDTR_DATA_BEG+(ushort)id)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 909 | #define AscSynIndexToPeriod(index) (uchar)(asc_dvc->sdtr_period_tbl[ (index) ]) |
| 910 | #define AscGetChipSignatureByte(port) (uchar)inp((port)+IOP_SIG_BYTE) |
| 911 | #define AscGetChipSignatureWord(port) (ushort)inpw((port)+IOP_SIG_WORD) |
| 912 | #define AscGetChipVerNo(port) (uchar)inp((port)+IOP_VERSION) |
| 913 | #define AscGetChipCfgLsw(port) (ushort)inpw((port)+IOP_CONFIG_LOW) |
| 914 | #define AscGetChipCfgMsw(port) (ushort)inpw((port)+IOP_CONFIG_HIGH) |
| 915 | #define AscSetChipCfgLsw(port, data) outpw((port)+IOP_CONFIG_LOW, data) |
| 916 | #define AscSetChipCfgMsw(port, data) outpw((port)+IOP_CONFIG_HIGH, data) |
| 917 | #define AscGetChipEEPCmd(port) (uchar)inp((port)+IOP_EEP_CMD) |
| 918 | #define AscSetChipEEPCmd(port, data) outp((port)+IOP_EEP_CMD, data) |
| 919 | #define AscGetChipEEPData(port) (ushort)inpw((port)+IOP_EEP_DATA) |
| 920 | #define AscSetChipEEPData(port, data) outpw((port)+IOP_EEP_DATA, data) |
| 921 | #define AscGetChipLramAddr(port) (ushort)inpw((PortAddr)((port)+IOP_RAM_ADDR)) |
| 922 | #define AscSetChipLramAddr(port, addr) outpw((PortAddr)((port)+IOP_RAM_ADDR), addr) |
| 923 | #define AscGetChipLramData(port) (ushort)inpw((port)+IOP_RAM_DATA) |
| 924 | #define AscSetChipLramData(port, data) outpw((port)+IOP_RAM_DATA, data) |
| 925 | #define AscGetChipIFC(port) (uchar)inp((port)+IOP_REG_IFC) |
| 926 | #define AscSetChipIFC(port, data) outp((port)+IOP_REG_IFC, data) |
| 927 | #define AscGetChipStatus(port) (ASC_CS_TYPE)inpw((port)+IOP_STATUS) |
| 928 | #define AscSetChipStatus(port, cs_val) outpw((port)+IOP_STATUS, cs_val) |
| 929 | #define AscGetChipControl(port) (uchar)inp((port)+IOP_CTRL) |
| 930 | #define AscSetChipControl(port, cc_val) outp((port)+IOP_CTRL, cc_val) |
| 931 | #define AscGetChipSyn(port) (uchar)inp((port)+IOP_SYN_OFFSET) |
| 932 | #define AscSetChipSyn(port, data) outp((port)+IOP_SYN_OFFSET, data) |
| 933 | #define AscSetPCAddr(port, data) outpw((port)+IOP_REG_PC, data) |
| 934 | #define AscGetPCAddr(port) (ushort)inpw((port)+IOP_REG_PC) |
| 935 | #define AscIsIntPending(port) (AscGetChipStatus(port) & (CSW_INT_PENDING | CSW_SCSI_RESET_LATCH)) |
| 936 | #define AscGetChipScsiID(port) ((AscGetChipCfgLsw(port) >> 8) & ASC_MAX_TID) |
| 937 | #define AscGetExtraControl(port) (uchar)inp((port)+IOP_EXTRA_CONTROL) |
| 938 | #define AscSetExtraControl(port, data) outp((port)+IOP_EXTRA_CONTROL, data) |
| 939 | #define AscReadChipAX(port) (ushort)inpw((port)+IOP_REG_AX) |
| 940 | #define AscWriteChipAX(port, data) outpw((port)+IOP_REG_AX, data) |
| 941 | #define AscReadChipIX(port) (uchar)inp((port)+IOP_REG_IX) |
| 942 | #define AscWriteChipIX(port, data) outp((port)+IOP_REG_IX, data) |
| 943 | #define AscReadChipIH(port) (ushort)inpw((port)+IOP_REG_IH) |
| 944 | #define AscWriteChipIH(port, data) outpw((port)+IOP_REG_IH, data) |
| 945 | #define AscReadChipQP(port) (uchar)inp((port)+IOP_REG_QP) |
| 946 | #define AscWriteChipQP(port, data) outp((port)+IOP_REG_QP, data) |
| 947 | #define AscReadChipFIFO_L(port) (ushort)inpw((port)+IOP_REG_FIFO_L) |
| 948 | #define AscWriteChipFIFO_L(port, data) outpw((port)+IOP_REG_FIFO_L, data) |
| 949 | #define AscReadChipFIFO_H(port) (ushort)inpw((port)+IOP_REG_FIFO_H) |
| 950 | #define AscWriteChipFIFO_H(port, data) outpw((port)+IOP_REG_FIFO_H, data) |
| 951 | #define AscReadChipDmaSpeed(port) (uchar)inp((port)+IOP_DMA_SPEED) |
| 952 | #define AscWriteChipDmaSpeed(port, data) outp((port)+IOP_DMA_SPEED, data) |
| 953 | #define AscReadChipDA0(port) (ushort)inpw((port)+IOP_REG_DA0) |
| 954 | #define AscWriteChipDA0(port) outpw((port)+IOP_REG_DA0, data) |
| 955 | #define AscReadChipDA1(port) (ushort)inpw((port)+IOP_REG_DA1) |
| 956 | #define AscWriteChipDA1(port) outpw((port)+IOP_REG_DA1, data) |
| 957 | #define AscReadChipDC0(port) (ushort)inpw((port)+IOP_REG_DC0) |
| 958 | #define AscWriteChipDC0(port) outpw((port)+IOP_REG_DC0, data) |
| 959 | #define AscReadChipDC1(port) (ushort)inpw((port)+IOP_REG_DC1) |
| 960 | #define AscWriteChipDC1(port) outpw((port)+IOP_REG_DC1, data) |
| 961 | #define AscReadChipDvcID(port) (uchar)inp((port)+IOP_REG_ID) |
| 962 | #define AscWriteChipDvcID(port, data) outp((port)+IOP_REG_ID, data) |
| 963 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 964 | #define ADV_LIB_VERSION_MAJOR 5 |
| 965 | #define ADV_LIB_VERSION_MINOR 14 |
| 966 | |
| 967 | /* |
| 968 | * Define Adv Library required special types. |
| 969 | */ |
| 970 | |
| 971 | /* |
| 972 | * Portable Data Types |
| 973 | * |
| 974 | * Any instance where a 32-bit long or pointer type is assumed |
| 975 | * for precision or HW defined structures, the following define |
| 976 | * types must be used. In Linux the char, short, and int types |
| 977 | * are all consistent at 8, 16, and 32 bits respectively. Pointers |
| 978 | * and long types are 64 bits on Alpha and UltraSPARC. |
| 979 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 980 | #define ADV_PADDR __u32 /* Physical address data type. */ |
| 981 | #define ADV_VADDR __u32 /* Virtual address data type. */ |
| 982 | #define ADV_DCNT __u32 /* Unsigned Data count type. */ |
| 983 | #define ADV_SDCNT __s32 /* Signed Data count type. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 984 | |
| 985 | /* |
| 986 | * These macros are used to convert a virtual address to a |
| 987 | * 32-bit value. This currently can be used on Linux Alpha |
| 988 | * which uses 64-bit virtual address but a 32-bit bus address. |
| 989 | * This is likely to break in the future, but doing this now |
| 990 | * will give us time to change the HW and FW to handle 64-bit |
| 991 | * addresses. |
| 992 | */ |
| 993 | #define ADV_VADDR_TO_U32 virt_to_bus |
| 994 | #define ADV_U32_TO_VADDR bus_to_virt |
| 995 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 996 | #define AdvPortAddr void __iomem * /* Virtual memory address size */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 997 | |
| 998 | /* |
| 999 | * Define Adv Library required memory access macros. |
| 1000 | */ |
| 1001 | #define ADV_MEM_READB(addr) readb(addr) |
| 1002 | #define ADV_MEM_READW(addr) readw(addr) |
| 1003 | #define ADV_MEM_WRITEB(addr, byte) writeb(byte, addr) |
| 1004 | #define ADV_MEM_WRITEW(addr, word) writew(word, addr) |
| 1005 | #define ADV_MEM_WRITEDW(addr, dword) writel(dword, addr) |
| 1006 | |
| 1007 | #define ADV_CARRIER_COUNT (ASC_DEF_MAX_HOST_QNG + 15) |
| 1008 | |
| 1009 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1010 | * Define total number of simultaneous maximum element scatter-gather |
| 1011 | * request blocks per wide adapter. ASC_DEF_MAX_HOST_QNG (253) is the |
| 1012 | * maximum number of outstanding commands per wide host adapter. Each |
| 1013 | * command uses one or more ADV_SG_BLOCK each with 15 scatter-gather |
| 1014 | * elements. Allow each command to have at least one ADV_SG_BLOCK structure. |
| 1015 | * This allows about 15 commands to have the maximum 17 ADV_SG_BLOCK |
| 1016 | * structures or 255 scatter-gather elements. |
| 1017 | * |
| 1018 | */ |
| 1019 | #define ADV_TOT_SG_BLOCK ASC_DEF_MAX_HOST_QNG |
| 1020 | |
| 1021 | /* |
| 1022 | * Define Adv Library required maximum number of scatter-gather |
| 1023 | * elements per request. |
| 1024 | */ |
| 1025 | #define ADV_MAX_SG_LIST 255 |
| 1026 | |
| 1027 | /* Number of SG blocks needed. */ |
| 1028 | #define ADV_NUM_SG_BLOCK \ |
| 1029 | ((ADV_MAX_SG_LIST + (NO_OF_SG_PER_BLOCK - 1))/NO_OF_SG_PER_BLOCK) |
| 1030 | |
| 1031 | /* Total contiguous memory needed for SG blocks. */ |
| 1032 | #define ADV_SG_TOTAL_MEM_SIZE \ |
| 1033 | (sizeof(ADV_SG_BLOCK) * ADV_NUM_SG_BLOCK) |
| 1034 | |
| 1035 | #define ADV_PAGE_SIZE PAGE_SIZE |
| 1036 | |
| 1037 | #define ADV_NUM_PAGE_CROSSING \ |
| 1038 | ((ADV_SG_TOTAL_MEM_SIZE + (ADV_PAGE_SIZE - 1))/ADV_PAGE_SIZE) |
| 1039 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1040 | #define ADV_EEP_DVC_CFG_BEGIN (0x00) |
| 1041 | #define ADV_EEP_DVC_CFG_END (0x15) |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1042 | #define ADV_EEP_DVC_CTL_BEGIN (0x16) /* location of OEM name */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1043 | #define ADV_EEP_MAX_WORD_ADDR (0x1E) |
| 1044 | |
| 1045 | #define ADV_EEP_DELAY_MS 100 |
| 1046 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1047 | #define ADV_EEPROM_BIG_ENDIAN 0x8000 /* EEPROM Bit 15 */ |
| 1048 | #define ADV_EEPROM_BIOS_ENABLE 0x4000 /* EEPROM Bit 14 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1049 | /* |
| 1050 | * For the ASC3550 Bit 13 is Termination Polarity control bit. |
| 1051 | * For later ICs Bit 13 controls whether the CIS (Card Information |
| 1052 | * Service Section) is loaded from EEPROM. |
| 1053 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1054 | #define ADV_EEPROM_TERM_POL 0x2000 /* EEPROM Bit 13 */ |
| 1055 | #define ADV_EEPROM_CIS_LD 0x2000 /* EEPROM Bit 13 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1056 | /* |
| 1057 | * ASC38C1600 Bit 11 |
| 1058 | * |
| 1059 | * If EEPROM Bit 11 is 0 for Function 0, then Function 0 will specify |
| 1060 | * INT A in the PCI Configuration Space Int Pin field. If it is 1, then |
| 1061 | * Function 0 will specify INT B. |
| 1062 | * |
| 1063 | * If EEPROM Bit 11 is 0 for Function 1, then Function 1 will specify |
| 1064 | * INT B in the PCI Configuration Space Int Pin field. If it is 1, then |
| 1065 | * Function 1 will specify INT A. |
| 1066 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1067 | #define ADV_EEPROM_INTAB 0x0800 /* EEPROM Bit 11 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1068 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1069 | typedef struct adveep_3550_config { |
| 1070 | /* Word Offset, Description */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1071 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1072 | ushort cfg_lsw; /* 00 power up initialization */ |
| 1073 | /* bit 13 set - Term Polarity Control */ |
| 1074 | /* bit 14 set - BIOS Enable */ |
| 1075 | /* bit 15 set - Big Endian Mode */ |
| 1076 | ushort cfg_msw; /* 01 unused */ |
| 1077 | ushort disc_enable; /* 02 disconnect enable */ |
| 1078 | ushort wdtr_able; /* 03 Wide DTR able */ |
| 1079 | ushort sdtr_able; /* 04 Synchronous DTR able */ |
| 1080 | ushort start_motor; /* 05 send start up motor */ |
| 1081 | ushort tagqng_able; /* 06 tag queuing able */ |
| 1082 | ushort bios_scan; /* 07 BIOS device control */ |
| 1083 | ushort scam_tolerant; /* 08 no scam */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1084 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1085 | uchar adapter_scsi_id; /* 09 Host Adapter ID */ |
| 1086 | uchar bios_boot_delay; /* power up wait */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1087 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1088 | uchar scsi_reset_delay; /* 10 reset delay */ |
| 1089 | uchar bios_id_lun; /* first boot device scsi id & lun */ |
| 1090 | /* high nibble is lun */ |
| 1091 | /* low nibble is scsi id */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1092 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1093 | uchar termination; /* 11 0 - automatic */ |
| 1094 | /* 1 - low off / high off */ |
| 1095 | /* 2 - low off / high on */ |
| 1096 | /* 3 - low on / high on */ |
| 1097 | /* There is no low on / high off */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1098 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1099 | uchar reserved1; /* reserved byte (not used) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1100 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1101 | ushort bios_ctrl; /* 12 BIOS control bits */ |
| 1102 | /* bit 0 BIOS don't act as initiator. */ |
| 1103 | /* bit 1 BIOS > 1 GB support */ |
| 1104 | /* bit 2 BIOS > 2 Disk Support */ |
| 1105 | /* bit 3 BIOS don't support removables */ |
| 1106 | /* bit 4 BIOS support bootable CD */ |
| 1107 | /* bit 5 BIOS scan enabled */ |
| 1108 | /* bit 6 BIOS support multiple LUNs */ |
| 1109 | /* bit 7 BIOS display of message */ |
| 1110 | /* bit 8 SCAM disabled */ |
| 1111 | /* bit 9 Reset SCSI bus during init. */ |
| 1112 | /* bit 10 */ |
| 1113 | /* bit 11 No verbose initialization. */ |
| 1114 | /* bit 12 SCSI parity enabled */ |
| 1115 | /* bit 13 */ |
| 1116 | /* bit 14 */ |
| 1117 | /* bit 15 */ |
| 1118 | ushort ultra_able; /* 13 ULTRA speed able */ |
| 1119 | ushort reserved2; /* 14 reserved */ |
| 1120 | uchar max_host_qng; /* 15 maximum host queuing */ |
| 1121 | uchar max_dvc_qng; /* maximum per device queuing */ |
| 1122 | ushort dvc_cntl; /* 16 control bit for driver */ |
| 1123 | ushort bug_fix; /* 17 control bit for bug fix */ |
| 1124 | ushort serial_number_word1; /* 18 Board serial number word 1 */ |
| 1125 | ushort serial_number_word2; /* 19 Board serial number word 2 */ |
| 1126 | ushort serial_number_word3; /* 20 Board serial number word 3 */ |
| 1127 | ushort check_sum; /* 21 EEP check sum */ |
| 1128 | uchar oem_name[16]; /* 22 OEM name */ |
| 1129 | ushort dvc_err_code; /* 30 last device driver error code */ |
| 1130 | ushort adv_err_code; /* 31 last uc and Adv Lib error code */ |
| 1131 | ushort adv_err_addr; /* 32 last uc error address */ |
| 1132 | ushort saved_dvc_err_code; /* 33 saved last dev. driver error code */ |
| 1133 | ushort saved_adv_err_code; /* 34 saved last uc and Adv Lib error code */ |
| 1134 | ushort saved_adv_err_addr; /* 35 saved last uc error address */ |
| 1135 | ushort num_of_err; /* 36 number of error */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1136 | } ADVEEP_3550_CONFIG; |
| 1137 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1138 | typedef struct adveep_38C0800_config { |
| 1139 | /* Word Offset, Description */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1140 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1141 | ushort cfg_lsw; /* 00 power up initialization */ |
| 1142 | /* bit 13 set - Load CIS */ |
| 1143 | /* bit 14 set - BIOS Enable */ |
| 1144 | /* bit 15 set - Big Endian Mode */ |
| 1145 | ushort cfg_msw; /* 01 unused */ |
| 1146 | ushort disc_enable; /* 02 disconnect enable */ |
| 1147 | ushort wdtr_able; /* 03 Wide DTR able */ |
| 1148 | ushort sdtr_speed1; /* 04 SDTR Speed TID 0-3 */ |
| 1149 | ushort start_motor; /* 05 send start up motor */ |
| 1150 | ushort tagqng_able; /* 06 tag queuing able */ |
| 1151 | ushort bios_scan; /* 07 BIOS device control */ |
| 1152 | ushort scam_tolerant; /* 08 no scam */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1153 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1154 | uchar adapter_scsi_id; /* 09 Host Adapter ID */ |
| 1155 | uchar bios_boot_delay; /* power up wait */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1156 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1157 | uchar scsi_reset_delay; /* 10 reset delay */ |
| 1158 | uchar bios_id_lun; /* first boot device scsi id & lun */ |
| 1159 | /* high nibble is lun */ |
| 1160 | /* low nibble is scsi id */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1161 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1162 | uchar termination_se; /* 11 0 - automatic */ |
| 1163 | /* 1 - low off / high off */ |
| 1164 | /* 2 - low off / high on */ |
| 1165 | /* 3 - low on / high on */ |
| 1166 | /* There is no low on / high off */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1167 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1168 | uchar termination_lvd; /* 11 0 - automatic */ |
| 1169 | /* 1 - low off / high off */ |
| 1170 | /* 2 - low off / high on */ |
| 1171 | /* 3 - low on / high on */ |
| 1172 | /* There is no low on / high off */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1173 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1174 | ushort bios_ctrl; /* 12 BIOS control bits */ |
| 1175 | /* bit 0 BIOS don't act as initiator. */ |
| 1176 | /* bit 1 BIOS > 1 GB support */ |
| 1177 | /* bit 2 BIOS > 2 Disk Support */ |
| 1178 | /* bit 3 BIOS don't support removables */ |
| 1179 | /* bit 4 BIOS support bootable CD */ |
| 1180 | /* bit 5 BIOS scan enabled */ |
| 1181 | /* bit 6 BIOS support multiple LUNs */ |
| 1182 | /* bit 7 BIOS display of message */ |
| 1183 | /* bit 8 SCAM disabled */ |
| 1184 | /* bit 9 Reset SCSI bus during init. */ |
| 1185 | /* bit 10 */ |
| 1186 | /* bit 11 No verbose initialization. */ |
| 1187 | /* bit 12 SCSI parity enabled */ |
| 1188 | /* bit 13 */ |
| 1189 | /* bit 14 */ |
| 1190 | /* bit 15 */ |
| 1191 | ushort sdtr_speed2; /* 13 SDTR speed TID 4-7 */ |
| 1192 | ushort sdtr_speed3; /* 14 SDTR speed TID 8-11 */ |
| 1193 | uchar max_host_qng; /* 15 maximum host queueing */ |
| 1194 | uchar max_dvc_qng; /* maximum per device queuing */ |
| 1195 | ushort dvc_cntl; /* 16 control bit for driver */ |
| 1196 | ushort sdtr_speed4; /* 17 SDTR speed 4 TID 12-15 */ |
| 1197 | ushort serial_number_word1; /* 18 Board serial number word 1 */ |
| 1198 | ushort serial_number_word2; /* 19 Board serial number word 2 */ |
| 1199 | ushort serial_number_word3; /* 20 Board serial number word 3 */ |
| 1200 | ushort check_sum; /* 21 EEP check sum */ |
| 1201 | uchar oem_name[16]; /* 22 OEM name */ |
| 1202 | ushort dvc_err_code; /* 30 last device driver error code */ |
| 1203 | ushort adv_err_code; /* 31 last uc and Adv Lib error code */ |
| 1204 | ushort adv_err_addr; /* 32 last uc error address */ |
| 1205 | ushort saved_dvc_err_code; /* 33 saved last dev. driver error code */ |
| 1206 | ushort saved_adv_err_code; /* 34 saved last uc and Adv Lib error code */ |
| 1207 | ushort saved_adv_err_addr; /* 35 saved last uc error address */ |
| 1208 | ushort reserved36; /* 36 reserved */ |
| 1209 | ushort reserved37; /* 37 reserved */ |
| 1210 | ushort reserved38; /* 38 reserved */ |
| 1211 | ushort reserved39; /* 39 reserved */ |
| 1212 | ushort reserved40; /* 40 reserved */ |
| 1213 | ushort reserved41; /* 41 reserved */ |
| 1214 | ushort reserved42; /* 42 reserved */ |
| 1215 | ushort reserved43; /* 43 reserved */ |
| 1216 | ushort reserved44; /* 44 reserved */ |
| 1217 | ushort reserved45; /* 45 reserved */ |
| 1218 | ushort reserved46; /* 46 reserved */ |
| 1219 | ushort reserved47; /* 47 reserved */ |
| 1220 | ushort reserved48; /* 48 reserved */ |
| 1221 | ushort reserved49; /* 49 reserved */ |
| 1222 | ushort reserved50; /* 50 reserved */ |
| 1223 | ushort reserved51; /* 51 reserved */ |
| 1224 | ushort reserved52; /* 52 reserved */ |
| 1225 | ushort reserved53; /* 53 reserved */ |
| 1226 | ushort reserved54; /* 54 reserved */ |
| 1227 | ushort reserved55; /* 55 reserved */ |
| 1228 | ushort cisptr_lsw; /* 56 CIS PTR LSW */ |
| 1229 | ushort cisprt_msw; /* 57 CIS PTR MSW */ |
| 1230 | ushort subsysvid; /* 58 SubSystem Vendor ID */ |
| 1231 | ushort subsysid; /* 59 SubSystem ID */ |
| 1232 | ushort reserved60; /* 60 reserved */ |
| 1233 | ushort reserved61; /* 61 reserved */ |
| 1234 | ushort reserved62; /* 62 reserved */ |
| 1235 | ushort reserved63; /* 63 reserved */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1236 | } ADVEEP_38C0800_CONFIG; |
| 1237 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1238 | typedef struct adveep_38C1600_config { |
| 1239 | /* Word Offset, Description */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1240 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1241 | ushort cfg_lsw; /* 00 power up initialization */ |
| 1242 | /* bit 11 set - Func. 0 INTB, Func. 1 INTA */ |
| 1243 | /* clear - Func. 0 INTA, Func. 1 INTB */ |
| 1244 | /* bit 13 set - Load CIS */ |
| 1245 | /* bit 14 set - BIOS Enable */ |
| 1246 | /* bit 15 set - Big Endian Mode */ |
| 1247 | ushort cfg_msw; /* 01 unused */ |
| 1248 | ushort disc_enable; /* 02 disconnect enable */ |
| 1249 | ushort wdtr_able; /* 03 Wide DTR able */ |
| 1250 | ushort sdtr_speed1; /* 04 SDTR Speed TID 0-3 */ |
| 1251 | ushort start_motor; /* 05 send start up motor */ |
| 1252 | ushort tagqng_able; /* 06 tag queuing able */ |
| 1253 | ushort bios_scan; /* 07 BIOS device control */ |
| 1254 | ushort scam_tolerant; /* 08 no scam */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1255 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1256 | uchar adapter_scsi_id; /* 09 Host Adapter ID */ |
| 1257 | uchar bios_boot_delay; /* power up wait */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1258 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1259 | uchar scsi_reset_delay; /* 10 reset delay */ |
| 1260 | uchar bios_id_lun; /* first boot device scsi id & lun */ |
| 1261 | /* high nibble is lun */ |
| 1262 | /* low nibble is scsi id */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1263 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1264 | uchar termination_se; /* 11 0 - automatic */ |
| 1265 | /* 1 - low off / high off */ |
| 1266 | /* 2 - low off / high on */ |
| 1267 | /* 3 - low on / high on */ |
| 1268 | /* There is no low on / high off */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1269 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1270 | uchar termination_lvd; /* 11 0 - automatic */ |
| 1271 | /* 1 - low off / high off */ |
| 1272 | /* 2 - low off / high on */ |
| 1273 | /* 3 - low on / high on */ |
| 1274 | /* There is no low on / high off */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1275 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1276 | ushort bios_ctrl; /* 12 BIOS control bits */ |
| 1277 | /* bit 0 BIOS don't act as initiator. */ |
| 1278 | /* bit 1 BIOS > 1 GB support */ |
| 1279 | /* bit 2 BIOS > 2 Disk Support */ |
| 1280 | /* bit 3 BIOS don't support removables */ |
| 1281 | /* bit 4 BIOS support bootable CD */ |
| 1282 | /* bit 5 BIOS scan enabled */ |
| 1283 | /* bit 6 BIOS support multiple LUNs */ |
| 1284 | /* bit 7 BIOS display of message */ |
| 1285 | /* bit 8 SCAM disabled */ |
| 1286 | /* bit 9 Reset SCSI bus during init. */ |
| 1287 | /* bit 10 Basic Integrity Checking disabled */ |
| 1288 | /* bit 11 No verbose initialization. */ |
| 1289 | /* bit 12 SCSI parity enabled */ |
| 1290 | /* bit 13 AIPP (Asyn. Info. Ph. Prot.) dis. */ |
| 1291 | /* bit 14 */ |
| 1292 | /* bit 15 */ |
| 1293 | ushort sdtr_speed2; /* 13 SDTR speed TID 4-7 */ |
| 1294 | ushort sdtr_speed3; /* 14 SDTR speed TID 8-11 */ |
| 1295 | uchar max_host_qng; /* 15 maximum host queueing */ |
| 1296 | uchar max_dvc_qng; /* maximum per device queuing */ |
| 1297 | ushort dvc_cntl; /* 16 control bit for driver */ |
| 1298 | ushort sdtr_speed4; /* 17 SDTR speed 4 TID 12-15 */ |
| 1299 | ushort serial_number_word1; /* 18 Board serial number word 1 */ |
| 1300 | ushort serial_number_word2; /* 19 Board serial number word 2 */ |
| 1301 | ushort serial_number_word3; /* 20 Board serial number word 3 */ |
| 1302 | ushort check_sum; /* 21 EEP check sum */ |
| 1303 | uchar oem_name[16]; /* 22 OEM name */ |
| 1304 | ushort dvc_err_code; /* 30 last device driver error code */ |
| 1305 | ushort adv_err_code; /* 31 last uc and Adv Lib error code */ |
| 1306 | ushort adv_err_addr; /* 32 last uc error address */ |
| 1307 | ushort saved_dvc_err_code; /* 33 saved last dev. driver error code */ |
| 1308 | ushort saved_adv_err_code; /* 34 saved last uc and Adv Lib error code */ |
| 1309 | ushort saved_adv_err_addr; /* 35 saved last uc error address */ |
| 1310 | ushort reserved36; /* 36 reserved */ |
| 1311 | ushort reserved37; /* 37 reserved */ |
| 1312 | ushort reserved38; /* 38 reserved */ |
| 1313 | ushort reserved39; /* 39 reserved */ |
| 1314 | ushort reserved40; /* 40 reserved */ |
| 1315 | ushort reserved41; /* 41 reserved */ |
| 1316 | ushort reserved42; /* 42 reserved */ |
| 1317 | ushort reserved43; /* 43 reserved */ |
| 1318 | ushort reserved44; /* 44 reserved */ |
| 1319 | ushort reserved45; /* 45 reserved */ |
| 1320 | ushort reserved46; /* 46 reserved */ |
| 1321 | ushort reserved47; /* 47 reserved */ |
| 1322 | ushort reserved48; /* 48 reserved */ |
| 1323 | ushort reserved49; /* 49 reserved */ |
| 1324 | ushort reserved50; /* 50 reserved */ |
| 1325 | ushort reserved51; /* 51 reserved */ |
| 1326 | ushort reserved52; /* 52 reserved */ |
| 1327 | ushort reserved53; /* 53 reserved */ |
| 1328 | ushort reserved54; /* 54 reserved */ |
| 1329 | ushort reserved55; /* 55 reserved */ |
| 1330 | ushort cisptr_lsw; /* 56 CIS PTR LSW */ |
| 1331 | ushort cisprt_msw; /* 57 CIS PTR MSW */ |
| 1332 | ushort subsysvid; /* 58 SubSystem Vendor ID */ |
| 1333 | ushort subsysid; /* 59 SubSystem ID */ |
| 1334 | ushort reserved60; /* 60 reserved */ |
| 1335 | ushort reserved61; /* 61 reserved */ |
| 1336 | ushort reserved62; /* 62 reserved */ |
| 1337 | ushort reserved63; /* 63 reserved */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1338 | } ADVEEP_38C1600_CONFIG; |
| 1339 | |
| 1340 | /* |
| 1341 | * EEPROM Commands |
| 1342 | */ |
| 1343 | #define ASC_EEP_CMD_DONE 0x0200 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1344 | |
| 1345 | /* bios_ctrl */ |
| 1346 | #define BIOS_CTRL_BIOS 0x0001 |
| 1347 | #define BIOS_CTRL_EXTENDED_XLAT 0x0002 |
| 1348 | #define BIOS_CTRL_GT_2_DISK 0x0004 |
| 1349 | #define BIOS_CTRL_BIOS_REMOVABLE 0x0008 |
| 1350 | #define BIOS_CTRL_BOOTABLE_CD 0x0010 |
| 1351 | #define BIOS_CTRL_MULTIPLE_LUN 0x0040 |
| 1352 | #define BIOS_CTRL_DISPLAY_MSG 0x0080 |
| 1353 | #define BIOS_CTRL_NO_SCAM 0x0100 |
| 1354 | #define BIOS_CTRL_RESET_SCSI_BUS 0x0200 |
| 1355 | #define BIOS_CTRL_INIT_VERBOSE 0x0800 |
| 1356 | #define BIOS_CTRL_SCSI_PARITY 0x1000 |
| 1357 | #define BIOS_CTRL_AIPP_DIS 0x2000 |
| 1358 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1359 | #define ADV_3550_MEMSIZE 0x2000 /* 8 KB Internal Memory */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1360 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1361 | #define ADV_38C0800_MEMSIZE 0x4000 /* 16 KB Internal Memory */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1362 | |
| 1363 | /* |
| 1364 | * XXX - Since ASC38C1600 Rev.3 has a local RAM failure issue, there is |
| 1365 | * a special 16K Adv Library and Microcode version. After the issue is |
| 1366 | * resolved, should restore 32K support. |
| 1367 | * |
| 1368 | * #define ADV_38C1600_MEMSIZE 0x8000L * 32 KB Internal Memory * |
| 1369 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1370 | #define ADV_38C1600_MEMSIZE 0x4000 /* 16 KB Internal Memory */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1371 | |
| 1372 | /* |
| 1373 | * Byte I/O register address from base of 'iop_base'. |
| 1374 | */ |
| 1375 | #define IOPB_INTR_STATUS_REG 0x00 |
| 1376 | #define IOPB_CHIP_ID_1 0x01 |
| 1377 | #define IOPB_INTR_ENABLES 0x02 |
| 1378 | #define IOPB_CHIP_TYPE_REV 0x03 |
| 1379 | #define IOPB_RES_ADDR_4 0x04 |
| 1380 | #define IOPB_RES_ADDR_5 0x05 |
| 1381 | #define IOPB_RAM_DATA 0x06 |
| 1382 | #define IOPB_RES_ADDR_7 0x07 |
| 1383 | #define IOPB_FLAG_REG 0x08 |
| 1384 | #define IOPB_RES_ADDR_9 0x09 |
| 1385 | #define IOPB_RISC_CSR 0x0A |
| 1386 | #define IOPB_RES_ADDR_B 0x0B |
| 1387 | #define IOPB_RES_ADDR_C 0x0C |
| 1388 | #define IOPB_RES_ADDR_D 0x0D |
| 1389 | #define IOPB_SOFT_OVER_WR 0x0E |
| 1390 | #define IOPB_RES_ADDR_F 0x0F |
| 1391 | #define IOPB_MEM_CFG 0x10 |
| 1392 | #define IOPB_RES_ADDR_11 0x11 |
| 1393 | #define IOPB_GPIO_DATA 0x12 |
| 1394 | #define IOPB_RES_ADDR_13 0x13 |
| 1395 | #define IOPB_FLASH_PAGE 0x14 |
| 1396 | #define IOPB_RES_ADDR_15 0x15 |
| 1397 | #define IOPB_GPIO_CNTL 0x16 |
| 1398 | #define IOPB_RES_ADDR_17 0x17 |
| 1399 | #define IOPB_FLASH_DATA 0x18 |
| 1400 | #define IOPB_RES_ADDR_19 0x19 |
| 1401 | #define IOPB_RES_ADDR_1A 0x1A |
| 1402 | #define IOPB_RES_ADDR_1B 0x1B |
| 1403 | #define IOPB_RES_ADDR_1C 0x1C |
| 1404 | #define IOPB_RES_ADDR_1D 0x1D |
| 1405 | #define IOPB_RES_ADDR_1E 0x1E |
| 1406 | #define IOPB_RES_ADDR_1F 0x1F |
| 1407 | #define IOPB_DMA_CFG0 0x20 |
| 1408 | #define IOPB_DMA_CFG1 0x21 |
| 1409 | #define IOPB_TICKLE 0x22 |
| 1410 | #define IOPB_DMA_REG_WR 0x23 |
| 1411 | #define IOPB_SDMA_STATUS 0x24 |
| 1412 | #define IOPB_SCSI_BYTE_CNT 0x25 |
| 1413 | #define IOPB_HOST_BYTE_CNT 0x26 |
| 1414 | #define IOPB_BYTE_LEFT_TO_XFER 0x27 |
| 1415 | #define IOPB_BYTE_TO_XFER_0 0x28 |
| 1416 | #define IOPB_BYTE_TO_XFER_1 0x29 |
| 1417 | #define IOPB_BYTE_TO_XFER_2 0x2A |
| 1418 | #define IOPB_BYTE_TO_XFER_3 0x2B |
| 1419 | #define IOPB_ACC_GRP 0x2C |
| 1420 | #define IOPB_RES_ADDR_2D 0x2D |
| 1421 | #define IOPB_DEV_ID 0x2E |
| 1422 | #define IOPB_RES_ADDR_2F 0x2F |
| 1423 | #define IOPB_SCSI_DATA 0x30 |
| 1424 | #define IOPB_RES_ADDR_31 0x31 |
| 1425 | #define IOPB_RES_ADDR_32 0x32 |
| 1426 | #define IOPB_SCSI_DATA_HSHK 0x33 |
| 1427 | #define IOPB_SCSI_CTRL 0x34 |
| 1428 | #define IOPB_RES_ADDR_35 0x35 |
| 1429 | #define IOPB_RES_ADDR_36 0x36 |
| 1430 | #define IOPB_RES_ADDR_37 0x37 |
| 1431 | #define IOPB_RAM_BIST 0x38 |
| 1432 | #define IOPB_PLL_TEST 0x39 |
| 1433 | #define IOPB_PCI_INT_CFG 0x3A |
| 1434 | #define IOPB_RES_ADDR_3B 0x3B |
| 1435 | #define IOPB_RFIFO_CNT 0x3C |
| 1436 | #define IOPB_RES_ADDR_3D 0x3D |
| 1437 | #define IOPB_RES_ADDR_3E 0x3E |
| 1438 | #define IOPB_RES_ADDR_3F 0x3F |
| 1439 | |
| 1440 | /* |
| 1441 | * Word I/O register address from base of 'iop_base'. |
| 1442 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1443 | #define IOPW_CHIP_ID_0 0x00 /* CID0 */ |
| 1444 | #define IOPW_CTRL_REG 0x02 /* CC */ |
| 1445 | #define IOPW_RAM_ADDR 0x04 /* LA */ |
| 1446 | #define IOPW_RAM_DATA 0x06 /* LD */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1447 | #define IOPW_RES_ADDR_08 0x08 |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1448 | #define IOPW_RISC_CSR 0x0A /* CSR */ |
| 1449 | #define IOPW_SCSI_CFG0 0x0C /* CFG0 */ |
| 1450 | #define IOPW_SCSI_CFG1 0x0E /* CFG1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1451 | #define IOPW_RES_ADDR_10 0x10 |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1452 | #define IOPW_SEL_MASK 0x12 /* SM */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1453 | #define IOPW_RES_ADDR_14 0x14 |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1454 | #define IOPW_FLASH_ADDR 0x16 /* FA */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1455 | #define IOPW_RES_ADDR_18 0x18 |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1456 | #define IOPW_EE_CMD 0x1A /* EC */ |
| 1457 | #define IOPW_EE_DATA 0x1C /* ED */ |
| 1458 | #define IOPW_SFIFO_CNT 0x1E /* SFC */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1459 | #define IOPW_RES_ADDR_20 0x20 |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1460 | #define IOPW_Q_BASE 0x22 /* QB */ |
| 1461 | #define IOPW_QP 0x24 /* QP */ |
| 1462 | #define IOPW_IX 0x26 /* IX */ |
| 1463 | #define IOPW_SP 0x28 /* SP */ |
| 1464 | #define IOPW_PC 0x2A /* PC */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1465 | #define IOPW_RES_ADDR_2C 0x2C |
| 1466 | #define IOPW_RES_ADDR_2E 0x2E |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1467 | #define IOPW_SCSI_DATA 0x30 /* SD */ |
| 1468 | #define IOPW_SCSI_DATA_HSHK 0x32 /* SDH */ |
| 1469 | #define IOPW_SCSI_CTRL 0x34 /* SC */ |
| 1470 | #define IOPW_HSHK_CFG 0x36 /* HCFG */ |
| 1471 | #define IOPW_SXFR_STATUS 0x36 /* SXS */ |
| 1472 | #define IOPW_SXFR_CNTL 0x38 /* SXL */ |
| 1473 | #define IOPW_SXFR_CNTH 0x3A /* SXH */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1474 | #define IOPW_RES_ADDR_3C 0x3C |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1475 | #define IOPW_RFIFO_DATA 0x3E /* RFD */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1476 | |
| 1477 | /* |
| 1478 | * Doubleword I/O register address from base of 'iop_base'. |
| 1479 | */ |
| 1480 | #define IOPDW_RES_ADDR_0 0x00 |
| 1481 | #define IOPDW_RAM_DATA 0x04 |
| 1482 | #define IOPDW_RES_ADDR_8 0x08 |
| 1483 | #define IOPDW_RES_ADDR_C 0x0C |
| 1484 | #define IOPDW_RES_ADDR_10 0x10 |
| 1485 | #define IOPDW_COMMA 0x14 |
| 1486 | #define IOPDW_COMMB 0x18 |
| 1487 | #define IOPDW_RES_ADDR_1C 0x1C |
| 1488 | #define IOPDW_SDMA_ADDR0 0x20 |
| 1489 | #define IOPDW_SDMA_ADDR1 0x24 |
| 1490 | #define IOPDW_SDMA_COUNT 0x28 |
| 1491 | #define IOPDW_SDMA_ERROR 0x2C |
| 1492 | #define IOPDW_RDMA_ADDR0 0x30 |
| 1493 | #define IOPDW_RDMA_ADDR1 0x34 |
| 1494 | #define IOPDW_RDMA_COUNT 0x38 |
| 1495 | #define IOPDW_RDMA_ERROR 0x3C |
| 1496 | |
| 1497 | #define ADV_CHIP_ID_BYTE 0x25 |
| 1498 | #define ADV_CHIP_ID_WORD 0x04C1 |
| 1499 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1500 | #define ADV_INTR_ENABLE_HOST_INTR 0x01 |
| 1501 | #define ADV_INTR_ENABLE_SEL_INTR 0x02 |
| 1502 | #define ADV_INTR_ENABLE_DPR_INTR 0x04 |
| 1503 | #define ADV_INTR_ENABLE_RTA_INTR 0x08 |
| 1504 | #define ADV_INTR_ENABLE_RMA_INTR 0x10 |
| 1505 | #define ADV_INTR_ENABLE_RST_INTR 0x20 |
| 1506 | #define ADV_INTR_ENABLE_DPE_INTR 0x40 |
| 1507 | #define ADV_INTR_ENABLE_GLOBAL_INTR 0x80 |
| 1508 | |
| 1509 | #define ADV_INTR_STATUS_INTRA 0x01 |
| 1510 | #define ADV_INTR_STATUS_INTRB 0x02 |
| 1511 | #define ADV_INTR_STATUS_INTRC 0x04 |
| 1512 | |
| 1513 | #define ADV_RISC_CSR_STOP (0x0000) |
| 1514 | #define ADV_RISC_TEST_COND (0x2000) |
| 1515 | #define ADV_RISC_CSR_RUN (0x4000) |
| 1516 | #define ADV_RISC_CSR_SINGLE_STEP (0x8000) |
| 1517 | |
| 1518 | #define ADV_CTRL_REG_HOST_INTR 0x0100 |
| 1519 | #define ADV_CTRL_REG_SEL_INTR 0x0200 |
| 1520 | #define ADV_CTRL_REG_DPR_INTR 0x0400 |
| 1521 | #define ADV_CTRL_REG_RTA_INTR 0x0800 |
| 1522 | #define ADV_CTRL_REG_RMA_INTR 0x1000 |
| 1523 | #define ADV_CTRL_REG_RES_BIT14 0x2000 |
| 1524 | #define ADV_CTRL_REG_DPE_INTR 0x4000 |
| 1525 | #define ADV_CTRL_REG_POWER_DONE 0x8000 |
| 1526 | #define ADV_CTRL_REG_ANY_INTR 0xFF00 |
| 1527 | |
| 1528 | #define ADV_CTRL_REG_CMD_RESET 0x00C6 |
| 1529 | #define ADV_CTRL_REG_CMD_WR_IO_REG 0x00C5 |
| 1530 | #define ADV_CTRL_REG_CMD_RD_IO_REG 0x00C4 |
| 1531 | #define ADV_CTRL_REG_CMD_WR_PCI_CFG_SPACE 0x00C3 |
| 1532 | #define ADV_CTRL_REG_CMD_RD_PCI_CFG_SPACE 0x00C2 |
| 1533 | |
| 1534 | #define ADV_TICKLE_NOP 0x00 |
| 1535 | #define ADV_TICKLE_A 0x01 |
| 1536 | #define ADV_TICKLE_B 0x02 |
| 1537 | #define ADV_TICKLE_C 0x03 |
| 1538 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1539 | #define AdvIsIntPending(port) \ |
| 1540 | (AdvReadWordRegister(port, IOPW_CTRL_REG) & ADV_CTRL_REG_HOST_INTR) |
| 1541 | |
| 1542 | /* |
| 1543 | * SCSI_CFG0 Register bit definitions |
| 1544 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1545 | #define TIMER_MODEAB 0xC000 /* Watchdog, Second, and Select. Timer Ctrl. */ |
| 1546 | #define PARITY_EN 0x2000 /* Enable SCSI Parity Error detection */ |
| 1547 | #define EVEN_PARITY 0x1000 /* Select Even Parity */ |
| 1548 | #define WD_LONG 0x0800 /* Watchdog Interval, 1: 57 min, 0: 13 sec */ |
| 1549 | #define QUEUE_128 0x0400 /* Queue Size, 1: 128 byte, 0: 64 byte */ |
| 1550 | #define PRIM_MODE 0x0100 /* Primitive SCSI mode */ |
| 1551 | #define SCAM_EN 0x0080 /* Enable SCAM selection */ |
| 1552 | #define SEL_TMO_LONG 0x0040 /* Sel/Resel Timeout, 1: 400 ms, 0: 1.6 ms */ |
| 1553 | #define CFRM_ID 0x0020 /* SCAM id sel. confirm., 1: fast, 0: 6.4 ms */ |
| 1554 | #define OUR_ID_EN 0x0010 /* Enable OUR_ID bits */ |
| 1555 | #define OUR_ID 0x000F /* SCSI ID */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1556 | |
| 1557 | /* |
| 1558 | * SCSI_CFG1 Register bit definitions |
| 1559 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1560 | #define BIG_ENDIAN 0x8000 /* Enable Big Endian Mode MIO:15, EEP:15 */ |
| 1561 | #define TERM_POL 0x2000 /* Terminator Polarity Ctrl. MIO:13, EEP:13 */ |
| 1562 | #define SLEW_RATE 0x1000 /* SCSI output buffer slew rate */ |
| 1563 | #define FILTER_SEL 0x0C00 /* Filter Period Selection */ |
| 1564 | #define FLTR_DISABLE 0x0000 /* Input Filtering Disabled */ |
| 1565 | #define FLTR_11_TO_20NS 0x0800 /* Input Filtering 11ns to 20ns */ |
| 1566 | #define FLTR_21_TO_39NS 0x0C00 /* Input Filtering 21ns to 39ns */ |
| 1567 | #define ACTIVE_DBL 0x0200 /* Disable Active Negation */ |
| 1568 | #define DIFF_MODE 0x0100 /* SCSI differential Mode (Read-Only) */ |
| 1569 | #define DIFF_SENSE 0x0080 /* 1: No SE cables, 0: SE cable (Read-Only) */ |
| 1570 | #define TERM_CTL_SEL 0x0040 /* Enable TERM_CTL_H and TERM_CTL_L */ |
| 1571 | #define TERM_CTL 0x0030 /* External SCSI Termination Bits */ |
| 1572 | #define TERM_CTL_H 0x0020 /* Enable External SCSI Upper Termination */ |
| 1573 | #define TERM_CTL_L 0x0010 /* Enable External SCSI Lower Termination */ |
| 1574 | #define CABLE_DETECT 0x000F /* External SCSI Cable Connection Status */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1575 | |
| 1576 | /* |
| 1577 | * Addendum for ASC-38C0800 Chip |
| 1578 | * |
| 1579 | * The ASC-38C1600 Chip uses the same definitions except that the |
| 1580 | * bus mode override bits [12:10] have been moved to byte register |
| 1581 | * offset 0xE (IOPB_SOFT_OVER_WR) bits [12:10]. The [12:10] bits in |
| 1582 | * SCSI_CFG1 are read-only and always available. Bit 14 (DIS_TERM_DRV) |
| 1583 | * is not needed. The [12:10] bits in IOPB_SOFT_OVER_WR are write-only. |
| 1584 | * Also each ASC-38C1600 function or channel uses only cable bits [5:4] |
| 1585 | * and [1:0]. Bits [14], [7:6], [3:2] are unused. |
| 1586 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1587 | #define DIS_TERM_DRV 0x4000 /* 1: Read c_det[3:0], 0: cannot read */ |
| 1588 | #define HVD_LVD_SE 0x1C00 /* Device Detect Bits */ |
| 1589 | #define HVD 0x1000 /* HVD Device Detect */ |
| 1590 | #define LVD 0x0800 /* LVD Device Detect */ |
| 1591 | #define SE 0x0400 /* SE Device Detect */ |
| 1592 | #define TERM_LVD 0x00C0 /* LVD Termination Bits */ |
| 1593 | #define TERM_LVD_HI 0x0080 /* Enable LVD Upper Termination */ |
| 1594 | #define TERM_LVD_LO 0x0040 /* Enable LVD Lower Termination */ |
| 1595 | #define TERM_SE 0x0030 /* SE Termination Bits */ |
| 1596 | #define TERM_SE_HI 0x0020 /* Enable SE Upper Termination */ |
| 1597 | #define TERM_SE_LO 0x0010 /* Enable SE Lower Termination */ |
| 1598 | #define C_DET_LVD 0x000C /* LVD Cable Detect Bits */ |
| 1599 | #define C_DET3 0x0008 /* Cable Detect for LVD External Wide */ |
| 1600 | #define C_DET2 0x0004 /* Cable Detect for LVD Internal Wide */ |
| 1601 | #define C_DET_SE 0x0003 /* SE Cable Detect Bits */ |
| 1602 | #define C_DET1 0x0002 /* Cable Detect for SE Internal Wide */ |
| 1603 | #define C_DET0 0x0001 /* Cable Detect for SE Internal Narrow */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1604 | |
| 1605 | #define CABLE_ILLEGAL_A 0x7 |
| 1606 | /* x 0 0 0 | on on | Illegal (all 3 connectors are used) */ |
| 1607 | |
| 1608 | #define CABLE_ILLEGAL_B 0xB |
| 1609 | /* 0 x 0 0 | on on | Illegal (all 3 connectors are used) */ |
| 1610 | |
| 1611 | /* |
| 1612 | * MEM_CFG Register bit definitions |
| 1613 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1614 | #define BIOS_EN 0x40 /* BIOS Enable MIO:14,EEP:14 */ |
| 1615 | #define FAST_EE_CLK 0x20 /* Diagnostic Bit */ |
| 1616 | #define RAM_SZ 0x1C /* Specify size of RAM to RISC */ |
| 1617 | #define RAM_SZ_2KB 0x00 /* 2 KB */ |
| 1618 | #define RAM_SZ_4KB 0x04 /* 4 KB */ |
| 1619 | #define RAM_SZ_8KB 0x08 /* 8 KB */ |
| 1620 | #define RAM_SZ_16KB 0x0C /* 16 KB */ |
| 1621 | #define RAM_SZ_32KB 0x10 /* 32 KB */ |
| 1622 | #define RAM_SZ_64KB 0x14 /* 64 KB */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1623 | |
| 1624 | /* |
| 1625 | * DMA_CFG0 Register bit definitions |
| 1626 | * |
| 1627 | * This register is only accessible to the host. |
| 1628 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1629 | #define BC_THRESH_ENB 0x80 /* PCI DMA Start Conditions */ |
| 1630 | #define FIFO_THRESH 0x70 /* PCI DMA FIFO Threshold */ |
| 1631 | #define FIFO_THRESH_16B 0x00 /* 16 bytes */ |
| 1632 | #define FIFO_THRESH_32B 0x20 /* 32 bytes */ |
| 1633 | #define FIFO_THRESH_48B 0x30 /* 48 bytes */ |
| 1634 | #define FIFO_THRESH_64B 0x40 /* 64 bytes */ |
| 1635 | #define FIFO_THRESH_80B 0x50 /* 80 bytes (default) */ |
| 1636 | #define FIFO_THRESH_96B 0x60 /* 96 bytes */ |
| 1637 | #define FIFO_THRESH_112B 0x70 /* 112 bytes */ |
| 1638 | #define START_CTL 0x0C /* DMA start conditions */ |
| 1639 | #define START_CTL_TH 0x00 /* Wait threshold level (default) */ |
| 1640 | #define START_CTL_ID 0x04 /* Wait SDMA/SBUS idle */ |
| 1641 | #define START_CTL_THID 0x08 /* Wait threshold and SDMA/SBUS idle */ |
| 1642 | #define START_CTL_EMFU 0x0C /* Wait SDMA FIFO empty/full */ |
| 1643 | #define READ_CMD 0x03 /* Memory Read Method */ |
| 1644 | #define READ_CMD_MR 0x00 /* Memory Read */ |
| 1645 | #define READ_CMD_MRL 0x02 /* Memory Read Long */ |
| 1646 | #define READ_CMD_MRM 0x03 /* Memory Read Multiple (default) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1647 | |
| 1648 | /* |
| 1649 | * ASC-38C0800 RAM BIST Register bit definitions |
| 1650 | */ |
| 1651 | #define RAM_TEST_MODE 0x80 |
| 1652 | #define PRE_TEST_MODE 0x40 |
| 1653 | #define NORMAL_MODE 0x00 |
| 1654 | #define RAM_TEST_DONE 0x10 |
| 1655 | #define RAM_TEST_STATUS 0x0F |
| 1656 | #define RAM_TEST_HOST_ERROR 0x08 |
| 1657 | #define RAM_TEST_INTRAM_ERROR 0x04 |
| 1658 | #define RAM_TEST_RISC_ERROR 0x02 |
| 1659 | #define RAM_TEST_SCSI_ERROR 0x01 |
| 1660 | #define RAM_TEST_SUCCESS 0x00 |
| 1661 | #define PRE_TEST_VALUE 0x05 |
| 1662 | #define NORMAL_VALUE 0x00 |
| 1663 | |
| 1664 | /* |
| 1665 | * ASC38C1600 Definitions |
| 1666 | * |
| 1667 | * IOPB_PCI_INT_CFG Bit Field Definitions |
| 1668 | */ |
| 1669 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1670 | #define INTAB_LD 0x80 /* Value loaded from EEPROM Bit 11. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1671 | |
| 1672 | /* |
| 1673 | * Bit 1 can be set to change the interrupt for the Function to operate in |
| 1674 | * Totem Pole mode. By default Bit 1 is 0 and the interrupt operates in |
| 1675 | * Open Drain mode. Both functions of the ASC38C1600 must be set to the same |
| 1676 | * mode, otherwise the operating mode is undefined. |
| 1677 | */ |
| 1678 | #define TOTEMPOLE 0x02 |
| 1679 | |
| 1680 | /* |
| 1681 | * Bit 0 can be used to change the Int Pin for the Function. The value is |
| 1682 | * 0 by default for both Functions with Function 0 using INT A and Function |
| 1683 | * B using INT B. For Function 0 if set, INT B is used. For Function 1 if set, |
| 1684 | * INT A is used. |
| 1685 | * |
| 1686 | * EEPROM Word 0 Bit 11 for each Function may change the initial Int Pin |
| 1687 | * value specified in the PCI Configuration Space. |
| 1688 | */ |
| 1689 | #define INTAB 0x01 |
| 1690 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1691 | /* |
| 1692 | * Adv Library Status Definitions |
| 1693 | */ |
| 1694 | #define ADV_TRUE 1 |
| 1695 | #define ADV_FALSE 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1696 | #define ADV_SUCCESS 1 |
| 1697 | #define ADV_BUSY 0 |
| 1698 | #define ADV_ERROR (-1) |
| 1699 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1700 | /* |
| 1701 | * ADV_DVC_VAR 'warn_code' values |
| 1702 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1703 | #define ASC_WARN_BUSRESET_ERROR 0x0001 /* SCSI Bus Reset error */ |
| 1704 | #define ASC_WARN_EEPROM_CHKSUM 0x0002 /* EEP check sum error */ |
| 1705 | #define ASC_WARN_EEPROM_TERMINATION 0x0004 /* EEP termination bad field */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1706 | #define ASC_WARN_ERROR 0xFFFF /* ADV_ERROR return */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1707 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1708 | #define ADV_MAX_TID 15 /* max. target identifier */ |
| 1709 | #define ADV_MAX_LUN 7 /* max. logical unit number */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1710 | |
| 1711 | /* |
| 1712 | * Error code values are set in ADV_DVC_VAR 'err_code'. |
| 1713 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1714 | #define ASC_IERR_WRITE_EEPROM 0x0001 /* write EEPROM error */ |
| 1715 | #define ASC_IERR_MCODE_CHKSUM 0x0002 /* micro code check sum error */ |
| 1716 | #define ASC_IERR_NO_CARRIER 0x0004 /* No more carrier memory. */ |
| 1717 | #define ASC_IERR_START_STOP_CHIP 0x0008 /* start/stop chip failed */ |
| 1718 | #define ASC_IERR_CHIP_VERSION 0x0040 /* wrong chip version */ |
| 1719 | #define ASC_IERR_SET_SCSI_ID 0x0080 /* set SCSI ID failed */ |
| 1720 | #define ASC_IERR_HVD_DEVICE 0x0100 /* HVD attached to LVD connector. */ |
| 1721 | #define ASC_IERR_BAD_SIGNATURE 0x0200 /* signature not found */ |
| 1722 | #define ASC_IERR_ILLEGAL_CONNECTION 0x0400 /* Illegal cable connection */ |
| 1723 | #define ASC_IERR_SINGLE_END_DEVICE 0x0800 /* Single-end used w/differential */ |
| 1724 | #define ASC_IERR_REVERSED_CABLE 0x1000 /* Narrow flat cable reversed */ |
| 1725 | #define ASC_IERR_BIST_PRE_TEST 0x2000 /* BIST pre-test error */ |
| 1726 | #define ASC_IERR_BIST_RAM_TEST 0x4000 /* BIST RAM test error */ |
| 1727 | #define ASC_IERR_BAD_CHIPTYPE 0x8000 /* Invalid 'chip_type' setting. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1728 | |
| 1729 | /* |
| 1730 | * Fixed locations of microcode operating variables. |
| 1731 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1732 | #define ASC_MC_CODE_BEGIN_ADDR 0x0028 /* microcode start address */ |
| 1733 | #define ASC_MC_CODE_END_ADDR 0x002A /* microcode end address */ |
| 1734 | #define ASC_MC_CODE_CHK_SUM 0x002C /* microcode code checksum */ |
| 1735 | #define ASC_MC_VERSION_DATE 0x0038 /* microcode version */ |
| 1736 | #define ASC_MC_VERSION_NUM 0x003A /* microcode number */ |
| 1737 | #define ASC_MC_BIOSMEM 0x0040 /* BIOS RISC Memory Start */ |
| 1738 | #define ASC_MC_BIOSLEN 0x0050 /* BIOS RISC Memory Length */ |
| 1739 | #define ASC_MC_BIOS_SIGNATURE 0x0058 /* BIOS Signature 0x55AA */ |
| 1740 | #define ASC_MC_BIOS_VERSION 0x005A /* BIOS Version (2 bytes) */ |
| 1741 | #define ASC_MC_SDTR_SPEED1 0x0090 /* SDTR Speed for TID 0-3 */ |
| 1742 | #define ASC_MC_SDTR_SPEED2 0x0092 /* SDTR Speed for TID 4-7 */ |
| 1743 | #define ASC_MC_SDTR_SPEED3 0x0094 /* SDTR Speed for TID 8-11 */ |
| 1744 | #define ASC_MC_SDTR_SPEED4 0x0096 /* SDTR Speed for TID 12-15 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1745 | #define ASC_MC_CHIP_TYPE 0x009A |
| 1746 | #define ASC_MC_INTRB_CODE 0x009B |
| 1747 | #define ASC_MC_WDTR_ABLE 0x009C |
| 1748 | #define ASC_MC_SDTR_ABLE 0x009E |
| 1749 | #define ASC_MC_TAGQNG_ABLE 0x00A0 |
| 1750 | #define ASC_MC_DISC_ENABLE 0x00A2 |
| 1751 | #define ASC_MC_IDLE_CMD_STATUS 0x00A4 |
| 1752 | #define ASC_MC_IDLE_CMD 0x00A6 |
| 1753 | #define ASC_MC_IDLE_CMD_PARAMETER 0x00A8 |
| 1754 | #define ASC_MC_DEFAULT_SCSI_CFG0 0x00AC |
| 1755 | #define ASC_MC_DEFAULT_SCSI_CFG1 0x00AE |
| 1756 | #define ASC_MC_DEFAULT_MEM_CFG 0x00B0 |
| 1757 | #define ASC_MC_DEFAULT_SEL_MASK 0x00B2 |
| 1758 | #define ASC_MC_SDTR_DONE 0x00B6 |
| 1759 | #define ASC_MC_NUMBER_OF_QUEUED_CMD 0x00C0 |
| 1760 | #define ASC_MC_NUMBER_OF_MAX_CMD 0x00D0 |
| 1761 | #define ASC_MC_DEVICE_HSHK_CFG_TABLE 0x0100 |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1762 | #define ASC_MC_CONTROL_FLAG 0x0122 /* Microcode control flag. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1763 | #define ASC_MC_WDTR_DONE 0x0124 |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1764 | #define ASC_MC_CAM_MODE_MASK 0x015E /* CAM mode TID bitmask. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1765 | #define ASC_MC_ICQ 0x0160 |
| 1766 | #define ASC_MC_IRQ 0x0164 |
| 1767 | #define ASC_MC_PPR_ABLE 0x017A |
| 1768 | |
| 1769 | /* |
| 1770 | * BIOS LRAM variable absolute offsets. |
| 1771 | */ |
| 1772 | #define BIOS_CODESEG 0x54 |
| 1773 | #define BIOS_CODELEN 0x56 |
| 1774 | #define BIOS_SIGNATURE 0x58 |
| 1775 | #define BIOS_VERSION 0x5A |
| 1776 | |
| 1777 | /* |
| 1778 | * Microcode Control Flags |
| 1779 | * |
| 1780 | * Flags set by the Adv Library in RISC variable 'control_flag' (0x122) |
| 1781 | * and handled by the microcode. |
| 1782 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1783 | #define CONTROL_FLAG_IGNORE_PERR 0x0001 /* Ignore DMA Parity Errors */ |
| 1784 | #define CONTROL_FLAG_ENABLE_AIPP 0x0002 /* Enabled AIPP checking. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1785 | |
| 1786 | /* |
| 1787 | * ASC_MC_DEVICE_HSHK_CFG_TABLE microcode table or HSHK_CFG register format |
| 1788 | */ |
| 1789 | #define HSHK_CFG_WIDE_XFR 0x8000 |
| 1790 | #define HSHK_CFG_RATE 0x0F00 |
| 1791 | #define HSHK_CFG_OFFSET 0x001F |
| 1792 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1793 | #define ASC_DEF_MAX_HOST_QNG 0xFD /* Max. number of host commands (253) */ |
| 1794 | #define ASC_DEF_MIN_HOST_QNG 0x10 /* Min. number of host commands (16) */ |
| 1795 | #define ASC_DEF_MAX_DVC_QNG 0x3F /* Max. number commands per device (63) */ |
| 1796 | #define ASC_DEF_MIN_DVC_QNG 0x04 /* Min. number commands per device (4) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1797 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1798 | #define ASC_QC_DATA_CHECK 0x01 /* Require ASC_QC_DATA_OUT set or clear. */ |
| 1799 | #define ASC_QC_DATA_OUT 0x02 /* Data out DMA transfer. */ |
| 1800 | #define ASC_QC_START_MOTOR 0x04 /* Send auto-start motor before request. */ |
| 1801 | #define ASC_QC_NO_OVERRUN 0x08 /* Don't report overrun. */ |
| 1802 | #define ASC_QC_FREEZE_TIDQ 0x10 /* Freeze TID queue after request. XXX TBD */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1803 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1804 | #define ASC_QSC_NO_DISC 0x01 /* Don't allow disconnect for request. */ |
| 1805 | #define ASC_QSC_NO_TAGMSG 0x02 /* Don't allow tag queuing for request. */ |
| 1806 | #define ASC_QSC_NO_SYNC 0x04 /* Don't use Synch. transfer on request. */ |
| 1807 | #define ASC_QSC_NO_WIDE 0x08 /* Don't use Wide transfer on request. */ |
| 1808 | #define ASC_QSC_REDO_DTR 0x10 /* Renegotiate WDTR/SDTR before request. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1809 | /* |
| 1810 | * Note: If a Tag Message is to be sent and neither ASC_QSC_HEAD_TAG or |
| 1811 | * ASC_QSC_ORDERED_TAG is set, then a Simple Tag Message (0x20) is used. |
| 1812 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1813 | #define ASC_QSC_HEAD_TAG 0x40 /* Use Head Tag Message (0x21). */ |
| 1814 | #define ASC_QSC_ORDERED_TAG 0x80 /* Use Ordered Tag Message (0x22). */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1815 | |
| 1816 | /* |
| 1817 | * All fields here are accessed by the board microcode and need to be |
| 1818 | * little-endian. |
| 1819 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1820 | typedef struct adv_carr_t { |
| 1821 | ADV_VADDR carr_va; /* Carrier Virtual Address */ |
| 1822 | ADV_PADDR carr_pa; /* Carrier Physical Address */ |
| 1823 | ADV_VADDR areq_vpa; /* ASC_SCSI_REQ_Q Virtual or Physical Address */ |
| 1824 | /* |
| 1825 | * next_vpa [31:4] Carrier Virtual or Physical Next Pointer |
| 1826 | * |
| 1827 | * next_vpa [3:1] Reserved Bits |
| 1828 | * next_vpa [0] Done Flag set in Response Queue. |
| 1829 | */ |
| 1830 | ADV_VADDR next_vpa; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1831 | } ADV_CARR_T; |
| 1832 | |
| 1833 | /* |
| 1834 | * Mask used to eliminate low 4 bits of carrier 'next_vpa' field. |
| 1835 | */ |
| 1836 | #define ASC_NEXT_VPA_MASK 0xFFFFFFF0 |
| 1837 | |
| 1838 | #define ASC_RQ_DONE 0x00000001 |
| 1839 | #define ASC_RQ_GOOD 0x00000002 |
| 1840 | #define ASC_CQ_STOPPER 0x00000000 |
| 1841 | |
| 1842 | #define ASC_GET_CARRP(carrp) ((carrp) & ASC_NEXT_VPA_MASK) |
| 1843 | |
| 1844 | #define ADV_CARRIER_NUM_PAGE_CROSSING \ |
| 1845 | (((ADV_CARRIER_COUNT * sizeof(ADV_CARR_T)) + \ |
| 1846 | (ADV_PAGE_SIZE - 1))/ADV_PAGE_SIZE) |
| 1847 | |
| 1848 | #define ADV_CARRIER_BUFSIZE \ |
| 1849 | ((ADV_CARRIER_COUNT + ADV_CARRIER_NUM_PAGE_CROSSING) * sizeof(ADV_CARR_T)) |
| 1850 | |
| 1851 | /* |
| 1852 | * ASC_SCSI_REQ_Q 'a_flag' definitions |
| 1853 | * |
| 1854 | * The Adv Library should limit use to the lower nibble (4 bits) of |
| 1855 | * a_flag. Drivers are free to use the upper nibble (4 bits) of a_flag. |
| 1856 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1857 | #define ADV_POLL_REQUEST 0x01 /* poll for request completion */ |
| 1858 | #define ADV_SCSIQ_DONE 0x02 /* request done */ |
| 1859 | #define ADV_DONT_RETRY 0x08 /* don't do retry */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1860 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1861 | #define ADV_CHIP_ASC3550 0x01 /* Ultra-Wide IC */ |
| 1862 | #define ADV_CHIP_ASC38C0800 0x02 /* Ultra2-Wide/LVD IC */ |
| 1863 | #define ADV_CHIP_ASC38C1600 0x03 /* Ultra3-Wide/LVD2 IC */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1864 | |
| 1865 | /* |
| 1866 | * Adapter temporary configuration structure |
| 1867 | * |
| 1868 | * This structure can be discarded after initialization. Don't add |
| 1869 | * fields here needed after initialization. |
| 1870 | * |
| 1871 | * Field naming convention: |
| 1872 | * |
| 1873 | * *_enable indicates the field enables or disables a feature. The |
| 1874 | * value of the field is never reset. |
| 1875 | */ |
| 1876 | typedef struct adv_dvc_cfg { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1877 | ushort disc_enable; /* enable disconnection */ |
| 1878 | uchar chip_version; /* chip version */ |
| 1879 | uchar termination; /* Term. Ctrl. bits 6-5 of SCSI_CFG1 register */ |
| 1880 | ushort lib_version; /* Adv Library version number */ |
| 1881 | ushort control_flag; /* Microcode Control Flag */ |
| 1882 | ushort mcode_date; /* Microcode date */ |
| 1883 | ushort mcode_version; /* Microcode version */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1884 | ushort serial1; /* EEPROM serial number word 1 */ |
| 1885 | ushort serial2; /* EEPROM serial number word 2 */ |
| 1886 | ushort serial3; /* EEPROM serial number word 3 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1887 | } ADV_DVC_CFG; |
| 1888 | |
| 1889 | struct adv_dvc_var; |
| 1890 | struct adv_scsi_req_q; |
| 1891 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1892 | /* |
| 1893 | * Adapter operation variable structure. |
| 1894 | * |
| 1895 | * One structure is required per host adapter. |
| 1896 | * |
| 1897 | * Field naming convention: |
| 1898 | * |
| 1899 | * *_able indicates both whether a feature should be enabled or disabled |
| 1900 | * and whether a device isi capable of the feature. At initialization |
| 1901 | * this field may be set, but later if a device is found to be incapable |
| 1902 | * of the feature, the field is cleared. |
| 1903 | */ |
| 1904 | typedef struct adv_dvc_var { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1905 | AdvPortAddr iop_base; /* I/O port address */ |
| 1906 | ushort err_code; /* fatal error code */ |
| 1907 | ushort bios_ctrl; /* BIOS control word, EEPROM word 12 */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1908 | ushort wdtr_able; /* try WDTR for a device */ |
| 1909 | ushort sdtr_able; /* try SDTR for a device */ |
| 1910 | ushort ultra_able; /* try SDTR Ultra speed for a device */ |
| 1911 | ushort sdtr_speed1; /* EEPROM SDTR Speed for TID 0-3 */ |
| 1912 | ushort sdtr_speed2; /* EEPROM SDTR Speed for TID 4-7 */ |
| 1913 | ushort sdtr_speed3; /* EEPROM SDTR Speed for TID 8-11 */ |
| 1914 | ushort sdtr_speed4; /* EEPROM SDTR Speed for TID 12-15 */ |
| 1915 | ushort tagqng_able; /* try tagged queuing with a device */ |
| 1916 | ushort ppr_able; /* PPR message capable per TID bitmask. */ |
| 1917 | uchar max_dvc_qng; /* maximum number of tagged commands per device */ |
| 1918 | ushort start_motor; /* start motor command allowed */ |
| 1919 | uchar scsi_reset_wait; /* delay in seconds after scsi bus reset */ |
| 1920 | uchar chip_no; /* should be assigned by caller */ |
| 1921 | uchar max_host_qng; /* maximum number of Q'ed command allowed */ |
| 1922 | uchar irq_no; /* IRQ number */ |
| 1923 | ushort no_scam; /* scam_tolerant of EEPROM */ |
| 1924 | struct asc_board *drv_ptr; /* driver pointer to private structure */ |
| 1925 | uchar chip_scsi_id; /* chip SCSI target ID */ |
| 1926 | uchar chip_type; |
| 1927 | uchar bist_err_code; |
| 1928 | ADV_CARR_T *carrier_buf; |
| 1929 | ADV_CARR_T *carr_freelist; /* Carrier free list. */ |
| 1930 | ADV_CARR_T *icq_sp; /* Initiator command queue stopper pointer. */ |
| 1931 | ADV_CARR_T *irq_sp; /* Initiator response queue stopper pointer. */ |
| 1932 | ushort carr_pending_cnt; /* Count of pending carriers. */ |
| 1933 | /* |
| 1934 | * Note: The following fields will not be used after initialization. The |
| 1935 | * driver may discard the buffer after initialization is done. |
| 1936 | */ |
| 1937 | ADV_DVC_CFG *cfg; /* temporary configuration structure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1938 | } ADV_DVC_VAR; |
| 1939 | |
| 1940 | #define NO_OF_SG_PER_BLOCK 15 |
| 1941 | |
| 1942 | typedef struct asc_sg_block { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1943 | uchar reserved1; |
| 1944 | uchar reserved2; |
| 1945 | uchar reserved3; |
| 1946 | uchar sg_cnt; /* Valid entries in block. */ |
| 1947 | ADV_PADDR sg_ptr; /* Pointer to next sg block. */ |
| 1948 | struct { |
| 1949 | ADV_PADDR sg_addr; /* SG element address. */ |
| 1950 | ADV_DCNT sg_count; /* SG element count. */ |
| 1951 | } sg_list[NO_OF_SG_PER_BLOCK]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1952 | } ADV_SG_BLOCK; |
| 1953 | |
| 1954 | /* |
| 1955 | * ADV_SCSI_REQ_Q - microcode request structure |
| 1956 | * |
| 1957 | * All fields in this structure up to byte 60 are used by the microcode. |
| 1958 | * The microcode makes assumptions about the size and ordering of fields |
| 1959 | * in this structure. Do not change the structure definition here without |
| 1960 | * coordinating the change with the microcode. |
| 1961 | * |
| 1962 | * All fields accessed by microcode must be maintained in little_endian |
| 1963 | * order. |
| 1964 | */ |
| 1965 | typedef struct adv_scsi_req_q { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 1966 | uchar cntl; /* Ucode flags and state (ASC_MC_QC_*). */ |
| 1967 | uchar target_cmd; |
| 1968 | uchar target_id; /* Device target identifier. */ |
| 1969 | uchar target_lun; /* Device target logical unit number. */ |
| 1970 | ADV_PADDR data_addr; /* Data buffer physical address. */ |
| 1971 | ADV_DCNT data_cnt; /* Data count. Ucode sets to residual. */ |
| 1972 | ADV_PADDR sense_addr; |
| 1973 | ADV_PADDR carr_pa; |
| 1974 | uchar mflag; |
| 1975 | uchar sense_len; |
| 1976 | uchar cdb_len; /* SCSI CDB length. Must <= 16 bytes. */ |
| 1977 | uchar scsi_cntl; |
| 1978 | uchar done_status; /* Completion status. */ |
| 1979 | uchar scsi_status; /* SCSI status byte. */ |
| 1980 | uchar host_status; /* Ucode host status. */ |
| 1981 | uchar sg_working_ix; |
| 1982 | uchar cdb[12]; /* SCSI CDB bytes 0-11. */ |
| 1983 | ADV_PADDR sg_real_addr; /* SG list physical address. */ |
| 1984 | ADV_PADDR scsiq_rptr; |
| 1985 | uchar cdb16[4]; /* SCSI CDB bytes 12-15. */ |
| 1986 | ADV_VADDR scsiq_ptr; |
| 1987 | ADV_VADDR carr_va; |
| 1988 | /* |
| 1989 | * End of microcode structure - 60 bytes. The rest of the structure |
| 1990 | * is used by the Adv Library and ignored by the microcode. |
| 1991 | */ |
| 1992 | ADV_VADDR srb_ptr; |
| 1993 | ADV_SG_BLOCK *sg_list_ptr; /* SG list virtual address. */ |
| 1994 | char *vdata_addr; /* Data buffer virtual address. */ |
| 1995 | uchar a_flag; |
| 1996 | uchar pad[2]; /* Pad out to a word boundary. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1997 | } ADV_SCSI_REQ_Q; |
| 1998 | |
| 1999 | /* |
| 2000 | * Microcode idle loop commands |
| 2001 | */ |
| 2002 | #define IDLE_CMD_COMPLETED 0 |
| 2003 | #define IDLE_CMD_STOP_CHIP 0x0001 |
| 2004 | #define IDLE_CMD_STOP_CHIP_SEND_INT 0x0002 |
| 2005 | #define IDLE_CMD_SEND_INT 0x0004 |
| 2006 | #define IDLE_CMD_ABORT 0x0008 |
| 2007 | #define IDLE_CMD_DEVICE_RESET 0x0010 |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2008 | #define IDLE_CMD_SCSI_RESET_START 0x0020 /* Assert SCSI Bus Reset */ |
| 2009 | #define IDLE_CMD_SCSI_RESET_END 0x0040 /* Deassert SCSI Bus Reset */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2010 | #define IDLE_CMD_SCSIREQ 0x0080 |
| 2011 | |
| 2012 | #define IDLE_CMD_STATUS_SUCCESS 0x0001 |
| 2013 | #define IDLE_CMD_STATUS_FAILURE 0x0002 |
| 2014 | |
| 2015 | /* |
| 2016 | * AdvSendIdleCmd() flag definitions. |
| 2017 | */ |
| 2018 | #define ADV_NOWAIT 0x01 |
| 2019 | |
| 2020 | /* |
| 2021 | * Wait loop time out values. |
| 2022 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2023 | #define SCSI_WAIT_100_MSEC 100UL /* 100 milliseconds */ |
| 2024 | #define SCSI_US_PER_MSEC 1000 /* microseconds per millisecond */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2025 | #define SCSI_MAX_RETRY 10 /* retry count */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2026 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2027 | #define ADV_ASYNC_RDMA_FAILURE 0x01 /* Fatal RDMA failure. */ |
| 2028 | #define ADV_ASYNC_SCSI_BUS_RESET_DET 0x02 /* Detected SCSI Bus Reset. */ |
| 2029 | #define ADV_ASYNC_CARRIER_READY_FAILURE 0x03 /* Carrier Ready failure. */ |
| 2030 | #define ADV_RDMA_IN_CARR_AND_Q_INVALID 0x04 /* RDMAed-in data invalid. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2031 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2032 | #define ADV_HOST_SCSI_BUS_RESET 0x80 /* Host Initiated SCSI Bus Reset. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2033 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2034 | /* Read byte from a register. */ |
| 2035 | #define AdvReadByteRegister(iop_base, reg_off) \ |
| 2036 | (ADV_MEM_READB((iop_base) + (reg_off))) |
| 2037 | |
| 2038 | /* Write byte to a register. */ |
| 2039 | #define AdvWriteByteRegister(iop_base, reg_off, byte) \ |
| 2040 | (ADV_MEM_WRITEB((iop_base) + (reg_off), (byte))) |
| 2041 | |
| 2042 | /* Read word (2 bytes) from a register. */ |
| 2043 | #define AdvReadWordRegister(iop_base, reg_off) \ |
| 2044 | (ADV_MEM_READW((iop_base) + (reg_off))) |
| 2045 | |
| 2046 | /* Write word (2 bytes) to a register. */ |
| 2047 | #define AdvWriteWordRegister(iop_base, reg_off, word) \ |
| 2048 | (ADV_MEM_WRITEW((iop_base) + (reg_off), (word))) |
| 2049 | |
| 2050 | /* Write dword (4 bytes) to a register. */ |
| 2051 | #define AdvWriteDWordRegister(iop_base, reg_off, dword) \ |
| 2052 | (ADV_MEM_WRITEDW((iop_base) + (reg_off), (dword))) |
| 2053 | |
| 2054 | /* Read byte from LRAM. */ |
| 2055 | #define AdvReadByteLram(iop_base, addr, byte) \ |
| 2056 | do { \ |
| 2057 | ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)); \ |
| 2058 | (byte) = ADV_MEM_READB((iop_base) + IOPB_RAM_DATA); \ |
| 2059 | } while (0) |
| 2060 | |
| 2061 | /* Write byte to LRAM. */ |
| 2062 | #define AdvWriteByteLram(iop_base, addr, byte) \ |
| 2063 | (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)), \ |
| 2064 | ADV_MEM_WRITEB((iop_base) + IOPB_RAM_DATA, (byte))) |
| 2065 | |
| 2066 | /* Read word (2 bytes) from LRAM. */ |
| 2067 | #define AdvReadWordLram(iop_base, addr, word) \ |
| 2068 | do { \ |
| 2069 | ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)); \ |
| 2070 | (word) = (ADV_MEM_READW((iop_base) + IOPW_RAM_DATA)); \ |
| 2071 | } while (0) |
| 2072 | |
| 2073 | /* Write word (2 bytes) to LRAM. */ |
| 2074 | #define AdvWriteWordLram(iop_base, addr, word) \ |
| 2075 | (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)), \ |
| 2076 | ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, (word))) |
| 2077 | |
| 2078 | /* Write little-endian double word (4 bytes) to LRAM */ |
| 2079 | /* Because of unspecified C language ordering don't use auto-increment. */ |
| 2080 | #define AdvWriteDWordLramNoSwap(iop_base, addr, dword) \ |
| 2081 | ((ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)), \ |
| 2082 | ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, \ |
| 2083 | cpu_to_le16((ushort) ((dword) & 0xFFFF)))), \ |
| 2084 | (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr) + 2), \ |
| 2085 | ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, \ |
| 2086 | cpu_to_le16((ushort) ((dword >> 16) & 0xFFFF))))) |
| 2087 | |
| 2088 | /* Read word (2 bytes) from LRAM assuming that the address is already set. */ |
| 2089 | #define AdvReadWordAutoIncLram(iop_base) \ |
| 2090 | (ADV_MEM_READW((iop_base) + IOPW_RAM_DATA)) |
| 2091 | |
| 2092 | /* Write word (2 bytes) to LRAM assuming that the address is already set. */ |
| 2093 | #define AdvWriteWordAutoIncLram(iop_base, word) \ |
| 2094 | (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, (word))) |
| 2095 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2096 | /* |
| 2097 | * Define macro to check for Condor signature. |
| 2098 | * |
| 2099 | * Evaluate to ADV_TRUE if a Condor chip is found the specified port |
| 2100 | * address 'iop_base'. Otherwise evalue to ADV_FALSE. |
| 2101 | */ |
| 2102 | #define AdvFindSignature(iop_base) \ |
| 2103 | (((AdvReadByteRegister((iop_base), IOPB_CHIP_ID_1) == \ |
| 2104 | ADV_CHIP_ID_BYTE) && \ |
| 2105 | (AdvReadWordRegister((iop_base), IOPW_CHIP_ID_0) == \ |
| 2106 | ADV_CHIP_ID_WORD)) ? ADV_TRUE : ADV_FALSE) |
| 2107 | |
| 2108 | /* |
| 2109 | * Define macro to Return the version number of the chip at 'iop_base'. |
| 2110 | * |
| 2111 | * The second parameter 'bus_type' is currently unused. |
| 2112 | */ |
| 2113 | #define AdvGetChipVersion(iop_base, bus_type) \ |
| 2114 | AdvReadByteRegister((iop_base), IOPB_CHIP_TYPE_REV) |
| 2115 | |
| 2116 | /* |
| 2117 | * Abort an SRB in the chip's RISC Memory. The 'srb_ptr' argument must |
| 2118 | * match the ASC_SCSI_REQ_Q 'srb_ptr' field. |
| 2119 | * |
| 2120 | * If the request has not yet been sent to the device it will simply be |
| 2121 | * aborted from RISC memory. If the request is disconnected it will be |
| 2122 | * aborted on reselection by sending an Abort Message to the target ID. |
| 2123 | * |
| 2124 | * Return value: |
| 2125 | * ADV_TRUE(1) - Queue was successfully aborted. |
| 2126 | * ADV_FALSE(0) - Queue was not found on the active queue list. |
| 2127 | */ |
| 2128 | #define AdvAbortQueue(asc_dvc, scsiq) \ |
| 2129 | AdvSendIdleCmd((asc_dvc), (ushort) IDLE_CMD_ABORT, \ |
| 2130 | (ADV_DCNT) (scsiq)) |
| 2131 | |
| 2132 | /* |
| 2133 | * Send a Bus Device Reset Message to the specified target ID. |
| 2134 | * |
| 2135 | * All outstanding commands will be purged if sending the |
| 2136 | * Bus Device Reset Message is successful. |
| 2137 | * |
| 2138 | * Return Value: |
| 2139 | * ADV_TRUE(1) - All requests on the target are purged. |
| 2140 | * ADV_FALSE(0) - Couldn't issue Bus Device Reset Message; Requests |
| 2141 | * are not purged. |
| 2142 | */ |
| 2143 | #define AdvResetDevice(asc_dvc, target_id) \ |
| 2144 | AdvSendIdleCmd((asc_dvc), (ushort) IDLE_CMD_DEVICE_RESET, \ |
| 2145 | (ADV_DCNT) (target_id)) |
| 2146 | |
| 2147 | /* |
| 2148 | * SCSI Wide Type definition. |
| 2149 | */ |
| 2150 | #define ADV_SCSI_BIT_ID_TYPE ushort |
| 2151 | |
| 2152 | /* |
| 2153 | * AdvInitScsiTarget() 'cntl_flag' options. |
| 2154 | */ |
| 2155 | #define ADV_SCAN_LUN 0x01 |
| 2156 | #define ADV_CAPINFO_NOLUN 0x02 |
| 2157 | |
| 2158 | /* |
| 2159 | * Convert target id to target id bit mask. |
| 2160 | */ |
| 2161 | #define ADV_TID_TO_TIDMASK(tid) (0x01 << ((tid) & ADV_MAX_TID)) |
| 2162 | |
| 2163 | /* |
| 2164 | * ASC_SCSI_REQ_Q 'done_status' and 'host_status' return values. |
| 2165 | */ |
| 2166 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2167 | #define QD_NO_STATUS 0x00 /* Request not completed yet. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2168 | #define QD_NO_ERROR 0x01 |
| 2169 | #define QD_ABORTED_BY_HOST 0x02 |
| 2170 | #define QD_WITH_ERROR 0x04 |
| 2171 | |
| 2172 | #define QHSTA_NO_ERROR 0x00 |
| 2173 | #define QHSTA_M_SEL_TIMEOUT 0x11 |
| 2174 | #define QHSTA_M_DATA_OVER_RUN 0x12 |
| 2175 | #define QHSTA_M_UNEXPECTED_BUS_FREE 0x13 |
| 2176 | #define QHSTA_M_QUEUE_ABORTED 0x15 |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2177 | #define QHSTA_M_SXFR_SDMA_ERR 0x16 /* SXFR_STATUS SCSI DMA Error */ |
| 2178 | #define QHSTA_M_SXFR_SXFR_PERR 0x17 /* SXFR_STATUS SCSI Bus Parity Error */ |
| 2179 | #define QHSTA_M_RDMA_PERR 0x18 /* RISC PCI DMA parity error */ |
| 2180 | #define QHSTA_M_SXFR_OFF_UFLW 0x19 /* SXFR_STATUS Offset Underflow */ |
| 2181 | #define QHSTA_M_SXFR_OFF_OFLW 0x20 /* SXFR_STATUS Offset Overflow */ |
| 2182 | #define QHSTA_M_SXFR_WD_TMO 0x21 /* SXFR_STATUS Watchdog Timeout */ |
| 2183 | #define QHSTA_M_SXFR_DESELECTED 0x22 /* SXFR_STATUS Deselected */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2184 | /* Note: QHSTA_M_SXFR_XFR_OFLW is identical to QHSTA_M_DATA_OVER_RUN. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2185 | #define QHSTA_M_SXFR_XFR_OFLW 0x12 /* SXFR_STATUS Transfer Overflow */ |
| 2186 | #define QHSTA_M_SXFR_XFR_PH_ERR 0x24 /* SXFR_STATUS Transfer Phase Error */ |
| 2187 | #define QHSTA_M_SXFR_UNKNOWN_ERROR 0x25 /* SXFR_STATUS Unknown Error */ |
| 2188 | #define QHSTA_M_SCSI_BUS_RESET 0x30 /* Request aborted from SBR */ |
| 2189 | #define QHSTA_M_SCSI_BUS_RESET_UNSOL 0x31 /* Request aborted from unsol. SBR */ |
| 2190 | #define QHSTA_M_BUS_DEVICE_RESET 0x32 /* Request aborted from BDR */ |
| 2191 | #define QHSTA_M_DIRECTION_ERR 0x35 /* Data Phase mismatch */ |
| 2192 | #define QHSTA_M_DIRECTION_ERR_HUNG 0x36 /* Data Phase mismatch and bus hang */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2193 | #define QHSTA_M_WTM_TIMEOUT 0x41 |
| 2194 | #define QHSTA_M_BAD_CMPL_STATUS_IN 0x42 |
| 2195 | #define QHSTA_M_NO_AUTO_REQ_SENSE 0x43 |
| 2196 | #define QHSTA_M_AUTO_REQ_SENSE_FAIL 0x44 |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2197 | #define QHSTA_M_INVALID_DEVICE 0x45 /* Bad target ID */ |
| 2198 | #define QHSTA_M_FROZEN_TIDQ 0x46 /* TID Queue frozen. */ |
| 2199 | #define QHSTA_M_SGBACKUP_ERROR 0x47 /* Scatter-Gather backup error */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2200 | |
| 2201 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2202 | * DvcGetPhyAddr() flag arguments |
| 2203 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2204 | #define ADV_IS_SCSIQ_FLAG 0x01 /* 'addr' is ASC_SCSI_REQ_Q pointer */ |
| 2205 | #define ADV_ASCGETSGLIST_VADDR 0x02 /* 'addr' is AscGetSGList() virtual addr */ |
| 2206 | #define ADV_IS_SENSE_FLAG 0x04 /* 'addr' is sense virtual pointer */ |
| 2207 | #define ADV_IS_DATA_FLAG 0x08 /* 'addr' is data virtual pointer */ |
| 2208 | #define ADV_IS_SGLIST_FLAG 0x10 /* 'addr' is sglist virtual pointer */ |
| 2209 | #define ADV_IS_CARRIER_FLAG 0x20 /* 'addr' is ADV_CARR_T pointer */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2210 | |
| 2211 | /* Return the address that is aligned at the next doubleword >= to 'addr'. */ |
| 2212 | #define ADV_8BALIGN(addr) (((ulong) (addr) + 0x7) & ~0x7) |
| 2213 | #define ADV_16BALIGN(addr) (((ulong) (addr) + 0xF) & ~0xF) |
| 2214 | #define ADV_32BALIGN(addr) (((ulong) (addr) + 0x1F) & ~0x1F) |
| 2215 | |
| 2216 | /* |
| 2217 | * Total contiguous memory needed for driver SG blocks. |
| 2218 | * |
| 2219 | * ADV_MAX_SG_LIST must be defined by a driver. It is the maximum |
| 2220 | * number of scatter-gather elements the driver supports in a |
| 2221 | * single request. |
| 2222 | */ |
| 2223 | |
| 2224 | #define ADV_SG_LIST_MAX_BYTE_SIZE \ |
| 2225 | (sizeof(ADV_SG_BLOCK) * \ |
| 2226 | ((ADV_MAX_SG_LIST + (NO_OF_SG_PER_BLOCK - 1))/NO_OF_SG_PER_BLOCK)) |
| 2227 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2228 | /* Reference Scsi_Host hostdata */ |
| 2229 | #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) |
| 2230 | |
| 2231 | /* asc_board_t flags */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2232 | #define ASC_IS_WIDE_BOARD 0x04 /* AdvanSys Wide Board */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2233 | #define ASC_SELECT_QUEUE_DEPTHS 0x08 |
| 2234 | |
| 2235 | #define ASC_NARROW_BOARD(boardp) (((boardp)->flags & ASC_IS_WIDE_BOARD) == 0) |
| 2236 | #define ASC_WIDE_BOARD(boardp) ((boardp)->flags & ASC_IS_WIDE_BOARD) |
| 2237 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2238 | #define NO_ISA_DMA 0xff /* No ISA DMA Channel Used */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2239 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2240 | #define ASC_INFO_SIZE 128 /* advansys_info() line size */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2241 | |
| 2242 | #ifdef CONFIG_PROC_FS |
| 2243 | /* /proc/scsi/advansys/[0...] related definitions */ |
| 2244 | #define ASC_PRTBUF_SIZE 2048 |
| 2245 | #define ASC_PRTLINE_SIZE 160 |
| 2246 | |
| 2247 | #define ASC_PRT_NEXT() \ |
| 2248 | if (cp) { \ |
| 2249 | totlen += len; \ |
| 2250 | leftlen -= len; \ |
| 2251 | if (leftlen == 0) { \ |
| 2252 | return totlen; \ |
| 2253 | } \ |
| 2254 | cp += len; \ |
| 2255 | } |
| 2256 | #endif /* CONFIG_PROC_FS */ |
| 2257 | |
| 2258 | /* Asc Library return codes */ |
| 2259 | #define ASC_TRUE 1 |
| 2260 | #define ASC_FALSE 0 |
| 2261 | #define ASC_NOERROR 1 |
| 2262 | #define ASC_BUSY 0 |
| 2263 | #define ASC_ERROR (-1) |
| 2264 | |
| 2265 | /* struct scsi_cmnd function return codes */ |
| 2266 | #define STATUS_BYTE(byte) (byte) |
| 2267 | #define MSG_BYTE(byte) ((byte) << 8) |
| 2268 | #define HOST_BYTE(byte) ((byte) << 16) |
| 2269 | #define DRIVER_BYTE(byte) ((byte) << 24) |
| 2270 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2271 | #ifndef ADVANSYS_STATS |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2272 | #define ASC_STATS(shost, counter) |
| 2273 | #define ASC_STATS_ADD(shost, counter, count) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2274 | #else /* ADVANSYS_STATS */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2275 | #define ASC_STATS(shost, counter) \ |
| 2276 | (ASC_BOARDP(shost)->asc_stats.counter++) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2277 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2278 | #define ASC_STATS_ADD(shost, counter, count) \ |
| 2279 | (ASC_BOARDP(shost)->asc_stats.counter += (count)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2280 | #endif /* ADVANSYS_STATS */ |
| 2281 | |
| 2282 | #define ASC_CEILING(val, unit) (((val) + ((unit) - 1))/(unit)) |
| 2283 | |
| 2284 | /* If the result wraps when calculating tenths, return 0. */ |
| 2285 | #define ASC_TENTHS(num, den) \ |
| 2286 | (((10 * ((num)/(den))) > (((num) * 10)/(den))) ? \ |
| 2287 | 0 : ((((num) * 10)/(den)) - (10 * ((num)/(den))))) |
| 2288 | |
| 2289 | /* |
| 2290 | * Display a message to the console. |
| 2291 | */ |
| 2292 | #define ASC_PRINT(s) \ |
| 2293 | { \ |
| 2294 | printk("advansys: "); \ |
| 2295 | printk(s); \ |
| 2296 | } |
| 2297 | |
| 2298 | #define ASC_PRINT1(s, a1) \ |
| 2299 | { \ |
| 2300 | printk("advansys: "); \ |
| 2301 | printk((s), (a1)); \ |
| 2302 | } |
| 2303 | |
| 2304 | #define ASC_PRINT2(s, a1, a2) \ |
| 2305 | { \ |
| 2306 | printk("advansys: "); \ |
| 2307 | printk((s), (a1), (a2)); \ |
| 2308 | } |
| 2309 | |
| 2310 | #define ASC_PRINT3(s, a1, a2, a3) \ |
| 2311 | { \ |
| 2312 | printk("advansys: "); \ |
| 2313 | printk((s), (a1), (a2), (a3)); \ |
| 2314 | } |
| 2315 | |
| 2316 | #define ASC_PRINT4(s, a1, a2, a3, a4) \ |
| 2317 | { \ |
| 2318 | printk("advansys: "); \ |
| 2319 | printk((s), (a1), (a2), (a3), (a4)); \ |
| 2320 | } |
| 2321 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2322 | #ifndef ADVANSYS_DEBUG |
| 2323 | |
| 2324 | #define ASC_DBG(lvl, s) |
| 2325 | #define ASC_DBG1(lvl, s, a1) |
| 2326 | #define ASC_DBG2(lvl, s, a1, a2) |
| 2327 | #define ASC_DBG3(lvl, s, a1, a2, a3) |
| 2328 | #define ASC_DBG4(lvl, s, a1, a2, a3, a4) |
| 2329 | #define ASC_DBG_PRT_SCSI_HOST(lvl, s) |
| 2330 | #define ASC_DBG_PRT_SCSI_CMND(lvl, s) |
| 2331 | #define ASC_DBG_PRT_ASC_SCSI_Q(lvl, scsiqp) |
| 2332 | #define ASC_DBG_PRT_ADV_SCSI_REQ_Q(lvl, scsiqp) |
| 2333 | #define ASC_DBG_PRT_ASC_QDONE_INFO(lvl, qdone) |
| 2334 | #define ADV_DBG_PRT_ADV_SCSI_REQ_Q(lvl, scsiqp) |
| 2335 | #define ASC_DBG_PRT_HEX(lvl, name, start, length) |
| 2336 | #define ASC_DBG_PRT_CDB(lvl, cdb, len) |
| 2337 | #define ASC_DBG_PRT_SENSE(lvl, sense, len) |
| 2338 | #define ASC_DBG_PRT_INQUIRY(lvl, inq, len) |
| 2339 | |
| 2340 | #else /* ADVANSYS_DEBUG */ |
| 2341 | |
| 2342 | /* |
| 2343 | * Debugging Message Levels: |
| 2344 | * 0: Errors Only |
| 2345 | * 1: High-Level Tracing |
| 2346 | * 2-N: Verbose Tracing |
| 2347 | */ |
| 2348 | |
| 2349 | #define ASC_DBG(lvl, s) \ |
| 2350 | { \ |
| 2351 | if (asc_dbglvl >= (lvl)) { \ |
| 2352 | printk(s); \ |
| 2353 | } \ |
| 2354 | } |
| 2355 | |
| 2356 | #define ASC_DBG1(lvl, s, a1) \ |
| 2357 | { \ |
| 2358 | if (asc_dbglvl >= (lvl)) { \ |
| 2359 | printk((s), (a1)); \ |
| 2360 | } \ |
| 2361 | } |
| 2362 | |
| 2363 | #define ASC_DBG2(lvl, s, a1, a2) \ |
| 2364 | { \ |
| 2365 | if (asc_dbglvl >= (lvl)) { \ |
| 2366 | printk((s), (a1), (a2)); \ |
| 2367 | } \ |
| 2368 | } |
| 2369 | |
| 2370 | #define ASC_DBG3(lvl, s, a1, a2, a3) \ |
| 2371 | { \ |
| 2372 | if (asc_dbglvl >= (lvl)) { \ |
| 2373 | printk((s), (a1), (a2), (a3)); \ |
| 2374 | } \ |
| 2375 | } |
| 2376 | |
| 2377 | #define ASC_DBG4(lvl, s, a1, a2, a3, a4) \ |
| 2378 | { \ |
| 2379 | if (asc_dbglvl >= (lvl)) { \ |
| 2380 | printk((s), (a1), (a2), (a3), (a4)); \ |
| 2381 | } \ |
| 2382 | } |
| 2383 | |
| 2384 | #define ASC_DBG_PRT_SCSI_HOST(lvl, s) \ |
| 2385 | { \ |
| 2386 | if (asc_dbglvl >= (lvl)) { \ |
| 2387 | asc_prt_scsi_host(s); \ |
| 2388 | } \ |
| 2389 | } |
| 2390 | |
| 2391 | #define ASC_DBG_PRT_SCSI_CMND(lvl, s) \ |
| 2392 | { \ |
| 2393 | if (asc_dbglvl >= (lvl)) { \ |
| 2394 | asc_prt_scsi_cmnd(s); \ |
| 2395 | } \ |
| 2396 | } |
| 2397 | |
| 2398 | #define ASC_DBG_PRT_ASC_SCSI_Q(lvl, scsiqp) \ |
| 2399 | { \ |
| 2400 | if (asc_dbglvl >= (lvl)) { \ |
| 2401 | asc_prt_asc_scsi_q(scsiqp); \ |
| 2402 | } \ |
| 2403 | } |
| 2404 | |
| 2405 | #define ASC_DBG_PRT_ASC_QDONE_INFO(lvl, qdone) \ |
| 2406 | { \ |
| 2407 | if (asc_dbglvl >= (lvl)) { \ |
| 2408 | asc_prt_asc_qdone_info(qdone); \ |
| 2409 | } \ |
| 2410 | } |
| 2411 | |
| 2412 | #define ASC_DBG_PRT_ADV_SCSI_REQ_Q(lvl, scsiqp) \ |
| 2413 | { \ |
| 2414 | if (asc_dbglvl >= (lvl)) { \ |
| 2415 | asc_prt_adv_scsi_req_q(scsiqp); \ |
| 2416 | } \ |
| 2417 | } |
| 2418 | |
| 2419 | #define ASC_DBG_PRT_HEX(lvl, name, start, length) \ |
| 2420 | { \ |
| 2421 | if (asc_dbglvl >= (lvl)) { \ |
| 2422 | asc_prt_hex((name), (start), (length)); \ |
| 2423 | } \ |
| 2424 | } |
| 2425 | |
| 2426 | #define ASC_DBG_PRT_CDB(lvl, cdb, len) \ |
| 2427 | ASC_DBG_PRT_HEX((lvl), "CDB", (uchar *) (cdb), (len)); |
| 2428 | |
| 2429 | #define ASC_DBG_PRT_SENSE(lvl, sense, len) \ |
| 2430 | ASC_DBG_PRT_HEX((lvl), "SENSE", (uchar *) (sense), (len)); |
| 2431 | |
| 2432 | #define ASC_DBG_PRT_INQUIRY(lvl, inq, len) \ |
| 2433 | ASC_DBG_PRT_HEX((lvl), "INQUIRY", (uchar *) (inq), (len)); |
| 2434 | #endif /* ADVANSYS_DEBUG */ |
| 2435 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2436 | #ifdef ADVANSYS_STATS |
| 2437 | |
| 2438 | /* Per board statistics structure */ |
| 2439 | struct asc_stats { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2440 | /* Driver Entrypoint Statistics */ |
| 2441 | ADV_DCNT queuecommand; /* # calls to advansys_queuecommand() */ |
| 2442 | ADV_DCNT reset; /* # calls to advansys_eh_bus_reset() */ |
| 2443 | ADV_DCNT biosparam; /* # calls to advansys_biosparam() */ |
| 2444 | ADV_DCNT interrupt; /* # advansys_interrupt() calls */ |
| 2445 | ADV_DCNT callback; /* # calls to asc/adv_isr_callback() */ |
| 2446 | ADV_DCNT done; /* # calls to request's scsi_done function */ |
| 2447 | ADV_DCNT build_error; /* # asc/adv_build_req() ASC_ERROR returns. */ |
| 2448 | ADV_DCNT adv_build_noreq; /* # adv_build_req() adv_req_t alloc. fail. */ |
| 2449 | ADV_DCNT adv_build_nosg; /* # adv_build_req() adv_sgblk_t alloc. fail. */ |
| 2450 | /* AscExeScsiQueue()/AdvExeScsiQueue() Statistics */ |
| 2451 | ADV_DCNT exe_noerror; /* # ASC_NOERROR returns. */ |
| 2452 | ADV_DCNT exe_busy; /* # ASC_BUSY returns. */ |
| 2453 | ADV_DCNT exe_error; /* # ASC_ERROR returns. */ |
| 2454 | ADV_DCNT exe_unknown; /* # unknown returns. */ |
| 2455 | /* Data Transfer Statistics */ |
| 2456 | ADV_DCNT cont_cnt; /* # non-scatter-gather I/O requests received */ |
| 2457 | ADV_DCNT cont_xfer; /* # contiguous transfer 512-bytes */ |
| 2458 | ADV_DCNT sg_cnt; /* # scatter-gather I/O requests received */ |
| 2459 | ADV_DCNT sg_elem; /* # scatter-gather elements */ |
| 2460 | ADV_DCNT sg_xfer; /* # scatter-gather transfer 512-bytes */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2461 | }; |
| 2462 | #endif /* ADVANSYS_STATS */ |
| 2463 | |
| 2464 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2465 | * Adv Library Request Structures |
| 2466 | * |
| 2467 | * The following two structures are used to process Wide Board requests. |
| 2468 | * |
| 2469 | * The ADV_SCSI_REQ_Q structure in adv_req_t is passed to the Adv Library |
| 2470 | * and microcode with the ADV_SCSI_REQ_Q field 'srb_ptr' pointing to the |
| 2471 | * adv_req_t. The adv_req_t structure 'cmndp' field in turn points to the |
| 2472 | * Mid-Level SCSI request structure. |
| 2473 | * |
| 2474 | * Zero or more ADV_SG_BLOCK are used with each ADV_SCSI_REQ_Q. Each |
| 2475 | * ADV_SG_BLOCK structure holds 15 scatter-gather elements. Under Linux |
| 2476 | * up to 255 scatter-gather elements may be used per request or |
| 2477 | * ADV_SCSI_REQ_Q. |
| 2478 | * |
| 2479 | * Both structures must be 32 byte aligned. |
| 2480 | */ |
| 2481 | typedef struct adv_sgblk { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2482 | ADV_SG_BLOCK sg_block; /* Sgblock structure. */ |
| 2483 | uchar align[32]; /* Sgblock structure padding. */ |
| 2484 | struct adv_sgblk *next_sgblkp; /* Next scatter-gather structure. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2485 | } adv_sgblk_t; |
| 2486 | |
| 2487 | typedef struct adv_req { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2488 | ADV_SCSI_REQ_Q scsi_req_q; /* Adv Library request structure. */ |
| 2489 | uchar align[32]; /* Request structure padding. */ |
| 2490 | struct scsi_cmnd *cmndp; /* Mid-Level SCSI command pointer. */ |
| 2491 | adv_sgblk_t *sgblkp; /* Adv Library scatter-gather pointer. */ |
| 2492 | struct adv_req *next_reqp; /* Next Request Structure. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2493 | } adv_req_t; |
| 2494 | |
| 2495 | /* |
| 2496 | * Structure allocated for each board. |
| 2497 | * |
Matthew Wilcox | 8dfb537 | 2007-07-30 09:08:34 -0600 | [diff] [blame] | 2498 | * This structure is allocated by scsi_host_alloc() at the end |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2499 | * of the 'Scsi_Host' structure starting at the 'hostdata' |
| 2500 | * field. It is guaranteed to be allocated from DMA-able memory. |
| 2501 | */ |
| 2502 | typedef struct asc_board { |
Matthew Wilcox | 394dbf3 | 2007-07-26 11:56:40 -0400 | [diff] [blame] | 2503 | struct device *dev; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2504 | int id; /* Board Id */ |
| 2505 | uint flags; /* Board flags */ |
| 2506 | union { |
| 2507 | ASC_DVC_VAR asc_dvc_var; /* Narrow board */ |
| 2508 | ADV_DVC_VAR adv_dvc_var; /* Wide board */ |
| 2509 | } dvc_var; |
| 2510 | union { |
| 2511 | ASC_DVC_CFG asc_dvc_cfg; /* Narrow board */ |
| 2512 | ADV_DVC_CFG adv_dvc_cfg; /* Wide board */ |
| 2513 | } dvc_cfg; |
| 2514 | ushort asc_n_io_port; /* Number I/O ports. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2515 | ADV_SCSI_BIT_ID_TYPE init_tidmask; /* Target init./valid mask */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2516 | ushort reqcnt[ADV_MAX_TID + 1]; /* Starvation request count */ |
| 2517 | ADV_SCSI_BIT_ID_TYPE queue_full; /* Queue full mask */ |
| 2518 | ushort queue_full_cnt[ADV_MAX_TID + 1]; /* Queue full count */ |
| 2519 | union { |
| 2520 | ASCEEP_CONFIG asc_eep; /* Narrow EEPROM config. */ |
| 2521 | ADVEEP_3550_CONFIG adv_3550_eep; /* 3550 EEPROM config. */ |
| 2522 | ADVEEP_38C0800_CONFIG adv_38C0800_eep; /* 38C0800 EEPROM config. */ |
| 2523 | ADVEEP_38C1600_CONFIG adv_38C1600_eep; /* 38C1600 EEPROM config. */ |
| 2524 | } eep_config; |
| 2525 | ulong last_reset; /* Saved last reset time */ |
| 2526 | spinlock_t lock; /* Board spinlock */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2527 | /* /proc/scsi/advansys/[0...] */ |
| 2528 | char *prtbuf; /* /proc print buffer */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2529 | #ifdef ADVANSYS_STATS |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2530 | struct asc_stats asc_stats; /* Board statistics */ |
| 2531 | #endif /* ADVANSYS_STATS */ |
| 2532 | /* |
| 2533 | * The following fields are used only for Narrow Boards. |
| 2534 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2535 | uchar sdtr_data[ASC_MAX_TID + 1]; /* SDTR information */ |
| 2536 | /* |
| 2537 | * The following fields are used only for Wide Boards. |
| 2538 | */ |
| 2539 | void __iomem *ioremap_addr; /* I/O Memory remap address. */ |
| 2540 | ushort ioport; /* I/O Port address. */ |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 2541 | ADV_CARR_T *carrp; /* ADV_CARR_T memory block. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2542 | adv_req_t *orig_reqp; /* adv_req_t memory block. */ |
| 2543 | adv_req_t *adv_reqp; /* Request structures. */ |
| 2544 | adv_sgblk_t *adv_sgblkp; /* Scatter-gather structures. */ |
| 2545 | ushort bios_signature; /* BIOS Signature. */ |
| 2546 | ushort bios_version; /* BIOS Version. */ |
| 2547 | ushort bios_codeseg; /* BIOS Code Segment. */ |
| 2548 | ushort bios_codelen; /* BIOS Code Segment Length. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2549 | } asc_board_t; |
| 2550 | |
Matthew Wilcox | 13ac2d9 | 2007-07-30 08:10:23 -0600 | [diff] [blame] | 2551 | #define adv_dvc_to_board(adv_dvc) container_of(adv_dvc, struct asc_board, \ |
| 2552 | dvc_var.adv_dvc_var) |
| 2553 | #define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev) |
| 2554 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2555 | /* Number of boards detected in system. */ |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 2556 | static int asc_board_count; |
| 2557 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2558 | /* Overrun buffer used by all narrow boards. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2559 | static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2560 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2561 | #ifdef ADVANSYS_DEBUG |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2562 | static int asc_dbglvl = 3; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2563 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2564 | /* |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 2565 | * asc_prt_scsi_host() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2566 | */ |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 2567 | static void asc_prt_scsi_host(struct Scsi_Host *s) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2568 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2569 | asc_board_t *boardp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2570 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 2571 | boardp = ASC_BOARDP(s); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2572 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 2573 | printk("Scsi_Host at addr 0x%lx\n", (ulong)s); |
| 2574 | printk(" host_busy %u, host_no %d, last_reset %d,\n", |
| 2575 | s->host_busy, s->host_no, (unsigned)s->last_reset); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2576 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 2577 | printk(" base 0x%lx, io_port 0x%lx, irq 0x%x,\n", |
| 2578 | (ulong)s->base, (ulong)s->io_port, s->irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2579 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 2580 | printk(" dma_channel %d, this_id %d, can_queue %d,\n", |
| 2581 | s->dma_channel, s->this_id, s->can_queue); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2582 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 2583 | printk(" cmd_per_lun %d, sg_tablesize %d, unchecked_isa_dma %d\n", |
| 2584 | s->cmd_per_lun, s->sg_tablesize, s->unchecked_isa_dma); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2585 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2586 | if (ASC_NARROW_BOARD(boardp)) { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 2587 | asc_prt_asc_dvc_var(&ASC_BOARDP(s)->dvc_var.asc_dvc_var); |
| 2588 | asc_prt_asc_dvc_cfg(&ASC_BOARDP(s)->dvc_cfg.asc_dvc_cfg); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2589 | } else { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 2590 | asc_prt_adv_dvc_var(&ASC_BOARDP(s)->dvc_var.adv_dvc_var); |
| 2591 | asc_prt_adv_dvc_cfg(&ASC_BOARDP(s)->dvc_cfg.adv_dvc_cfg); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2592 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2593 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 2594 | |
| 2595 | /* |
| 2596 | * asc_prt_scsi_cmnd() |
| 2597 | */ |
| 2598 | static void asc_prt_scsi_cmnd(struct scsi_cmnd *s) |
| 2599 | { |
| 2600 | printk("struct scsi_cmnd at addr 0x%lx\n", (ulong)s); |
| 2601 | |
| 2602 | printk(" host 0x%lx, device 0x%lx, target %u, lun %u, channel %u,\n", |
| 2603 | (ulong)s->device->host, (ulong)s->device, s->device->id, |
| 2604 | s->device->lun, s->device->channel); |
| 2605 | |
| 2606 | asc_prt_hex(" CDB", s->cmnd, s->cmd_len); |
| 2607 | |
| 2608 | printk("sc_data_direction %u, resid %d\n", |
| 2609 | s->sc_data_direction, s->resid); |
| 2610 | |
| 2611 | printk(" use_sg %u, sglist_len %u\n", s->use_sg, s->sglist_len); |
| 2612 | |
| 2613 | printk(" serial_number 0x%x, retries %d, allowed %d\n", |
| 2614 | (unsigned)s->serial_number, s->retries, s->allowed); |
| 2615 | |
| 2616 | printk(" timeout_per_command %d\n", s->timeout_per_command); |
| 2617 | |
| 2618 | printk(" scsi_done 0x%p, done 0x%p, host_scribble 0x%p, result 0x%x\n", |
| 2619 | s->scsi_done, s->done, s->host_scribble, s->result); |
| 2620 | |
| 2621 | printk(" tag %u, pid %u\n", (unsigned)s->tag, (unsigned)s->pid); |
| 2622 | } |
| 2623 | |
| 2624 | /* |
| 2625 | * asc_prt_asc_dvc_var() |
| 2626 | */ |
| 2627 | static void asc_prt_asc_dvc_var(ASC_DVC_VAR *h) |
| 2628 | { |
| 2629 | printk("ASC_DVC_VAR at addr 0x%lx\n", (ulong)h); |
| 2630 | |
| 2631 | printk(" iop_base 0x%x, err_code 0x%x, dvc_cntl 0x%x, bug_fix_cntl " |
| 2632 | "%d,\n", h->iop_base, h->err_code, h->dvc_cntl, h->bug_fix_cntl); |
| 2633 | |
| 2634 | printk(" bus_type %d, init_sdtr 0x%x,\n", h->bus_type, |
| 2635 | (unsigned)h->init_sdtr); |
| 2636 | |
| 2637 | printk(" sdtr_done 0x%x, use_tagged_qng 0x%x, unit_not_ready 0x%x, " |
| 2638 | "chip_no 0x%x,\n", (unsigned)h->sdtr_done, |
| 2639 | (unsigned)h->use_tagged_qng, (unsigned)h->unit_not_ready, |
| 2640 | (unsigned)h->chip_no); |
| 2641 | |
| 2642 | printk(" queue_full_or_busy 0x%x, start_motor 0x%x, scsi_reset_wait " |
| 2643 | "%u,\n", (unsigned)h->queue_full_or_busy, |
| 2644 | (unsigned)h->start_motor, (unsigned)h->scsi_reset_wait); |
| 2645 | |
| 2646 | printk(" is_in_int %u, max_total_qng %u, cur_total_qng %u, " |
| 2647 | "in_critical_cnt %u,\n", (unsigned)h->is_in_int, |
| 2648 | (unsigned)h->max_total_qng, (unsigned)h->cur_total_qng, |
| 2649 | (unsigned)h->in_critical_cnt); |
| 2650 | |
| 2651 | printk(" last_q_shortage %u, init_state 0x%x, no_scam 0x%x, " |
| 2652 | "pci_fix_asyn_xfer 0x%x,\n", (unsigned)h->last_q_shortage, |
| 2653 | (unsigned)h->init_state, (unsigned)h->no_scam, |
| 2654 | (unsigned)h->pci_fix_asyn_xfer); |
| 2655 | |
| 2656 | printk(" cfg 0x%lx, irq_no 0x%x\n", (ulong)h->cfg, (unsigned)h->irq_no); |
| 2657 | } |
| 2658 | |
| 2659 | /* |
| 2660 | * asc_prt_asc_dvc_cfg() |
| 2661 | */ |
| 2662 | static void asc_prt_asc_dvc_cfg(ASC_DVC_CFG *h) |
| 2663 | { |
| 2664 | printk("ASC_DVC_CFG at addr 0x%lx\n", (ulong)h); |
| 2665 | |
| 2666 | printk(" can_tagged_qng 0x%x, cmd_qng_enabled 0x%x,\n", |
| 2667 | h->can_tagged_qng, h->cmd_qng_enabled); |
| 2668 | printk(" disc_enable 0x%x, sdtr_enable 0x%x,\n", |
| 2669 | h->disc_enable, h->sdtr_enable); |
| 2670 | |
| 2671 | printk |
| 2672 | (" chip_scsi_id %d, isa_dma_speed %d, isa_dma_channel %d, chip_version %d,\n", |
| 2673 | h->chip_scsi_id, h->isa_dma_speed, h->isa_dma_channel, |
| 2674 | h->chip_version); |
| 2675 | |
| 2676 | printk |
| 2677 | (" pci_device_id %d, lib_serial_no %u, lib_version %u, mcode_date 0x%x,\n", |
| 2678 | to_pci_dev(h->dev)->device, h->lib_serial_no, h->lib_version, |
| 2679 | h->mcode_date); |
| 2680 | |
| 2681 | printk(" mcode_version %d, overrun_buf 0x%lx\n", |
| 2682 | h->mcode_version, (ulong)h->overrun_buf); |
| 2683 | } |
| 2684 | |
| 2685 | /* |
| 2686 | * asc_prt_asc_scsi_q() |
| 2687 | */ |
| 2688 | static void asc_prt_asc_scsi_q(ASC_SCSI_Q *q) |
| 2689 | { |
| 2690 | ASC_SG_HEAD *sgp; |
| 2691 | int i; |
| 2692 | |
| 2693 | printk("ASC_SCSI_Q at addr 0x%lx\n", (ulong)q); |
| 2694 | |
| 2695 | printk |
| 2696 | (" target_ix 0x%x, target_lun %u, srb_ptr 0x%lx, tag_code 0x%x,\n", |
| 2697 | q->q2.target_ix, q->q1.target_lun, (ulong)q->q2.srb_ptr, |
| 2698 | q->q2.tag_code); |
| 2699 | |
| 2700 | printk |
| 2701 | (" data_addr 0x%lx, data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n", |
| 2702 | (ulong)le32_to_cpu(q->q1.data_addr), |
| 2703 | (ulong)le32_to_cpu(q->q1.data_cnt), |
| 2704 | (ulong)le32_to_cpu(q->q1.sense_addr), q->q1.sense_len); |
| 2705 | |
| 2706 | printk(" cdbptr 0x%lx, cdb_len %u, sg_head 0x%lx, sg_queue_cnt %u\n", |
| 2707 | (ulong)q->cdbptr, q->q2.cdb_len, |
| 2708 | (ulong)q->sg_head, q->q1.sg_queue_cnt); |
| 2709 | |
| 2710 | if (q->sg_head) { |
| 2711 | sgp = q->sg_head; |
| 2712 | printk("ASC_SG_HEAD at addr 0x%lx\n", (ulong)sgp); |
| 2713 | printk(" entry_cnt %u, queue_cnt %u\n", sgp->entry_cnt, |
| 2714 | sgp->queue_cnt); |
| 2715 | for (i = 0; i < sgp->entry_cnt; i++) { |
| 2716 | printk(" [%u]: addr 0x%lx, bytes %lu\n", |
| 2717 | i, (ulong)le32_to_cpu(sgp->sg_list[i].addr), |
| 2718 | (ulong)le32_to_cpu(sgp->sg_list[i].bytes)); |
| 2719 | } |
| 2720 | |
| 2721 | } |
| 2722 | } |
| 2723 | |
| 2724 | /* |
| 2725 | * asc_prt_asc_qdone_info() |
| 2726 | */ |
| 2727 | static void asc_prt_asc_qdone_info(ASC_QDONE_INFO *q) |
| 2728 | { |
| 2729 | printk("ASC_QDONE_INFO at addr 0x%lx\n", (ulong)q); |
| 2730 | printk(" srb_ptr 0x%lx, target_ix %u, cdb_len %u, tag_code %u,\n", |
| 2731 | (ulong)q->d2.srb_ptr, q->d2.target_ix, q->d2.cdb_len, |
| 2732 | q->d2.tag_code); |
| 2733 | printk |
| 2734 | (" done_stat 0x%x, host_stat 0x%x, scsi_stat 0x%x, scsi_msg 0x%x\n", |
| 2735 | q->d3.done_stat, q->d3.host_stat, q->d3.scsi_stat, q->d3.scsi_msg); |
| 2736 | } |
| 2737 | |
| 2738 | /* |
| 2739 | * asc_prt_adv_dvc_var() |
| 2740 | * |
| 2741 | * Display an ADV_DVC_VAR structure. |
| 2742 | */ |
| 2743 | static void asc_prt_adv_dvc_var(ADV_DVC_VAR *h) |
| 2744 | { |
| 2745 | printk(" ADV_DVC_VAR at addr 0x%lx\n", (ulong)h); |
| 2746 | |
| 2747 | printk(" iop_base 0x%lx, err_code 0x%x, ultra_able 0x%x\n", |
| 2748 | (ulong)h->iop_base, h->err_code, (unsigned)h->ultra_able); |
| 2749 | |
| 2750 | printk(" isr_callback 0x%lx, sdtr_able 0x%x, wdtr_able 0x%x\n", |
| 2751 | (ulong)h->isr_callback, (unsigned)h->sdtr_able, |
| 2752 | (unsigned)h->wdtr_able); |
| 2753 | |
| 2754 | printk(" start_motor 0x%x, scsi_reset_wait 0x%x, irq_no 0x%x,\n", |
| 2755 | (unsigned)h->start_motor, |
| 2756 | (unsigned)h->scsi_reset_wait, (unsigned)h->irq_no); |
| 2757 | |
| 2758 | printk(" max_host_qng %u, max_dvc_qng %u, carr_freelist 0x%lxn\n", |
| 2759 | (unsigned)h->max_host_qng, (unsigned)h->max_dvc_qng, |
| 2760 | (ulong)h->carr_freelist); |
| 2761 | |
| 2762 | printk(" icq_sp 0x%lx, irq_sp 0x%lx\n", |
| 2763 | (ulong)h->icq_sp, (ulong)h->irq_sp); |
| 2764 | |
| 2765 | printk(" no_scam 0x%x, tagqng_able 0x%x\n", |
| 2766 | (unsigned)h->no_scam, (unsigned)h->tagqng_able); |
| 2767 | |
| 2768 | printk(" chip_scsi_id 0x%x, cfg 0x%lx\n", |
| 2769 | (unsigned)h->chip_scsi_id, (ulong)h->cfg); |
| 2770 | } |
| 2771 | |
| 2772 | /* |
| 2773 | * asc_prt_adv_dvc_cfg() |
| 2774 | * |
| 2775 | * Display an ADV_DVC_CFG structure. |
| 2776 | */ |
| 2777 | static void asc_prt_adv_dvc_cfg(ADV_DVC_CFG *h) |
| 2778 | { |
| 2779 | printk(" ADV_DVC_CFG at addr 0x%lx\n", (ulong)h); |
| 2780 | |
| 2781 | printk(" disc_enable 0x%x, termination 0x%x\n", |
| 2782 | h->disc_enable, h->termination); |
| 2783 | |
| 2784 | printk(" chip_version 0x%x, mcode_date 0x%x\n", |
| 2785 | h->chip_version, h->mcode_date); |
| 2786 | |
| 2787 | printk(" mcode_version 0x%x, pci_device_id 0x%x, lib_version %u\n", |
| 2788 | h->mcode_version, to_pci_dev(h->dev)->device, h->lib_version); |
| 2789 | |
| 2790 | printk(" control_flag 0x%x\n", h->control_flag); |
| 2791 | } |
| 2792 | |
| 2793 | /* |
| 2794 | * asc_prt_adv_scsi_req_q() |
| 2795 | * |
| 2796 | * Display an ADV_SCSI_REQ_Q structure. |
| 2797 | */ |
| 2798 | static void asc_prt_adv_scsi_req_q(ADV_SCSI_REQ_Q *q) |
| 2799 | { |
| 2800 | int sg_blk_cnt; |
| 2801 | struct asc_sg_block *sg_ptr; |
| 2802 | |
| 2803 | printk("ADV_SCSI_REQ_Q at addr 0x%lx\n", (ulong)q); |
| 2804 | |
| 2805 | printk(" target_id %u, target_lun %u, srb_ptr 0x%lx, a_flag 0x%x\n", |
| 2806 | q->target_id, q->target_lun, (ulong)q->srb_ptr, q->a_flag); |
| 2807 | |
| 2808 | printk(" cntl 0x%x, data_addr 0x%lx, vdata_addr 0x%lx\n", |
| 2809 | q->cntl, (ulong)le32_to_cpu(q->data_addr), (ulong)q->vdata_addr); |
| 2810 | |
| 2811 | printk(" data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n", |
| 2812 | (ulong)le32_to_cpu(q->data_cnt), |
| 2813 | (ulong)le32_to_cpu(q->sense_addr), q->sense_len); |
| 2814 | |
| 2815 | printk |
| 2816 | (" cdb_len %u, done_status 0x%x, host_status 0x%x, scsi_status 0x%x\n", |
| 2817 | q->cdb_len, q->done_status, q->host_status, q->scsi_status); |
| 2818 | |
| 2819 | printk(" sg_working_ix 0x%x, target_cmd %u\n", |
| 2820 | q->sg_working_ix, q->target_cmd); |
| 2821 | |
| 2822 | printk(" scsiq_rptr 0x%lx, sg_real_addr 0x%lx, sg_list_ptr 0x%lx\n", |
| 2823 | (ulong)le32_to_cpu(q->scsiq_rptr), |
| 2824 | (ulong)le32_to_cpu(q->sg_real_addr), (ulong)q->sg_list_ptr); |
| 2825 | |
| 2826 | /* Display the request's ADV_SG_BLOCK structures. */ |
| 2827 | if (q->sg_list_ptr != NULL) { |
| 2828 | sg_blk_cnt = 0; |
| 2829 | while (1) { |
| 2830 | /* |
| 2831 | * 'sg_ptr' is a physical address. Convert it to a virtual |
| 2832 | * address by indexing 'sg_blk_cnt' into the virtual address |
| 2833 | * array 'sg_list_ptr'. |
| 2834 | * |
| 2835 | * XXX - Assumes all SG physical blocks are virtually contiguous. |
| 2836 | */ |
| 2837 | sg_ptr = |
| 2838 | &(((ADV_SG_BLOCK *)(q->sg_list_ptr))[sg_blk_cnt]); |
| 2839 | asc_prt_adv_sgblock(sg_blk_cnt, sg_ptr); |
| 2840 | if (sg_ptr->sg_ptr == 0) { |
| 2841 | break; |
| 2842 | } |
| 2843 | sg_blk_cnt++; |
| 2844 | } |
| 2845 | } |
| 2846 | } |
| 2847 | |
| 2848 | /* |
| 2849 | * asc_prt_adv_sgblock() |
| 2850 | * |
| 2851 | * Display an ADV_SG_BLOCK structure. |
| 2852 | */ |
| 2853 | static void asc_prt_adv_sgblock(int sgblockno, ADV_SG_BLOCK *b) |
| 2854 | { |
| 2855 | int i; |
| 2856 | |
| 2857 | printk(" ASC_SG_BLOCK at addr 0x%lx (sgblockno %d)\n", |
| 2858 | (ulong)b, sgblockno); |
| 2859 | printk(" sg_cnt %u, sg_ptr 0x%lx\n", |
| 2860 | b->sg_cnt, (ulong)le32_to_cpu(b->sg_ptr)); |
| 2861 | BUG_ON(b->sg_cnt > NO_OF_SG_PER_BLOCK); |
| 2862 | if (b->sg_ptr != 0) |
| 2863 | BUG_ON(b->sg_cnt != NO_OF_SG_PER_BLOCK); |
| 2864 | for (i = 0; i < b->sg_cnt; i++) { |
| 2865 | printk(" [%u]: sg_addr 0x%lx, sg_count 0x%lx\n", |
| 2866 | i, (ulong)b->sg_list[i].sg_addr, |
| 2867 | (ulong)b->sg_list[i].sg_count); |
| 2868 | } |
| 2869 | } |
| 2870 | |
| 2871 | /* |
| 2872 | * asc_prt_hex() |
| 2873 | * |
| 2874 | * Print hexadecimal output in 4 byte groupings 32 bytes |
| 2875 | * or 8 double-words per line. |
| 2876 | */ |
| 2877 | static void asc_prt_hex(char *f, uchar *s, int l) |
| 2878 | { |
| 2879 | int i; |
| 2880 | int j; |
| 2881 | int k; |
| 2882 | int m; |
| 2883 | |
| 2884 | printk("%s: (%d bytes)\n", f, l); |
| 2885 | |
| 2886 | for (i = 0; i < l; i += 32) { |
| 2887 | |
| 2888 | /* Display a maximum of 8 double-words per line. */ |
| 2889 | if ((k = (l - i) / 4) >= 8) { |
| 2890 | k = 8; |
| 2891 | m = 0; |
| 2892 | } else { |
| 2893 | m = (l - i) % 4; |
| 2894 | } |
| 2895 | |
| 2896 | for (j = 0; j < k; j++) { |
| 2897 | printk(" %2.2X%2.2X%2.2X%2.2X", |
| 2898 | (unsigned)s[i + (j * 4)], |
| 2899 | (unsigned)s[i + (j * 4) + 1], |
| 2900 | (unsigned)s[i + (j * 4) + 2], |
| 2901 | (unsigned)s[i + (j * 4) + 3]); |
| 2902 | } |
| 2903 | |
| 2904 | switch (m) { |
| 2905 | case 0: |
| 2906 | default: |
| 2907 | break; |
| 2908 | case 1: |
| 2909 | printk(" %2.2X", (unsigned)s[i + (j * 4)]); |
| 2910 | break; |
| 2911 | case 2: |
| 2912 | printk(" %2.2X%2.2X", |
| 2913 | (unsigned)s[i + (j * 4)], |
| 2914 | (unsigned)s[i + (j * 4) + 1]); |
| 2915 | break; |
| 2916 | case 3: |
| 2917 | printk(" %2.2X%2.2X%2.2X", |
| 2918 | (unsigned)s[i + (j * 4) + 1], |
| 2919 | (unsigned)s[i + (j * 4) + 2], |
| 2920 | (unsigned)s[i + (j * 4) + 3]); |
| 2921 | break; |
| 2922 | } |
| 2923 | |
| 2924 | printk("\n"); |
| 2925 | } |
| 2926 | } |
| 2927 | #endif /* ADVANSYS_DEBUG */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2928 | |
| 2929 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2930 | * advansys_info() |
| 2931 | * |
| 2932 | * Return suitable for printing on the console with the argument |
| 2933 | * adapter's configuration information. |
| 2934 | * |
| 2935 | * Note: The information line should not exceed ASC_INFO_SIZE bytes, |
| 2936 | * otherwise the static 'info' array will be overrun. |
| 2937 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2938 | static const char *advansys_info(struct Scsi_Host *shost) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2939 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2940 | static char info[ASC_INFO_SIZE]; |
| 2941 | asc_board_t *boardp; |
| 2942 | ASC_DVC_VAR *asc_dvc_varp; |
| 2943 | ADV_DVC_VAR *adv_dvc_varp; |
| 2944 | char *busname; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2945 | char *widename = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2946 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2947 | boardp = ASC_BOARDP(shost); |
| 2948 | if (ASC_NARROW_BOARD(boardp)) { |
| 2949 | asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; |
| 2950 | ASC_DBG(1, "advansys_info: begin\n"); |
| 2951 | if (asc_dvc_varp->bus_type & ASC_IS_ISA) { |
| 2952 | if ((asc_dvc_varp->bus_type & ASC_IS_ISAPNP) == |
| 2953 | ASC_IS_ISAPNP) { |
| 2954 | busname = "ISA PnP"; |
| 2955 | } else { |
| 2956 | busname = "ISA"; |
| 2957 | } |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2958 | sprintf(info, |
| 2959 | "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X, DMA 0x%X", |
| 2960 | ASC_VERSION, busname, |
| 2961 | (ulong)shost->io_port, |
Matthew Wilcox | 4a2d31c | 2007-07-26 11:55:34 -0400 | [diff] [blame] | 2962 | (ulong)shost->io_port + ASC_IOADR_GAP - 1, |
| 2963 | shost->irq, shost->dma_channel); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2964 | } else { |
| 2965 | if (asc_dvc_varp->bus_type & ASC_IS_VL) { |
| 2966 | busname = "VL"; |
| 2967 | } else if (asc_dvc_varp->bus_type & ASC_IS_EISA) { |
| 2968 | busname = "EISA"; |
| 2969 | } else if (asc_dvc_varp->bus_type & ASC_IS_PCI) { |
| 2970 | if ((asc_dvc_varp->bus_type & ASC_IS_PCI_ULTRA) |
| 2971 | == ASC_IS_PCI_ULTRA) { |
| 2972 | busname = "PCI Ultra"; |
| 2973 | } else { |
| 2974 | busname = "PCI"; |
| 2975 | } |
| 2976 | } else { |
| 2977 | busname = "?"; |
Matthew Wilcox | ecec194 | 2007-07-30 08:08:22 -0600 | [diff] [blame] | 2978 | ASC_PRINT2("advansys_info: board %d: unknown " |
| 2979 | "bus type %d\n", boardp->id, |
| 2980 | asc_dvc_varp->bus_type); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2981 | } |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2982 | sprintf(info, |
| 2983 | "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X", |
Matthew Wilcox | ecec194 | 2007-07-30 08:08:22 -0600 | [diff] [blame] | 2984 | ASC_VERSION, busname, (ulong)shost->io_port, |
Matthew Wilcox | 4a2d31c | 2007-07-26 11:55:34 -0400 | [diff] [blame] | 2985 | (ulong)shost->io_port + ASC_IOADR_GAP - 1, |
| 2986 | shost->irq); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2987 | } |
| 2988 | } else { |
| 2989 | /* |
| 2990 | * Wide Adapter Information |
| 2991 | * |
| 2992 | * Memory-mapped I/O is used instead of I/O space to access |
| 2993 | * the adapter, but display the I/O Port range. The Memory |
| 2994 | * I/O address is displayed through the driver /proc file. |
| 2995 | */ |
| 2996 | adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; |
| 2997 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 2998 | widename = "Ultra-Wide"; |
| 2999 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3000 | widename = "Ultra2-Wide"; |
| 3001 | } else { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3002 | widename = "Ultra3-Wide"; |
| 3003 | } |
| 3004 | sprintf(info, |
| 3005 | "AdvanSys SCSI %s: PCI %s: PCIMEM 0x%lX-0x%lX, IRQ 0x%X", |
| 3006 | ASC_VERSION, widename, (ulong)adv_dvc_varp->iop_base, |
Matthew Wilcox | 4a2d31c | 2007-07-26 11:55:34 -0400 | [diff] [blame] | 3007 | (ulong)adv_dvc_varp->iop_base + boardp->asc_n_io_port - 1, shost->irq); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3008 | } |
Matthew Wilcox | b009bef | 2007-09-09 08:56:38 -0600 | [diff] [blame] | 3009 | BUG_ON(strlen(info) >= ASC_INFO_SIZE); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3010 | ASC_DBG(1, "advansys_info: end\n"); |
| 3011 | return info; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3012 | } |
| 3013 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 3014 | #ifdef CONFIG_PROC_FS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3015 | /* |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 3016 | * asc_prt_line() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3017 | * |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 3018 | * If 'cp' is NULL print to the console, otherwise print to a buffer. |
| 3019 | * |
| 3020 | * Return 0 if printing to the console, otherwise return the number of |
| 3021 | * bytes written to the buffer. |
| 3022 | * |
| 3023 | * Note: If any single line is greater than ASC_PRTLINE_SIZE bytes the stack |
| 3024 | * will be corrupted. 's[]' is defined to be ASC_PRTLINE_SIZE bytes. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3025 | */ |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 3026 | static int asc_prt_line(char *buf, int buflen, char *fmt, ...) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3027 | { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 3028 | va_list args; |
| 3029 | int ret; |
| 3030 | char s[ASC_PRTLINE_SIZE]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3031 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 3032 | va_start(args, fmt); |
| 3033 | ret = vsprintf(s, fmt, args); |
| 3034 | BUG_ON(ret >= ASC_PRTLINE_SIZE); |
| 3035 | if (buf == NULL) { |
| 3036 | (void)printk(s); |
| 3037 | ret = 0; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3038 | } else { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 3039 | ret = min(buflen, ret); |
| 3040 | memcpy(buf, s, ret); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3041 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 3042 | va_end(args); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3043 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3044 | } |
| 3045 | |
| 3046 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3047 | * asc_prt_board_devices() |
| 3048 | * |
| 3049 | * Print driver information for devices attached to the board. |
| 3050 | * |
| 3051 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, |
| 3052 | * cf. asc_prt_line(). |
| 3053 | * |
| 3054 | * Return the number of characters copied into 'cp'. No more than |
| 3055 | * 'cplen' characters will be copied to 'cp'. |
| 3056 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3057 | static int asc_prt_board_devices(struct Scsi_Host *shost, char *cp, int cplen) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3058 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3059 | asc_board_t *boardp; |
| 3060 | int leftlen; |
| 3061 | int totlen; |
| 3062 | int len; |
| 3063 | int chip_scsi_id; |
| 3064 | int i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3065 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3066 | boardp = ASC_BOARDP(shost); |
| 3067 | leftlen = cplen; |
| 3068 | totlen = len = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3069 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3070 | len = asc_prt_line(cp, leftlen, |
| 3071 | "\nDevice Information for AdvanSys SCSI Host %d:\n", |
| 3072 | shost->host_no); |
| 3073 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3074 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3075 | if (ASC_NARROW_BOARD(boardp)) { |
| 3076 | chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id; |
| 3077 | } else { |
| 3078 | chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id; |
| 3079 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3080 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3081 | len = asc_prt_line(cp, leftlen, "Target IDs Detected:"); |
| 3082 | ASC_PRT_NEXT(); |
| 3083 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 3084 | if (boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) { |
| 3085 | len = asc_prt_line(cp, leftlen, " %X,", i); |
| 3086 | ASC_PRT_NEXT(); |
| 3087 | } |
| 3088 | } |
| 3089 | len = asc_prt_line(cp, leftlen, " (%X=Host Adapter)\n", chip_scsi_id); |
| 3090 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3091 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3092 | return totlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3093 | } |
| 3094 | |
| 3095 | /* |
| 3096 | * Display Wide Board BIOS Information. |
| 3097 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3098 | static int asc_prt_adv_bios(struct Scsi_Host *shost, char *cp, int cplen) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3099 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3100 | asc_board_t *boardp; |
| 3101 | int leftlen; |
| 3102 | int totlen; |
| 3103 | int len; |
| 3104 | ushort major, minor, letter; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3105 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3106 | boardp = ASC_BOARDP(shost); |
| 3107 | leftlen = cplen; |
| 3108 | totlen = len = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3109 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3110 | len = asc_prt_line(cp, leftlen, "\nROM BIOS Version: "); |
| 3111 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3112 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3113 | /* |
| 3114 | * If the BIOS saved a valid signature, then fill in |
| 3115 | * the BIOS code segment base address. |
| 3116 | */ |
| 3117 | if (boardp->bios_signature != 0x55AA) { |
| 3118 | len = asc_prt_line(cp, leftlen, "Disabled or Pre-3.1\n"); |
| 3119 | ASC_PRT_NEXT(); |
| 3120 | len = asc_prt_line(cp, leftlen, |
| 3121 | "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n"); |
| 3122 | ASC_PRT_NEXT(); |
| 3123 | len = asc_prt_line(cp, leftlen, |
| 3124 | "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n"); |
| 3125 | ASC_PRT_NEXT(); |
| 3126 | } else { |
| 3127 | major = (boardp->bios_version >> 12) & 0xF; |
| 3128 | minor = (boardp->bios_version >> 8) & 0xF; |
| 3129 | letter = (boardp->bios_version & 0xFF); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3130 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3131 | len = asc_prt_line(cp, leftlen, "%d.%d%c\n", |
| 3132 | major, minor, |
| 3133 | letter >= 26 ? '?' : letter + 'A'); |
| 3134 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3135 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3136 | /* |
| 3137 | * Current available ROM BIOS release is 3.1I for UW |
| 3138 | * and 3.2I for U2W. This code doesn't differentiate |
| 3139 | * UW and U2W boards. |
| 3140 | */ |
| 3141 | if (major < 3 || (major <= 3 && minor < 1) || |
| 3142 | (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) { |
| 3143 | len = asc_prt_line(cp, leftlen, |
| 3144 | "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n"); |
| 3145 | ASC_PRT_NEXT(); |
| 3146 | len = asc_prt_line(cp, leftlen, |
| 3147 | "ftp://ftp.connectcom.net/pub\n"); |
| 3148 | ASC_PRT_NEXT(); |
| 3149 | } |
| 3150 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3151 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3152 | return totlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3153 | } |
| 3154 | |
| 3155 | /* |
| 3156 | * Add serial number to information bar if signature AAh |
| 3157 | * is found in at bit 15-9 (7 bits) of word 1. |
| 3158 | * |
| 3159 | * Serial Number consists fo 12 alpha-numeric digits. |
| 3160 | * |
| 3161 | * 1 - Product type (A,B,C,D..) Word0: 15-13 (3 bits) |
| 3162 | * 2 - MFG Location (A,B,C,D..) Word0: 12-10 (3 bits) |
| 3163 | * 3-4 - Product ID (0-99) Word0: 9-0 (10 bits) |
| 3164 | * 5 - Product revision (A-J) Word0: " " |
| 3165 | * |
| 3166 | * Signature Word1: 15-9 (7 bits) |
| 3167 | * 6 - Year (0-9) Word1: 8-6 (3 bits) & Word2: 15 (1 bit) |
| 3168 | * 7-8 - Week of the year (1-52) Word1: 5-0 (6 bits) |
| 3169 | * |
| 3170 | * 9-12 - Serial Number (A001-Z999) Word2: 14-0 (15 bits) |
| 3171 | * |
| 3172 | * Note 1: Only production cards will have a serial number. |
| 3173 | * |
| 3174 | * Note 2: Signature is most significant 7 bits (0xFE). |
| 3175 | * |
| 3176 | * Returns ASC_TRUE if serial number found, otherwise returns ASC_FALSE. |
| 3177 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3178 | static int asc_get_eeprom_string(ushort *serialnum, uchar *cp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3179 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3180 | ushort w, num; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3181 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3182 | if ((serialnum[1] & 0xFE00) != ((ushort)0xAA << 8)) { |
| 3183 | return ASC_FALSE; |
| 3184 | } else { |
| 3185 | /* |
| 3186 | * First word - 6 digits. |
| 3187 | */ |
| 3188 | w = serialnum[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3189 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3190 | /* Product type - 1st digit. */ |
| 3191 | if ((*cp = 'A' + ((w & 0xE000) >> 13)) == 'H') { |
| 3192 | /* Product type is P=Prototype */ |
| 3193 | *cp += 0x8; |
| 3194 | } |
| 3195 | cp++; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3196 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3197 | /* Manufacturing location - 2nd digit. */ |
| 3198 | *cp++ = 'A' + ((w & 0x1C00) >> 10); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3199 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3200 | /* Product ID - 3rd, 4th digits. */ |
| 3201 | num = w & 0x3FF; |
| 3202 | *cp++ = '0' + (num / 100); |
| 3203 | num %= 100; |
| 3204 | *cp++ = '0' + (num / 10); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3205 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3206 | /* Product revision - 5th digit. */ |
| 3207 | *cp++ = 'A' + (num % 10); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3208 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3209 | /* |
| 3210 | * Second word |
| 3211 | */ |
| 3212 | w = serialnum[1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3213 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3214 | /* |
| 3215 | * Year - 6th digit. |
| 3216 | * |
| 3217 | * If bit 15 of third word is set, then the |
| 3218 | * last digit of the year is greater than 7. |
| 3219 | */ |
| 3220 | if (serialnum[2] & 0x8000) { |
| 3221 | *cp++ = '8' + ((w & 0x1C0) >> 6); |
| 3222 | } else { |
| 3223 | *cp++ = '0' + ((w & 0x1C0) >> 6); |
| 3224 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3225 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3226 | /* Week of year - 7th, 8th digits. */ |
| 3227 | num = w & 0x003F; |
| 3228 | *cp++ = '0' + num / 10; |
| 3229 | num %= 10; |
| 3230 | *cp++ = '0' + num; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3231 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3232 | /* |
| 3233 | * Third word |
| 3234 | */ |
| 3235 | w = serialnum[2] & 0x7FFF; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3236 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3237 | /* Serial number - 9th digit. */ |
| 3238 | *cp++ = 'A' + (w / 1000); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3239 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3240 | /* 10th, 11th, 12th digits. */ |
| 3241 | num = w % 1000; |
| 3242 | *cp++ = '0' + num / 100; |
| 3243 | num %= 100; |
| 3244 | *cp++ = '0' + num / 10; |
| 3245 | num %= 10; |
| 3246 | *cp++ = '0' + num; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3247 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3248 | *cp = '\0'; /* Null Terminate the string. */ |
| 3249 | return ASC_TRUE; |
| 3250 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3251 | } |
| 3252 | |
| 3253 | /* |
| 3254 | * asc_prt_asc_board_eeprom() |
| 3255 | * |
| 3256 | * Print board EEPROM configuration. |
| 3257 | * |
| 3258 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, |
| 3259 | * cf. asc_prt_line(). |
| 3260 | * |
| 3261 | * Return the number of characters copied into 'cp'. No more than |
| 3262 | * 'cplen' characters will be copied to 'cp'. |
| 3263 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3264 | static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3265 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3266 | asc_board_t *boardp; |
| 3267 | ASC_DVC_VAR *asc_dvc_varp; |
| 3268 | int leftlen; |
| 3269 | int totlen; |
| 3270 | int len; |
| 3271 | ASCEEP_CONFIG *ep; |
| 3272 | int i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3273 | #ifdef CONFIG_ISA |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3274 | int isa_dma_speed[] = { 10, 8, 7, 6, 5, 4, 3, 2 }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3275 | #endif /* CONFIG_ISA */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3276 | uchar serialstr[13]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3277 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3278 | boardp = ASC_BOARDP(shost); |
| 3279 | asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; |
| 3280 | ep = &boardp->eep_config.asc_eep; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3281 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3282 | leftlen = cplen; |
| 3283 | totlen = len = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3284 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3285 | len = asc_prt_line(cp, leftlen, |
| 3286 | "\nEEPROM Settings for AdvanSys SCSI Host %d:\n", |
| 3287 | shost->host_no); |
| 3288 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3289 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3290 | if (asc_get_eeprom_string((ushort *)&ep->adapter_info[0], serialstr) |
| 3291 | == ASC_TRUE) { |
| 3292 | len = |
| 3293 | asc_prt_line(cp, leftlen, " Serial Number: %s\n", |
| 3294 | serialstr); |
| 3295 | ASC_PRT_NEXT(); |
| 3296 | } else { |
| 3297 | if (ep->adapter_info[5] == 0xBB) { |
| 3298 | len = asc_prt_line(cp, leftlen, |
| 3299 | " Default Settings Used for EEPROM-less Adapter.\n"); |
| 3300 | ASC_PRT_NEXT(); |
| 3301 | } else { |
| 3302 | len = asc_prt_line(cp, leftlen, |
| 3303 | " Serial Number Signature Not Present.\n"); |
| 3304 | ASC_PRT_NEXT(); |
| 3305 | } |
| 3306 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3307 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3308 | len = asc_prt_line(cp, leftlen, |
| 3309 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
| 3310 | ASC_EEP_GET_CHIP_ID(ep), ep->max_total_qng, |
| 3311 | ep->max_tag_qng); |
| 3312 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3313 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3314 | len = asc_prt_line(cp, leftlen, |
| 3315 | " cntl 0x%x, no_scam 0x%x\n", ep->cntl, ep->no_scam); |
| 3316 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3317 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3318 | len = asc_prt_line(cp, leftlen, " Target ID: "); |
| 3319 | ASC_PRT_NEXT(); |
| 3320 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 3321 | len = asc_prt_line(cp, leftlen, " %d", i); |
| 3322 | ASC_PRT_NEXT(); |
| 3323 | } |
| 3324 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3325 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3326 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3327 | len = asc_prt_line(cp, leftlen, " Disconnects: "); |
| 3328 | ASC_PRT_NEXT(); |
| 3329 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 3330 | len = asc_prt_line(cp, leftlen, " %c", |
| 3331 | (ep-> |
| 3332 | disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : |
| 3333 | 'N'); |
| 3334 | ASC_PRT_NEXT(); |
| 3335 | } |
| 3336 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3337 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3338 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3339 | len = asc_prt_line(cp, leftlen, " Command Queuing: "); |
| 3340 | ASC_PRT_NEXT(); |
| 3341 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 3342 | len = asc_prt_line(cp, leftlen, " %c", |
| 3343 | (ep-> |
| 3344 | use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : |
| 3345 | 'N'); |
| 3346 | ASC_PRT_NEXT(); |
| 3347 | } |
| 3348 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3349 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3350 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3351 | len = asc_prt_line(cp, leftlen, " Start Motor: "); |
| 3352 | ASC_PRT_NEXT(); |
| 3353 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 3354 | len = asc_prt_line(cp, leftlen, " %c", |
| 3355 | (ep-> |
| 3356 | start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : |
| 3357 | 'N'); |
| 3358 | ASC_PRT_NEXT(); |
| 3359 | } |
| 3360 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3361 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3362 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3363 | len = asc_prt_line(cp, leftlen, " Synchronous Transfer:"); |
| 3364 | ASC_PRT_NEXT(); |
| 3365 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 3366 | len = asc_prt_line(cp, leftlen, " %c", |
| 3367 | (ep-> |
| 3368 | init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : |
| 3369 | 'N'); |
| 3370 | ASC_PRT_NEXT(); |
| 3371 | } |
| 3372 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3373 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3374 | |
| 3375 | #ifdef CONFIG_ISA |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3376 | if (asc_dvc_varp->bus_type & ASC_IS_ISA) { |
| 3377 | len = asc_prt_line(cp, leftlen, |
| 3378 | " Host ISA DMA speed: %d MB/S\n", |
| 3379 | isa_dma_speed[ASC_EEP_GET_DMA_SPD(ep)]); |
| 3380 | ASC_PRT_NEXT(); |
| 3381 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3382 | #endif /* CONFIG_ISA */ |
| 3383 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3384 | return totlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3385 | } |
| 3386 | |
| 3387 | /* |
| 3388 | * asc_prt_adv_board_eeprom() |
| 3389 | * |
| 3390 | * Print board EEPROM configuration. |
| 3391 | * |
| 3392 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, |
| 3393 | * cf. asc_prt_line(). |
| 3394 | * |
| 3395 | * Return the number of characters copied into 'cp'. No more than |
| 3396 | * 'cplen' characters will be copied to 'cp'. |
| 3397 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3398 | static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3399 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3400 | asc_board_t *boardp; |
| 3401 | ADV_DVC_VAR *adv_dvc_varp; |
| 3402 | int leftlen; |
| 3403 | int totlen; |
| 3404 | int len; |
| 3405 | int i; |
| 3406 | char *termstr; |
| 3407 | uchar serialstr[13]; |
| 3408 | ADVEEP_3550_CONFIG *ep_3550 = NULL; |
| 3409 | ADVEEP_38C0800_CONFIG *ep_38C0800 = NULL; |
| 3410 | ADVEEP_38C1600_CONFIG *ep_38C1600 = NULL; |
| 3411 | ushort word; |
| 3412 | ushort *wordp; |
| 3413 | ushort sdtr_speed = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3414 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3415 | boardp = ASC_BOARDP(shost); |
| 3416 | adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; |
| 3417 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 3418 | ep_3550 = &boardp->eep_config.adv_3550_eep; |
| 3419 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
| 3420 | ep_38C0800 = &boardp->eep_config.adv_38C0800_eep; |
| 3421 | } else { |
| 3422 | ep_38C1600 = &boardp->eep_config.adv_38C1600_eep; |
| 3423 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3424 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3425 | leftlen = cplen; |
| 3426 | totlen = len = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3427 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3428 | len = asc_prt_line(cp, leftlen, |
| 3429 | "\nEEPROM Settings for AdvanSys SCSI Host %d:\n", |
| 3430 | shost->host_no); |
| 3431 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3432 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3433 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 3434 | wordp = &ep_3550->serial_number_word1; |
| 3435 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
| 3436 | wordp = &ep_38C0800->serial_number_word1; |
| 3437 | } else { |
| 3438 | wordp = &ep_38C1600->serial_number_word1; |
| 3439 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3440 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3441 | if (asc_get_eeprom_string(wordp, serialstr) == ASC_TRUE) { |
| 3442 | len = |
| 3443 | asc_prt_line(cp, leftlen, " Serial Number: %s\n", |
| 3444 | serialstr); |
| 3445 | ASC_PRT_NEXT(); |
| 3446 | } else { |
| 3447 | len = asc_prt_line(cp, leftlen, |
| 3448 | " Serial Number Signature Not Present.\n"); |
| 3449 | ASC_PRT_NEXT(); |
| 3450 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3451 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3452 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 3453 | len = asc_prt_line(cp, leftlen, |
| 3454 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
| 3455 | ep_3550->adapter_scsi_id, |
| 3456 | ep_3550->max_host_qng, ep_3550->max_dvc_qng); |
| 3457 | ASC_PRT_NEXT(); |
| 3458 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
| 3459 | len = asc_prt_line(cp, leftlen, |
| 3460 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
| 3461 | ep_38C0800->adapter_scsi_id, |
| 3462 | ep_38C0800->max_host_qng, |
| 3463 | ep_38C0800->max_dvc_qng); |
| 3464 | ASC_PRT_NEXT(); |
| 3465 | } else { |
| 3466 | len = asc_prt_line(cp, leftlen, |
| 3467 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
| 3468 | ep_38C1600->adapter_scsi_id, |
| 3469 | ep_38C1600->max_host_qng, |
| 3470 | ep_38C1600->max_dvc_qng); |
| 3471 | ASC_PRT_NEXT(); |
| 3472 | } |
| 3473 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 3474 | word = ep_3550->termination; |
| 3475 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
| 3476 | word = ep_38C0800->termination_lvd; |
| 3477 | } else { |
| 3478 | word = ep_38C1600->termination_lvd; |
| 3479 | } |
| 3480 | switch (word) { |
| 3481 | case 1: |
| 3482 | termstr = "Low Off/High Off"; |
| 3483 | break; |
| 3484 | case 2: |
| 3485 | termstr = "Low Off/High On"; |
| 3486 | break; |
| 3487 | case 3: |
| 3488 | termstr = "Low On/High On"; |
| 3489 | break; |
| 3490 | default: |
| 3491 | case 0: |
| 3492 | termstr = "Automatic"; |
| 3493 | break; |
| 3494 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3495 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3496 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 3497 | len = asc_prt_line(cp, leftlen, |
| 3498 | " termination: %u (%s), bios_ctrl: 0x%x\n", |
| 3499 | ep_3550->termination, termstr, |
| 3500 | ep_3550->bios_ctrl); |
| 3501 | ASC_PRT_NEXT(); |
| 3502 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
| 3503 | len = asc_prt_line(cp, leftlen, |
| 3504 | " termination: %u (%s), bios_ctrl: 0x%x\n", |
| 3505 | ep_38C0800->termination_lvd, termstr, |
| 3506 | ep_38C0800->bios_ctrl); |
| 3507 | ASC_PRT_NEXT(); |
| 3508 | } else { |
| 3509 | len = asc_prt_line(cp, leftlen, |
| 3510 | " termination: %u (%s), bios_ctrl: 0x%x\n", |
| 3511 | ep_38C1600->termination_lvd, termstr, |
| 3512 | ep_38C1600->bios_ctrl); |
| 3513 | ASC_PRT_NEXT(); |
| 3514 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3515 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3516 | len = asc_prt_line(cp, leftlen, " Target ID: "); |
| 3517 | ASC_PRT_NEXT(); |
| 3518 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 3519 | len = asc_prt_line(cp, leftlen, " %X", i); |
| 3520 | ASC_PRT_NEXT(); |
| 3521 | } |
| 3522 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3523 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3524 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3525 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 3526 | word = ep_3550->disc_enable; |
| 3527 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
| 3528 | word = ep_38C0800->disc_enable; |
| 3529 | } else { |
| 3530 | word = ep_38C1600->disc_enable; |
| 3531 | } |
| 3532 | len = asc_prt_line(cp, leftlen, " Disconnects: "); |
| 3533 | ASC_PRT_NEXT(); |
| 3534 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 3535 | len = asc_prt_line(cp, leftlen, " %c", |
| 3536 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
| 3537 | ASC_PRT_NEXT(); |
| 3538 | } |
| 3539 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3540 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3541 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3542 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 3543 | word = ep_3550->tagqng_able; |
| 3544 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
| 3545 | word = ep_38C0800->tagqng_able; |
| 3546 | } else { |
| 3547 | word = ep_38C1600->tagqng_able; |
| 3548 | } |
| 3549 | len = asc_prt_line(cp, leftlen, " Command Queuing: "); |
| 3550 | ASC_PRT_NEXT(); |
| 3551 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 3552 | len = asc_prt_line(cp, leftlen, " %c", |
| 3553 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
| 3554 | ASC_PRT_NEXT(); |
| 3555 | } |
| 3556 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3557 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3558 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3559 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 3560 | word = ep_3550->start_motor; |
| 3561 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
| 3562 | word = ep_38C0800->start_motor; |
| 3563 | } else { |
| 3564 | word = ep_38C1600->start_motor; |
| 3565 | } |
| 3566 | len = asc_prt_line(cp, leftlen, " Start Motor: "); |
| 3567 | ASC_PRT_NEXT(); |
| 3568 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 3569 | len = asc_prt_line(cp, leftlen, " %c", |
| 3570 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
| 3571 | ASC_PRT_NEXT(); |
| 3572 | } |
| 3573 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3574 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3575 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3576 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 3577 | len = asc_prt_line(cp, leftlen, " Synchronous Transfer:"); |
| 3578 | ASC_PRT_NEXT(); |
| 3579 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 3580 | len = asc_prt_line(cp, leftlen, " %c", |
| 3581 | (ep_3550-> |
| 3582 | sdtr_able & ADV_TID_TO_TIDMASK(i)) ? |
| 3583 | 'Y' : 'N'); |
| 3584 | ASC_PRT_NEXT(); |
| 3585 | } |
| 3586 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3587 | ASC_PRT_NEXT(); |
| 3588 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3589 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3590 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 3591 | len = asc_prt_line(cp, leftlen, " Ultra Transfer: "); |
| 3592 | ASC_PRT_NEXT(); |
| 3593 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 3594 | len = asc_prt_line(cp, leftlen, " %c", |
| 3595 | (ep_3550-> |
| 3596 | ultra_able & ADV_TID_TO_TIDMASK(i)) |
| 3597 | ? 'Y' : 'N'); |
| 3598 | ASC_PRT_NEXT(); |
| 3599 | } |
| 3600 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3601 | ASC_PRT_NEXT(); |
| 3602 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3603 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3604 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 3605 | word = ep_3550->wdtr_able; |
| 3606 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
| 3607 | word = ep_38C0800->wdtr_able; |
| 3608 | } else { |
| 3609 | word = ep_38C1600->wdtr_able; |
| 3610 | } |
| 3611 | len = asc_prt_line(cp, leftlen, " Wide Transfer: "); |
| 3612 | ASC_PRT_NEXT(); |
| 3613 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 3614 | len = asc_prt_line(cp, leftlen, " %c", |
| 3615 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
| 3616 | ASC_PRT_NEXT(); |
| 3617 | } |
| 3618 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3619 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3620 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3621 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 || |
| 3622 | adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) { |
| 3623 | len = asc_prt_line(cp, leftlen, |
| 3624 | " Synchronous Transfer Speed (Mhz):\n "); |
| 3625 | ASC_PRT_NEXT(); |
| 3626 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 3627 | char *speed_str; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3628 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3629 | if (i == 0) { |
| 3630 | sdtr_speed = adv_dvc_varp->sdtr_speed1; |
| 3631 | } else if (i == 4) { |
| 3632 | sdtr_speed = adv_dvc_varp->sdtr_speed2; |
| 3633 | } else if (i == 8) { |
| 3634 | sdtr_speed = adv_dvc_varp->sdtr_speed3; |
| 3635 | } else if (i == 12) { |
| 3636 | sdtr_speed = adv_dvc_varp->sdtr_speed4; |
| 3637 | } |
| 3638 | switch (sdtr_speed & ADV_MAX_TID) { |
| 3639 | case 0: |
| 3640 | speed_str = "Off"; |
| 3641 | break; |
| 3642 | case 1: |
| 3643 | speed_str = " 5"; |
| 3644 | break; |
| 3645 | case 2: |
| 3646 | speed_str = " 10"; |
| 3647 | break; |
| 3648 | case 3: |
| 3649 | speed_str = " 20"; |
| 3650 | break; |
| 3651 | case 4: |
| 3652 | speed_str = " 40"; |
| 3653 | break; |
| 3654 | case 5: |
| 3655 | speed_str = " 80"; |
| 3656 | break; |
| 3657 | default: |
| 3658 | speed_str = "Unk"; |
| 3659 | break; |
| 3660 | } |
| 3661 | len = asc_prt_line(cp, leftlen, "%X:%s ", i, speed_str); |
| 3662 | ASC_PRT_NEXT(); |
| 3663 | if (i == 7) { |
| 3664 | len = asc_prt_line(cp, leftlen, "\n "); |
| 3665 | ASC_PRT_NEXT(); |
| 3666 | } |
| 3667 | sdtr_speed >>= 4; |
| 3668 | } |
| 3669 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3670 | ASC_PRT_NEXT(); |
| 3671 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3672 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3673 | return totlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3674 | } |
| 3675 | |
| 3676 | /* |
| 3677 | * asc_prt_driver_conf() |
| 3678 | * |
| 3679 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, |
| 3680 | * cf. asc_prt_line(). |
| 3681 | * |
| 3682 | * Return the number of characters copied into 'cp'. No more than |
| 3683 | * 'cplen' characters will be copied to 'cp'. |
| 3684 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3685 | static int asc_prt_driver_conf(struct Scsi_Host *shost, char *cp, int cplen) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3686 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3687 | asc_board_t *boardp; |
| 3688 | int leftlen; |
| 3689 | int totlen; |
| 3690 | int len; |
| 3691 | int chip_scsi_id; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3692 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3693 | boardp = ASC_BOARDP(shost); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3694 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3695 | leftlen = cplen; |
| 3696 | totlen = len = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3697 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3698 | len = asc_prt_line(cp, leftlen, |
| 3699 | "\nLinux Driver Configuration and Information for AdvanSys SCSI Host %d:\n", |
| 3700 | shost->host_no); |
| 3701 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3702 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3703 | len = asc_prt_line(cp, leftlen, |
| 3704 | " host_busy %u, last_reset %u, max_id %u, max_lun %u, max_channel %u\n", |
| 3705 | shost->host_busy, shost->last_reset, shost->max_id, |
| 3706 | shost->max_lun, shost->max_channel); |
| 3707 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3708 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3709 | len = asc_prt_line(cp, leftlen, |
| 3710 | " unique_id %d, can_queue %d, this_id %d, sg_tablesize %u, cmd_per_lun %u\n", |
| 3711 | shost->unique_id, shost->can_queue, shost->this_id, |
| 3712 | shost->sg_tablesize, shost->cmd_per_lun); |
| 3713 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3714 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3715 | len = asc_prt_line(cp, leftlen, |
| 3716 | " unchecked_isa_dma %d, use_clustering %d\n", |
| 3717 | shost->unchecked_isa_dma, shost->use_clustering); |
| 3718 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3719 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3720 | len = asc_prt_line(cp, leftlen, |
| 3721 | " flags 0x%x, last_reset 0x%x, jiffies 0x%x, asc_n_io_port 0x%x\n", |
| 3722 | boardp->flags, boardp->last_reset, jiffies, |
| 3723 | boardp->asc_n_io_port); |
| 3724 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3725 | |
Matthew Wilcox | 4a2d31c | 2007-07-26 11:55:34 -0400 | [diff] [blame] | 3726 | len = asc_prt_line(cp, leftlen, " io_port 0x%x\n", shost->io_port); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3727 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3728 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3729 | if (ASC_NARROW_BOARD(boardp)) { |
| 3730 | chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id; |
| 3731 | } else { |
| 3732 | chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id; |
| 3733 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3734 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3735 | return totlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3736 | } |
| 3737 | |
| 3738 | /* |
| 3739 | * asc_prt_asc_board_info() |
| 3740 | * |
| 3741 | * Print dynamic board configuration information. |
| 3742 | * |
| 3743 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, |
| 3744 | * cf. asc_prt_line(). |
| 3745 | * |
| 3746 | * Return the number of characters copied into 'cp'. No more than |
| 3747 | * 'cplen' characters will be copied to 'cp'. |
| 3748 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3749 | static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3750 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3751 | asc_board_t *boardp; |
| 3752 | int chip_scsi_id; |
| 3753 | int leftlen; |
| 3754 | int totlen; |
| 3755 | int len; |
| 3756 | ASC_DVC_VAR *v; |
| 3757 | ASC_DVC_CFG *c; |
| 3758 | int i; |
| 3759 | int renegotiate = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3760 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3761 | boardp = ASC_BOARDP(shost); |
| 3762 | v = &boardp->dvc_var.asc_dvc_var; |
| 3763 | c = &boardp->dvc_cfg.asc_dvc_cfg; |
| 3764 | chip_scsi_id = c->chip_scsi_id; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3765 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3766 | leftlen = cplen; |
| 3767 | totlen = len = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3768 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3769 | len = asc_prt_line(cp, leftlen, |
| 3770 | "\nAsc Library Configuration and Statistics for AdvanSys SCSI Host %d:\n", |
| 3771 | shost->host_no); |
| 3772 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3773 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3774 | len = asc_prt_line(cp, leftlen, |
| 3775 | " chip_version %u, lib_version 0x%x, lib_serial_no %u, mcode_date 0x%x\n", |
| 3776 | c->chip_version, c->lib_version, c->lib_serial_no, |
| 3777 | c->mcode_date); |
| 3778 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3779 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3780 | len = asc_prt_line(cp, leftlen, |
| 3781 | " mcode_version 0x%x, err_code %u\n", |
| 3782 | c->mcode_version, v->err_code); |
| 3783 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3784 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3785 | /* Current number of commands waiting for the host. */ |
| 3786 | len = asc_prt_line(cp, leftlen, |
| 3787 | " Total Command Pending: %d\n", v->cur_total_qng); |
| 3788 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3789 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3790 | len = asc_prt_line(cp, leftlen, " Command Queuing:"); |
| 3791 | ASC_PRT_NEXT(); |
| 3792 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 3793 | if ((chip_scsi_id == i) || |
| 3794 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 3795 | continue; |
| 3796 | } |
| 3797 | len = asc_prt_line(cp, leftlen, " %X:%c", |
| 3798 | i, |
| 3799 | (v-> |
| 3800 | use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? |
| 3801 | 'Y' : 'N'); |
| 3802 | ASC_PRT_NEXT(); |
| 3803 | } |
| 3804 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3805 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3806 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3807 | /* Current number of commands waiting for a device. */ |
| 3808 | len = asc_prt_line(cp, leftlen, " Command Queue Pending:"); |
| 3809 | ASC_PRT_NEXT(); |
| 3810 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 3811 | if ((chip_scsi_id == i) || |
| 3812 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 3813 | continue; |
| 3814 | } |
| 3815 | len = asc_prt_line(cp, leftlen, " %X:%u", i, v->cur_dvc_qng[i]); |
| 3816 | ASC_PRT_NEXT(); |
| 3817 | } |
| 3818 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3819 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3820 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3821 | /* Current limit on number of commands that can be sent to a device. */ |
| 3822 | len = asc_prt_line(cp, leftlen, " Command Queue Limit:"); |
| 3823 | ASC_PRT_NEXT(); |
| 3824 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 3825 | if ((chip_scsi_id == i) || |
| 3826 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 3827 | continue; |
| 3828 | } |
| 3829 | len = asc_prt_line(cp, leftlen, " %X:%u", i, v->max_dvc_qng[i]); |
| 3830 | ASC_PRT_NEXT(); |
| 3831 | } |
| 3832 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3833 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3834 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3835 | /* Indicate whether the device has returned queue full status. */ |
| 3836 | len = asc_prt_line(cp, leftlen, " Command Queue Full:"); |
| 3837 | ASC_PRT_NEXT(); |
| 3838 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 3839 | if ((chip_scsi_id == i) || |
| 3840 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 3841 | continue; |
| 3842 | } |
| 3843 | if (boardp->queue_full & ADV_TID_TO_TIDMASK(i)) { |
| 3844 | len = asc_prt_line(cp, leftlen, " %X:Y-%d", |
| 3845 | i, boardp->queue_full_cnt[i]); |
| 3846 | } else { |
| 3847 | len = asc_prt_line(cp, leftlen, " %X:N", i); |
| 3848 | } |
| 3849 | ASC_PRT_NEXT(); |
| 3850 | } |
| 3851 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3852 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3853 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3854 | len = asc_prt_line(cp, leftlen, " Synchronous Transfer:"); |
| 3855 | ASC_PRT_NEXT(); |
| 3856 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 3857 | if ((chip_scsi_id == i) || |
| 3858 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 3859 | continue; |
| 3860 | } |
| 3861 | len = asc_prt_line(cp, leftlen, " %X:%c", |
| 3862 | i, |
| 3863 | (v-> |
| 3864 | sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : |
| 3865 | 'N'); |
| 3866 | ASC_PRT_NEXT(); |
| 3867 | } |
| 3868 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3869 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3870 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3871 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 3872 | uchar syn_period_ix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3873 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3874 | if ((chip_scsi_id == i) || |
| 3875 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0) || |
| 3876 | ((v->init_sdtr & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 3877 | continue; |
| 3878 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3879 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3880 | len = asc_prt_line(cp, leftlen, " %X:", i); |
| 3881 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3882 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3883 | if ((boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET) == 0) { |
| 3884 | len = asc_prt_line(cp, leftlen, " Asynchronous"); |
| 3885 | ASC_PRT_NEXT(); |
| 3886 | } else { |
| 3887 | syn_period_ix = |
| 3888 | (boardp->sdtr_data[i] >> 4) & (v->max_sdtr_index - |
| 3889 | 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3890 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3891 | len = asc_prt_line(cp, leftlen, |
| 3892 | " Transfer Period Factor: %d (%d.%d Mhz),", |
| 3893 | v->sdtr_period_tbl[syn_period_ix], |
| 3894 | 250 / |
| 3895 | v->sdtr_period_tbl[syn_period_ix], |
| 3896 | ASC_TENTHS(250, |
| 3897 | v-> |
| 3898 | sdtr_period_tbl |
| 3899 | [syn_period_ix])); |
| 3900 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3901 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3902 | len = asc_prt_line(cp, leftlen, " REQ/ACK Offset: %d", |
| 3903 | boardp-> |
| 3904 | sdtr_data[i] & ASC_SYN_MAX_OFFSET); |
| 3905 | ASC_PRT_NEXT(); |
| 3906 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3907 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3908 | if ((v->sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { |
| 3909 | len = asc_prt_line(cp, leftlen, "*\n"); |
| 3910 | renegotiate = 1; |
| 3911 | } else { |
| 3912 | len = asc_prt_line(cp, leftlen, "\n"); |
| 3913 | } |
| 3914 | ASC_PRT_NEXT(); |
| 3915 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3916 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3917 | if (renegotiate) { |
| 3918 | len = asc_prt_line(cp, leftlen, |
| 3919 | " * = Re-negotiation pending before next command.\n"); |
| 3920 | ASC_PRT_NEXT(); |
| 3921 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3922 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3923 | return totlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3924 | } |
| 3925 | |
| 3926 | /* |
| 3927 | * asc_prt_adv_board_info() |
| 3928 | * |
| 3929 | * Print dynamic board configuration information. |
| 3930 | * |
| 3931 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, |
| 3932 | * cf. asc_prt_line(). |
| 3933 | * |
| 3934 | * Return the number of characters copied into 'cp'. No more than |
| 3935 | * 'cplen' characters will be copied to 'cp'. |
| 3936 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3937 | static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3938 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3939 | asc_board_t *boardp; |
| 3940 | int leftlen; |
| 3941 | int totlen; |
| 3942 | int len; |
| 3943 | int i; |
| 3944 | ADV_DVC_VAR *v; |
| 3945 | ADV_DVC_CFG *c; |
| 3946 | AdvPortAddr iop_base; |
| 3947 | ushort chip_scsi_id; |
| 3948 | ushort lramword; |
| 3949 | uchar lrambyte; |
| 3950 | ushort tagqng_able; |
| 3951 | ushort sdtr_able, wdtr_able; |
| 3952 | ushort wdtr_done, sdtr_done; |
| 3953 | ushort period = 0; |
| 3954 | int renegotiate = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3955 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3956 | boardp = ASC_BOARDP(shost); |
| 3957 | v = &boardp->dvc_var.adv_dvc_var; |
| 3958 | c = &boardp->dvc_cfg.adv_dvc_cfg; |
| 3959 | iop_base = v->iop_base; |
| 3960 | chip_scsi_id = v->chip_scsi_id; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3961 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3962 | leftlen = cplen; |
| 3963 | totlen = len = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3964 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3965 | len = asc_prt_line(cp, leftlen, |
| 3966 | "\nAdv Library Configuration and Statistics for AdvanSys SCSI Host %d:\n", |
| 3967 | shost->host_no); |
| 3968 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3969 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3970 | len = asc_prt_line(cp, leftlen, |
| 3971 | " iop_base 0x%lx, cable_detect: %X, err_code %u\n", |
| 3972 | v->iop_base, |
| 3973 | AdvReadWordRegister(iop_base, |
| 3974 | IOPW_SCSI_CFG1) & CABLE_DETECT, |
| 3975 | v->err_code); |
| 3976 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3977 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3978 | len = asc_prt_line(cp, leftlen, |
| 3979 | " chip_version %u, lib_version 0x%x, mcode_date 0x%x, mcode_version 0x%x\n", |
| 3980 | c->chip_version, c->lib_version, c->mcode_date, |
| 3981 | c->mcode_version); |
| 3982 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3983 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3984 | AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able); |
| 3985 | len = asc_prt_line(cp, leftlen, " Queuing Enabled:"); |
| 3986 | ASC_PRT_NEXT(); |
| 3987 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 3988 | if ((chip_scsi_id == i) || |
| 3989 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 3990 | continue; |
| 3991 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3992 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 3993 | len = asc_prt_line(cp, leftlen, " %X:%c", |
| 3994 | i, |
| 3995 | (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : |
| 3996 | 'N'); |
| 3997 | ASC_PRT_NEXT(); |
| 3998 | } |
| 3999 | len = asc_prt_line(cp, leftlen, "\n"); |
| 4000 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4001 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4002 | len = asc_prt_line(cp, leftlen, " Queue Limit:"); |
| 4003 | ASC_PRT_NEXT(); |
| 4004 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 4005 | if ((chip_scsi_id == i) || |
| 4006 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 4007 | continue; |
| 4008 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4009 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4010 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + i, |
| 4011 | lrambyte); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4012 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4013 | len = asc_prt_line(cp, leftlen, " %X:%d", i, lrambyte); |
| 4014 | ASC_PRT_NEXT(); |
| 4015 | } |
| 4016 | len = asc_prt_line(cp, leftlen, "\n"); |
| 4017 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4018 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4019 | len = asc_prt_line(cp, leftlen, " Command Pending:"); |
| 4020 | ASC_PRT_NEXT(); |
| 4021 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 4022 | if ((chip_scsi_id == i) || |
| 4023 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 4024 | continue; |
| 4025 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4026 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4027 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_QUEUED_CMD + i, |
| 4028 | lrambyte); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4029 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4030 | len = asc_prt_line(cp, leftlen, " %X:%d", i, lrambyte); |
| 4031 | ASC_PRT_NEXT(); |
| 4032 | } |
| 4033 | len = asc_prt_line(cp, leftlen, "\n"); |
| 4034 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4035 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4036 | AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); |
| 4037 | len = asc_prt_line(cp, leftlen, " Wide Enabled:"); |
| 4038 | ASC_PRT_NEXT(); |
| 4039 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 4040 | if ((chip_scsi_id == i) || |
| 4041 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 4042 | continue; |
| 4043 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4044 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4045 | len = asc_prt_line(cp, leftlen, " %X:%c", |
| 4046 | i, |
| 4047 | (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : |
| 4048 | 'N'); |
| 4049 | ASC_PRT_NEXT(); |
| 4050 | } |
| 4051 | len = asc_prt_line(cp, leftlen, "\n"); |
| 4052 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4053 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4054 | AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done); |
| 4055 | len = asc_prt_line(cp, leftlen, " Transfer Bit Width:"); |
| 4056 | ASC_PRT_NEXT(); |
| 4057 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 4058 | if ((chip_scsi_id == i) || |
| 4059 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 4060 | continue; |
| 4061 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4062 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4063 | AdvReadWordLram(iop_base, |
| 4064 | ASC_MC_DEVICE_HSHK_CFG_TABLE + (2 * i), |
| 4065 | lramword); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4066 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4067 | len = asc_prt_line(cp, leftlen, " %X:%d", |
| 4068 | i, (lramword & 0x8000) ? 16 : 8); |
| 4069 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4070 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4071 | if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) && |
| 4072 | (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { |
| 4073 | len = asc_prt_line(cp, leftlen, "*"); |
| 4074 | ASC_PRT_NEXT(); |
| 4075 | renegotiate = 1; |
| 4076 | } |
| 4077 | } |
| 4078 | len = asc_prt_line(cp, leftlen, "\n"); |
| 4079 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4080 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4081 | AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); |
| 4082 | len = asc_prt_line(cp, leftlen, " Synchronous Enabled:"); |
| 4083 | ASC_PRT_NEXT(); |
| 4084 | for (i = 0; i <= ADV_MAX_TID; i++) { |
| 4085 | if ((chip_scsi_id == i) || |
| 4086 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 4087 | continue; |
| 4088 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4089 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4090 | len = asc_prt_line(cp, leftlen, " %X:%c", |
| 4091 | i, |
| 4092 | (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : |
| 4093 | 'N'); |
| 4094 | ASC_PRT_NEXT(); |
| 4095 | } |
| 4096 | len = asc_prt_line(cp, leftlen, "\n"); |
| 4097 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4098 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4099 | AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done); |
| 4100 | for (i = 0; i <= ADV_MAX_TID; i++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4101 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4102 | AdvReadWordLram(iop_base, |
| 4103 | ASC_MC_DEVICE_HSHK_CFG_TABLE + (2 * i), |
| 4104 | lramword); |
| 4105 | lramword &= ~0x8000; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4106 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4107 | if ((chip_scsi_id == i) || |
| 4108 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0) || |
| 4109 | ((sdtr_able & ADV_TID_TO_TIDMASK(i)) == 0)) { |
| 4110 | continue; |
| 4111 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4112 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4113 | len = asc_prt_line(cp, leftlen, " %X:", i); |
| 4114 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4115 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4116 | if ((lramword & 0x1F) == 0) { /* Check for REQ/ACK Offset 0. */ |
| 4117 | len = asc_prt_line(cp, leftlen, " Asynchronous"); |
| 4118 | ASC_PRT_NEXT(); |
| 4119 | } else { |
| 4120 | len = |
| 4121 | asc_prt_line(cp, leftlen, |
| 4122 | " Transfer Period Factor: "); |
| 4123 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4124 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4125 | if ((lramword & 0x1F00) == 0x1100) { /* 80 Mhz */ |
| 4126 | len = |
| 4127 | asc_prt_line(cp, leftlen, "9 (80.0 Mhz),"); |
| 4128 | ASC_PRT_NEXT(); |
| 4129 | } else if ((lramword & 0x1F00) == 0x1000) { /* 40 Mhz */ |
| 4130 | len = |
| 4131 | asc_prt_line(cp, leftlen, "10 (40.0 Mhz),"); |
| 4132 | ASC_PRT_NEXT(); |
| 4133 | } else { /* 20 Mhz or below. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4134 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4135 | period = (((lramword >> 8) * 25) + 50) / 4; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4136 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4137 | if (period == 0) { /* Should never happen. */ |
| 4138 | len = |
| 4139 | asc_prt_line(cp, leftlen, |
| 4140 | "%d (? Mhz), "); |
| 4141 | ASC_PRT_NEXT(); |
| 4142 | } else { |
| 4143 | len = asc_prt_line(cp, leftlen, |
| 4144 | "%d (%d.%d Mhz),", |
| 4145 | period, 250 / period, |
| 4146 | ASC_TENTHS(250, |
| 4147 | period)); |
| 4148 | ASC_PRT_NEXT(); |
| 4149 | } |
| 4150 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4151 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4152 | len = asc_prt_line(cp, leftlen, " REQ/ACK Offset: %d", |
| 4153 | lramword & 0x1F); |
| 4154 | ASC_PRT_NEXT(); |
| 4155 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4156 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4157 | if ((sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { |
| 4158 | len = asc_prt_line(cp, leftlen, "*\n"); |
| 4159 | renegotiate = 1; |
| 4160 | } else { |
| 4161 | len = asc_prt_line(cp, leftlen, "\n"); |
| 4162 | } |
| 4163 | ASC_PRT_NEXT(); |
| 4164 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4165 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4166 | if (renegotiate) { |
| 4167 | len = asc_prt_line(cp, leftlen, |
| 4168 | " * = Re-negotiation pending before next command.\n"); |
| 4169 | ASC_PRT_NEXT(); |
| 4170 | } |
| 4171 | |
| 4172 | return totlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4173 | } |
| 4174 | |
| 4175 | /* |
| 4176 | * asc_proc_copy() |
| 4177 | * |
| 4178 | * Copy proc information to a read buffer taking into account the current |
| 4179 | * read offset in the file and the remaining space in the read buffer. |
| 4180 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4181 | static int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4182 | asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4183 | char *cp, int cplen) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4184 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4185 | int cnt = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4186 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4187 | ASC_DBG3(2, "asc_proc_copy: offset %d, advoffset %d, cplen %d\n", |
| 4188 | (unsigned)offset, (unsigned)advoffset, cplen); |
| 4189 | if (offset <= advoffset) { |
| 4190 | /* Read offset below current offset, copy everything. */ |
| 4191 | cnt = min(cplen, leftlen); |
| 4192 | ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n", |
| 4193 | (ulong)curbuf, (ulong)cp, cnt); |
| 4194 | memcpy(curbuf, cp, cnt); |
| 4195 | } else if (offset < advoffset + cplen) { |
| 4196 | /* Read offset within current range, partial copy. */ |
| 4197 | cnt = (advoffset + cplen) - offset; |
| 4198 | cp = (cp + cplen) - cnt; |
| 4199 | cnt = min(cnt, leftlen); |
| 4200 | ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n", |
| 4201 | (ulong)curbuf, (ulong)cp, cnt); |
| 4202 | memcpy(curbuf, cp, cnt); |
| 4203 | } |
| 4204 | return cnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4205 | } |
| 4206 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4207 | #ifdef ADVANSYS_STATS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4208 | /* |
| 4209 | * asc_prt_board_stats() |
| 4210 | * |
| 4211 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, |
| 4212 | * cf. asc_prt_line(). |
| 4213 | * |
| 4214 | * Return the number of characters copied into 'cp'. No more than |
| 4215 | * 'cplen' characters will be copied to 'cp'. |
| 4216 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4217 | static int asc_prt_board_stats(struct Scsi_Host *shost, char *cp, int cplen) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4218 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4219 | int leftlen; |
| 4220 | int totlen; |
| 4221 | int len; |
| 4222 | struct asc_stats *s; |
| 4223 | asc_board_t *boardp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4224 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4225 | leftlen = cplen; |
| 4226 | totlen = len = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4227 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4228 | boardp = ASC_BOARDP(shost); |
| 4229 | s = &boardp->asc_stats; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4230 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4231 | len = asc_prt_line(cp, leftlen, |
| 4232 | "\nLinux Driver Statistics for AdvanSys SCSI Host %d:\n", |
| 4233 | shost->host_no); |
| 4234 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4235 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4236 | len = asc_prt_line(cp, leftlen, |
| 4237 | " queuecommand %lu, reset %lu, biosparam %lu, interrupt %lu\n", |
| 4238 | s->queuecommand, s->reset, s->biosparam, |
| 4239 | s->interrupt); |
| 4240 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4241 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4242 | len = asc_prt_line(cp, leftlen, |
| 4243 | " callback %lu, done %lu, build_error %lu, build_noreq %lu, build_nosg %lu\n", |
| 4244 | s->callback, s->done, s->build_error, |
| 4245 | s->adv_build_noreq, s->adv_build_nosg); |
| 4246 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4247 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4248 | len = asc_prt_line(cp, leftlen, |
| 4249 | " exe_noerror %lu, exe_busy %lu, exe_error %lu, exe_unknown %lu\n", |
| 4250 | s->exe_noerror, s->exe_busy, s->exe_error, |
| 4251 | s->exe_unknown); |
| 4252 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4253 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4254 | /* |
| 4255 | * Display data transfer statistics. |
| 4256 | */ |
| 4257 | if (s->cont_cnt > 0) { |
| 4258 | len = asc_prt_line(cp, leftlen, " cont_cnt %lu, ", s->cont_cnt); |
| 4259 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4260 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4261 | len = asc_prt_line(cp, leftlen, "cont_xfer %lu.%01lu kb ", |
| 4262 | s->cont_xfer / 2, |
| 4263 | ASC_TENTHS(s->cont_xfer, 2)); |
| 4264 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4265 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4266 | /* Contiguous transfer average size */ |
| 4267 | len = asc_prt_line(cp, leftlen, "avg_xfer %lu.%01lu kb\n", |
| 4268 | (s->cont_xfer / 2) / s->cont_cnt, |
| 4269 | ASC_TENTHS((s->cont_xfer / 2), s->cont_cnt)); |
| 4270 | ASC_PRT_NEXT(); |
| 4271 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4272 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4273 | if (s->sg_cnt > 0) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4274 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4275 | len = asc_prt_line(cp, leftlen, " sg_cnt %lu, sg_elem %lu, ", |
| 4276 | s->sg_cnt, s->sg_elem); |
| 4277 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4278 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4279 | len = asc_prt_line(cp, leftlen, "sg_xfer %lu.%01lu kb\n", |
| 4280 | s->sg_xfer / 2, ASC_TENTHS(s->sg_xfer, 2)); |
| 4281 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4282 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4283 | /* Scatter gather transfer statistics */ |
| 4284 | len = asc_prt_line(cp, leftlen, " avg_num_elem %lu.%01lu, ", |
| 4285 | s->sg_elem / s->sg_cnt, |
| 4286 | ASC_TENTHS(s->sg_elem, s->sg_cnt)); |
| 4287 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4288 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4289 | len = asc_prt_line(cp, leftlen, "avg_elem_size %lu.%01lu kb, ", |
| 4290 | (s->sg_xfer / 2) / s->sg_elem, |
| 4291 | ASC_TENTHS((s->sg_xfer / 2), s->sg_elem)); |
| 4292 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4293 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4294 | len = asc_prt_line(cp, leftlen, "avg_xfer_size %lu.%01lu kb\n", |
| 4295 | (s->sg_xfer / 2) / s->sg_cnt, |
| 4296 | ASC_TENTHS((s->sg_xfer / 2), s->sg_cnt)); |
| 4297 | ASC_PRT_NEXT(); |
| 4298 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4299 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4300 | /* |
| 4301 | * Display request queuing statistics. |
| 4302 | */ |
| 4303 | len = asc_prt_line(cp, leftlen, |
| 4304 | " Active and Waiting Request Queues (Time Unit: %d HZ):\n", |
| 4305 | HZ); |
| 4306 | ASC_PRT_NEXT(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4307 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4308 | return totlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4309 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4310 | #endif /* ADVANSYS_STATS */ |
| 4311 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4312 | /* |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4313 | * advansys_proc_info() - /proc/scsi/advansys/{0,1,2,3,...} |
| 4314 | * |
| 4315 | * *buffer: I/O buffer |
| 4316 | * **start: if inout == FALSE pointer into buffer where user read should start |
| 4317 | * offset: current offset into a /proc/scsi/advansys/[0...] file |
| 4318 | * length: length of buffer |
| 4319 | * hostno: Scsi_Host host_no |
| 4320 | * inout: TRUE - user is writing; FALSE - user is reading |
| 4321 | * |
| 4322 | * Return the number of bytes read from or written to a |
| 4323 | * /proc/scsi/advansys/[0...] file. |
| 4324 | * |
| 4325 | * Note: This function uses the per board buffer 'prtbuf' which is |
| 4326 | * allocated when the board is initialized in advansys_detect(). The |
| 4327 | * buffer is ASC_PRTBUF_SIZE bytes. The function asc_proc_copy() is |
| 4328 | * used to write to the buffer. The way asc_proc_copy() is written |
| 4329 | * if 'prtbuf' is too small it will not be overwritten. Instead the |
| 4330 | * user just won't get all the available statistics. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4331 | */ |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4332 | static int |
| 4333 | advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, |
| 4334 | off_t offset, int length, int inout) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4335 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4336 | asc_board_t *boardp; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4337 | char *cp; |
| 4338 | int cplen; |
| 4339 | int cnt; |
| 4340 | int totcnt; |
| 4341 | int leftlen; |
| 4342 | char *curbuf; |
| 4343 | off_t advoffset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4344 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4345 | ASC_DBG(1, "advansys_proc_info: begin\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4346 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4347 | /* |
| 4348 | * User write not supported. |
| 4349 | */ |
| 4350 | if (inout == TRUE) { |
| 4351 | return (-ENOSYS); |
| 4352 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4353 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4354 | /* |
| 4355 | * User read of /proc/scsi/advansys/[0...] file. |
| 4356 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4357 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4358 | boardp = ASC_BOARDP(shost); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4359 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4360 | /* Copy read data starting at the beginning of the buffer. */ |
| 4361 | *start = buffer; |
| 4362 | curbuf = buffer; |
| 4363 | advoffset = 0; |
| 4364 | totcnt = 0; |
| 4365 | leftlen = length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4366 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4367 | /* |
| 4368 | * Get board configuration information. |
| 4369 | * |
| 4370 | * advansys_info() returns the board string from its own static buffer. |
| 4371 | */ |
| 4372 | cp = (char *)advansys_info(shost); |
| 4373 | strcat(cp, "\n"); |
| 4374 | cplen = strlen(cp); |
| 4375 | /* Copy board information. */ |
| 4376 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); |
| 4377 | totcnt += cnt; |
| 4378 | leftlen -= cnt; |
| 4379 | if (leftlen == 0) { |
| 4380 | ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); |
| 4381 | return totcnt; |
| 4382 | } |
| 4383 | advoffset += cplen; |
| 4384 | curbuf += cnt; |
| 4385 | |
| 4386 | /* |
| 4387 | * Display Wide Board BIOS Information. |
| 4388 | */ |
| 4389 | if (ASC_WIDE_BOARD(boardp)) { |
| 4390 | cp = boardp->prtbuf; |
| 4391 | cplen = asc_prt_adv_bios(shost, cp, ASC_PRTBUF_SIZE); |
| 4392 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); |
| 4393 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, |
| 4394 | cplen); |
| 4395 | totcnt += cnt; |
| 4396 | leftlen -= cnt; |
| 4397 | if (leftlen == 0) { |
| 4398 | ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); |
| 4399 | return totcnt; |
| 4400 | } |
| 4401 | advoffset += cplen; |
| 4402 | curbuf += cnt; |
| 4403 | } |
| 4404 | |
| 4405 | /* |
| 4406 | * Display driver information for each device attached to the board. |
| 4407 | */ |
| 4408 | cp = boardp->prtbuf; |
| 4409 | cplen = asc_prt_board_devices(shost, cp, ASC_PRTBUF_SIZE); |
| 4410 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); |
| 4411 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); |
| 4412 | totcnt += cnt; |
| 4413 | leftlen -= cnt; |
| 4414 | if (leftlen == 0) { |
| 4415 | ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); |
| 4416 | return totcnt; |
| 4417 | } |
| 4418 | advoffset += cplen; |
| 4419 | curbuf += cnt; |
| 4420 | |
| 4421 | /* |
| 4422 | * Display EEPROM configuration for the board. |
| 4423 | */ |
| 4424 | cp = boardp->prtbuf; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4425 | if (ASC_NARROW_BOARD(boardp)) { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4426 | cplen = asc_prt_asc_board_eeprom(shost, cp, ASC_PRTBUF_SIZE); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4427 | } else { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4428 | cplen = asc_prt_adv_board_eeprom(shost, cp, ASC_PRTBUF_SIZE); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4429 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4430 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); |
| 4431 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); |
| 4432 | totcnt += cnt; |
| 4433 | leftlen -= cnt; |
| 4434 | if (leftlen == 0) { |
| 4435 | ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); |
| 4436 | return totcnt; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4437 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4438 | advoffset += cplen; |
| 4439 | curbuf += cnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4440 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4441 | /* |
| 4442 | * Display driver configuration and information for the board. |
| 4443 | */ |
| 4444 | cp = boardp->prtbuf; |
| 4445 | cplen = asc_prt_driver_conf(shost, cp, ASC_PRTBUF_SIZE); |
| 4446 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); |
| 4447 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); |
| 4448 | totcnt += cnt; |
| 4449 | leftlen -= cnt; |
| 4450 | if (leftlen == 0) { |
| 4451 | ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); |
| 4452 | return totcnt; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4453 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4454 | advoffset += cplen; |
| 4455 | curbuf += cnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4456 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4457 | #ifdef ADVANSYS_STATS |
| 4458 | /* |
| 4459 | * Display driver statistics for the board. |
| 4460 | */ |
| 4461 | cp = boardp->prtbuf; |
| 4462 | cplen = asc_prt_board_stats(shost, cp, ASC_PRTBUF_SIZE); |
| 4463 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); |
| 4464 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); |
| 4465 | totcnt += cnt; |
| 4466 | leftlen -= cnt; |
| 4467 | if (leftlen == 0) { |
| 4468 | ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); |
| 4469 | return totcnt; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4470 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4471 | advoffset += cplen; |
| 4472 | curbuf += cnt; |
| 4473 | #endif /* ADVANSYS_STATS */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4474 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4475 | /* |
| 4476 | * Display Asc Library dynamic configuration information |
| 4477 | * for the board. |
| 4478 | */ |
| 4479 | cp = boardp->prtbuf; |
| 4480 | if (ASC_NARROW_BOARD(boardp)) { |
| 4481 | cplen = asc_prt_asc_board_info(shost, cp, ASC_PRTBUF_SIZE); |
| 4482 | } else { |
| 4483 | cplen = asc_prt_adv_board_info(shost, cp, ASC_PRTBUF_SIZE); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4484 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4485 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); |
| 4486 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); |
| 4487 | totcnt += cnt; |
| 4488 | leftlen -= cnt; |
| 4489 | if (leftlen == 0) { |
| 4490 | ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); |
| 4491 | return totcnt; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4492 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4493 | advoffset += cplen; |
| 4494 | curbuf += cnt; |
| 4495 | |
| 4496 | ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); |
| 4497 | |
| 4498 | return totcnt; |
| 4499 | } |
| 4500 | #endif /* CONFIG_PROC_FS */ |
| 4501 | |
| 4502 | static void asc_scsi_done(struct scsi_cmnd *scp) |
| 4503 | { |
| 4504 | struct asc_board *boardp = ASC_BOARDP(scp->device->host); |
| 4505 | |
| 4506 | if (scp->use_sg) |
| 4507 | dma_unmap_sg(boardp->dev, |
| 4508 | (struct scatterlist *)scp->request_buffer, |
| 4509 | scp->use_sg, scp->sc_data_direction); |
| 4510 | else if (scp->request_bufflen) |
| 4511 | dma_unmap_single(boardp->dev, scp->SCp.dma_handle, |
| 4512 | scp->request_bufflen, scp->sc_data_direction); |
| 4513 | |
| 4514 | ASC_STATS(scp->device->host, done); |
| 4515 | |
| 4516 | scp->scsi_done(scp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4517 | } |
| 4518 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4519 | static void AscSetBank(PortAddr iop_base, uchar bank) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4520 | { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4521 | uchar val; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4522 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4523 | val = AscGetChipControl(iop_base) & |
| 4524 | (~ |
| 4525 | (CC_SINGLE_STEP | CC_TEST | CC_DIAG | CC_SCSI_RESET | |
| 4526 | CC_CHIP_RESET)); |
| 4527 | if (bank == 1) { |
| 4528 | val |= CC_BANK_ONE; |
| 4529 | } else if (bank == 2) { |
| 4530 | val |= CC_DIAG | CC_BANK_ONE; |
| 4531 | } else { |
| 4532 | val &= ~CC_BANK_ONE; |
| 4533 | } |
| 4534 | AscSetChipControl(iop_base, val); |
| 4535 | return; |
| 4536 | } |
| 4537 | |
| 4538 | static void AscSetChipIH(PortAddr iop_base, ushort ins_code) |
| 4539 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4540 | AscSetBank(iop_base, 1); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4541 | AscWriteChipIH(iop_base, ins_code); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4542 | AscSetBank(iop_base, 0); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4543 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4544 | } |
| 4545 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4546 | static int AscStartChip(PortAddr iop_base) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4547 | { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4548 | AscSetChipControl(iop_base, 0); |
| 4549 | if ((AscGetChipStatus(iop_base) & CSW_HALTED) != 0) { |
| 4550 | return (0); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4551 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 4552 | return (1); |
| 4553 | } |
| 4554 | |
| 4555 | static int AscStopChip(PortAddr iop_base) |
| 4556 | { |
| 4557 | uchar cc_val; |
| 4558 | |
| 4559 | cc_val = |
| 4560 | AscGetChipControl(iop_base) & |
| 4561 | (~(CC_SINGLE_STEP | CC_TEST | CC_DIAG)); |
| 4562 | AscSetChipControl(iop_base, (uchar)(cc_val | CC_HALT)); |
| 4563 | AscSetChipIH(iop_base, INS_HALT); |
| 4564 | AscSetChipIH(iop_base, INS_RFLAG_WTM); |
| 4565 | if ((AscGetChipStatus(iop_base) & CSW_HALTED) == 0) { |
| 4566 | return (0); |
| 4567 | } |
| 4568 | return (1); |
| 4569 | } |
| 4570 | |
| 4571 | static int AscIsChipHalted(PortAddr iop_base) |
| 4572 | { |
| 4573 | if ((AscGetChipStatus(iop_base) & CSW_HALTED) != 0) { |
| 4574 | if ((AscGetChipControl(iop_base) & CC_HALT) != 0) { |
| 4575 | return (1); |
| 4576 | } |
| 4577 | } |
| 4578 | return (0); |
| 4579 | } |
| 4580 | |
| 4581 | static int AscResetChipAndScsiBus(ASC_DVC_VAR *asc_dvc) |
| 4582 | { |
| 4583 | PortAddr iop_base; |
| 4584 | int i = 10; |
| 4585 | |
| 4586 | iop_base = asc_dvc->iop_base; |
| 4587 | while ((AscGetChipStatus(iop_base) & CSW_SCSI_RESET_ACTIVE) |
| 4588 | && (i-- > 0)) { |
| 4589 | mdelay(100); |
| 4590 | } |
| 4591 | AscStopChip(iop_base); |
| 4592 | AscSetChipControl(iop_base, CC_CHIP_RESET | CC_SCSI_RESET | CC_HALT); |
| 4593 | udelay(60); |
| 4594 | AscSetChipIH(iop_base, INS_RFLAG_WTM); |
| 4595 | AscSetChipIH(iop_base, INS_HALT); |
| 4596 | AscSetChipControl(iop_base, CC_CHIP_RESET | CC_HALT); |
| 4597 | AscSetChipControl(iop_base, CC_HALT); |
| 4598 | mdelay(200); |
| 4599 | AscSetChipStatus(iop_base, CIW_CLR_SCSI_RESET_INT); |
| 4600 | AscSetChipStatus(iop_base, 0); |
| 4601 | return (AscIsChipHalted(iop_base)); |
| 4602 | } |
| 4603 | |
| 4604 | static int AscFindSignature(PortAddr iop_base) |
| 4605 | { |
| 4606 | ushort sig_word; |
| 4607 | |
| 4608 | ASC_DBG2(1, "AscFindSignature: AscGetChipSignatureByte(0x%x) 0x%x\n", |
| 4609 | iop_base, AscGetChipSignatureByte(iop_base)); |
| 4610 | if (AscGetChipSignatureByte(iop_base) == (uchar)ASC_1000_ID1B) { |
| 4611 | ASC_DBG2(1, |
| 4612 | "AscFindSignature: AscGetChipSignatureWord(0x%x) 0x%x\n", |
| 4613 | iop_base, AscGetChipSignatureWord(iop_base)); |
| 4614 | sig_word = AscGetChipSignatureWord(iop_base); |
| 4615 | if ((sig_word == (ushort)ASC_1000_ID0W) || |
| 4616 | (sig_word == (ushort)ASC_1000_ID0W_FIX)) { |
| 4617 | return (1); |
| 4618 | } |
| 4619 | } |
| 4620 | return (0); |
| 4621 | } |
| 4622 | |
| 4623 | static void AscEnableInterrupt(PortAddr iop_base) |
| 4624 | { |
| 4625 | ushort cfg; |
| 4626 | |
| 4627 | cfg = AscGetChipCfgLsw(iop_base); |
| 4628 | AscSetChipCfgLsw(iop_base, cfg | ASC_CFG0_HOST_INT_ON); |
| 4629 | return; |
| 4630 | } |
| 4631 | |
| 4632 | static void AscDisableInterrupt(PortAddr iop_base) |
| 4633 | { |
| 4634 | ushort cfg; |
| 4635 | |
| 4636 | cfg = AscGetChipCfgLsw(iop_base); |
| 4637 | AscSetChipCfgLsw(iop_base, cfg & (~ASC_CFG0_HOST_INT_ON)); |
| 4638 | return; |
| 4639 | } |
| 4640 | |
| 4641 | static uchar AscReadLramByte(PortAddr iop_base, ushort addr) |
| 4642 | { |
| 4643 | unsigned char byte_data; |
| 4644 | unsigned short word_data; |
| 4645 | |
| 4646 | if (isodd_word(addr)) { |
| 4647 | AscSetChipLramAddr(iop_base, addr - 1); |
| 4648 | word_data = AscGetChipLramData(iop_base); |
| 4649 | byte_data = (word_data >> 8) & 0xFF; |
| 4650 | } else { |
| 4651 | AscSetChipLramAddr(iop_base, addr); |
| 4652 | word_data = AscGetChipLramData(iop_base); |
| 4653 | byte_data = word_data & 0xFF; |
| 4654 | } |
| 4655 | return byte_data; |
| 4656 | } |
| 4657 | |
| 4658 | static ushort AscReadLramWord(PortAddr iop_base, ushort addr) |
| 4659 | { |
| 4660 | ushort word_data; |
| 4661 | |
| 4662 | AscSetChipLramAddr(iop_base, addr); |
| 4663 | word_data = AscGetChipLramData(iop_base); |
| 4664 | return (word_data); |
| 4665 | } |
| 4666 | |
| 4667 | #if CC_VERY_LONG_SG_LIST |
| 4668 | static ASC_DCNT AscReadLramDWord(PortAddr iop_base, ushort addr) |
| 4669 | { |
| 4670 | ushort val_low, val_high; |
| 4671 | ASC_DCNT dword_data; |
| 4672 | |
| 4673 | AscSetChipLramAddr(iop_base, addr); |
| 4674 | val_low = AscGetChipLramData(iop_base); |
| 4675 | val_high = AscGetChipLramData(iop_base); |
| 4676 | dword_data = ((ASC_DCNT) val_high << 16) | (ASC_DCNT) val_low; |
| 4677 | return (dword_data); |
| 4678 | } |
| 4679 | #endif /* CC_VERY_LONG_SG_LIST */ |
| 4680 | |
| 4681 | static void |
| 4682 | AscMemWordSetLram(PortAddr iop_base, ushort s_addr, ushort set_wval, int words) |
| 4683 | { |
| 4684 | int i; |
| 4685 | |
| 4686 | AscSetChipLramAddr(iop_base, s_addr); |
| 4687 | for (i = 0; i < words; i++) { |
| 4688 | AscSetChipLramData(iop_base, set_wval); |
| 4689 | } |
| 4690 | } |
| 4691 | |
| 4692 | static void AscWriteLramWord(PortAddr iop_base, ushort addr, ushort word_val) |
| 4693 | { |
| 4694 | AscSetChipLramAddr(iop_base, addr); |
| 4695 | AscSetChipLramData(iop_base, word_val); |
| 4696 | return; |
| 4697 | } |
| 4698 | |
| 4699 | static void AscWriteLramByte(PortAddr iop_base, ushort addr, uchar byte_val) |
| 4700 | { |
| 4701 | ushort word_data; |
| 4702 | |
| 4703 | if (isodd_word(addr)) { |
| 4704 | addr--; |
| 4705 | word_data = AscReadLramWord(iop_base, addr); |
| 4706 | word_data &= 0x00FF; |
| 4707 | word_data |= (((ushort)byte_val << 8) & 0xFF00); |
| 4708 | } else { |
| 4709 | word_data = AscReadLramWord(iop_base, addr); |
| 4710 | word_data &= 0xFF00; |
| 4711 | word_data |= ((ushort)byte_val & 0x00FF); |
| 4712 | } |
| 4713 | AscWriteLramWord(iop_base, addr, word_data); |
| 4714 | return; |
| 4715 | } |
| 4716 | |
| 4717 | /* |
| 4718 | * Copy 2 bytes to LRAM. |
| 4719 | * |
| 4720 | * The source data is assumed to be in little-endian order in memory |
| 4721 | * and is maintained in little-endian order when written to LRAM. |
| 4722 | */ |
| 4723 | static void |
| 4724 | AscMemWordCopyPtrToLram(PortAddr iop_base, |
| 4725 | ushort s_addr, uchar *s_buffer, int words) |
| 4726 | { |
| 4727 | int i; |
| 4728 | |
| 4729 | AscSetChipLramAddr(iop_base, s_addr); |
| 4730 | for (i = 0; i < 2 * words; i += 2) { |
| 4731 | /* |
| 4732 | * On a little-endian system the second argument below |
| 4733 | * produces a little-endian ushort which is written to |
| 4734 | * LRAM in little-endian order. On a big-endian system |
| 4735 | * the second argument produces a big-endian ushort which |
| 4736 | * is "transparently" byte-swapped by outpw() and written |
| 4737 | * in little-endian order to LRAM. |
| 4738 | */ |
| 4739 | outpw(iop_base + IOP_RAM_DATA, |
| 4740 | ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]); |
| 4741 | } |
| 4742 | return; |
| 4743 | } |
| 4744 | |
| 4745 | /* |
| 4746 | * Copy 4 bytes to LRAM. |
| 4747 | * |
| 4748 | * The source data is assumed to be in little-endian order in memory |
| 4749 | * and is maintained in little-endian order when writen to LRAM. |
| 4750 | */ |
| 4751 | static void |
| 4752 | AscMemDWordCopyPtrToLram(PortAddr iop_base, |
| 4753 | ushort s_addr, uchar *s_buffer, int dwords) |
| 4754 | { |
| 4755 | int i; |
| 4756 | |
| 4757 | AscSetChipLramAddr(iop_base, s_addr); |
| 4758 | for (i = 0; i < 4 * dwords; i += 4) { |
| 4759 | outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]); /* LSW */ |
| 4760 | outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 3] << 8) | s_buffer[i + 2]); /* MSW */ |
| 4761 | } |
| 4762 | return; |
| 4763 | } |
| 4764 | |
| 4765 | /* |
| 4766 | * Copy 2 bytes from LRAM. |
| 4767 | * |
| 4768 | * The source data is assumed to be in little-endian order in LRAM |
| 4769 | * and is maintained in little-endian order when written to memory. |
| 4770 | */ |
| 4771 | static void |
| 4772 | AscMemWordCopyPtrFromLram(PortAddr iop_base, |
| 4773 | ushort s_addr, uchar *d_buffer, int words) |
| 4774 | { |
| 4775 | int i; |
| 4776 | ushort word; |
| 4777 | |
| 4778 | AscSetChipLramAddr(iop_base, s_addr); |
| 4779 | for (i = 0; i < 2 * words; i += 2) { |
| 4780 | word = inpw(iop_base + IOP_RAM_DATA); |
| 4781 | d_buffer[i] = word & 0xff; |
| 4782 | d_buffer[i + 1] = (word >> 8) & 0xff; |
| 4783 | } |
| 4784 | return; |
| 4785 | } |
| 4786 | |
| 4787 | static ASC_DCNT AscMemSumLramWord(PortAddr iop_base, ushort s_addr, int words) |
| 4788 | { |
| 4789 | ASC_DCNT sum; |
| 4790 | int i; |
| 4791 | |
| 4792 | sum = 0L; |
| 4793 | for (i = 0; i < words; i++, s_addr += 2) { |
| 4794 | sum += AscReadLramWord(iop_base, s_addr); |
| 4795 | } |
| 4796 | return (sum); |
| 4797 | } |
| 4798 | |
| 4799 | static ushort AscInitLram(ASC_DVC_VAR *asc_dvc) |
| 4800 | { |
| 4801 | uchar i; |
| 4802 | ushort s_addr; |
| 4803 | PortAddr iop_base; |
| 4804 | ushort warn_code; |
| 4805 | |
| 4806 | iop_base = asc_dvc->iop_base; |
| 4807 | warn_code = 0; |
| 4808 | AscMemWordSetLram(iop_base, ASC_QADR_BEG, 0, |
| 4809 | (ushort)(((int)(asc_dvc->max_total_qng + 2 + 1) * |
| 4810 | 64) >> 1)); |
| 4811 | i = ASC_MIN_ACTIVE_QNO; |
| 4812 | s_addr = ASC_QADR_BEG + ASC_QBLK_SIZE; |
| 4813 | AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_FWD), |
| 4814 | (uchar)(i + 1)); |
| 4815 | AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_BWD), |
| 4816 | (uchar)(asc_dvc->max_total_qng)); |
| 4817 | AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_QNO), |
| 4818 | (uchar)i); |
| 4819 | i++; |
| 4820 | s_addr += ASC_QBLK_SIZE; |
| 4821 | for (; i < asc_dvc->max_total_qng; i++, s_addr += ASC_QBLK_SIZE) { |
| 4822 | AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_FWD), |
| 4823 | (uchar)(i + 1)); |
| 4824 | AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_BWD), |
| 4825 | (uchar)(i - 1)); |
| 4826 | AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_QNO), |
| 4827 | (uchar)i); |
| 4828 | } |
| 4829 | AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_FWD), |
| 4830 | (uchar)ASC_QLINK_END); |
| 4831 | AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_BWD), |
| 4832 | (uchar)(asc_dvc->max_total_qng - 1)); |
| 4833 | AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_QNO), |
| 4834 | (uchar)asc_dvc->max_total_qng); |
| 4835 | i++; |
| 4836 | s_addr += ASC_QBLK_SIZE; |
| 4837 | for (; i <= (uchar)(asc_dvc->max_total_qng + 3); |
| 4838 | i++, s_addr += ASC_QBLK_SIZE) { |
| 4839 | AscWriteLramByte(iop_base, |
| 4840 | (ushort)(s_addr + (ushort)ASC_SCSIQ_B_FWD), i); |
| 4841 | AscWriteLramByte(iop_base, |
| 4842 | (ushort)(s_addr + (ushort)ASC_SCSIQ_B_BWD), i); |
| 4843 | AscWriteLramByte(iop_base, |
| 4844 | (ushort)(s_addr + (ushort)ASC_SCSIQ_B_QNO), i); |
| 4845 | } |
| 4846 | return warn_code; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4847 | } |
| 4848 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4849 | static ASC_DCNT |
| 4850 | AscLoadMicroCode(PortAddr iop_base, |
| 4851 | ushort s_addr, uchar *mcode_buf, ushort mcode_size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4852 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4853 | ASC_DCNT chksum; |
| 4854 | ushort mcode_word_size; |
| 4855 | ushort mcode_chksum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4856 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4857 | /* Write the microcode buffer starting at LRAM address 0. */ |
| 4858 | mcode_word_size = (ushort)(mcode_size >> 1); |
| 4859 | AscMemWordSetLram(iop_base, s_addr, 0, mcode_word_size); |
| 4860 | AscMemWordCopyPtrToLram(iop_base, s_addr, mcode_buf, mcode_word_size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4861 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4862 | chksum = AscMemSumLramWord(iop_base, s_addr, mcode_word_size); |
| 4863 | ASC_DBG1(1, "AscLoadMicroCode: chksum 0x%lx\n", (ulong)chksum); |
| 4864 | mcode_chksum = (ushort)AscMemSumLramWord(iop_base, |
| 4865 | (ushort)ASC_CODE_SEC_BEG, |
| 4866 | (ushort)((mcode_size - |
| 4867 | s_addr - (ushort) |
| 4868 | ASC_CODE_SEC_BEG) / |
| 4869 | 2)); |
| 4870 | ASC_DBG1(1, "AscLoadMicroCode: mcode_chksum 0x%lx\n", |
| 4871 | (ulong)mcode_chksum); |
| 4872 | AscWriteLramWord(iop_base, ASCV_MCODE_CHKSUM_W, mcode_chksum); |
| 4873 | AscWriteLramWord(iop_base, ASCV_MCODE_SIZE_W, mcode_size); |
| 4874 | return (chksum); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4875 | } |
| 4876 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4877 | /* Microcode buffer is kept after initialization for error recovery. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4878 | static uchar _asc_mcode_buf[] = { |
| 4879 | 0x01, 0x03, 0x01, 0x19, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4880 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4881 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4882 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4883 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 4884 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x12, 0x0D, 0x05, |
| 4885 | 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 4886 | 0xFF, 0x80, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4887 | 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0xFF, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4888 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 4889 | 0x00, 0x00, 0xE4, 0x88, 0x00, 0x00, 0x00, 0x00, 0x80, 0x73, 0x48, 0x04, |
| 4890 | 0x36, 0x00, 0x00, 0xA2, 0xC2, 0x00, 0x80, 0x73, 0x03, 0x23, 0x36, 0x40, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4891 | 0xB6, 0x00, 0x36, 0x00, 0x05, 0xD6, 0x0C, 0xD2, 0x12, 0xDA, 0x00, 0xA2, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4892 | 0xC2, 0x00, 0x92, 0x80, 0x1E, 0x98, 0x50, 0x00, 0xF5, 0x00, 0x48, 0x98, |
| 4893 | 0xDF, 0x23, 0x36, 0x60, 0xB6, 0x00, 0x92, 0x80, 0x4F, 0x00, 0xF5, 0x00, |
| 4894 | 0x48, 0x98, 0xEF, 0x23, 0x36, 0x60, 0xB6, 0x00, 0x92, 0x80, 0x80, 0x62, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4895 | 0x92, 0x80, 0x00, 0x46, 0x15, 0xEE, 0x13, 0xEA, 0x02, 0x01, 0x09, 0xD8, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4896 | 0xCD, 0x04, 0x4D, 0x00, 0x00, 0xA3, 0xD6, 0x00, 0xA6, 0x97, 0x7F, 0x23, |
| 4897 | 0x04, 0x61, 0x84, 0x01, 0xE6, 0x84, 0xD2, 0xC1, 0x80, 0x73, 0xCD, 0x04, |
| 4898 | 0x4D, 0x00, 0x00, 0xA3, 0xDA, 0x01, 0xA6, 0x97, 0xC6, 0x81, 0xC2, 0x88, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4899 | 0x80, 0x73, 0x80, 0x77, 0x00, 0x01, 0x01, 0xA1, 0xFE, 0x00, 0x4F, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4900 | 0x84, 0x97, 0x07, 0xA6, 0x08, 0x01, 0x00, 0x33, 0x03, 0x00, 0xC2, 0x88, |
| 4901 | 0x03, 0x03, 0x01, 0xDE, 0xC2, 0x88, 0xCE, 0x00, 0x69, 0x60, 0xCE, 0x00, |
| 4902 | 0x02, 0x03, 0x4A, 0x60, 0x00, 0xA2, 0x78, 0x01, 0x80, 0x63, 0x07, 0xA6, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4903 | 0x24, 0x01, 0x78, 0x81, 0x03, 0x03, 0x80, 0x63, 0xE2, 0x00, 0x07, 0xA6, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4904 | 0x34, 0x01, 0x00, 0x33, 0x04, 0x00, 0xC2, 0x88, 0x03, 0x07, 0x02, 0x01, |
| 4905 | 0x04, 0xCA, 0x0D, 0x23, 0x68, 0x98, 0x4D, 0x04, 0x04, 0x85, 0x05, 0xD8, |
| 4906 | 0x0D, 0x23, 0x68, 0x98, 0xCD, 0x04, 0x15, 0x23, 0xF8, 0x88, 0xFB, 0x23, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4907 | 0x02, 0x61, 0x82, 0x01, 0x80, 0x63, 0x02, 0x03, 0x06, 0xA3, 0x62, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4908 | 0x00, 0x33, 0x0A, 0x00, 0xC2, 0x88, 0x4E, 0x00, 0x07, 0xA3, 0x6E, 0x01, |
| 4909 | 0x00, 0x33, 0x0B, 0x00, 0xC2, 0x88, 0xCD, 0x04, 0x36, 0x2D, 0x00, 0x33, |
| 4910 | 0x1A, 0x00, 0xC2, 0x88, 0x50, 0x04, 0x88, 0x81, 0x06, 0xAB, 0x82, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4911 | 0x88, 0x81, 0x4E, 0x00, 0x07, 0xA3, 0x92, 0x01, 0x50, 0x00, 0x00, 0xA3, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4912 | 0x3C, 0x01, 0x00, 0x05, 0x7C, 0x81, 0x46, 0x97, 0x02, 0x01, 0x05, 0xC6, |
| 4913 | 0x04, 0x23, 0xA0, 0x01, 0x15, 0x23, 0xA1, 0x01, 0xBE, 0x81, 0xFD, 0x23, |
| 4914 | 0x02, 0x61, 0x82, 0x01, 0x0A, 0xDA, 0x4A, 0x00, 0x06, 0x61, 0x00, 0xA0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4915 | 0xB4, 0x01, 0x80, 0x63, 0xCD, 0x04, 0x36, 0x2D, 0x00, 0x33, 0x1B, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4916 | 0xC2, 0x88, 0x06, 0x23, 0x68, 0x98, 0xCD, 0x04, 0xE6, 0x84, 0x06, 0x01, |
| 4917 | 0x00, 0xA2, 0xD4, 0x01, 0x57, 0x60, 0x00, 0xA0, 0xDA, 0x01, 0xE6, 0x84, |
| 4918 | 0x80, 0x23, 0xA0, 0x01, 0xE6, 0x84, 0x80, 0x73, 0x4B, 0x00, 0x06, 0x61, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4919 | 0x00, 0xA2, 0x00, 0x02, 0x04, 0x01, 0x0C, 0xDE, 0x02, 0x01, 0x03, 0xCC, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4920 | 0x4F, 0x00, 0x84, 0x97, 0xFC, 0x81, 0x08, 0x23, 0x02, 0x41, 0x82, 0x01, |
| 4921 | 0x4F, 0x00, 0x62, 0x97, 0x48, 0x04, 0x84, 0x80, 0xF0, 0x97, 0x00, 0x46, |
| 4922 | 0x56, 0x00, 0x03, 0xC0, 0x01, 0x23, 0xE8, 0x00, 0x81, 0x73, 0x06, 0x29, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4923 | 0x03, 0x42, 0x06, 0xE2, 0x03, 0xEE, 0x6B, 0xEB, 0x11, 0x23, 0xF8, 0x88, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4924 | 0x04, 0x98, 0xF0, 0x80, 0x80, 0x73, 0x80, 0x77, 0x07, 0xA4, 0x2A, 0x02, |
| 4925 | 0x7C, 0x95, 0x06, 0xA6, 0x34, 0x02, 0x03, 0xA6, 0x4C, 0x04, 0x46, 0x82, |
| 4926 | 0x04, 0x01, 0x03, 0xD8, 0xB4, 0x98, 0x6A, 0x96, 0x46, 0x82, 0xFE, 0x95, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4927 | 0x80, 0x67, 0x83, 0x03, 0x80, 0x63, 0xB6, 0x2D, 0x02, 0xA6, 0x6C, 0x02, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4928 | 0x07, 0xA6, 0x5A, 0x02, 0x06, 0xA6, 0x5E, 0x02, 0x03, 0xA6, 0x62, 0x02, |
| 4929 | 0xC2, 0x88, 0x7C, 0x95, 0x48, 0x82, 0x60, 0x96, 0x48, 0x82, 0x04, 0x23, |
| 4930 | 0xA0, 0x01, 0x14, 0x23, 0xA1, 0x01, 0x3C, 0x84, 0x04, 0x01, 0x0C, 0xDC, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4931 | 0xE0, 0x23, 0x25, 0x61, 0xEF, 0x00, 0x14, 0x01, 0x4F, 0x04, 0xA8, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4932 | 0x6F, 0x00, 0xA5, 0x01, 0x03, 0x23, 0xA4, 0x01, 0x06, 0x23, 0x9C, 0x01, |
| 4933 | 0x24, 0x2B, 0x1C, 0x01, 0x02, 0xA6, 0xAA, 0x02, 0x07, 0xA6, 0x5A, 0x02, |
| 4934 | 0x06, 0xA6, 0x5E, 0x02, 0x03, 0xA6, 0x20, 0x04, 0x01, 0xA6, 0xB4, 0x02, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4935 | 0x00, 0xA6, 0xB4, 0x02, 0x00, 0x33, 0x12, 0x00, 0xC2, 0x88, 0x00, 0x0E, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4936 | 0x80, 0x63, 0x00, 0x43, 0x00, 0xA0, 0x8C, 0x02, 0x4D, 0x04, 0x04, 0x01, |
| 4937 | 0x0B, 0xDC, 0xE7, 0x23, 0x04, 0x61, 0x84, 0x01, 0x10, 0x31, 0x12, 0x35, |
| 4938 | 0x14, 0x01, 0xEC, 0x00, 0x6C, 0x38, 0x00, 0x3F, 0x00, 0x00, 0xEA, 0x82, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4939 | 0x18, 0x23, 0x04, 0x61, 0x18, 0xA0, 0xE2, 0x02, 0x04, 0x01, 0xA2, 0xC8, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4940 | 0x00, 0x33, 0x1F, 0x00, 0xC2, 0x88, 0x08, 0x31, 0x0A, 0x35, 0x0C, 0x39, |
| 4941 | 0x0E, 0x3D, 0x7E, 0x98, 0xB6, 0x2D, 0x01, 0xA6, 0x14, 0x03, 0x00, 0xA6, |
| 4942 | 0x14, 0x03, 0x07, 0xA6, 0x0C, 0x03, 0x06, 0xA6, 0x10, 0x03, 0x03, 0xA6, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4943 | 0x20, 0x04, 0x02, 0xA6, 0x6C, 0x02, 0x00, 0x33, 0x33, 0x00, 0xC2, 0x88, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4944 | 0x7C, 0x95, 0xEE, 0x82, 0x60, 0x96, 0xEE, 0x82, 0x82, 0x98, 0x80, 0x42, |
| 4945 | 0x7E, 0x98, 0x64, 0xE4, 0x04, 0x01, 0x2D, 0xC8, 0x31, 0x05, 0x07, 0x01, |
| 4946 | 0x00, 0xA2, 0x54, 0x03, 0x00, 0x43, 0x87, 0x01, 0x05, 0x05, 0x86, 0x98, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4947 | 0x7E, 0x98, 0x00, 0xA6, 0x16, 0x03, 0x07, 0xA6, 0x4C, 0x03, 0x03, 0xA6, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4948 | 0x3C, 0x04, 0x06, 0xA6, 0x50, 0x03, 0x01, 0xA6, 0x16, 0x03, 0x00, 0x33, |
| 4949 | 0x25, 0x00, 0xC2, 0x88, 0x7C, 0x95, 0x32, 0x83, 0x60, 0x96, 0x32, 0x83, |
| 4950 | 0x04, 0x01, 0x10, 0xCE, 0x07, 0xC8, 0x05, 0x05, 0xEB, 0x04, 0x00, 0x33, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4951 | 0x00, 0x20, 0xC0, 0x20, 0x81, 0x62, 0x72, 0x83, 0x00, 0x01, 0x05, 0x05, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4952 | 0xFF, 0xA2, 0x7A, 0x03, 0xB1, 0x01, 0x08, 0x23, 0xB2, 0x01, 0x2E, 0x83, |
| 4953 | 0x05, 0x05, 0x15, 0x01, 0x00, 0xA2, 0x9A, 0x03, 0xEC, 0x00, 0x6E, 0x00, |
| 4954 | 0x95, 0x01, 0x6C, 0x38, 0x00, 0x3F, 0x00, 0x00, 0x01, 0xA6, 0x96, 0x03, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4955 | 0x00, 0xA6, 0x96, 0x03, 0x10, 0x84, 0x80, 0x42, 0x7E, 0x98, 0x01, 0xA6, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4956 | 0xA4, 0x03, 0x00, 0xA6, 0xBC, 0x03, 0x10, 0x84, 0xA8, 0x98, 0x80, 0x42, |
| 4957 | 0x01, 0xA6, 0xA4, 0x03, 0x07, 0xA6, 0xB2, 0x03, 0xD4, 0x83, 0x7C, 0x95, |
| 4958 | 0xA8, 0x83, 0x00, 0x33, 0x2F, 0x00, 0xC2, 0x88, 0xA8, 0x98, 0x80, 0x42, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4959 | 0x00, 0xA6, 0xBC, 0x03, 0x07, 0xA6, 0xCA, 0x03, 0xD4, 0x83, 0x7C, 0x95, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4960 | 0xC0, 0x83, 0x00, 0x33, 0x26, 0x00, 0xC2, 0x88, 0x38, 0x2B, 0x80, 0x32, |
| 4961 | 0x80, 0x36, 0x04, 0x23, 0xA0, 0x01, 0x12, 0x23, 0xA1, 0x01, 0x10, 0x84, |
| 4962 | 0x07, 0xF0, 0x06, 0xA4, 0xF4, 0x03, 0x80, 0x6B, 0x80, 0x67, 0x05, 0x23, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4963 | 0x83, 0x03, 0x80, 0x63, 0x03, 0xA6, 0x0E, 0x04, 0x07, 0xA6, 0x06, 0x04, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4964 | 0x06, 0xA6, 0x0A, 0x04, 0x00, 0x33, 0x17, 0x00, 0xC2, 0x88, 0x7C, 0x95, |
| 4965 | 0xF4, 0x83, 0x60, 0x96, 0xF4, 0x83, 0x20, 0x84, 0x07, 0xF0, 0x06, 0xA4, |
| 4966 | 0x20, 0x04, 0x80, 0x6B, 0x80, 0x67, 0x05, 0x23, 0x83, 0x03, 0x80, 0x63, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4967 | 0xB6, 0x2D, 0x03, 0xA6, 0x3C, 0x04, 0x07, 0xA6, 0x34, 0x04, 0x06, 0xA6, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4968 | 0x38, 0x04, 0x00, 0x33, 0x30, 0x00, 0xC2, 0x88, 0x7C, 0x95, 0x20, 0x84, |
| 4969 | 0x60, 0x96, 0x20, 0x84, 0x1D, 0x01, 0x06, 0xCC, 0x00, 0x33, 0x00, 0x84, |
| 4970 | 0xC0, 0x20, 0x00, 0x23, 0xEA, 0x00, 0x81, 0x62, 0xA2, 0x0D, 0x80, 0x63, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4971 | 0x07, 0xA6, 0x5A, 0x04, 0x00, 0x33, 0x18, 0x00, 0xC2, 0x88, 0x03, 0x03, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4972 | 0x80, 0x63, 0xA3, 0x01, 0x07, 0xA4, 0x64, 0x04, 0x23, 0x01, 0x00, 0xA2, |
| 4973 | 0x86, 0x04, 0x0A, 0xA0, 0x76, 0x04, 0xE0, 0x00, 0x00, 0x33, 0x1D, 0x00, |
| 4974 | 0xC2, 0x88, 0x0B, 0xA0, 0x82, 0x04, 0xE0, 0x00, 0x00, 0x33, 0x1E, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4975 | 0xC2, 0x88, 0x42, 0x23, 0xF8, 0x88, 0x00, 0x23, 0x22, 0xA3, 0xE6, 0x04, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4976 | 0x08, 0x23, 0x22, 0xA3, 0xA2, 0x04, 0x28, 0x23, 0x22, 0xA3, 0xAE, 0x04, |
| 4977 | 0x02, 0x23, 0x22, 0xA3, 0xC4, 0x04, 0x42, 0x23, 0xF8, 0x88, 0x4A, 0x00, |
| 4978 | 0x06, 0x61, 0x00, 0xA0, 0xAE, 0x04, 0x45, 0x23, 0xF8, 0x88, 0x04, 0x98, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4979 | 0x00, 0xA2, 0xC0, 0x04, 0xB4, 0x98, 0x00, 0x33, 0x00, 0x82, 0xC0, 0x20, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4980 | 0x81, 0x62, 0xE8, 0x81, 0x47, 0x23, 0xF8, 0x88, 0x04, 0x01, 0x0B, 0xDE, |
| 4981 | 0x04, 0x98, 0xB4, 0x98, 0x00, 0x33, 0x00, 0x81, 0xC0, 0x20, 0x81, 0x62, |
| 4982 | 0x14, 0x01, 0x00, 0xA0, 0x00, 0x02, 0x43, 0x23, 0xF8, 0x88, 0x04, 0x23, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4983 | 0xA0, 0x01, 0x44, 0x23, 0xA1, 0x01, 0x80, 0x73, 0x4D, 0x00, 0x03, 0xA3, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4984 | 0xF4, 0x04, 0x00, 0x33, 0x27, 0x00, 0xC2, 0x88, 0x04, 0x01, 0x04, 0xDC, |
| 4985 | 0x02, 0x23, 0xA2, 0x01, 0x04, 0x23, 0xA0, 0x01, 0x04, 0x98, 0x26, 0x95, |
| 4986 | 0x4B, 0x00, 0xF6, 0x00, 0x4F, 0x04, 0x4F, 0x00, 0x00, 0xA3, 0x22, 0x05, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4987 | 0x00, 0x05, 0x76, 0x00, 0x06, 0x61, 0x00, 0xA2, 0x1C, 0x05, 0x0A, 0x85, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4988 | 0x46, 0x97, 0xCD, 0x04, 0x24, 0x85, 0x48, 0x04, 0x84, 0x80, 0x02, 0x01, |
| 4989 | 0x03, 0xDA, 0x80, 0x23, 0x82, 0x01, 0x34, 0x85, 0x02, 0x23, 0xA0, 0x01, |
| 4990 | 0x4A, 0x00, 0x06, 0x61, 0x00, 0xA2, 0x40, 0x05, 0x1D, 0x01, 0x04, 0xD6, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4991 | 0xFF, 0x23, 0x86, 0x41, 0x4B, 0x60, 0xCB, 0x00, 0xFF, 0x23, 0x80, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4992 | 0x49, 0x00, 0x81, 0x01, 0x04, 0x01, 0x02, 0xC8, 0x30, 0x01, 0x80, 0x01, |
| 4993 | 0xF7, 0x04, 0x03, 0x01, 0x49, 0x04, 0x80, 0x01, 0xC9, 0x00, 0x00, 0x05, |
| 4994 | 0x00, 0x01, 0xFF, 0xA0, 0x60, 0x05, 0x77, 0x04, 0x01, 0x23, 0xEA, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4995 | 0x5D, 0x00, 0xFE, 0xC7, 0x00, 0x62, 0x00, 0x23, 0xEA, 0x00, 0x00, 0x63, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 4996 | 0x07, 0xA4, 0xF8, 0x05, 0x03, 0x03, 0x02, 0xA0, 0x8E, 0x05, 0xF4, 0x85, |
| 4997 | 0x00, 0x33, 0x2D, 0x00, 0xC2, 0x88, 0x04, 0xA0, 0xB8, 0x05, 0x80, 0x63, |
| 4998 | 0x00, 0x23, 0xDF, 0x00, 0x4A, 0x00, 0x06, 0x61, 0x00, 0xA2, 0xA4, 0x05, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 4999 | 0x1D, 0x01, 0x06, 0xD6, 0x02, 0x23, 0x02, 0x41, 0x82, 0x01, 0x50, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5000 | 0x62, 0x97, 0x04, 0x85, 0x04, 0x23, 0x02, 0x41, 0x82, 0x01, 0x04, 0x85, |
| 5001 | 0x08, 0xA0, 0xBE, 0x05, 0xF4, 0x85, 0x03, 0xA0, 0xC4, 0x05, 0xF4, 0x85, |
| 5002 | 0x01, 0xA0, 0xCE, 0x05, 0x88, 0x00, 0x80, 0x63, 0xCC, 0x86, 0x07, 0xA0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5003 | 0xEE, 0x05, 0x5F, 0x00, 0x00, 0x2B, 0xDF, 0x08, 0x00, 0xA2, 0xE6, 0x05, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5004 | 0x80, 0x67, 0x80, 0x63, 0x01, 0xA2, 0x7A, 0x06, 0x7C, 0x85, 0x06, 0x23, |
| 5005 | 0x68, 0x98, 0x48, 0x23, 0xF8, 0x88, 0x07, 0x23, 0x80, 0x00, 0x06, 0x87, |
| 5006 | 0x80, 0x63, 0x7C, 0x85, 0x00, 0x23, 0xDF, 0x00, 0x00, 0x63, 0x4A, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5007 | 0x06, 0x61, 0x00, 0xA2, 0x36, 0x06, 0x1D, 0x01, 0x16, 0xD4, 0xC0, 0x23, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5008 | 0x07, 0x41, 0x83, 0x03, 0x80, 0x63, 0x06, 0xA6, 0x1C, 0x06, 0x00, 0x33, |
| 5009 | 0x37, 0x00, 0xC2, 0x88, 0x1D, 0x01, 0x01, 0xD6, 0x20, 0x23, 0x63, 0x60, |
| 5010 | 0x83, 0x03, 0x80, 0x63, 0x02, 0x23, 0xDF, 0x00, 0x07, 0xA6, 0x7C, 0x05, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5011 | 0xEF, 0x04, 0x6F, 0x00, 0x00, 0x63, 0x4B, 0x00, 0x06, 0x41, 0xCB, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5012 | 0x52, 0x00, 0x06, 0x61, 0x00, 0xA2, 0x4E, 0x06, 0x1D, 0x01, 0x03, 0xCA, |
| 5013 | 0xC0, 0x23, 0x07, 0x41, 0x00, 0x63, 0x1D, 0x01, 0x04, 0xCC, 0x00, 0x33, |
| 5014 | 0x00, 0x83, 0xC0, 0x20, 0x81, 0x62, 0x80, 0x23, 0x07, 0x41, 0x00, 0x63, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5015 | 0x80, 0x67, 0x08, 0x23, 0x83, 0x03, 0x80, 0x63, 0x00, 0x63, 0x01, 0x23, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5016 | 0xDF, 0x00, 0x06, 0xA6, 0x84, 0x06, 0x07, 0xA6, 0x7C, 0x05, 0x80, 0x67, |
| 5017 | 0x80, 0x63, 0x00, 0x33, 0x00, 0x40, 0xC0, 0x20, 0x81, 0x62, 0x00, 0x63, |
| 5018 | 0x00, 0x00, 0xFE, 0x95, 0x83, 0x03, 0x80, 0x63, 0x06, 0xA6, 0x94, 0x06, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5019 | 0x07, 0xA6, 0x7C, 0x05, 0x00, 0x00, 0x01, 0xA0, 0x14, 0x07, 0x00, 0x2B, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5020 | 0x40, 0x0E, 0x80, 0x63, 0x01, 0x00, 0x06, 0xA6, 0xAA, 0x06, 0x07, 0xA6, |
| 5021 | 0x7C, 0x05, 0x40, 0x0E, 0x80, 0x63, 0x00, 0x43, 0x00, 0xA0, 0xA2, 0x06, |
| 5022 | 0x06, 0xA6, 0xBC, 0x06, 0x07, 0xA6, 0x7C, 0x05, 0x80, 0x67, 0x40, 0x0E, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5023 | 0x80, 0x63, 0x07, 0xA6, 0x7C, 0x05, 0x00, 0x23, 0xDF, 0x00, 0x00, 0x63, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5024 | 0x07, 0xA6, 0xD6, 0x06, 0x00, 0x33, 0x2A, 0x00, 0xC2, 0x88, 0x03, 0x03, |
| 5025 | 0x80, 0x63, 0x89, 0x00, 0x0A, 0x2B, 0x07, 0xA6, 0xE8, 0x06, 0x00, 0x33, |
| 5026 | 0x29, 0x00, 0xC2, 0x88, 0x00, 0x43, 0x00, 0xA2, 0xF4, 0x06, 0xC0, 0x0E, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5027 | 0x80, 0x63, 0xDE, 0x86, 0xC0, 0x0E, 0x00, 0x33, 0x00, 0x80, 0xC0, 0x20, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5028 | 0x81, 0x62, 0x04, 0x01, 0x02, 0xDA, 0x80, 0x63, 0x7C, 0x85, 0x80, 0x7B, |
| 5029 | 0x80, 0x63, 0x06, 0xA6, 0x8C, 0x06, 0x00, 0x33, 0x2C, 0x00, 0xC2, 0x88, |
| 5030 | 0x0C, 0xA2, 0x2E, 0x07, 0xFE, 0x95, 0x83, 0x03, 0x80, 0x63, 0x06, 0xA6, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5031 | 0x2C, 0x07, 0x07, 0xA6, 0x7C, 0x05, 0x00, 0x33, 0x3D, 0x00, 0xC2, 0x88, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5032 | 0x00, 0x00, 0x80, 0x67, 0x83, 0x03, 0x80, 0x63, 0x0C, 0xA0, 0x44, 0x07, |
| 5033 | 0x07, 0xA6, 0x7C, 0x05, 0xBF, 0x23, 0x04, 0x61, 0x84, 0x01, 0xE6, 0x84, |
| 5034 | 0x00, 0x63, 0xF0, 0x04, 0x01, 0x01, 0xF1, 0x00, 0x00, 0x01, 0xF2, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5035 | 0x01, 0x05, 0x80, 0x01, 0x72, 0x04, 0x71, 0x00, 0x81, 0x01, 0x70, 0x04, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5036 | 0x80, 0x05, 0x81, 0x05, 0x00, 0x63, 0xF0, 0x04, 0xF2, 0x00, 0x72, 0x04, |
| 5037 | 0x01, 0x01, 0xF1, 0x00, 0x70, 0x00, 0x81, 0x01, 0x70, 0x04, 0x71, 0x00, |
| 5038 | 0x81, 0x01, 0x72, 0x00, 0x80, 0x01, 0x71, 0x04, 0x70, 0x00, 0x80, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5039 | 0x70, 0x04, 0x00, 0x63, 0xF0, 0x04, 0xF2, 0x00, 0x72, 0x04, 0x00, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5040 | 0xF1, 0x00, 0x70, 0x00, 0x80, 0x01, 0x70, 0x04, 0x71, 0x00, 0x80, 0x01, |
| 5041 | 0x72, 0x00, 0x81, 0x01, 0x71, 0x04, 0x70, 0x00, 0x81, 0x01, 0x70, 0x04, |
| 5042 | 0x00, 0x63, 0x00, 0x23, 0xB3, 0x01, 0x83, 0x05, 0xA3, 0x01, 0xA2, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5043 | 0xA1, 0x01, 0x01, 0x23, 0xA0, 0x01, 0x00, 0x01, 0xC8, 0x00, 0x03, 0xA1, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5044 | 0xC4, 0x07, 0x00, 0x33, 0x07, 0x00, 0xC2, 0x88, 0x80, 0x05, 0x81, 0x05, |
| 5045 | 0x04, 0x01, 0x11, 0xC8, 0x48, 0x00, 0xB0, 0x01, 0xB1, 0x01, 0x08, 0x23, |
| 5046 | 0xB2, 0x01, 0x05, 0x01, 0x48, 0x04, 0x00, 0x43, 0x00, 0xA2, 0xE4, 0x07, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5047 | 0x00, 0x05, 0xDA, 0x87, 0x00, 0x01, 0xC8, 0x00, 0xFF, 0x23, 0x80, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5048 | 0x05, 0x05, 0x00, 0x63, 0xF7, 0x04, 0x1A, 0x09, 0xF6, 0x08, 0x6E, 0x04, |
| 5049 | 0x00, 0x02, 0x80, 0x43, 0x76, 0x08, 0x80, 0x02, 0x77, 0x04, 0x00, 0x63, |
| 5050 | 0xF7, 0x04, 0x1A, 0x09, 0xF6, 0x08, 0x6E, 0x04, 0x00, 0x02, 0x00, 0xA0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5051 | 0x14, 0x08, 0x16, 0x88, 0x00, 0x43, 0x76, 0x08, 0x80, 0x02, 0x77, 0x04, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5052 | 0x00, 0x63, 0xF3, 0x04, 0x00, 0x23, 0xF4, 0x00, 0x74, 0x00, 0x80, 0x43, |
| 5053 | 0xF4, 0x00, 0xCF, 0x40, 0x00, 0xA2, 0x44, 0x08, 0x74, 0x04, 0x02, 0x01, |
| 5054 | 0xF7, 0xC9, 0xF6, 0xD9, 0x00, 0x01, 0x01, 0xA1, 0x24, 0x08, 0x04, 0x98, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5055 | 0x26, 0x95, 0x24, 0x88, 0x73, 0x04, 0x00, 0x63, 0xF3, 0x04, 0x75, 0x04, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5056 | 0x5A, 0x88, 0x02, 0x01, 0x04, 0xD8, 0x46, 0x97, 0x04, 0x98, 0x26, 0x95, |
| 5057 | 0x4A, 0x88, 0x75, 0x00, 0x00, 0xA3, 0x64, 0x08, 0x00, 0x05, 0x4E, 0x88, |
| 5058 | 0x73, 0x04, 0x00, 0x63, 0x80, 0x7B, 0x80, 0x63, 0x06, 0xA6, 0x76, 0x08, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5059 | 0x00, 0x33, 0x3E, 0x00, 0xC2, 0x88, 0x80, 0x67, 0x83, 0x03, 0x80, 0x63, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5060 | 0x00, 0x63, 0x38, 0x2B, 0x9C, 0x88, 0x38, 0x2B, 0x92, 0x88, 0x32, 0x09, |
| 5061 | 0x31, 0x05, 0x92, 0x98, 0x05, 0x05, 0xB2, 0x09, 0x00, 0x63, 0x00, 0x32, |
| 5062 | 0x00, 0x36, 0x00, 0x3A, 0x00, 0x3E, 0x00, 0x63, 0x80, 0x32, 0x80, 0x36, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5063 | 0x80, 0x3A, 0x80, 0x3E, 0xB4, 0x3D, 0x00, 0x63, 0x38, 0x2B, 0x40, 0x32, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5064 | 0x40, 0x36, 0x40, 0x3A, 0x40, 0x3E, 0x00, 0x63, 0x5A, 0x20, 0xC9, 0x40, |
| 5065 | 0x00, 0xA0, 0xB4, 0x08, 0x5D, 0x00, 0xFE, 0xC3, 0x00, 0x63, 0x80, 0x73, |
| 5066 | 0xE6, 0x20, 0x02, 0x23, 0xE8, 0x00, 0x82, 0x73, 0xFF, 0xFD, 0x80, 0x73, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5067 | 0x13, 0x23, 0xF8, 0x88, 0x66, 0x20, 0xC0, 0x20, 0x04, 0x23, 0xA0, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5068 | 0xA1, 0x23, 0xA1, 0x01, 0x81, 0x62, 0xE2, 0x88, 0x80, 0x73, 0x80, 0x77, |
| 5069 | 0x68, 0x00, 0x00, 0xA2, 0x80, 0x00, 0x03, 0xC2, 0xF1, 0xC7, 0x41, 0x23, |
| 5070 | 0xF8, 0x88, 0x11, 0x23, 0xA1, 0x01, 0x04, 0x23, 0xA0, 0x01, 0xE6, 0x84, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5071 | }; |
| 5072 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 5073 | static unsigned short _asc_mcode_size = sizeof(_asc_mcode_buf); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5074 | static ADV_DCNT _asc_mcode_chksum = 0x012C453FUL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5075 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5076 | /* Microcode buffer is kept after initialization for error recovery. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5077 | static unsigned char _adv_asc3550_buf[] = { |
| 5078 | 0x00, 0x00, 0x00, 0xf2, 0x00, 0xf0, 0x00, 0x16, 0x18, 0xe4, 0x00, 0xfc, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5079 | 0x01, 0x00, 0x48, 0xe4, 0xbe, 0x18, 0x18, 0x80, 0x03, 0xf6, 0x02, 0x00, |
| 5080 | 0x00, 0xfa, 0xff, 0xff, 0x28, 0x0e, 0x9e, 0xe7, 0xff, 0x00, 0x82, 0xe7, |
| 5081 | 0x00, 0xea, 0x00, 0xf6, 0x01, 0xe6, 0x09, 0xe7, 0x55, 0xf0, 0x01, 0xf6, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5082 | 0x01, 0xfa, 0x08, 0x00, 0x03, 0x00, 0x04, 0x00, 0x18, 0xf4, 0x10, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5083 | 0x00, 0xec, 0x85, 0xf0, 0xbc, 0x00, 0xd5, 0xf0, 0x8e, 0x0c, 0x38, 0x54, |
| 5084 | 0x00, 0xe6, 0x1e, 0xf0, 0x86, 0xf0, 0xb4, 0x00, 0x98, 0x57, 0xd0, 0x01, |
| 5085 | 0x0c, 0x1c, 0x3e, 0x1c, 0x0c, 0x00, 0xbb, 0x00, 0xaa, 0x18, 0x02, 0x80, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5086 | 0x32, 0xf0, 0x01, 0xfc, 0x88, 0x0c, 0xc6, 0x12, 0x02, 0x13, 0x18, 0x40, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5087 | 0x00, 0x57, 0x01, 0xea, 0x3c, 0x00, 0x6c, 0x01, 0x6e, 0x01, 0x04, 0x12, |
| 5088 | 0x3e, 0x57, 0x00, 0x80, 0x03, 0xe6, 0xb6, 0x00, 0xc0, 0x00, 0x01, 0x01, |
| 5089 | 0x3e, 0x01, 0xda, 0x0f, 0x22, 0x10, 0x08, 0x12, 0x02, 0x4a, 0xb9, 0x54, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5090 | 0x03, 0x58, 0x1b, 0x80, 0x30, 0xe4, 0x4b, 0xe4, 0x20, 0x00, 0x32, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5091 | 0x3e, 0x00, 0x80, 0x00, 0x24, 0x01, 0x3c, 0x01, 0x68, 0x01, 0x6a, 0x01, |
| 5092 | 0x70, 0x01, 0x72, 0x01, 0x74, 0x01, 0x76, 0x01, 0x78, 0x01, 0x62, 0x0a, |
| 5093 | 0x92, 0x0c, 0x2c, 0x10, 0x2e, 0x10, 0x06, 0x13, 0x4c, 0x1c, 0xbb, 0x55, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5094 | 0x3c, 0x56, 0x04, 0x80, 0x4a, 0xe4, 0x02, 0xee, 0x5b, 0xf0, 0xb1, 0xf0, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5095 | 0x03, 0xf7, 0x06, 0xf7, 0x03, 0xfc, 0x0f, 0x00, 0x40, 0x00, 0xbe, 0x00, |
| 5096 | 0x00, 0x01, 0xb0, 0x08, 0x30, 0x13, 0x64, 0x15, 0x32, 0x1c, 0x38, 0x1c, |
| 5097 | 0x4e, 0x1c, 0x10, 0x44, 0x02, 0x48, 0x00, 0x4c, 0x04, 0xea, 0x5d, 0xf0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5098 | 0x04, 0xf6, 0x02, 0xfc, 0x05, 0x00, 0x34, 0x00, 0x36, 0x00, 0x98, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5099 | 0xcc, 0x00, 0x20, 0x01, 0x4e, 0x01, 0x4e, 0x0b, 0x1e, 0x0e, 0x0c, 0x10, |
| 5100 | 0x0a, 0x12, 0x04, 0x13, 0x40, 0x13, 0x30, 0x1c, 0x00, 0x4e, 0xbd, 0x56, |
| 5101 | 0x06, 0x83, 0x00, 0xdc, 0x05, 0xf0, 0x09, 0xf0, 0x59, 0xf0, 0xa7, 0xf0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5102 | 0xb8, 0xf0, 0x0e, 0xf7, 0x06, 0x00, 0x19, 0x00, 0x33, 0x00, 0x9b, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5103 | 0xa4, 0x00, 0xb5, 0x00, 0xba, 0x00, 0xd0, 0x00, 0xe1, 0x00, 0xe7, 0x00, |
| 5104 | 0xde, 0x03, 0x56, 0x0a, 0x14, 0x0e, 0x02, 0x10, 0x04, 0x10, 0x0a, 0x10, |
| 5105 | 0x36, 0x10, 0x0a, 0x13, 0x12, 0x13, 0x52, 0x13, 0x10, 0x15, 0x14, 0x15, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5106 | 0xac, 0x16, 0x20, 0x1c, 0x34, 0x1c, 0x36, 0x1c, 0x08, 0x44, 0x38, 0x44, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5107 | 0x91, 0x44, 0x0a, 0x45, 0x48, 0x46, 0x01, 0x48, 0x68, 0x54, 0x83, 0x55, |
| 5108 | 0xb0, 0x57, 0x01, 0x58, 0x83, 0x59, 0x05, 0xe6, 0x0b, 0xf0, 0x0c, 0xf0, |
| 5109 | 0x5c, 0xf0, 0x4b, 0xf4, 0x04, 0xf8, 0x05, 0xf8, 0x02, 0xfa, 0x03, 0xfa, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5110 | 0x04, 0xfc, 0x05, 0xfc, 0x07, 0x00, 0x0a, 0x00, 0x0d, 0x00, 0x1c, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5111 | 0x9e, 0x00, 0xa8, 0x00, 0xaa, 0x00, 0xb9, 0x00, 0xe0, 0x00, 0x22, 0x01, |
| 5112 | 0x26, 0x01, 0x79, 0x01, 0x7a, 0x01, 0xc0, 0x01, 0xc2, 0x01, 0x7c, 0x02, |
| 5113 | 0x5a, 0x03, 0xea, 0x04, 0xe8, 0x07, 0x68, 0x08, 0x69, 0x08, 0xba, 0x08, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5114 | 0xe9, 0x09, 0x06, 0x0b, 0x3a, 0x0e, 0x00, 0x10, 0x1a, 0x10, 0xed, 0x10, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5115 | 0xf1, 0x10, 0x06, 0x12, 0x0c, 0x13, 0x16, 0x13, 0x1e, 0x13, 0x82, 0x13, |
| 5116 | 0x42, 0x14, 0xd6, 0x14, 0x8a, 0x15, 0xc6, 0x17, 0xd2, 0x17, 0x6b, 0x18, |
| 5117 | 0x12, 0x1c, 0x46, 0x1c, 0x9c, 0x32, 0x00, 0x40, 0x0e, 0x47, 0x48, 0x47, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5118 | 0x41, 0x48, 0x89, 0x48, 0x80, 0x4c, 0x00, 0x54, 0x44, 0x55, 0xe5, 0x55, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5119 | 0x14, 0x56, 0x77, 0x57, 0xbf, 0x57, 0x40, 0x5c, 0x06, 0x80, 0x08, 0x90, |
| 5120 | 0x03, 0xa1, 0xfe, 0x9c, 0xf0, 0x29, 0x02, 0xfe, 0xb8, 0x0c, 0xff, 0x10, |
| 5121 | 0x00, 0x00, 0xd0, 0xfe, 0xcc, 0x18, 0x00, 0xcf, 0xfe, 0x80, 0x01, 0xff, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5122 | 0x03, 0x00, 0x00, 0xfe, 0x93, 0x15, 0xfe, 0x0f, 0x05, 0xff, 0x38, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5123 | 0x00, 0xfe, 0x57, 0x24, 0x00, 0xfe, 0x48, 0x00, 0x4f, 0xff, 0x04, 0x00, |
| 5124 | 0x00, 0x10, 0xff, 0x09, 0x00, 0x00, 0xff, 0x08, 0x01, 0x01, 0xff, 0x08, |
| 5125 | 0xff, 0xff, 0xff, 0x27, 0x00, 0x00, 0xff, 0x10, 0xff, 0xff, 0xff, 0x0f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5126 | 0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, 0x00, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5127 | 0xfe, 0x04, 0xf7, 0xcf, 0x2a, 0x67, 0x0b, 0x01, 0xfe, 0xce, 0x0e, 0xfe, |
| 5128 | 0x04, 0xf7, 0xcf, 0x67, 0x0b, 0x3c, 0x2a, 0xfe, 0x3d, 0xf0, 0xfe, 0x02, |
| 5129 | 0x02, 0xfe, 0x20, 0xf0, 0x9c, 0xfe, 0x91, 0xf0, 0xfe, 0xf0, 0x01, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5130 | 0x90, 0xf0, 0xfe, 0xf0, 0x01, 0xfe, 0x8f, 0xf0, 0x9c, 0x05, 0x51, 0x3b, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5131 | 0x02, 0xfe, 0xd4, 0x0c, 0x01, 0xfe, 0x44, 0x0d, 0xfe, 0xdd, 0x12, 0xfe, |
| 5132 | 0xfc, 0x10, 0xfe, 0x28, 0x1c, 0x05, 0xfe, 0xa6, 0x00, 0xfe, 0xd3, 0x12, |
| 5133 | 0x47, 0x18, 0xfe, 0xa6, 0x00, 0xb5, 0xfe, 0x48, 0xf0, 0xfe, 0x86, 0x02, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5134 | 0xfe, 0x49, 0xf0, 0xfe, 0xa0, 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xbe, 0x02, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5135 | 0xfe, 0x46, 0xf0, 0xfe, 0x50, 0x02, 0xfe, 0x47, 0xf0, 0xfe, 0x56, 0x02, |
| 5136 | 0xfe, 0x43, 0xf0, 0xfe, 0x44, 0x02, 0xfe, 0x44, 0xf0, 0xfe, 0x48, 0x02, |
| 5137 | 0xfe, 0x45, 0xf0, 0xfe, 0x4c, 0x02, 0x17, 0x0b, 0xa0, 0x17, 0x06, 0x18, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5138 | 0x96, 0x02, 0x29, 0xfe, 0x00, 0x1c, 0xde, 0xfe, 0x02, 0x1c, 0xdd, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5139 | 0x1e, 0x1c, 0xfe, 0xe9, 0x10, 0x01, 0xfe, 0x20, 0x17, 0xfe, 0xe7, 0x10, |
| 5140 | 0xfe, 0x06, 0xfc, 0xc7, 0x0a, 0x6b, 0x01, 0x9e, 0x02, 0x29, 0x14, 0x4d, |
| 5141 | 0x37, 0x97, 0x01, 0xfe, 0x64, 0x0f, 0x0a, 0x6b, 0x01, 0x82, 0xfe, 0xbd, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5142 | 0x10, 0x0a, 0x6b, 0x01, 0x82, 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5143 | 0x58, 0x1c, 0x17, 0x06, 0x18, 0x96, 0x2a, 0x25, 0x29, 0xfe, 0x3d, 0xf0, |
| 5144 | 0xfe, 0x02, 0x02, 0x21, 0xfe, 0x94, 0x02, 0xfe, 0x5a, 0x1c, 0xea, 0xfe, |
| 5145 | 0x14, 0x1c, 0x14, 0xfe, 0x30, 0x00, 0x37, 0x97, 0x01, 0xfe, 0x54, 0x0f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5146 | 0x17, 0x06, 0x18, 0x96, 0x02, 0xd0, 0x1e, 0x20, 0x07, 0x10, 0x34, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5147 | 0x69, 0x10, 0x17, 0x06, 0x18, 0x96, 0xfe, 0x04, 0xec, 0x20, 0x46, 0x3d, |
| 5148 | 0x12, 0x20, 0xfe, 0x05, 0xf6, 0xc7, 0x01, 0xfe, 0x52, 0x16, 0x09, 0x4a, |
| 5149 | 0x4c, 0x35, 0x11, 0x2d, 0x3c, 0x8a, 0x01, 0xe6, 0x02, 0x29, 0x0a, 0x40, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5150 | 0x01, 0x0e, 0x07, 0x00, 0x5d, 0x01, 0x6f, 0xfe, 0x18, 0x10, 0xfe, 0x41, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5151 | 0x58, 0x0a, 0x99, 0x01, 0x0e, 0xfe, 0xc8, 0x54, 0x64, 0xfe, 0x0c, 0x03, |
| 5152 | 0x01, 0xe6, 0x02, 0x29, 0x2a, 0x46, 0xfe, 0x02, 0xe8, 0x27, 0xf8, 0xfe, |
| 5153 | 0x9e, 0x43, 0xf7, 0xfe, 0x27, 0xf0, 0xfe, 0xdc, 0x01, 0xfe, 0x07, 0x4b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5154 | 0xfe, 0x20, 0xf0, 0x9c, 0xfe, 0x40, 0x1c, 0x25, 0xd2, 0xfe, 0x26, 0xf0, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5155 | 0xfe, 0x56, 0x03, 0xfe, 0xa0, 0xf0, 0xfe, 0x44, 0x03, 0xfe, 0x11, 0xf0, |
| 5156 | 0x9c, 0xfe, 0xef, 0x10, 0xfe, 0x9f, 0xf0, 0xfe, 0x64, 0x03, 0xeb, 0x0f, |
| 5157 | 0xfe, 0x11, 0x00, 0x02, 0x5a, 0x2a, 0xfe, 0x48, 0x1c, 0xeb, 0x09, 0x04, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5158 | 0x1d, 0xfe, 0x18, 0x13, 0x23, 0x1e, 0x98, 0xac, 0x12, 0x98, 0x0a, 0x40, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5159 | 0x01, 0x0e, 0xac, 0x75, 0x01, 0xfe, 0xbc, 0x15, 0x11, 0xca, 0x25, 0xd2, |
| 5160 | 0xfe, 0x01, 0xf0, 0xd2, 0xfe, 0x82, 0xf0, 0xfe, 0x92, 0x03, 0xec, 0x11, |
| 5161 | 0xfe, 0xe4, 0x00, 0x65, 0xfe, 0xa4, 0x03, 0x25, 0x32, 0x1f, 0xfe, 0xb4, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5162 | 0x03, 0x01, 0x43, 0xfe, 0x06, 0xf0, 0xfe, 0xc4, 0x03, 0x8d, 0x81, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5163 | 0x0a, 0xf0, 0xfe, 0x7a, 0x06, 0x02, 0x22, 0x05, 0x6b, 0x28, 0x16, 0xfe, |
| 5164 | 0xf6, 0x04, 0x14, 0x2c, 0x01, 0x33, 0x8f, 0xfe, 0x66, 0x02, 0x02, 0xd1, |
| 5165 | 0xeb, 0x2a, 0x67, 0x1a, 0xfe, 0x67, 0x1b, 0xf8, 0xf7, 0xfe, 0x48, 0x1c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5166 | 0x70, 0x01, 0x6e, 0x87, 0x0a, 0x40, 0x01, 0x0e, 0x07, 0x00, 0x16, 0xd3, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5167 | 0x0a, 0xca, 0x01, 0x0e, 0x74, 0x60, 0x59, 0x76, 0x27, 0x05, 0x6b, 0x28, |
| 5168 | 0xfe, 0x10, 0x12, 0x14, 0x2c, 0x01, 0x33, 0x8f, 0xfe, 0x66, 0x02, 0x02, |
| 5169 | 0xd1, 0xbc, 0x7d, 0xbd, 0x7f, 0x25, 0x22, 0x65, 0xfe, 0x3c, 0x04, 0x1f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5170 | 0xfe, 0x38, 0x04, 0x68, 0xfe, 0xa0, 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x4e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5171 | 0x12, 0x2b, 0xff, 0x02, 0x00, 0x10, 0x01, 0x08, 0x1f, 0xfe, 0xe0, 0x04, |
| 5172 | 0x2b, 0x01, 0x08, 0x1f, 0x22, 0x30, 0x2e, 0xd5, 0xfe, 0x4c, 0x44, 0xfe, |
| 5173 | 0x4c, 0x12, 0x60, 0xfe, 0x44, 0x48, 0x13, 0x2c, 0xfe, 0x4c, 0x54, 0x64, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5174 | 0xd3, 0x46, 0x76, 0x27, 0xfa, 0xef, 0xfe, 0x62, 0x13, 0x09, 0x04, 0x1d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5175 | 0xfe, 0x2a, 0x13, 0x2f, 0x07, 0x7e, 0xa5, 0xfe, 0x20, 0x10, 0x13, 0x2c, |
| 5176 | 0xfe, 0x4c, 0x54, 0x64, 0xd3, 0xfa, 0xef, 0x86, 0x09, 0x04, 0x1d, 0xfe, |
| 5177 | 0x08, 0x13, 0x2f, 0x07, 0x7e, 0x6e, 0x09, 0x04, 0x1d, 0xfe, 0x1c, 0x12, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5178 | 0x14, 0x92, 0x09, 0x04, 0x06, 0x3b, 0x14, 0xc4, 0x01, 0x33, 0x8f, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5179 | 0x70, 0x0c, 0x02, 0x22, 0x2b, 0x11, 0xfe, 0xe6, 0x00, 0xfe, 0x1c, 0x90, |
| 5180 | 0xf9, 0x03, 0x14, 0x92, 0x01, 0x33, 0x02, 0x29, 0xfe, 0x42, 0x5b, 0x67, |
| 5181 | 0x1a, 0xfe, 0x46, 0x59, 0xf8, 0xf7, 0xfe, 0x87, 0x80, 0xfe, 0x31, 0xe4, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5182 | 0x4f, 0x09, 0x04, 0x0b, 0xfe, 0x78, 0x13, 0xfe, 0x20, 0x80, 0x07, 0x1a, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5183 | 0xfe, 0x70, 0x12, 0x49, 0x04, 0x06, 0xfe, 0x60, 0x13, 0x05, 0xfe, 0xa2, |
| 5184 | 0x00, 0x28, 0x16, 0xfe, 0x80, 0x05, 0xfe, 0x31, 0xe4, 0x6a, 0x49, 0x04, |
| 5185 | 0x0b, 0xfe, 0x4a, 0x13, 0x05, 0xfe, 0xa0, 0x00, 0x28, 0xfe, 0x42, 0x12, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5186 | 0x5e, 0x01, 0x08, 0x25, 0x32, 0xf1, 0x01, 0x08, 0x26, 0xfe, 0x98, 0x05, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5187 | 0x11, 0xfe, 0xe3, 0x00, 0x23, 0x49, 0xfe, 0x4a, 0xf0, 0xfe, 0x6a, 0x05, |
| 5188 | 0xfe, 0x49, 0xf0, 0xfe, 0x64, 0x05, 0x83, 0x24, 0xfe, 0x21, 0x00, 0xa1, |
| 5189 | 0x24, 0xfe, 0x22, 0x00, 0xa0, 0x24, 0x4c, 0xfe, 0x09, 0x48, 0x01, 0x08, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5190 | 0x26, 0xfe, 0x98, 0x05, 0xfe, 0xe2, 0x08, 0x49, 0x04, 0xc5, 0x3b, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5191 | 0x86, 0x24, 0x06, 0x12, 0xcc, 0x37, 0xfe, 0x27, 0x01, 0x09, 0x04, 0x1d, |
| 5192 | 0xfe, 0x22, 0x12, 0x47, 0x01, 0xa7, 0x14, 0x92, 0x09, 0x04, 0x06, 0x3b, |
| 5193 | 0x14, 0xc4, 0x01, 0x33, 0x8f, 0xfe, 0x70, 0x0c, 0x02, 0x22, 0x05, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5194 | 0x9c, 0x00, 0x28, 0xfe, 0x3e, 0x12, 0x05, 0x50, 0x28, 0xfe, 0x36, 0x13, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5195 | 0x47, 0x01, 0xa7, 0x26, 0xfe, 0x08, 0x06, 0x0a, 0x06, 0x49, 0x04, 0x19, |
| 5196 | 0xfe, 0x02, 0x12, 0x5f, 0x01, 0xfe, 0xaa, 0x14, 0x1f, 0xfe, 0xfe, 0x05, |
| 5197 | 0x11, 0x9a, 0x01, 0x43, 0x11, 0xfe, 0xe5, 0x00, 0x05, 0x50, 0xb4, 0x0c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5198 | 0x50, 0x05, 0xc6, 0x28, 0xfe, 0x62, 0x12, 0x05, 0x3f, 0x28, 0xfe, 0x5a, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5199 | 0x13, 0x01, 0xfe, 0x14, 0x18, 0x01, 0xfe, 0x66, 0x18, 0xfe, 0x43, 0x48, |
| 5200 | 0xb7, 0x19, 0x13, 0x6c, 0xff, 0x02, 0x00, 0x57, 0x48, 0x8b, 0x1c, 0x3d, |
| 5201 | 0x85, 0xb7, 0x69, 0x47, 0x01, 0xa7, 0x26, 0xfe, 0x72, 0x06, 0x49, 0x04, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5202 | 0x1b, 0xdf, 0x89, 0x0a, 0x4d, 0x01, 0xfe, 0xd8, 0x14, 0x1f, 0xfe, 0x68, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5203 | 0x06, 0x11, 0x9a, 0x01, 0x43, 0x11, 0xfe, 0xe5, 0x00, 0x05, 0x3f, 0xb4, |
| 5204 | 0x0c, 0x3f, 0x17, 0x06, 0x01, 0xa7, 0xec, 0x72, 0x70, 0x01, 0x6e, 0x87, |
| 5205 | 0x11, 0xfe, 0xe2, 0x00, 0x01, 0x08, 0x25, 0x32, 0xfe, 0x0a, 0xf0, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5206 | 0xa6, 0x06, 0x8c, 0xfe, 0x5c, 0x07, 0xfe, 0x06, 0xf0, 0xfe, 0x64, 0x07, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5207 | 0x8d, 0x81, 0x02, 0x22, 0x09, 0x04, 0x0b, 0xfe, 0x2e, 0x12, 0x15, 0x1a, |
| 5208 | 0x01, 0x08, 0x15, 0x00, 0x01, 0x08, 0x15, 0x00, 0x01, 0x08, 0x15, 0x00, |
| 5209 | 0x01, 0x08, 0xfe, 0x99, 0xa4, 0x01, 0x08, 0x15, 0x00, 0x02, 0xfe, 0x32, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5210 | 0x08, 0x61, 0x04, 0x1b, 0xfe, 0x38, 0x12, 0x09, 0x04, 0x1b, 0x6e, 0x15, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5211 | 0xfe, 0x1b, 0x00, 0x01, 0x08, 0x15, 0x00, 0x01, 0x08, 0x15, 0x00, 0x01, |
| 5212 | 0x08, 0x15, 0x00, 0x01, 0x08, 0x15, 0x06, 0x01, 0x08, 0x15, 0x00, 0x02, |
| 5213 | 0xd9, 0x66, 0x4c, 0xfe, 0x3a, 0x55, 0x5f, 0xfe, 0x9a, 0x81, 0x4b, 0x1d, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5214 | 0xba, 0xfe, 0x32, 0x07, 0x0a, 0x1d, 0xfe, 0x09, 0x6f, 0xaf, 0xfe, 0xca, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5215 | 0x45, 0xfe, 0x32, 0x12, 0x62, 0x2c, 0x85, 0x66, 0x7b, 0x01, 0x08, 0x25, |
| 5216 | 0x32, 0xfe, 0x0a, 0xf0, 0xfe, 0x32, 0x07, 0x8d, 0x81, 0x8c, 0xfe, 0x5c, |
| 5217 | 0x07, 0x02, 0x22, 0x01, 0x43, 0x02, 0xfe, 0x8a, 0x06, 0x15, 0x19, 0x02, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5218 | 0xfe, 0x8a, 0x06, 0xfe, 0x9c, 0xf7, 0xd4, 0xfe, 0x2c, 0x90, 0xfe, 0xae, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5219 | 0x90, 0x77, 0xfe, 0xca, 0x07, 0x0c, 0x54, 0x18, 0x55, 0x09, 0x4a, 0x6a, |
| 5220 | 0x35, 0x1e, 0x20, 0x07, 0x10, 0xfe, 0x0e, 0x12, 0x74, 0xfe, 0x80, 0x80, |
| 5221 | 0x37, 0x20, 0x63, 0x27, 0xfe, 0x06, 0x10, 0xfe, 0x83, 0xe7, 0xc4, 0xa1, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5222 | 0xfe, 0x03, 0x40, 0x09, 0x4a, 0x4f, 0x35, 0x01, 0xa8, 0xad, 0xfe, 0x1f, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5223 | 0x40, 0x12, 0x58, 0x01, 0xa5, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0xfe, |
| 5224 | 0x44, 0x51, 0xfe, 0xc6, 0x51, 0x83, 0xfb, 0xfe, 0x8a, 0x90, 0x0c, 0x52, |
| 5225 | 0x18, 0x53, 0xfe, 0x0c, 0x90, 0xfe, 0x8e, 0x90, 0xfe, 0x40, 0x50, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5226 | 0xc2, 0x50, 0x0c, 0x39, 0x18, 0x3a, 0xfe, 0x4a, 0x10, 0x09, 0x04, 0x6a, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5227 | 0xfe, 0x2a, 0x12, 0xfe, 0x2c, 0x90, 0xfe, 0xae, 0x90, 0x0c, 0x54, 0x18, |
| 5228 | 0x55, 0x09, 0x04, 0x4f, 0x85, 0x01, 0xa8, 0xfe, 0x1f, 0x80, 0x12, 0x58, |
| 5229 | 0xfe, 0x44, 0x90, 0xfe, 0xc6, 0x90, 0x0c, 0x56, 0x18, 0x57, 0xfb, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5230 | 0x8a, 0x90, 0x0c, 0x52, 0x18, 0x53, 0xfe, 0x40, 0x90, 0xfe, 0xc2, 0x90, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5231 | 0x0c, 0x39, 0x18, 0x3a, 0x0c, 0x38, 0x18, 0x4e, 0x09, 0x4a, 0x19, 0x35, |
| 5232 | 0x2a, 0x13, 0xfe, 0x4e, 0x11, 0x65, 0xfe, 0x48, 0x08, 0xfe, 0x9e, 0xf0, |
| 5233 | 0xfe, 0x5c, 0x08, 0xb1, 0x16, 0x32, 0x2a, 0x73, 0xdd, 0xb8, 0xfe, 0x80, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5234 | 0x08, 0xb9, 0xfe, 0x9e, 0x08, 0x8c, 0xfe, 0x74, 0x08, 0xfe, 0x06, 0xf0, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5235 | 0xfe, 0x7a, 0x08, 0x8d, 0x81, 0x02, 0x22, 0x01, 0x43, 0xfe, 0xc9, 0x10, |
| 5236 | 0x15, 0x19, 0xfe, 0xc9, 0x10, 0x61, 0x04, 0x06, 0xfe, 0x10, 0x12, 0x61, |
| 5237 | 0x04, 0x0b, 0x45, 0x09, 0x04, 0x0b, 0xfe, 0x68, 0x12, 0xfe, 0x2e, 0x1c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5238 | 0x02, 0xfe, 0x24, 0x0a, 0x61, 0x04, 0x06, 0x45, 0x61, 0x04, 0x0b, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5239 | 0x52, 0x12, 0xfe, 0x2c, 0x1c, 0xfe, 0xaa, 0xf0, 0xfe, 0x1e, 0x09, 0xfe, |
| 5240 | 0xac, 0xf0, 0xfe, 0xbe, 0x08, 0xfe, 0x8a, 0x10, 0xaa, 0xfe, 0xf3, 0x10, |
| 5241 | 0xfe, 0xad, 0xf0, 0xfe, 0xca, 0x08, 0x02, 0xfe, 0x24, 0x0a, 0xab, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5242 | 0xe7, 0x10, 0xfe, 0x2b, 0xf0, 0x9d, 0xe9, 0x1c, 0xfe, 0x00, 0xfe, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5243 | 0x1c, 0x12, 0xb5, 0xfe, 0xd2, 0xf0, 0x9d, 0xfe, 0x76, 0x18, 0x1c, 0x1a, |
| 5244 | 0x16, 0x9d, 0x05, 0xcb, 0x1c, 0x06, 0x16, 0x9d, 0xb8, 0x6d, 0xb9, 0x6d, |
| 5245 | 0xaa, 0xab, 0xfe, 0xb1, 0x10, 0x70, 0x5e, 0x2b, 0x14, 0x92, 0x01, 0x33, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5246 | 0x0f, 0xfe, 0x35, 0x00, 0xfe, 0x01, 0xf0, 0x5a, 0x0f, 0x7c, 0x02, 0x5a, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5247 | 0xfe, 0x74, 0x18, 0x1c, 0xfe, 0x00, 0xf8, 0x16, 0x6d, 0x67, 0x1b, 0x01, |
| 5248 | 0xfe, 0x44, 0x0d, 0x3b, 0x01, 0xe6, 0x1e, 0x27, 0x74, 0x67, 0x1a, 0x02, |
| 5249 | 0x6d, 0x09, 0x04, 0x0b, 0x21, 0xfe, 0x06, 0x0a, 0x09, 0x04, 0x6a, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5250 | 0x82, 0x12, 0x09, 0x04, 0x19, 0xfe, 0x66, 0x13, 0x1e, 0x58, 0xac, 0xfc, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5251 | 0xfe, 0x83, 0x80, 0xfe, 0xc8, 0x44, 0xfe, 0x2e, 0x13, 0xfe, 0x04, 0x91, |
| 5252 | 0xfe, 0x86, 0x91, 0x63, 0x27, 0xfe, 0x40, 0x59, 0xfe, 0xc1, 0x59, 0x77, |
| 5253 | 0xd7, 0x05, 0x54, 0x31, 0x55, 0x0c, 0x7b, 0x18, 0x7c, 0xbe, 0x54, 0xbf, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5254 | 0x55, 0x01, 0xa8, 0xad, 0x63, 0x27, 0x12, 0x58, 0xc0, 0x38, 0xc1, 0x4e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5255 | 0x79, 0x56, 0x68, 0x57, 0xf4, 0xf5, 0xfe, 0x04, 0xfa, 0x38, 0xfe, 0x05, |
| 5256 | 0xfa, 0x4e, 0x01, 0xa5, 0xa2, 0x23, 0x0c, 0x7b, 0x0c, 0x7c, 0x79, 0x56, |
| 5257 | 0x68, 0x57, 0xfe, 0x12, 0x10, 0x09, 0x04, 0x19, 0x16, 0xd7, 0x79, 0x39, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5258 | 0x68, 0x3a, 0x09, 0x04, 0xfe, 0xf7, 0x00, 0x35, 0x05, 0x52, 0x31, 0x53, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5259 | 0xfe, 0x10, 0x58, 0xfe, 0x91, 0x58, 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, |
| 5260 | 0x02, 0x6d, 0x09, 0x04, 0x19, 0x16, 0xd7, 0x09, 0x04, 0xfe, 0xf7, 0x00, |
| 5261 | 0x35, 0xfe, 0x3a, 0x55, 0xfe, 0x19, 0x81, 0x5f, 0xfe, 0x10, 0x90, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5262 | 0x92, 0x90, 0xfe, 0xd7, 0x10, 0x2f, 0x07, 0x9b, 0x16, 0xfe, 0xc6, 0x08, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5263 | 0x11, 0x9b, 0x09, 0x04, 0x0b, 0xfe, 0x14, 0x13, 0x05, 0x39, 0x31, 0x3a, |
| 5264 | 0x77, 0xfe, 0xc6, 0x08, 0xfe, 0x0c, 0x58, 0xfe, 0x8d, 0x58, 0x02, 0x6d, |
| 5265 | 0x23, 0x47, 0xfe, 0x19, 0x80, 0xde, 0x09, 0x04, 0x0b, 0xfe, 0x1a, 0x12, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5266 | 0xfe, 0x6c, 0x19, 0xfe, 0x19, 0x41, 0xe9, 0xb5, 0xfe, 0xd1, 0xf0, 0xd9, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5267 | 0x14, 0x7a, 0x01, 0x33, 0x0f, 0xfe, 0x44, 0x00, 0xfe, 0x8e, 0x10, 0xfe, |
| 5268 | 0x6c, 0x19, 0xbe, 0x39, 0xfe, 0xed, 0x19, 0xbf, 0x3a, 0xfe, 0x0c, 0x51, |
| 5269 | 0xfe, 0x8e, 0x51, 0xe9, 0x1c, 0xfe, 0x00, 0xff, 0x34, 0xfe, 0x74, 0x10, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5270 | 0xb5, 0xfe, 0xd2, 0xf0, 0xfe, 0xb2, 0x0a, 0xfe, 0x76, 0x18, 0x1c, 0x1a, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5271 | 0x84, 0x05, 0xcb, 0x1c, 0x06, 0xfe, 0x08, 0x13, 0x0f, 0xfe, 0x16, 0x00, |
| 5272 | 0x02, 0x5a, 0xfe, 0xd1, 0xf0, 0xfe, 0xc4, 0x0a, 0x14, 0x7a, 0x01, 0x33, |
| 5273 | 0x0f, 0xfe, 0x17, 0x00, 0xfe, 0x42, 0x10, 0xfe, 0xce, 0xf0, 0xfe, 0xca, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5274 | 0x0a, 0xfe, 0x3c, 0x10, 0xfe, 0xcd, 0xf0, 0xfe, 0xd6, 0x0a, 0x0f, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5275 | 0x22, 0x00, 0x02, 0x5a, 0xfe, 0xcb, 0xf0, 0xfe, 0xe2, 0x0a, 0x0f, 0xfe, |
| 5276 | 0x24, 0x00, 0x02, 0x5a, 0xfe, 0xd0, 0xf0, 0xfe, 0xec, 0x0a, 0x0f, 0x93, |
| 5277 | 0xdc, 0xfe, 0xcf, 0xf0, 0xfe, 0xf6, 0x0a, 0x0f, 0x4c, 0xfe, 0x10, 0x10, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5278 | 0xfe, 0xcc, 0xf0, 0xd9, 0x61, 0x04, 0x19, 0x3b, 0x0f, 0xfe, 0x12, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5279 | 0x2a, 0x13, 0xfe, 0x4e, 0x11, 0x65, 0xfe, 0x0c, 0x0b, 0xfe, 0x9e, 0xf0, |
| 5280 | 0xfe, 0x20, 0x0b, 0xb1, 0x16, 0x32, 0x2a, 0x73, 0xdd, 0xb8, 0x22, 0xb9, |
| 5281 | 0x22, 0x2a, 0xec, 0x65, 0xfe, 0x2c, 0x0b, 0x25, 0x32, 0x8c, 0xfe, 0x48, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5282 | 0x0b, 0x8d, 0x81, 0xb8, 0xd4, 0xb9, 0xd4, 0x02, 0x22, 0x01, 0x43, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5283 | 0xdb, 0x10, 0x11, 0xfe, 0xe8, 0x00, 0xaa, 0xab, 0x70, 0xbc, 0x7d, 0xbd, |
| 5284 | 0x7f, 0xfe, 0x89, 0xf0, 0x22, 0x30, 0x2e, 0xd8, 0xbc, 0x7d, 0xbd, 0x7f, |
| 5285 | 0x01, 0x08, 0x1f, 0x22, 0x30, 0x2e, 0xd6, 0xb1, 0x45, 0x0f, 0xfe, 0x42, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5286 | 0x00, 0x02, 0x5a, 0x78, 0x06, 0xfe, 0x81, 0x49, 0x16, 0xfe, 0x38, 0x0c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5287 | 0x09, 0x04, 0x0b, 0xfe, 0x44, 0x13, 0x0f, 0x00, 0x4b, 0x0b, 0xfe, 0x54, |
| 5288 | 0x12, 0x4b, 0xfe, 0x28, 0x00, 0x21, 0xfe, 0xa6, 0x0c, 0x0a, 0x40, 0x01, |
| 5289 | 0x0e, 0x07, 0x00, 0x5d, 0x3e, 0xfe, 0x28, 0x00, 0xfe, 0xe2, 0x10, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5290 | 0xe7, 0x01, 0xe8, 0x0a, 0x99, 0x01, 0xfe, 0x32, 0x0e, 0x59, 0x11, 0x2d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5291 | 0x01, 0x6f, 0x02, 0x29, 0x0f, 0xfe, 0x44, 0x00, 0x4b, 0x0b, 0xdf, 0x3e, |
| 5292 | 0x0b, 0xfe, 0xb4, 0x10, 0x01, 0x86, 0x3e, 0x0b, 0xfe, 0xaa, 0x10, 0x01, |
| 5293 | 0x86, 0xfe, 0x19, 0x82, 0xfe, 0x34, 0x46, 0xa3, 0x3e, 0x0b, 0x0f, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5294 | 0x43, 0x00, 0xfe, 0x96, 0x10, 0x09, 0x4a, 0x0b, 0x35, 0x01, 0xe7, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5295 | 0xe8, 0x59, 0x11, 0x2d, 0x01, 0x6f, 0x67, 0x0b, 0x59, 0x3c, 0x8a, 0x02, |
| 5296 | 0xfe, 0x2a, 0x03, 0x09, 0x04, 0x0b, 0x84, 0x3e, 0x0b, 0x0f, 0x00, 0xfe, |
| 5297 | 0x5c, 0x10, 0x61, 0x04, 0x1b, 0xfe, 0x58, 0x12, 0x09, 0x04, 0x1b, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5298 | 0x50, 0x13, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x5c, 0x0c, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5299 | 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x62, 0x0c, 0x09, 0x4a, 0x1b, 0x35, |
| 5300 | 0xfe, 0xa9, 0x10, 0x0f, 0xfe, 0x15, 0x00, 0xfe, 0x04, 0xe6, 0x0b, 0x5f, |
| 5301 | 0x5c, 0x0f, 0xfe, 0x13, 0x00, 0xfe, 0x10, 0x10, 0x0f, 0xfe, 0x47, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5302 | 0xa1, 0x0f, 0xfe, 0x41, 0x00, 0xa0, 0x0f, 0xfe, 0x24, 0x00, 0x87, 0xaa, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5303 | 0xab, 0x70, 0x05, 0x6b, 0x28, 0x21, 0xd1, 0x5f, 0xfe, 0x04, 0xe6, 0x1b, |
| 5304 | 0xfe, 0x9d, 0x41, 0xfe, 0x1c, 0x42, 0x59, 0x01, 0xda, 0x02, 0x29, 0xea, |
| 5305 | 0x14, 0x0b, 0x37, 0x95, 0xa9, 0x14, 0xfe, 0x31, 0x00, 0x37, 0x97, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5306 | 0xfe, 0x54, 0x0f, 0x02, 0xd0, 0x3c, 0xfe, 0x06, 0xec, 0xc9, 0xee, 0x3e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5307 | 0x1d, 0xfe, 0xce, 0x45, 0x34, 0x3c, 0xfe, 0x06, 0xea, 0xc9, 0xfe, 0x47, |
| 5308 | 0x4b, 0x89, 0xfe, 0x75, 0x57, 0x05, 0x51, 0xfe, 0x98, 0x56, 0xfe, 0x38, |
| 5309 | 0x12, 0x0a, 0x42, 0x01, 0x0e, 0xfe, 0x44, 0x48, 0x46, 0x09, 0x04, 0x1d, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5310 | 0xfe, 0x1a, 0x13, 0x0a, 0x40, 0x01, 0x0e, 0x47, 0xfe, 0x41, 0x58, 0x0a, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5311 | 0x99, 0x01, 0x0e, 0xfe, 0x49, 0x54, 0x8e, 0xfe, 0x2a, 0x0d, 0x02, 0xfe, |
| 5312 | 0x2a, 0x03, 0x0a, 0x51, 0xfe, 0xee, 0x14, 0xee, 0x3e, 0x1d, 0xfe, 0xce, |
| 5313 | 0x45, 0x34, 0x3c, 0xfe, 0xce, 0x47, 0xfe, 0xad, 0x13, 0x02, 0x29, 0x1e, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5314 | 0x20, 0x07, 0x10, 0xfe, 0x9e, 0x12, 0x23, 0x12, 0x4d, 0x12, 0x94, 0x12, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5315 | 0xce, 0x1e, 0x2d, 0x47, 0x37, 0x2d, 0xb1, 0xe0, 0xfe, 0xbc, 0xf0, 0xfe, |
| 5316 | 0xec, 0x0d, 0x13, 0x06, 0x12, 0x4d, 0x01, 0xfe, 0xe2, 0x15, 0x05, 0xfe, |
| 5317 | 0x38, 0x01, 0x31, 0xfe, 0x3a, 0x01, 0x77, 0xfe, 0xf0, 0x0d, 0xfe, 0x02, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5318 | 0xec, 0xce, 0x62, 0x00, 0x5d, 0xfe, 0x04, 0xec, 0x20, 0x46, 0xfe, 0x05, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5319 | 0xf6, 0xfe, 0x34, 0x01, 0x01, 0xfe, 0x52, 0x16, 0xfb, 0xfe, 0x48, 0xf4, |
| 5320 | 0x0d, 0xfe, 0x18, 0x13, 0xaf, 0xfe, 0x02, 0xea, 0xce, 0x62, 0x7a, 0xfe, |
| 5321 | 0xc5, 0x13, 0x14, 0x1b, 0x37, 0x95, 0xa9, 0x5c, 0x05, 0xfe, 0x38, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5322 | 0x1c, 0xfe, 0xf0, 0xff, 0x0c, 0xfe, 0x60, 0x01, 0x05, 0xfe, 0x3a, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5323 | 0x0c, 0xfe, 0x62, 0x01, 0x3d, 0x12, 0x20, 0x24, 0x06, 0x12, 0x2d, 0x11, |
| 5324 | 0x2d, 0x8a, 0x13, 0x06, 0x03, 0x23, 0x03, 0x1e, 0x4d, 0xfe, 0xf7, 0x12, |
| 5325 | 0x1e, 0x94, 0xac, 0x12, 0x94, 0x07, 0x7a, 0xfe, 0x71, 0x13, 0xfe, 0x24, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5326 | 0x1c, 0x14, 0x1a, 0x37, 0x95, 0xa9, 0xfe, 0xd9, 0x10, 0xb6, 0xfe, 0x03, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5327 | 0xdc, 0xfe, 0x73, 0x57, 0xfe, 0x80, 0x5d, 0x03, 0xb6, 0xfe, 0x03, 0xdc, |
| 5328 | 0xfe, 0x5b, 0x57, 0xfe, 0x80, 0x5d, 0x03, 0xfe, 0x03, 0x57, 0xb6, 0x23, |
| 5329 | 0xfe, 0x00, 0xcc, 0x03, 0xfe, 0x03, 0x57, 0xb6, 0x75, 0x03, 0x09, 0x04, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5330 | 0x4c, 0xfe, 0x22, 0x13, 0xfe, 0x1c, 0x80, 0x07, 0x06, 0xfe, 0x1a, 0x13, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5331 | 0xfe, 0x1e, 0x80, 0xe1, 0xfe, 0x1d, 0x80, 0xa4, 0xfe, 0x0c, 0x90, 0xfe, |
| 5332 | 0x0e, 0x13, 0xfe, 0x0e, 0x90, 0xa3, 0xfe, 0x3c, 0x90, 0xfe, 0x30, 0xf4, |
| 5333 | 0x0b, 0xfe, 0x3c, 0x50, 0xa0, 0x01, 0xfe, 0x82, 0x16, 0x2f, 0x07, 0x2d, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5334 | 0xe0, 0x01, 0xfe, 0xbc, 0x15, 0x09, 0x04, 0x1d, 0x45, 0x01, 0xe7, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5335 | 0xe8, 0x11, 0xfe, 0xe9, 0x00, 0x09, 0x04, 0x4c, 0xfe, 0x2c, 0x13, 0x01, |
| 5336 | 0xfe, 0x14, 0x16, 0xfe, 0x1e, 0x1c, 0xfe, 0x14, 0x90, 0xfe, 0x96, 0x90, |
| 5337 | 0x0c, 0xfe, 0x64, 0x01, 0x18, 0xfe, 0x66, 0x01, 0x09, 0x04, 0x4f, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5338 | 0x12, 0x12, 0xfe, 0x03, 0x80, 0x74, 0xfe, 0x01, 0xec, 0x20, 0xfe, 0x80, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5339 | 0x40, 0x12, 0x20, 0x63, 0x27, 0x11, 0xc8, 0x59, 0x1e, 0x20, 0xed, 0x76, |
| 5340 | 0x20, 0x03, 0xfe, 0x08, 0x1c, 0x05, 0xfe, 0xac, 0x00, 0xfe, 0x06, 0x58, |
| 5341 | 0x05, 0xfe, 0xae, 0x00, 0xfe, 0x07, 0x58, 0x05, 0xfe, 0xb0, 0x00, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5342 | 0x08, 0x58, 0x05, 0xfe, 0xb2, 0x00, 0xfe, 0x09, 0x58, 0xfe, 0x0a, 0x1c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5343 | 0x24, 0x69, 0x12, 0xc9, 0x23, 0x0c, 0x50, 0x0c, 0x3f, 0x13, 0x40, 0x48, |
| 5344 | 0x5f, 0x17, 0x1d, 0xfe, 0x90, 0x4d, 0xfe, 0x91, 0x54, 0x21, 0xfe, 0x08, |
| 5345 | 0x0f, 0x3e, 0x10, 0x13, 0x42, 0x48, 0x17, 0x4c, 0xfe, 0x90, 0x4d, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5346 | 0x91, 0x54, 0x21, 0xfe, 0x1e, 0x0f, 0x24, 0x10, 0x12, 0x20, 0x78, 0x2c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5347 | 0x46, 0x1e, 0x20, 0xed, 0x76, 0x20, 0x11, 0xc8, 0xf6, 0xfe, 0xd6, 0xf0, |
| 5348 | 0xfe, 0x32, 0x0f, 0xea, 0x70, 0xfe, 0x14, 0x1c, 0xfe, 0x10, 0x1c, 0xfe, |
| 5349 | 0x18, 0x1c, 0x03, 0x3c, 0xfe, 0x0c, 0x14, 0xee, 0xfe, 0x07, 0xe6, 0x1d, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5350 | 0xfe, 0xce, 0x47, 0xfe, 0xf5, 0x13, 0x03, 0x01, 0x86, 0x78, 0x2c, 0x46, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5351 | 0xfa, 0xef, 0xfe, 0x42, 0x13, 0x2f, 0x07, 0x2d, 0xfe, 0x34, 0x13, 0x0a, |
| 5352 | 0x42, 0x01, 0x0e, 0xb0, 0xfe, 0x36, 0x12, 0xf0, 0xfe, 0x45, 0x48, 0x01, |
| 5353 | 0xe3, 0xfe, 0x00, 0xcc, 0xb0, 0xfe, 0xf3, 0x13, 0x3d, 0x75, 0x07, 0x10, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5354 | 0xa3, 0x0a, 0x80, 0x01, 0x0e, 0xfe, 0x80, 0x5c, 0x01, 0x6f, 0xfe, 0x0e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5355 | 0x10, 0x07, 0x7e, 0x45, 0xf6, 0xfe, 0xd6, 0xf0, 0xfe, 0x6c, 0x0f, 0x03, |
| 5356 | 0xfe, 0x44, 0x58, 0x74, 0xfe, 0x01, 0xec, 0x97, 0xfe, 0x9e, 0x40, 0xfe, |
| 5357 | 0x9d, 0xe7, 0x00, 0xfe, 0x9c, 0xe7, 0x1b, 0x76, 0x27, 0x01, 0xda, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5358 | 0xdd, 0x10, 0x2a, 0xbc, 0x7d, 0xbd, 0x7f, 0x30, 0x2e, 0xd5, 0x07, 0x1b, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5359 | 0xfe, 0x48, 0x12, 0x07, 0x0b, 0xfe, 0x56, 0x12, 0x07, 0x1a, 0xfe, 0x30, |
| 5360 | 0x12, 0x07, 0xc2, 0x16, 0xfe, 0x3e, 0x11, 0x07, 0xfe, 0x23, 0x00, 0x16, |
| 5361 | 0xfe, 0x4a, 0x11, 0x07, 0x06, 0x16, 0xfe, 0xa8, 0x11, 0x07, 0x19, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5362 | 0x12, 0x12, 0x07, 0x00, 0x16, 0x22, 0x14, 0xc2, 0x01, 0x33, 0x9f, 0x2b, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5363 | 0x01, 0x08, 0x8c, 0x43, 0x03, 0x2b, 0xfe, 0x62, 0x08, 0x0a, 0xca, 0x01, |
| 5364 | 0xfe, 0x32, 0x0e, 0x11, 0x7e, 0x02, 0x29, 0x2b, 0x2f, 0x07, 0x9b, 0xfe, |
| 5365 | 0xd9, 0x13, 0x79, 0x39, 0x68, 0x3a, 0x77, 0xfe, 0xfc, 0x10, 0x09, 0x04, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5366 | 0x6a, 0xfe, 0x72, 0x12, 0xc0, 0x38, 0xc1, 0x4e, 0xf4, 0xf5, 0x8e, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5367 | 0xc6, 0x10, 0x1e, 0x58, 0xfe, 0x26, 0x13, 0x05, 0x7b, 0x31, 0x7c, 0x77, |
| 5368 | 0xfe, 0x82, 0x0c, 0x0c, 0x54, 0x18, 0x55, 0x23, 0x0c, 0x7b, 0x0c, 0x7c, |
| 5369 | 0x01, 0xa8, 0x24, 0x69, 0x73, 0x12, 0x58, 0x01, 0xa5, 0xc0, 0x38, 0xc1, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5370 | 0x4e, 0xfe, 0x04, 0x55, 0xfe, 0xa5, 0x55, 0xfe, 0x04, 0xfa, 0x38, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5371 | 0x05, 0xfa, 0x4e, 0xfe, 0x91, 0x10, 0x05, 0x56, 0x31, 0x57, 0xfe, 0x40, |
| 5372 | 0x56, 0xfe, 0xe1, 0x56, 0x0c, 0x56, 0x18, 0x57, 0x83, 0xc0, 0x38, 0xc1, |
| 5373 | 0x4e, 0xf4, 0xf5, 0x05, 0x52, 0x31, 0x53, 0xfe, 0x00, 0x56, 0xfe, 0xa1, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5374 | 0x56, 0x0c, 0x52, 0x18, 0x53, 0x09, 0x04, 0x6a, 0xfe, 0x1e, 0x12, 0x1e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5375 | 0x58, 0xfe, 0x1f, 0x40, 0x05, 0x54, 0x31, 0x55, 0xfe, 0x2c, 0x50, 0xfe, |
| 5376 | 0xae, 0x50, 0x05, 0x56, 0x31, 0x57, 0xfe, 0x44, 0x50, 0xfe, 0xc6, 0x50, |
| 5377 | 0x05, 0x52, 0x31, 0x53, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0x05, 0x39, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5378 | 0x31, 0x3a, 0xfe, 0x40, 0x50, 0xfe, 0xc2, 0x50, 0x02, 0x5c, 0x24, 0x06, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5379 | 0x12, 0xcd, 0x02, 0x5b, 0x2b, 0x01, 0x08, 0x1f, 0x44, 0x30, 0x2e, 0xd5, |
| 5380 | 0x07, 0x06, 0x21, 0x44, 0x2f, 0x07, 0x9b, 0x21, 0x5b, 0x01, 0x6e, 0x1c, |
| 5381 | 0x3d, 0x16, 0x44, 0x09, 0x04, 0x0b, 0xe2, 0x79, 0x39, 0x68, 0x3a, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5382 | 0x0a, 0x55, 0x34, 0xfe, 0x8b, 0x55, 0xbe, 0x39, 0xbf, 0x3a, 0xfe, 0x0c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5383 | 0x51, 0xfe, 0x8e, 0x51, 0x02, 0x5b, 0xfe, 0x19, 0x81, 0xaf, 0xfe, 0x19, |
| 5384 | 0x41, 0x02, 0x5b, 0x2b, 0x01, 0x08, 0x25, 0x32, 0x1f, 0xa2, 0x30, 0x2e, |
| 5385 | 0xd8, 0x4b, 0x1a, 0xfe, 0xa6, 0x12, 0x4b, 0x0b, 0x3b, 0x02, 0x44, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5386 | 0x08, 0x25, 0x32, 0x1f, 0xa2, 0x30, 0x2e, 0xd6, 0x07, 0x1a, 0x21, 0x44, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5387 | 0x01, 0x08, 0x1f, 0xa2, 0x30, 0x2e, 0xfe, 0xe8, 0x09, 0xfe, 0xc2, 0x49, |
| 5388 | 0x60, 0x05, 0xfe, 0x9c, 0x00, 0x28, 0x84, 0x49, 0x04, 0x19, 0x34, 0x9f, |
| 5389 | 0xfe, 0xbb, 0x45, 0x4b, 0x00, 0x45, 0x3e, 0x06, 0x78, 0x3d, 0xfe, 0xda, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5390 | 0x14, 0x01, 0x6e, 0x87, 0xfe, 0x4b, 0x45, 0xe2, 0x2f, 0x07, 0x9a, 0xe1, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5391 | 0x05, 0xc6, 0x28, 0x84, 0x05, 0x3f, 0x28, 0x34, 0x5e, 0x02, 0x5b, 0xfe, |
| 5392 | 0xc0, 0x5d, 0xfe, 0xf8, 0x14, 0xfe, 0x03, 0x17, 0x05, 0x50, 0xb4, 0x0c, |
| 5393 | 0x50, 0x5e, 0x2b, 0x01, 0x08, 0x26, 0x5c, 0x01, 0xfe, 0xaa, 0x14, 0x02, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5394 | 0x5c, 0x01, 0x08, 0x25, 0x32, 0x1f, 0x44, 0x30, 0x2e, 0xd6, 0x07, 0x06, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5395 | 0x21, 0x44, 0x01, 0xfe, 0x8e, 0x13, 0xfe, 0x42, 0x58, 0xfe, 0x82, 0x14, |
| 5396 | 0xfe, 0xa4, 0x14, 0x87, 0xfe, 0x4a, 0xf4, 0x0b, 0x16, 0x44, 0xfe, 0x4a, |
| 5397 | 0xf4, 0x06, 0xfe, 0x0c, 0x12, 0x2f, 0x07, 0x9a, 0x85, 0x02, 0x5b, 0x05, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5398 | 0x3f, 0xb4, 0x0c, 0x3f, 0x5e, 0x2b, 0x01, 0x08, 0x26, 0x5c, 0x01, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5399 | 0xd8, 0x14, 0x02, 0x5c, 0x13, 0x06, 0x65, 0xfe, 0xca, 0x12, 0x26, 0xfe, |
| 5400 | 0xe0, 0x12, 0x72, 0xf1, 0x01, 0x08, 0x23, 0x72, 0x03, 0x8f, 0xfe, 0xdc, |
| 5401 | 0x12, 0x25, 0xfe, 0xdc, 0x12, 0x1f, 0xfe, 0xca, 0x12, 0x5e, 0x2b, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5402 | 0x08, 0xfe, 0xd5, 0x10, 0x13, 0x6c, 0xff, 0x02, 0x00, 0x57, 0x48, 0x8b, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5403 | 0x1c, 0xfe, 0xff, 0x7f, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x13, |
| 5404 | 0x6c, 0xff, 0x02, 0x00, 0x57, 0x48, 0x8b, 0x1c, 0x3d, 0xfe, 0x30, 0x56, |
| 5405 | 0xfe, 0x00, 0x5c, 0x03, 0x13, 0x6c, 0xff, 0x02, 0x00, 0x57, 0x48, 0x8b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5406 | 0x03, 0x13, 0x6c, 0xff, 0x02, 0x00, 0x57, 0x48, 0x8b, 0xfe, 0x0b, 0x58, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5407 | 0x03, 0x0a, 0x50, 0x01, 0x82, 0x0a, 0x3f, 0x01, 0x82, 0x03, 0xfc, 0x1c, |
| 5408 | 0x10, 0xff, 0x03, 0x00, 0x54, 0xfe, 0x00, 0xf4, 0x19, 0x48, 0xfe, 0x00, |
| 5409 | 0x7d, 0xfe, 0x01, 0x7d, 0xfe, 0x02, 0x7d, 0xfe, 0x03, 0x7c, 0x63, 0x27, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5410 | 0x0c, 0x52, 0x18, 0x53, 0xbe, 0x56, 0xbf, 0x57, 0x03, 0xfe, 0x62, 0x08, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5411 | 0xfe, 0x82, 0x4a, 0xfe, 0xe1, 0x1a, 0xfe, 0x83, 0x5a, 0x74, 0x03, 0x01, |
| 5412 | 0xfe, 0x14, 0x18, 0xfe, 0x42, 0x48, 0x5f, 0x60, 0x89, 0x01, 0x08, 0x1f, |
| 5413 | 0xfe, 0xa2, 0x14, 0x30, 0x2e, 0xd8, 0x01, 0x08, 0x1f, 0xfe, 0xa2, 0x14, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5414 | 0x30, 0x2e, 0xfe, 0xe8, 0x0a, 0xfe, 0xc1, 0x59, 0x05, 0xc6, 0x28, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5415 | 0xcc, 0x12, 0x49, 0x04, 0x1b, 0xfe, 0xc4, 0x13, 0x23, 0x62, 0x1b, 0xe2, |
| 5416 | 0x4b, 0xc3, 0x64, 0xfe, 0xe8, 0x13, 0x3b, 0x13, 0x06, 0x17, 0xc3, 0x78, |
| 5417 | 0xdb, 0xfe, 0x78, 0x10, 0xff, 0x02, 0x83, 0x55, 0xa1, 0xff, 0x02, 0x83, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5418 | 0x55, 0x62, 0x1a, 0xa4, 0xbb, 0xfe, 0x30, 0x00, 0x8e, 0xe4, 0x17, 0x2c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5419 | 0x13, 0x06, 0xfe, 0x56, 0x10, 0x62, 0x0b, 0xe1, 0xbb, 0xfe, 0x64, 0x00, |
| 5420 | 0x8e, 0xe4, 0x0a, 0xfe, 0x64, 0x00, 0x17, 0x93, 0x13, 0x06, 0xfe, 0x28, |
| 5421 | 0x10, 0x62, 0x06, 0xfe, 0x60, 0x13, 0xbb, 0xfe, 0xc8, 0x00, 0x8e, 0xe4, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5422 | 0x0a, 0xfe, 0xc8, 0x00, 0x17, 0x4d, 0x13, 0x06, 0x83, 0xbb, 0xfe, 0x90, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5423 | 0x01, 0xba, 0xfe, 0x4e, 0x14, 0x89, 0xfe, 0x12, 0x10, 0xfe, 0x43, 0xf4, |
| 5424 | 0x94, 0xfe, 0x56, 0xf0, 0xfe, 0x60, 0x14, 0xfe, 0x04, 0xf4, 0x6c, 0xfe, |
| 5425 | 0x43, 0xf4, 0x93, 0xfe, 0xf3, 0x10, 0xf9, 0x01, 0xfe, 0x22, 0x13, 0x1c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5426 | 0x3d, 0xfe, 0x10, 0x13, 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x69, 0xba, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5427 | 0xfe, 0x9c, 0x14, 0xb7, 0x69, 0xfe, 0x1c, 0x10, 0xfe, 0x00, 0x17, 0xfe, |
| 5428 | 0x4d, 0xe4, 0x19, 0xba, 0xfe, 0x9c, 0x14, 0xb7, 0x19, 0x83, 0x60, 0x23, |
| 5429 | 0xfe, 0x4d, 0xf4, 0x00, 0xdf, 0x89, 0x13, 0x06, 0xfe, 0xb4, 0x56, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5430 | 0xc3, 0x58, 0x03, 0x60, 0x13, 0x0b, 0x03, 0x15, 0x06, 0x01, 0x08, 0x26, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5431 | 0xe5, 0x15, 0x0b, 0x01, 0x08, 0x26, 0xe5, 0x15, 0x1a, 0x01, 0x08, 0x26, |
| 5432 | 0xe5, 0x72, 0xfe, 0x89, 0x49, 0x01, 0x08, 0x03, 0x15, 0x06, 0x01, 0x08, |
| 5433 | 0x26, 0xa6, 0x15, 0x1a, 0x01, 0x08, 0x26, 0xa6, 0x15, 0x06, 0x01, 0x08, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5434 | 0x26, 0xa6, 0xfe, 0x89, 0x49, 0x01, 0x08, 0x26, 0xa6, 0x72, 0xfe, 0x89, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5435 | 0x4a, 0x01, 0x08, 0x03, 0x60, 0x03, 0x1e, 0xcc, 0x07, 0x06, 0xfe, 0x44, |
| 5436 | 0x13, 0xad, 0x12, 0xcc, 0xfe, 0x49, 0xf4, 0x00, 0x3b, 0x72, 0x9f, 0x5e, |
| 5437 | 0xfe, 0x01, 0xec, 0xfe, 0x27, 0x01, 0xf1, 0x01, 0x08, 0x2f, 0x07, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5438 | 0xe3, 0x00, 0xfe, 0x20, 0x13, 0x1f, 0xfe, 0x5a, 0x15, 0x23, 0x12, 0xcd, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5439 | 0x01, 0x43, 0x1e, 0xcd, 0x07, 0x06, 0x45, 0x09, 0x4a, 0x06, 0x35, 0x03, |
| 5440 | 0x0a, 0x42, 0x01, 0x0e, 0xed, 0x88, 0x07, 0x10, 0xa4, 0x0a, 0x80, 0x01, |
| 5441 | 0x0e, 0x88, 0x0a, 0x51, 0x01, 0x9e, 0x03, 0x0a, 0x80, 0x01, 0x0e, 0x88, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5442 | 0xfe, 0x80, 0xe7, 0x10, 0x07, 0x10, 0x84, 0xfe, 0x45, 0x58, 0x01, 0xe3, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5443 | 0x88, 0x03, 0x0a, 0x42, 0x01, 0x0e, 0x88, 0x0a, 0x51, 0x01, 0x9e, 0x03, |
| 5444 | 0x0a, 0x42, 0x01, 0x0e, 0xfe, 0x80, 0x80, 0xf2, 0xfe, 0x49, 0xe4, 0x10, |
| 5445 | 0xa4, 0x0a, 0x80, 0x01, 0x0e, 0xf2, 0x0a, 0x51, 0x01, 0x82, 0x03, 0x17, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5446 | 0x10, 0x71, 0x66, 0xfe, 0x60, 0x01, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5447 | 0xfe, 0x24, 0x1c, 0xfe, 0x1d, 0xf7, 0x1d, 0x90, 0xfe, 0xf6, 0x15, 0x01, |
| 5448 | 0xfe, 0xfc, 0x16, 0xe0, 0x91, 0x1d, 0x66, 0xfe, 0x2c, 0x01, 0xfe, 0x2f, |
| 5449 | 0x19, 0x03, 0xae, 0x21, 0xfe, 0xe6, 0x15, 0xfe, 0xda, 0x10, 0x17, 0x10, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5450 | 0x71, 0x05, 0xfe, 0x64, 0x01, 0xfe, 0x00, 0xf4, 0x19, 0xfe, 0x18, 0x58, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5451 | 0x05, 0xfe, 0x66, 0x01, 0xfe, 0x19, 0x58, 0x91, 0x19, 0xfe, 0x3c, 0x90, |
| 5452 | 0xfe, 0x30, 0xf4, 0x06, 0xfe, 0x3c, 0x50, 0x66, 0xfe, 0x38, 0x00, 0xfe, |
| 5453 | 0x0f, 0x79, 0xfe, 0x1c, 0xf7, 0x19, 0x90, 0xfe, 0x40, 0x16, 0xfe, 0xb6, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5454 | 0x14, 0x34, 0x03, 0xae, 0x21, 0xfe, 0x18, 0x16, 0xfe, 0x9c, 0x10, 0x17, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5455 | 0x10, 0x71, 0xfe, 0x83, 0x5a, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, |
| 5456 | 0x1d, 0xf7, 0x38, 0x90, 0xfe, 0x62, 0x16, 0xfe, 0x94, 0x14, 0xfe, 0x10, |
| 5457 | 0x13, 0x91, 0x38, 0x66, 0x1b, 0xfe, 0xaf, 0x19, 0xfe, 0x98, 0xe7, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5458 | 0x03, 0xae, 0x21, 0xfe, 0x56, 0x16, 0xfe, 0x6c, 0x10, 0x17, 0x10, 0x71, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5459 | 0xfe, 0x30, 0xbc, 0xfe, 0xb2, 0xbc, 0x91, 0xc5, 0x66, 0x1b, 0xfe, 0x0f, |
| 5460 | 0x79, 0xfe, 0x1c, 0xf7, 0xc5, 0x90, 0xfe, 0x9a, 0x16, 0xfe, 0x5c, 0x14, |
| 5461 | 0x34, 0x03, 0xae, 0x21, 0xfe, 0x86, 0x16, 0xfe, 0x42, 0x10, 0xfe, 0x02, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5462 | 0xf6, 0x10, 0x71, 0xfe, 0x18, 0xfe, 0x54, 0xfe, 0x19, 0xfe, 0x55, 0xfc, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5463 | 0xfe, 0x1d, 0xf7, 0x4f, 0x90, 0xfe, 0xc0, 0x16, 0xfe, 0x36, 0x14, 0xfe, |
| 5464 | 0x1c, 0x13, 0x91, 0x4f, 0x47, 0xfe, 0x83, 0x58, 0xfe, 0xaf, 0x19, 0xfe, |
| 5465 | 0x80, 0xe7, 0x10, 0xfe, 0x81, 0xe7, 0x10, 0x11, 0xfe, 0xdd, 0x00, 0x63, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5466 | 0x27, 0x03, 0x63, 0x27, 0xfe, 0x12, 0x45, 0x21, 0xfe, 0xb0, 0x16, 0x14, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5467 | 0x06, 0x37, 0x95, 0xa9, 0x02, 0x29, 0xfe, 0x39, 0xf0, 0xfe, 0x04, 0x17, |
| 5468 | 0x23, 0x03, 0xfe, 0x7e, 0x18, 0x1c, 0x1a, 0x5d, 0x13, 0x0d, 0x03, 0x71, |
| 5469 | 0x05, 0xcb, 0x1c, 0x06, 0xfe, 0xef, 0x12, 0xfe, 0xe1, 0x10, 0x78, 0x2c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5470 | 0x46, 0x2f, 0x07, 0x2d, 0xfe, 0x3c, 0x13, 0xfe, 0x82, 0x14, 0xfe, 0x42, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5471 | 0x13, 0x3c, 0x8a, 0x0a, 0x42, 0x01, 0x0e, 0xb0, 0xfe, 0x3e, 0x12, 0xf0, |
| 5472 | 0xfe, 0x45, 0x48, 0x01, 0xe3, 0xfe, 0x00, 0xcc, 0xb0, 0xfe, 0xf3, 0x13, |
| 5473 | 0x3d, 0x75, 0x07, 0x10, 0xa3, 0x0a, 0x80, 0x01, 0x0e, 0xf2, 0x01, 0x6f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5474 | 0xfe, 0x16, 0x10, 0x07, 0x7e, 0x85, 0xfe, 0x40, 0x14, 0xfe, 0x24, 0x12, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5475 | 0xf6, 0xfe, 0xd6, 0xf0, 0xfe, 0x24, 0x17, 0x17, 0x0b, 0x03, 0xfe, 0x9c, |
| 5476 | 0xe7, 0x0b, 0x0f, 0xfe, 0x15, 0x00, 0x59, 0x76, 0x27, 0x01, 0xda, 0x17, |
| 5477 | 0x06, 0x03, 0x3c, 0x8a, 0x09, 0x4a, 0x1d, 0x35, 0x11, 0x2d, 0x01, 0x6f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5478 | 0x17, 0x06, 0x03, 0xfe, 0x38, 0x90, 0xfe, 0xba, 0x90, 0x79, 0xc7, 0x68, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5479 | 0xc8, 0xfe, 0x48, 0x55, 0x34, 0xfe, 0xc9, 0x55, 0x03, 0x1e, 0x98, 0x73, |
| 5480 | 0x12, 0x98, 0x03, 0x0a, 0x99, 0x01, 0x0e, 0xf0, 0x0a, 0x40, 0x01, 0x0e, |
| 5481 | 0xfe, 0x49, 0x44, 0x16, 0xfe, 0xf0, 0x17, 0x73, 0x75, 0x03, 0x0a, 0x42, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5482 | 0x01, 0x0e, 0x07, 0x10, 0x45, 0x0a, 0x51, 0x01, 0x9e, 0x0a, 0x40, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5483 | 0x0e, 0x73, 0x75, 0x03, 0xfe, 0x4e, 0xe4, 0x1a, 0x64, 0xfe, 0x24, 0x18, |
| 5484 | 0x05, 0xfe, 0x90, 0x00, 0xfe, 0x3a, 0x45, 0x5b, 0xfe, 0x4e, 0xe4, 0xc2, |
| 5485 | 0x64, 0xfe, 0x36, 0x18, 0x05, 0xfe, 0x92, 0x00, 0xfe, 0x02, 0xe6, 0x1b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5486 | 0xdc, 0xfe, 0x4e, 0xe4, 0xfe, 0x0b, 0x00, 0x64, 0xfe, 0x48, 0x18, 0x05, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5487 | 0xfe, 0x94, 0x00, 0xfe, 0x02, 0xe6, 0x19, 0xfe, 0x08, 0x10, 0x05, 0xfe, |
| 5488 | 0x96, 0x00, 0xfe, 0x02, 0xe6, 0x2c, 0xfe, 0x4e, 0x45, 0xfe, 0x0c, 0x12, |
| 5489 | 0xaf, 0xff, 0x04, 0x68, 0x54, 0xde, 0x1c, 0x69, 0x03, 0x07, 0x7a, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5490 | 0x5a, 0xf0, 0xfe, 0x74, 0x18, 0x24, 0xfe, 0x09, 0x00, 0xfe, 0x34, 0x10, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5491 | 0x07, 0x1b, 0xfe, 0x5a, 0xf0, 0xfe, 0x82, 0x18, 0x24, 0xc3, 0xfe, 0x26, |
| 5492 | 0x10, 0x07, 0x1a, 0x5d, 0x24, 0x2c, 0xdc, 0x07, 0x0b, 0x5d, 0x24, 0x93, |
| 5493 | 0xfe, 0x0e, 0x10, 0x07, 0x06, 0x5d, 0x24, 0x4d, 0x9f, 0xad, 0x03, 0x14, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5494 | 0xfe, 0x09, 0x00, 0x01, 0x33, 0xfe, 0x04, 0xfe, 0x7d, 0x05, 0x7f, 0xf9, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5495 | 0x03, 0x25, 0xfe, 0xca, 0x18, 0xfe, 0x14, 0xf0, 0x08, 0x65, 0xfe, 0xc6, |
| 5496 | 0x18, 0x03, 0xff, 0x1a, 0x00, 0x00, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5497 | }; |
| 5498 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5499 | static unsigned short _adv_asc3550_size = sizeof(_adv_asc3550_buf); /* 0x13AD */ |
| 5500 | static ADV_DCNT _adv_asc3550_chksum = 0x04D52DDDUL; /* Expanded little-endian checksum. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5501 | |
| 5502 | /* Microcode buffer is kept after initialization for error recovery. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5503 | static unsigned char _adv_asc38C0800_buf[] = { |
| 5504 | 0x00, 0x00, 0x00, 0xf2, 0x00, 0xf0, 0x00, 0xfc, 0x00, 0x16, 0x18, 0xe4, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5505 | 0x01, 0x00, 0x48, 0xe4, 0x18, 0x80, 0x03, 0xf6, 0x02, 0x00, 0xce, 0x19, |
| 5506 | 0x00, 0xfa, 0xff, 0xff, 0x1c, 0x0f, 0x00, 0xf6, 0x9e, 0xe7, 0xff, 0x00, |
| 5507 | 0x82, 0xe7, 0x00, 0xea, 0x01, 0xfa, 0x01, 0xe6, 0x09, 0xe7, 0x55, 0xf0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5508 | 0x01, 0xf6, 0x03, 0x00, 0x04, 0x00, 0x10, 0x00, 0x1e, 0xf0, 0x85, 0xf0, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5509 | 0x18, 0xf4, 0x08, 0x00, 0xbc, 0x00, 0x38, 0x54, 0x00, 0xec, 0xd5, 0xf0, |
| 5510 | 0x82, 0x0d, 0x00, 0xe6, 0x86, 0xf0, 0xb1, 0xf0, 0x98, 0x57, 0x01, 0xfc, |
| 5511 | 0xb4, 0x00, 0xd4, 0x01, 0x0c, 0x1c, 0x3e, 0x1c, 0x3c, 0x00, 0xbb, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5512 | 0x00, 0x10, 0xba, 0x19, 0x02, 0x80, 0x32, 0xf0, 0x7c, 0x0d, 0x02, 0x13, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5513 | 0xba, 0x13, 0x18, 0x40, 0x00, 0x57, 0x01, 0xea, 0x02, 0xfc, 0x03, 0xfc, |
| 5514 | 0x3e, 0x00, 0x6c, 0x01, 0x6e, 0x01, 0x74, 0x01, 0x76, 0x01, 0xb9, 0x54, |
| 5515 | 0x3e, 0x57, 0x00, 0x80, 0x03, 0xe6, 0xb6, 0x00, 0xc0, 0x00, 0x01, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5516 | 0x3e, 0x01, 0x7a, 0x01, 0xca, 0x08, 0xce, 0x10, 0x16, 0x11, 0x04, 0x12, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5517 | 0x08, 0x12, 0x02, 0x4a, 0xbb, 0x55, 0x3c, 0x56, 0x03, 0x58, 0x1b, 0x80, |
| 5518 | 0x30, 0xe4, 0x4b, 0xe4, 0x5d, 0xf0, 0x02, 0xfa, 0x20, 0x00, 0x32, 0x00, |
| 5519 | 0x40, 0x00, 0x80, 0x00, 0x24, 0x01, 0x3c, 0x01, 0x68, 0x01, 0x6a, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5520 | 0x70, 0x01, 0x72, 0x01, 0x78, 0x01, 0x7c, 0x01, 0x62, 0x0a, 0x86, 0x0d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5521 | 0x06, 0x13, 0x4c, 0x1c, 0x04, 0x80, 0x4a, 0xe4, 0x02, 0xee, 0x5b, 0xf0, |
| 5522 | 0x03, 0xf7, 0x0c, 0x00, 0x0f, 0x00, 0x47, 0x00, 0xbe, 0x00, 0x00, 0x01, |
| 5523 | 0x20, 0x11, 0x5c, 0x16, 0x32, 0x1c, 0x38, 0x1c, 0x4e, 0x1c, 0x10, 0x44, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5524 | 0x00, 0x4c, 0x04, 0xea, 0x5c, 0xf0, 0xa7, 0xf0, 0x04, 0xf6, 0x03, 0xfa, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5525 | 0x05, 0x00, 0x34, 0x00, 0x36, 0x00, 0x98, 0x00, 0xcc, 0x00, 0x20, 0x01, |
| 5526 | 0x4e, 0x01, 0x4a, 0x0b, 0x42, 0x0c, 0x12, 0x0f, 0x0c, 0x10, 0x22, 0x11, |
| 5527 | 0x0a, 0x12, 0x04, 0x13, 0x30, 0x1c, 0x02, 0x48, 0x00, 0x4e, 0x42, 0x54, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5528 | 0x44, 0x55, 0xbd, 0x56, 0x06, 0x83, 0x00, 0xdc, 0x05, 0xf0, 0x09, 0xf0, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5529 | 0x59, 0xf0, 0xb8, 0xf0, 0x4b, 0xf4, 0x06, 0xf7, 0x0e, 0xf7, 0x04, 0xfc, |
| 5530 | 0x05, 0xfc, 0x06, 0x00, 0x19, 0x00, 0x33, 0x00, 0x9b, 0x00, 0xa4, 0x00, |
| 5531 | 0xb5, 0x00, 0xba, 0x00, 0xd0, 0x00, 0xe1, 0x00, 0xe7, 0x00, 0xe2, 0x03, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5532 | 0x08, 0x0f, 0x02, 0x10, 0x04, 0x10, 0x0a, 0x10, 0x0a, 0x13, 0x0c, 0x13, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5533 | 0x12, 0x13, 0x24, 0x14, 0x34, 0x14, 0x04, 0x16, 0x08, 0x16, 0xa4, 0x17, |
| 5534 | 0x20, 0x1c, 0x34, 0x1c, 0x36, 0x1c, 0x08, 0x44, 0x38, 0x44, 0x91, 0x44, |
| 5535 | 0x0a, 0x45, 0x48, 0x46, 0x01, 0x48, 0x68, 0x54, 0x3a, 0x55, 0x83, 0x55, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5536 | 0xe5, 0x55, 0xb0, 0x57, 0x01, 0x58, 0x83, 0x59, 0x05, 0xe6, 0x0b, 0xf0, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5537 | 0x0c, 0xf0, 0x04, 0xf8, 0x05, 0xf8, 0x07, 0x00, 0x0a, 0x00, 0x1c, 0x00, |
| 5538 | 0x1e, 0x00, 0x9e, 0x00, 0xa8, 0x00, 0xaa, 0x00, 0xb9, 0x00, 0xe0, 0x00, |
| 5539 | 0x22, 0x01, 0x26, 0x01, 0x79, 0x01, 0x7e, 0x01, 0xc4, 0x01, 0xc6, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5540 | 0x80, 0x02, 0x5e, 0x03, 0xee, 0x04, 0x9a, 0x06, 0xf8, 0x07, 0x62, 0x08, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5541 | 0x68, 0x08, 0x69, 0x08, 0xd6, 0x08, 0xe9, 0x09, 0xfa, 0x0b, 0x2e, 0x0f, |
| 5542 | 0x12, 0x10, 0x1a, 0x10, 0xed, 0x10, 0xf1, 0x10, 0x2a, 0x11, 0x06, 0x12, |
| 5543 | 0x0c, 0x12, 0x3e, 0x12, 0x10, 0x13, 0x16, 0x13, 0x1e, 0x13, 0x46, 0x14, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5544 | 0x76, 0x14, 0x82, 0x14, 0x36, 0x15, 0xca, 0x15, 0x6b, 0x18, 0xbe, 0x18, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5545 | 0xca, 0x18, 0xe6, 0x19, 0x12, 0x1c, 0x46, 0x1c, 0x9c, 0x32, 0x00, 0x40, |
| 5546 | 0x0e, 0x47, 0xfe, 0x9c, 0xf0, 0x2b, 0x02, 0xfe, 0xac, 0x0d, 0xff, 0x10, |
| 5547 | 0x00, 0x00, 0xd7, 0xfe, 0xe8, 0x19, 0x00, 0xd6, 0xfe, 0x84, 0x01, 0xff, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5548 | 0x03, 0x00, 0x00, 0xfe, 0x93, 0x15, 0xfe, 0x0f, 0x05, 0xff, 0x38, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5549 | 0x00, 0xfe, 0x57, 0x24, 0x00, 0xfe, 0x4c, 0x00, 0x5b, 0xff, 0x04, 0x00, |
| 5550 | 0x00, 0x11, 0xff, 0x09, 0x00, 0x00, 0xff, 0x08, 0x01, 0x01, 0xff, 0x08, |
| 5551 | 0xff, 0xff, 0xff, 0x27, 0x00, 0x00, 0xff, 0x10, 0xff, 0xff, 0xff, 0x11, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5552 | 0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, 0x00, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5553 | 0xfe, 0x04, 0xf7, 0xd6, 0x2c, 0x99, 0x0a, 0x01, 0xfe, 0xc2, 0x0f, 0xfe, |
| 5554 | 0x04, 0xf7, 0xd6, 0x99, 0x0a, 0x42, 0x2c, 0xfe, 0x3d, 0xf0, 0xfe, 0x06, |
| 5555 | 0x02, 0xfe, 0x20, 0xf0, 0xa7, 0xfe, 0x91, 0xf0, 0xfe, 0xf4, 0x01, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5556 | 0x90, 0xf0, 0xfe, 0xf4, 0x01, 0xfe, 0x8f, 0xf0, 0xa7, 0x03, 0x5d, 0x4d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5557 | 0x02, 0xfe, 0xc8, 0x0d, 0x01, 0xfe, 0x38, 0x0e, 0xfe, 0xdd, 0x12, 0xfe, |
| 5558 | 0xfc, 0x10, 0xfe, 0x28, 0x1c, 0x03, 0xfe, 0xa6, 0x00, 0xfe, 0xd3, 0x12, |
| 5559 | 0x41, 0x14, 0xfe, 0xa6, 0x00, 0xc2, 0xfe, 0x48, 0xf0, 0xfe, 0x8a, 0x02, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5560 | 0xfe, 0x49, 0xf0, 0xfe, 0xa4, 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xc2, 0x02, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5561 | 0xfe, 0x46, 0xf0, 0xfe, 0x54, 0x02, 0xfe, 0x47, 0xf0, 0xfe, 0x5a, 0x02, |
| 5562 | 0xfe, 0x43, 0xf0, 0xfe, 0x48, 0x02, 0xfe, 0x44, 0xf0, 0xfe, 0x4c, 0x02, |
| 5563 | 0xfe, 0x45, 0xf0, 0xfe, 0x50, 0x02, 0x18, 0x0a, 0xaa, 0x18, 0x06, 0x14, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5564 | 0xa1, 0x02, 0x2b, 0xfe, 0x00, 0x1c, 0xe7, 0xfe, 0x02, 0x1c, 0xe6, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5565 | 0x1e, 0x1c, 0xfe, 0xe9, 0x10, 0x01, 0xfe, 0x18, 0x18, 0xfe, 0xe7, 0x10, |
| 5566 | 0xfe, 0x06, 0xfc, 0xce, 0x09, 0x70, 0x01, 0xa8, 0x02, 0x2b, 0x15, 0x59, |
| 5567 | 0x39, 0xa2, 0x01, 0xfe, 0x58, 0x10, 0x09, 0x70, 0x01, 0x87, 0xfe, 0xbd, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5568 | 0x10, 0x09, 0x70, 0x01, 0x87, 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5569 | 0x58, 0x1c, 0x18, 0x06, 0x14, 0xa1, 0x2c, 0x1c, 0x2b, 0xfe, 0x3d, 0xf0, |
| 5570 | 0xfe, 0x06, 0x02, 0x23, 0xfe, 0x98, 0x02, 0xfe, 0x5a, 0x1c, 0xf8, 0xfe, |
| 5571 | 0x14, 0x1c, 0x15, 0xfe, 0x30, 0x00, 0x39, 0xa2, 0x01, 0xfe, 0x48, 0x10, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5572 | 0x18, 0x06, 0x14, 0xa1, 0x02, 0xd7, 0x22, 0x20, 0x07, 0x11, 0x35, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5573 | 0x69, 0x10, 0x18, 0x06, 0x14, 0xa1, 0xfe, 0x04, 0xec, 0x20, 0x4f, 0x43, |
| 5574 | 0x13, 0x20, 0xfe, 0x05, 0xf6, 0xce, 0x01, 0xfe, 0x4a, 0x17, 0x08, 0x54, |
| 5575 | 0x58, 0x37, 0x12, 0x2f, 0x42, 0x92, 0x01, 0xfe, 0x82, 0x16, 0x02, 0x2b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5576 | 0x09, 0x46, 0x01, 0x0e, 0x07, 0x00, 0x66, 0x01, 0x73, 0xfe, 0x18, 0x10, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5577 | 0xfe, 0x41, 0x58, 0x09, 0xa4, 0x01, 0x0e, 0xfe, 0xc8, 0x54, 0x6b, 0xfe, |
| 5578 | 0x10, 0x03, 0x01, 0xfe, 0x82, 0x16, 0x02, 0x2b, 0x2c, 0x4f, 0xfe, 0x02, |
| 5579 | 0xe8, 0x2a, 0xfe, 0xbf, 0x57, 0xfe, 0x9e, 0x43, 0xfe, 0x77, 0x57, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5580 | 0x27, 0xf0, 0xfe, 0xe0, 0x01, 0xfe, 0x07, 0x4b, 0xfe, 0x20, 0xf0, 0xa7, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5581 | 0xfe, 0x40, 0x1c, 0x1c, 0xd9, 0xfe, 0x26, 0xf0, 0xfe, 0x5a, 0x03, 0xfe, |
| 5582 | 0xa0, 0xf0, 0xfe, 0x48, 0x03, 0xfe, 0x11, 0xf0, 0xa7, 0xfe, 0xef, 0x10, |
| 5583 | 0xfe, 0x9f, 0xf0, 0xfe, 0x68, 0x03, 0xf9, 0x10, 0xfe, 0x11, 0x00, 0x02, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5584 | 0x65, 0x2c, 0xfe, 0x48, 0x1c, 0xf9, 0x08, 0x05, 0x1b, 0xfe, 0x18, 0x13, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5585 | 0x21, 0x22, 0xa3, 0xb7, 0x13, 0xa3, 0x09, 0x46, 0x01, 0x0e, 0xb7, 0x78, |
| 5586 | 0x01, 0xfe, 0xb4, 0x16, 0x12, 0xd1, 0x1c, 0xd9, 0xfe, 0x01, 0xf0, 0xd9, |
| 5587 | 0xfe, 0x82, 0xf0, 0xfe, 0x96, 0x03, 0xfa, 0x12, 0xfe, 0xe4, 0x00, 0x27, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5588 | 0xfe, 0xa8, 0x03, 0x1c, 0x34, 0x1d, 0xfe, 0xb8, 0x03, 0x01, 0x4b, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5589 | 0x06, 0xf0, 0xfe, 0xc8, 0x03, 0x95, 0x86, 0xfe, 0x0a, 0xf0, 0xfe, 0x8a, |
| 5590 | 0x06, 0x02, 0x24, 0x03, 0x70, 0x28, 0x17, 0xfe, 0xfa, 0x04, 0x15, 0x6d, |
| 5591 | 0x01, 0x36, 0x7b, 0xfe, 0x6a, 0x02, 0x02, 0xd8, 0xf9, 0x2c, 0x99, 0x19, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5592 | 0xfe, 0x67, 0x1b, 0xfe, 0xbf, 0x57, 0xfe, 0x77, 0x57, 0xfe, 0x48, 0x1c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5593 | 0x74, 0x01, 0xaf, 0x8c, 0x09, 0x46, 0x01, 0x0e, 0x07, 0x00, 0x17, 0xda, |
| 5594 | 0x09, 0xd1, 0x01, 0x0e, 0x8d, 0x51, 0x64, 0x79, 0x2a, 0x03, 0x70, 0x28, |
| 5595 | 0xfe, 0x10, 0x12, 0x15, 0x6d, 0x01, 0x36, 0x7b, 0xfe, 0x6a, 0x02, 0x02, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5596 | 0xd8, 0xc7, 0x81, 0xc8, 0x83, 0x1c, 0x24, 0x27, 0xfe, 0x40, 0x04, 0x1d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5597 | 0xfe, 0x3c, 0x04, 0x3b, 0xfe, 0xa0, 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x4e, |
| 5598 | 0x12, 0x2d, 0xff, 0x02, 0x00, 0x10, 0x01, 0x0b, 0x1d, 0xfe, 0xe4, 0x04, |
| 5599 | 0x2d, 0x01, 0x0b, 0x1d, 0x24, 0x33, 0x31, 0xde, 0xfe, 0x4c, 0x44, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5600 | 0x4c, 0x12, 0x51, 0xfe, 0x44, 0x48, 0x0f, 0x6f, 0xfe, 0x4c, 0x54, 0x6b, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5601 | 0xda, 0x4f, 0x79, 0x2a, 0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x62, |
| 5602 | 0x13, 0x08, 0x05, 0x1b, 0xfe, 0x2a, 0x13, 0x32, 0x07, 0x82, 0xfe, 0x52, |
| 5603 | 0x13, 0xfe, 0x20, 0x10, 0x0f, 0x6f, 0xfe, 0x4c, 0x54, 0x6b, 0xda, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5604 | 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x40, 0x13, 0x08, 0x05, 0x1b, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5605 | 0x08, 0x13, 0x32, 0x07, 0x82, 0xfe, 0x30, 0x13, 0x08, 0x05, 0x1b, 0xfe, |
| 5606 | 0x1c, 0x12, 0x15, 0x9d, 0x08, 0x05, 0x06, 0x4d, 0x15, 0xfe, 0x0d, 0x00, |
| 5607 | 0x01, 0x36, 0x7b, 0xfe, 0x64, 0x0d, 0x02, 0x24, 0x2d, 0x12, 0xfe, 0xe6, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5608 | 0x00, 0xfe, 0x1c, 0x90, 0xfe, 0x40, 0x5c, 0x04, 0x15, 0x9d, 0x01, 0x36, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5609 | 0x02, 0x2b, 0xfe, 0x42, 0x5b, 0x99, 0x19, 0xfe, 0x46, 0x59, 0xfe, 0xbf, |
| 5610 | 0x57, 0xfe, 0x77, 0x57, 0xfe, 0x87, 0x80, 0xfe, 0x31, 0xe4, 0x5b, 0x08, |
| 5611 | 0x05, 0x0a, 0xfe, 0x84, 0x13, 0xfe, 0x20, 0x80, 0x07, 0x19, 0xfe, 0x7c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5612 | 0x12, 0x53, 0x05, 0x06, 0xfe, 0x6c, 0x13, 0x03, 0xfe, 0xa2, 0x00, 0x28, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5613 | 0x17, 0xfe, 0x90, 0x05, 0xfe, 0x31, 0xe4, 0x5a, 0x53, 0x05, 0x0a, 0xfe, |
| 5614 | 0x56, 0x13, 0x03, 0xfe, 0xa0, 0x00, 0x28, 0xfe, 0x4e, 0x12, 0x67, 0xff, |
| 5615 | 0x02, 0x00, 0x10, 0x27, 0xfe, 0x48, 0x05, 0x1c, 0x34, 0xfe, 0x89, 0x48, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5616 | 0xff, 0x02, 0x00, 0x10, 0x27, 0xfe, 0x56, 0x05, 0x26, 0xfe, 0xa8, 0x05, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5617 | 0x12, 0xfe, 0xe3, 0x00, 0x21, 0x53, 0xfe, 0x4a, 0xf0, 0xfe, 0x76, 0x05, |
| 5618 | 0xfe, 0x49, 0xf0, 0xfe, 0x70, 0x05, 0x88, 0x25, 0xfe, 0x21, 0x00, 0xab, |
| 5619 | 0x25, 0xfe, 0x22, 0x00, 0xaa, 0x25, 0x58, 0xfe, 0x09, 0x48, 0xff, 0x02, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5620 | 0x00, 0x10, 0x27, 0xfe, 0x86, 0x05, 0x26, 0xfe, 0xa8, 0x05, 0xfe, 0xe2, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5621 | 0x08, 0x53, 0x05, 0xcb, 0x4d, 0x01, 0xb0, 0x25, 0x06, 0x13, 0xd3, 0x39, |
| 5622 | 0xfe, 0x27, 0x01, 0x08, 0x05, 0x1b, 0xfe, 0x22, 0x12, 0x41, 0x01, 0xb2, |
| 5623 | 0x15, 0x9d, 0x08, 0x05, 0x06, 0x4d, 0x15, 0xfe, 0x0d, 0x00, 0x01, 0x36, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5624 | 0x7b, 0xfe, 0x64, 0x0d, 0x02, 0x24, 0x03, 0xfe, 0x9c, 0x00, 0x28, 0xeb, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5625 | 0x03, 0x5c, 0x28, 0xfe, 0x36, 0x13, 0x41, 0x01, 0xb2, 0x26, 0xfe, 0x18, |
| 5626 | 0x06, 0x09, 0x06, 0x53, 0x05, 0x1f, 0xfe, 0x02, 0x12, 0x50, 0x01, 0xfe, |
| 5627 | 0x9e, 0x15, 0x1d, 0xfe, 0x0e, 0x06, 0x12, 0xa5, 0x01, 0x4b, 0x12, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5628 | 0xe5, 0x00, 0x03, 0x5c, 0xc1, 0x0c, 0x5c, 0x03, 0xcd, 0x28, 0xfe, 0x62, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5629 | 0x12, 0x03, 0x45, 0x28, 0xfe, 0x5a, 0x13, 0x01, 0xfe, 0x0c, 0x19, 0x01, |
| 5630 | 0xfe, 0x76, 0x19, 0xfe, 0x43, 0x48, 0xc4, 0xcc, 0x0f, 0x71, 0xff, 0x02, |
| 5631 | 0x00, 0x57, 0x52, 0x93, 0x1e, 0x43, 0x8b, 0xc4, 0x6e, 0x41, 0x01, 0xb2, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5632 | 0x26, 0xfe, 0x82, 0x06, 0x53, 0x05, 0x1a, 0xe9, 0x91, 0x09, 0x59, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5633 | 0xfe, 0xcc, 0x15, 0x1d, 0xfe, 0x78, 0x06, 0x12, 0xa5, 0x01, 0x4b, 0x12, |
| 5634 | 0xfe, 0xe5, 0x00, 0x03, 0x45, 0xc1, 0x0c, 0x45, 0x18, 0x06, 0x01, 0xb2, |
| 5635 | 0xfa, 0x76, 0x74, 0x01, 0xaf, 0x8c, 0x12, 0xfe, 0xe2, 0x00, 0x27, 0xdb, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5636 | 0x1c, 0x34, 0xfe, 0x0a, 0xf0, 0xfe, 0xb6, 0x06, 0x94, 0xfe, 0x6c, 0x07, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5637 | 0xfe, 0x06, 0xf0, 0xfe, 0x74, 0x07, 0x95, 0x86, 0x02, 0x24, 0x08, 0x05, |
| 5638 | 0x0a, 0xfe, 0x2e, 0x12, 0x16, 0x19, 0x01, 0x0b, 0x16, 0x00, 0x01, 0x0b, |
| 5639 | 0x16, 0x00, 0x01, 0x0b, 0x16, 0x00, 0x01, 0x0b, 0xfe, 0x99, 0xa4, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5640 | 0x0b, 0x16, 0x00, 0x02, 0xfe, 0x42, 0x08, 0x68, 0x05, 0x1a, 0xfe, 0x38, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5641 | 0x12, 0x08, 0x05, 0x1a, 0xfe, 0x30, 0x13, 0x16, 0xfe, 0x1b, 0x00, 0x01, |
| 5642 | 0x0b, 0x16, 0x00, 0x01, 0x0b, 0x16, 0x00, 0x01, 0x0b, 0x16, 0x00, 0x01, |
| 5643 | 0x0b, 0x16, 0x06, 0x01, 0x0b, 0x16, 0x00, 0x02, 0xe2, 0x6c, 0x58, 0xbe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5644 | 0x50, 0xfe, 0x9a, 0x81, 0x55, 0x1b, 0x7a, 0xfe, 0x42, 0x07, 0x09, 0x1b, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5645 | 0xfe, 0x09, 0x6f, 0xba, 0xfe, 0xca, 0x45, 0xfe, 0x32, 0x12, 0x69, 0x6d, |
| 5646 | 0x8b, 0x6c, 0x7f, 0x27, 0xfe, 0x54, 0x07, 0x1c, 0x34, 0xfe, 0x0a, 0xf0, |
| 5647 | 0xfe, 0x42, 0x07, 0x95, 0x86, 0x94, 0xfe, 0x6c, 0x07, 0x02, 0x24, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5648 | 0x4b, 0x02, 0xdb, 0x16, 0x1f, 0x02, 0xdb, 0xfe, 0x9c, 0xf7, 0xdc, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5649 | 0x2c, 0x90, 0xfe, 0xae, 0x90, 0x56, 0xfe, 0xda, 0x07, 0x0c, 0x60, 0x14, |
| 5650 | 0x61, 0x08, 0x54, 0x5a, 0x37, 0x22, 0x20, 0x07, 0x11, 0xfe, 0x0e, 0x12, |
| 5651 | 0x8d, 0xfe, 0x80, 0x80, 0x39, 0x20, 0x6a, 0x2a, 0xfe, 0x06, 0x10, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5652 | 0x83, 0xe7, 0xfe, 0x48, 0x00, 0xab, 0xfe, 0x03, 0x40, 0x08, 0x54, 0x5b, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5653 | 0x37, 0x01, 0xb3, 0xb8, 0xfe, 0x1f, 0x40, 0x13, 0x62, 0x01, 0xef, 0xfe, |
| 5654 | 0x08, 0x50, 0xfe, 0x8a, 0x50, 0xfe, 0x44, 0x51, 0xfe, 0xc6, 0x51, 0x88, |
| 5655 | 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90, 0x0c, 0x5e, 0x14, 0x5f, 0xfe, 0x0c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5656 | 0x90, 0xfe, 0x8e, 0x90, 0xfe, 0x40, 0x50, 0xfe, 0xc2, 0x50, 0x0c, 0x3d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5657 | 0x14, 0x3e, 0xfe, 0x4a, 0x10, 0x08, 0x05, 0x5a, 0xfe, 0x2a, 0x12, 0xfe, |
| 5658 | 0x2c, 0x90, 0xfe, 0xae, 0x90, 0x0c, 0x60, 0x14, 0x61, 0x08, 0x05, 0x5b, |
| 5659 | 0x8b, 0x01, 0xb3, 0xfe, 0x1f, 0x80, 0x13, 0x62, 0xfe, 0x44, 0x90, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5660 | 0xc6, 0x90, 0x0c, 0x3f, 0x14, 0x40, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5661 | 0x0c, 0x5e, 0x14, 0x5f, 0xfe, 0x40, 0x90, 0xfe, 0xc2, 0x90, 0x0c, 0x3d, |
| 5662 | 0x14, 0x3e, 0x0c, 0x2e, 0x14, 0x3c, 0x21, 0x0c, 0x49, 0x0c, 0x63, 0x08, |
| 5663 | 0x54, 0x1f, 0x37, 0x2c, 0x0f, 0xfe, 0x4e, 0x11, 0x27, 0xdd, 0xfe, 0x9e, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5664 | 0xf0, 0xfe, 0x76, 0x08, 0xbc, 0x17, 0x34, 0x2c, 0x77, 0xe6, 0xc5, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5665 | 0x9a, 0x08, 0xc6, 0xfe, 0xb8, 0x08, 0x94, 0xfe, 0x8e, 0x08, 0xfe, 0x06, |
| 5666 | 0xf0, 0xfe, 0x94, 0x08, 0x95, 0x86, 0x02, 0x24, 0x01, 0x4b, 0xfe, 0xc9, |
| 5667 | 0x10, 0x16, 0x1f, 0xfe, 0xc9, 0x10, 0x68, 0x05, 0x06, 0xfe, 0x10, 0x12, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5668 | 0x68, 0x05, 0x0a, 0x4e, 0x08, 0x05, 0x0a, 0xfe, 0x90, 0x12, 0xfe, 0x2e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5669 | 0x1c, 0x02, 0xfe, 0x18, 0x0b, 0x68, 0x05, 0x06, 0x4e, 0x68, 0x05, 0x0a, |
| 5670 | 0xfe, 0x7a, 0x12, 0xfe, 0x2c, 0x1c, 0xfe, 0xaa, 0xf0, 0xfe, 0xd2, 0x09, |
| 5671 | 0xfe, 0xac, 0xf0, 0xfe, 0x00, 0x09, 0x02, 0xfe, 0xde, 0x09, 0xfe, 0xb7, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5672 | 0xf0, 0xfe, 0xfc, 0x08, 0xfe, 0x02, 0xf6, 0x1a, 0x50, 0xfe, 0x70, 0x18, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5673 | 0xfe, 0xf1, 0x18, 0xfe, 0x40, 0x55, 0xfe, 0xe1, 0x55, 0xfe, 0x10, 0x58, |
| 5674 | 0xfe, 0x91, 0x58, 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0x1c, 0x85, 0xfe, |
| 5675 | 0x8c, 0xf0, 0xfe, 0xfc, 0x08, 0xfe, 0xac, 0xf0, 0xfe, 0xf0, 0x08, 0xb5, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5676 | 0xfe, 0xcb, 0x10, 0xfe, 0xad, 0xf0, 0xfe, 0x0c, 0x09, 0x02, 0xfe, 0x18, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5677 | 0x0b, 0xb6, 0xfe, 0xbf, 0x10, 0xfe, 0x2b, 0xf0, 0x85, 0xf4, 0x1e, 0xfe, |
| 5678 | 0x00, 0xfe, 0xfe, 0x1c, 0x12, 0xc2, 0xfe, 0xd2, 0xf0, 0x85, 0xfe, 0x76, |
| 5679 | 0x18, 0x1e, 0x19, 0x17, 0x85, 0x03, 0xd2, 0x1e, 0x06, 0x17, 0x85, 0xc5, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5680 | 0x4a, 0xc6, 0x4a, 0xb5, 0xb6, 0xfe, 0x89, 0x10, 0x74, 0x67, 0x2d, 0x15, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5681 | 0x9d, 0x01, 0x36, 0x10, 0xfe, 0x35, 0x00, 0xfe, 0x01, 0xf0, 0x65, 0x10, |
| 5682 | 0x80, 0x02, 0x65, 0xfe, 0x98, 0x80, 0xfe, 0x19, 0xe4, 0x0a, 0xfe, 0x1a, |
| 5683 | 0x12, 0x51, 0xfe, 0x19, 0x82, 0xfe, 0x6c, 0x18, 0xfe, 0x44, 0x54, 0xbe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5684 | 0xfe, 0x19, 0x81, 0xfe, 0x74, 0x18, 0x8f, 0x90, 0x17, 0xfe, 0xce, 0x08, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5685 | 0x02, 0x4a, 0x08, 0x05, 0x5a, 0xec, 0x03, 0x2e, 0x29, 0x3c, 0x0c, 0x3f, |
| 5686 | 0x14, 0x40, 0x9b, 0x2e, 0x9c, 0x3c, 0xfe, 0x6c, 0x18, 0xfe, 0xed, 0x18, |
| 5687 | 0xfe, 0x44, 0x54, 0xfe, 0xe5, 0x54, 0x3a, 0x3f, 0x3b, 0x40, 0x03, 0x49, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5688 | 0x29, 0x63, 0x8f, 0xfe, 0xe3, 0x54, 0xfe, 0x74, 0x18, 0xfe, 0xf5, 0x18, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5689 | 0x8f, 0xfe, 0xe3, 0x54, 0x90, 0xc0, 0x56, 0xfe, 0xce, 0x08, 0x02, 0x4a, |
| 5690 | 0xfe, 0x37, 0xf0, 0xfe, 0xda, 0x09, 0xfe, 0x8b, 0xf0, 0xfe, 0x60, 0x09, |
| 5691 | 0x02, 0x4a, 0x08, 0x05, 0x0a, 0x23, 0xfe, 0xfa, 0x0a, 0x3a, 0x49, 0x3b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5692 | 0x63, 0x56, 0xfe, 0x3e, 0x0a, 0x0f, 0xfe, 0xc0, 0x07, 0x41, 0x98, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5693 | 0xad, 0xfe, 0x01, 0x59, 0xfe, 0x52, 0xf0, 0xfe, 0x0c, 0x0a, 0x8f, 0x7a, |
| 5694 | 0xfe, 0x24, 0x0a, 0x3a, 0x49, 0x8f, 0xfe, 0xe3, 0x54, 0x57, 0x49, 0x7d, |
| 5695 | 0x63, 0xfe, 0x14, 0x58, 0xfe, 0x95, 0x58, 0x02, 0x4a, 0x3a, 0x49, 0x3b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5696 | 0x63, 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0xbe, 0x57, 0x49, 0x57, 0x63, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5697 | 0x02, 0x4a, 0x08, 0x05, 0x5a, 0xfe, 0x82, 0x12, 0x08, 0x05, 0x1f, 0xfe, |
| 5698 | 0x66, 0x13, 0x22, 0x62, 0xb7, 0xfe, 0x03, 0xa1, 0xfe, 0x83, 0x80, 0xfe, |
| 5699 | 0xc8, 0x44, 0xfe, 0x2e, 0x13, 0xfe, 0x04, 0x91, 0xfe, 0x86, 0x91, 0x6a, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5700 | 0x2a, 0xfe, 0x40, 0x59, 0xfe, 0xc1, 0x59, 0x56, 0xe0, 0x03, 0x60, 0x29, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5701 | 0x61, 0x0c, 0x7f, 0x14, 0x80, 0x57, 0x60, 0x7d, 0x61, 0x01, 0xb3, 0xb8, |
| 5702 | 0x6a, 0x2a, 0x13, 0x62, 0x9b, 0x2e, 0x9c, 0x3c, 0x3a, 0x3f, 0x3b, 0x40, |
| 5703 | 0x90, 0xc0, 0xfe, 0x04, 0xfa, 0x2e, 0xfe, 0x05, 0xfa, 0x3c, 0x01, 0xef, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5704 | 0xfe, 0x36, 0x10, 0x21, 0x0c, 0x7f, 0x0c, 0x80, 0x3a, 0x3f, 0x3b, 0x40, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5705 | 0xe4, 0x08, 0x05, 0x1f, 0x17, 0xe0, 0x3a, 0x3d, 0x3b, 0x3e, 0x08, 0x05, |
| 5706 | 0xfe, 0xf7, 0x00, 0x37, 0x03, 0x5e, 0x29, 0x5f, 0xfe, 0x10, 0x58, 0xfe, |
| 5707 | 0x91, 0x58, 0x57, 0x49, 0x7d, 0x63, 0x02, 0xfe, 0xf4, 0x09, 0x08, 0x05, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5708 | 0x1f, 0x17, 0xe0, 0x08, 0x05, 0xfe, 0xf7, 0x00, 0x37, 0xbe, 0xfe, 0x19, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5709 | 0x81, 0x50, 0xfe, 0x10, 0x90, 0xfe, 0x92, 0x90, 0xfe, 0xd3, 0x10, 0x32, |
| 5710 | 0x07, 0xa6, 0x17, 0xfe, 0x08, 0x09, 0x12, 0xa6, 0x08, 0x05, 0x0a, 0xfe, |
| 5711 | 0x14, 0x13, 0x03, 0x3d, 0x29, 0x3e, 0x56, 0xfe, 0x08, 0x09, 0xfe, 0x0c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5712 | 0x58, 0xfe, 0x8d, 0x58, 0x02, 0x4a, 0x21, 0x41, 0xfe, 0x19, 0x80, 0xe7, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5713 | 0x08, 0x05, 0x0a, 0xfe, 0x1a, 0x12, 0xfe, 0x6c, 0x19, 0xfe, 0x19, 0x41, |
| 5714 | 0xf4, 0xc2, 0xfe, 0xd1, 0xf0, 0xe2, 0x15, 0x7e, 0x01, 0x36, 0x10, 0xfe, |
| 5715 | 0x44, 0x00, 0xfe, 0x8e, 0x10, 0xfe, 0x6c, 0x19, 0x57, 0x3d, 0xfe, 0xed, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5716 | 0x19, 0x7d, 0x3e, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0xf4, 0x1e, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5717 | 0x00, 0xff, 0x35, 0xfe, 0x74, 0x10, 0xc2, 0xfe, 0xd2, 0xf0, 0xfe, 0xa6, |
| 5718 | 0x0b, 0xfe, 0x76, 0x18, 0x1e, 0x19, 0x8a, 0x03, 0xd2, 0x1e, 0x06, 0xfe, |
| 5719 | 0x08, 0x13, 0x10, 0xfe, 0x16, 0x00, 0x02, 0x65, 0xfe, 0xd1, 0xf0, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5720 | 0xb8, 0x0b, 0x15, 0x7e, 0x01, 0x36, 0x10, 0xfe, 0x17, 0x00, 0xfe, 0x42, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5721 | 0x10, 0xfe, 0xce, 0xf0, 0xfe, 0xbe, 0x0b, 0xfe, 0x3c, 0x10, 0xfe, 0xcd, |
| 5722 | 0xf0, 0xfe, 0xca, 0x0b, 0x10, 0xfe, 0x22, 0x00, 0x02, 0x65, 0xfe, 0xcb, |
| 5723 | 0xf0, 0xfe, 0xd6, 0x0b, 0x10, 0xfe, 0x24, 0x00, 0x02, 0x65, 0xfe, 0xd0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5724 | 0xf0, 0xfe, 0xe0, 0x0b, 0x10, 0x9e, 0xe5, 0xfe, 0xcf, 0xf0, 0xfe, 0xea, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5725 | 0x0b, 0x10, 0x58, 0xfe, 0x10, 0x10, 0xfe, 0xcc, 0xf0, 0xe2, 0x68, 0x05, |
| 5726 | 0x1f, 0x4d, 0x10, 0xfe, 0x12, 0x00, 0x2c, 0x0f, 0xfe, 0x4e, 0x11, 0x27, |
| 5727 | 0xfe, 0x00, 0x0c, 0xfe, 0x9e, 0xf0, 0xfe, 0x14, 0x0c, 0xbc, 0x17, 0x34, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5728 | 0x2c, 0x77, 0xe6, 0xc5, 0x24, 0xc6, 0x24, 0x2c, 0xfa, 0x27, 0xfe, 0x20, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5729 | 0x0c, 0x1c, 0x34, 0x94, 0xfe, 0x3c, 0x0c, 0x95, 0x86, 0xc5, 0xdc, 0xc6, |
| 5730 | 0xdc, 0x02, 0x24, 0x01, 0x4b, 0xfe, 0xdb, 0x10, 0x12, 0xfe, 0xe8, 0x00, |
| 5731 | 0xb5, 0xb6, 0x74, 0xc7, 0x81, 0xc8, 0x83, 0xfe, 0x89, 0xf0, 0x24, 0x33, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5732 | 0x31, 0xe1, 0xc7, 0x81, 0xc8, 0x83, 0x27, 0xfe, 0x66, 0x0c, 0x1d, 0x24, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5733 | 0x33, 0x31, 0xdf, 0xbc, 0x4e, 0x10, 0xfe, 0x42, 0x00, 0x02, 0x65, 0x7c, |
| 5734 | 0x06, 0xfe, 0x81, 0x49, 0x17, 0xfe, 0x2c, 0x0d, 0x08, 0x05, 0x0a, 0xfe, |
| 5735 | 0x44, 0x13, 0x10, 0x00, 0x55, 0x0a, 0xfe, 0x54, 0x12, 0x55, 0xfe, 0x28, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5736 | 0x00, 0x23, 0xfe, 0x9a, 0x0d, 0x09, 0x46, 0x01, 0x0e, 0x07, 0x00, 0x66, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5737 | 0x44, 0xfe, 0x28, 0x00, 0xfe, 0xe2, 0x10, 0x01, 0xf5, 0x01, 0xf6, 0x09, |
| 5738 | 0xa4, 0x01, 0xfe, 0x26, 0x0f, 0x64, 0x12, 0x2f, 0x01, 0x73, 0x02, 0x2b, |
| 5739 | 0x10, 0xfe, 0x44, 0x00, 0x55, 0x0a, 0xe9, 0x44, 0x0a, 0xfe, 0xb4, 0x10, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5740 | 0x01, 0xb0, 0x44, 0x0a, 0xfe, 0xaa, 0x10, 0x01, 0xb0, 0xfe, 0x19, 0x82, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5741 | 0xfe, 0x34, 0x46, 0xac, 0x44, 0x0a, 0x10, 0xfe, 0x43, 0x00, 0xfe, 0x96, |
| 5742 | 0x10, 0x08, 0x54, 0x0a, 0x37, 0x01, 0xf5, 0x01, 0xf6, 0x64, 0x12, 0x2f, |
| 5743 | 0x01, 0x73, 0x99, 0x0a, 0x64, 0x42, 0x92, 0x02, 0xfe, 0x2e, 0x03, 0x08, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5744 | 0x05, 0x0a, 0x8a, 0x44, 0x0a, 0x10, 0x00, 0xfe, 0x5c, 0x10, 0x68, 0x05, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5745 | 0x1a, 0xfe, 0x58, 0x12, 0x08, 0x05, 0x1a, 0xfe, 0x50, 0x13, 0xfe, 0x1c, |
| 5746 | 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x50, 0x0d, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, |
| 5747 | 0xf0, 0xfe, 0x56, 0x0d, 0x08, 0x54, 0x1a, 0x37, 0xfe, 0xa9, 0x10, 0x10, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5748 | 0xfe, 0x15, 0x00, 0xfe, 0x04, 0xe6, 0x0a, 0x50, 0xfe, 0x2e, 0x10, 0x10, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5749 | 0xfe, 0x13, 0x00, 0xfe, 0x10, 0x10, 0x10, 0x6f, 0xab, 0x10, 0xfe, 0x41, |
| 5750 | 0x00, 0xaa, 0x10, 0xfe, 0x24, 0x00, 0x8c, 0xb5, 0xb6, 0x74, 0x03, 0x70, |
| 5751 | 0x28, 0x23, 0xd8, 0x50, 0xfe, 0x04, 0xe6, 0x1a, 0xfe, 0x9d, 0x41, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5752 | 0x1c, 0x42, 0x64, 0x01, 0xe3, 0x02, 0x2b, 0xf8, 0x15, 0x0a, 0x39, 0xa0, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5753 | 0xb4, 0x15, 0xfe, 0x31, 0x00, 0x39, 0xa2, 0x01, 0xfe, 0x48, 0x10, 0x02, |
| 5754 | 0xd7, 0x42, 0xfe, 0x06, 0xec, 0xd0, 0xfc, 0x44, 0x1b, 0xfe, 0xce, 0x45, |
| 5755 | 0x35, 0x42, 0xfe, 0x06, 0xea, 0xd0, 0xfe, 0x47, 0x4b, 0x91, 0xfe, 0x75, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5756 | 0x57, 0x03, 0x5d, 0xfe, 0x98, 0x56, 0xfe, 0x38, 0x12, 0x09, 0x48, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5757 | 0x0e, 0xfe, 0x44, 0x48, 0x4f, 0x08, 0x05, 0x1b, 0xfe, 0x1a, 0x13, 0x09, |
| 5758 | 0x46, 0x01, 0x0e, 0x41, 0xfe, 0x41, 0x58, 0x09, 0xa4, 0x01, 0x0e, 0xfe, |
| 5759 | 0x49, 0x54, 0x96, 0xfe, 0x1e, 0x0e, 0x02, 0xfe, 0x2e, 0x03, 0x09, 0x5d, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5760 | 0xfe, 0xee, 0x14, 0xfc, 0x44, 0x1b, 0xfe, 0xce, 0x45, 0x35, 0x42, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5761 | 0xce, 0x47, 0xfe, 0xad, 0x13, 0x02, 0x2b, 0x22, 0x20, 0x07, 0x11, 0xfe, |
| 5762 | 0x9e, 0x12, 0x21, 0x13, 0x59, 0x13, 0x9f, 0x13, 0xd5, 0x22, 0x2f, 0x41, |
| 5763 | 0x39, 0x2f, 0xbc, 0xad, 0xfe, 0xbc, 0xf0, 0xfe, 0xe0, 0x0e, 0x0f, 0x06, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5764 | 0x13, 0x59, 0x01, 0xfe, 0xda, 0x16, 0x03, 0xfe, 0x38, 0x01, 0x29, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5765 | 0x3a, 0x01, 0x56, 0xfe, 0xe4, 0x0e, 0xfe, 0x02, 0xec, 0xd5, 0x69, 0x00, |
| 5766 | 0x66, 0xfe, 0x04, 0xec, 0x20, 0x4f, 0xfe, 0x05, 0xf6, 0xfe, 0x34, 0x01, |
| 5767 | 0x01, 0xfe, 0x4a, 0x17, 0xfe, 0x08, 0x90, 0xfe, 0x48, 0xf4, 0x0d, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5768 | 0x18, 0x13, 0xba, 0xfe, 0x02, 0xea, 0xd5, 0x69, 0x7e, 0xfe, 0xc5, 0x13, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5769 | 0x15, 0x1a, 0x39, 0xa0, 0xb4, 0xfe, 0x2e, 0x10, 0x03, 0xfe, 0x38, 0x01, |
| 5770 | 0x1e, 0xfe, 0xf0, 0xff, 0x0c, 0xfe, 0x60, 0x01, 0x03, 0xfe, 0x3a, 0x01, |
| 5771 | 0x0c, 0xfe, 0x62, 0x01, 0x43, 0x13, 0x20, 0x25, 0x06, 0x13, 0x2f, 0x12, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5772 | 0x2f, 0x92, 0x0f, 0x06, 0x04, 0x21, 0x04, 0x22, 0x59, 0xfe, 0xf7, 0x12, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5773 | 0x22, 0x9f, 0xb7, 0x13, 0x9f, 0x07, 0x7e, 0xfe, 0x71, 0x13, 0xfe, 0x24, |
| 5774 | 0x1c, 0x15, 0x19, 0x39, 0xa0, 0xb4, 0xfe, 0xd9, 0x10, 0xc3, 0xfe, 0x03, |
| 5775 | 0xdc, 0xfe, 0x73, 0x57, 0xfe, 0x80, 0x5d, 0x04, 0xc3, 0xfe, 0x03, 0xdc, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5776 | 0xfe, 0x5b, 0x57, 0xfe, 0x80, 0x5d, 0x04, 0xfe, 0x03, 0x57, 0xc3, 0x21, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5777 | 0xfe, 0x00, 0xcc, 0x04, 0xfe, 0x03, 0x57, 0xc3, 0x78, 0x04, 0x08, 0x05, |
| 5778 | 0x58, 0xfe, 0x22, 0x13, 0xfe, 0x1c, 0x80, 0x07, 0x06, 0xfe, 0x1a, 0x13, |
| 5779 | 0xfe, 0x1e, 0x80, 0xed, 0xfe, 0x1d, 0x80, 0xae, 0xfe, 0x0c, 0x90, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5780 | 0x0e, 0x13, 0xfe, 0x0e, 0x90, 0xac, 0xfe, 0x3c, 0x90, 0xfe, 0x30, 0xf4, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5781 | 0x0a, 0xfe, 0x3c, 0x50, 0xaa, 0x01, 0xfe, 0x7a, 0x17, 0x32, 0x07, 0x2f, |
| 5782 | 0xad, 0x01, 0xfe, 0xb4, 0x16, 0x08, 0x05, 0x1b, 0x4e, 0x01, 0xf5, 0x01, |
| 5783 | 0xf6, 0x12, 0xfe, 0xe9, 0x00, 0x08, 0x05, 0x58, 0xfe, 0x2c, 0x13, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5784 | 0xfe, 0x0c, 0x17, 0xfe, 0x1e, 0x1c, 0xfe, 0x14, 0x90, 0xfe, 0x96, 0x90, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5785 | 0x0c, 0xfe, 0x64, 0x01, 0x14, 0xfe, 0x66, 0x01, 0x08, 0x05, 0x5b, 0xfe, |
| 5786 | 0x12, 0x12, 0xfe, 0x03, 0x80, 0x8d, 0xfe, 0x01, 0xec, 0x20, 0xfe, 0x80, |
| 5787 | 0x40, 0x13, 0x20, 0x6a, 0x2a, 0x12, 0xcf, 0x64, 0x22, 0x20, 0xfb, 0x79, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5788 | 0x20, 0x04, 0xfe, 0x08, 0x1c, 0x03, 0xfe, 0xac, 0x00, 0xfe, 0x06, 0x58, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5789 | 0x03, 0xfe, 0xae, 0x00, 0xfe, 0x07, 0x58, 0x03, 0xfe, 0xb0, 0x00, 0xfe, |
| 5790 | 0x08, 0x58, 0x03, 0xfe, 0xb2, 0x00, 0xfe, 0x09, 0x58, 0xfe, 0x0a, 0x1c, |
| 5791 | 0x25, 0x6e, 0x13, 0xd0, 0x21, 0x0c, 0x5c, 0x0c, 0x45, 0x0f, 0x46, 0x52, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5792 | 0x50, 0x18, 0x1b, 0xfe, 0x90, 0x4d, 0xfe, 0x91, 0x54, 0x23, 0xfe, 0xfc, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5793 | 0x0f, 0x44, 0x11, 0x0f, 0x48, 0x52, 0x18, 0x58, 0xfe, 0x90, 0x4d, 0xfe, |
| 5794 | 0x91, 0x54, 0x23, 0xe4, 0x25, 0x11, 0x13, 0x20, 0x7c, 0x6f, 0x4f, 0x22, |
| 5795 | 0x20, 0xfb, 0x79, 0x20, 0x12, 0xcf, 0xfe, 0x14, 0x56, 0xfe, 0xd6, 0xf0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5796 | 0xfe, 0x26, 0x10, 0xf8, 0x74, 0xfe, 0x14, 0x1c, 0xfe, 0x10, 0x1c, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5797 | 0x18, 0x1c, 0x04, 0x42, 0xfe, 0x0c, 0x14, 0xfc, 0xfe, 0x07, 0xe6, 0x1b, |
| 5798 | 0xfe, 0xce, 0x47, 0xfe, 0xf5, 0x13, 0x04, 0x01, 0xb0, 0x7c, 0x6f, 0x4f, |
| 5799 | 0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x42, 0x13, 0x32, 0x07, 0x2f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5800 | 0xfe, 0x34, 0x13, 0x09, 0x48, 0x01, 0x0e, 0xbb, 0xfe, 0x36, 0x12, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5801 | 0x41, 0x48, 0xfe, 0x45, 0x48, 0x01, 0xf0, 0xfe, 0x00, 0xcc, 0xbb, 0xfe, |
| 5802 | 0xf3, 0x13, 0x43, 0x78, 0x07, 0x11, 0xac, 0x09, 0x84, 0x01, 0x0e, 0xfe, |
| 5803 | 0x80, 0x5c, 0x01, 0x73, 0xfe, 0x0e, 0x10, 0x07, 0x82, 0x4e, 0xfe, 0x14, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5804 | 0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0x60, 0x10, 0x04, 0xfe, 0x44, 0x58, 0x8d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5805 | 0xfe, 0x01, 0xec, 0xa2, 0xfe, 0x9e, 0x40, 0xfe, 0x9d, 0xe7, 0x00, 0xfe, |
| 5806 | 0x9c, 0xe7, 0x1a, 0x79, 0x2a, 0x01, 0xe3, 0xfe, 0xdd, 0x10, 0x2c, 0xc7, |
| 5807 | 0x81, 0xc8, 0x83, 0x33, 0x31, 0xde, 0x07, 0x1a, 0xfe, 0x48, 0x12, 0x07, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5808 | 0x0a, 0xfe, 0x56, 0x12, 0x07, 0x19, 0xfe, 0x30, 0x12, 0x07, 0xc9, 0x17, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5809 | 0xfe, 0x32, 0x12, 0x07, 0xfe, 0x23, 0x00, 0x17, 0xeb, 0x07, 0x06, 0x17, |
| 5810 | 0xfe, 0x9c, 0x12, 0x07, 0x1f, 0xfe, 0x12, 0x12, 0x07, 0x00, 0x17, 0x24, |
| 5811 | 0x15, 0xc9, 0x01, 0x36, 0xa9, 0x2d, 0x01, 0x0b, 0x94, 0x4b, 0x04, 0x2d, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5812 | 0xdd, 0x09, 0xd1, 0x01, 0xfe, 0x26, 0x0f, 0x12, 0x82, 0x02, 0x2b, 0x2d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5813 | 0x32, 0x07, 0xa6, 0xfe, 0xd9, 0x13, 0x3a, 0x3d, 0x3b, 0x3e, 0x56, 0xfe, |
| 5814 | 0xf0, 0x11, 0x08, 0x05, 0x5a, 0xfe, 0x72, 0x12, 0x9b, 0x2e, 0x9c, 0x3c, |
| 5815 | 0x90, 0xc0, 0x96, 0xfe, 0xba, 0x11, 0x22, 0x62, 0xfe, 0x26, 0x13, 0x03, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5816 | 0x7f, 0x29, 0x80, 0x56, 0xfe, 0x76, 0x0d, 0x0c, 0x60, 0x14, 0x61, 0x21, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5817 | 0x0c, 0x7f, 0x0c, 0x80, 0x01, 0xb3, 0x25, 0x6e, 0x77, 0x13, 0x62, 0x01, |
| 5818 | 0xef, 0x9b, 0x2e, 0x9c, 0x3c, 0xfe, 0x04, 0x55, 0xfe, 0xa5, 0x55, 0xfe, |
| 5819 | 0x04, 0xfa, 0x2e, 0xfe, 0x05, 0xfa, 0x3c, 0xfe, 0x91, 0x10, 0x03, 0x3f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5820 | 0x29, 0x40, 0xfe, 0x40, 0x56, 0xfe, 0xe1, 0x56, 0x0c, 0x3f, 0x14, 0x40, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5821 | 0x88, 0x9b, 0x2e, 0x9c, 0x3c, 0x90, 0xc0, 0x03, 0x5e, 0x29, 0x5f, 0xfe, |
| 5822 | 0x00, 0x56, 0xfe, 0xa1, 0x56, 0x0c, 0x5e, 0x14, 0x5f, 0x08, 0x05, 0x5a, |
| 5823 | 0xfe, 0x1e, 0x12, 0x22, 0x62, 0xfe, 0x1f, 0x40, 0x03, 0x60, 0x29, 0x61, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5824 | 0xfe, 0x2c, 0x50, 0xfe, 0xae, 0x50, 0x03, 0x3f, 0x29, 0x40, 0xfe, 0x44, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5825 | 0x50, 0xfe, 0xc6, 0x50, 0x03, 0x5e, 0x29, 0x5f, 0xfe, 0x08, 0x50, 0xfe, |
| 5826 | 0x8a, 0x50, 0x03, 0x3d, 0x29, 0x3e, 0xfe, 0x40, 0x50, 0xfe, 0xc2, 0x50, |
| 5827 | 0x02, 0x89, 0x25, 0x06, 0x13, 0xd4, 0x02, 0x72, 0x2d, 0x01, 0x0b, 0x1d, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5828 | 0x4c, 0x33, 0x31, 0xde, 0x07, 0x06, 0x23, 0x4c, 0x32, 0x07, 0xa6, 0x23, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5829 | 0x72, 0x01, 0xaf, 0x1e, 0x43, 0x17, 0x4c, 0x08, 0x05, 0x0a, 0xee, 0x3a, |
| 5830 | 0x3d, 0x3b, 0x3e, 0xfe, 0x0a, 0x55, 0x35, 0xfe, 0x8b, 0x55, 0x57, 0x3d, |
| 5831 | 0x7d, 0x3e, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0x02, 0x72, 0xfe, 0x19, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5832 | 0x81, 0xba, 0xfe, 0x19, 0x41, 0x02, 0x72, 0x2d, 0x01, 0x0b, 0x1c, 0x34, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5833 | 0x1d, 0xe8, 0x33, 0x31, 0xe1, 0x55, 0x19, 0xfe, 0xa6, 0x12, 0x55, 0x0a, |
| 5834 | 0x4d, 0x02, 0x4c, 0x01, 0x0b, 0x1c, 0x34, 0x1d, 0xe8, 0x33, 0x31, 0xdf, |
| 5835 | 0x07, 0x19, 0x23, 0x4c, 0x01, 0x0b, 0x1d, 0xe8, 0x33, 0x31, 0xfe, 0xe8, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5836 | 0x09, 0xfe, 0xc2, 0x49, 0x51, 0x03, 0xfe, 0x9c, 0x00, 0x28, 0x8a, 0x53, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5837 | 0x05, 0x1f, 0x35, 0xa9, 0xfe, 0xbb, 0x45, 0x55, 0x00, 0x4e, 0x44, 0x06, |
| 5838 | 0x7c, 0x43, 0xfe, 0xda, 0x14, 0x01, 0xaf, 0x8c, 0xfe, 0x4b, 0x45, 0xee, |
| 5839 | 0x32, 0x07, 0xa5, 0xed, 0x03, 0xcd, 0x28, 0x8a, 0x03, 0x45, 0x28, 0x35, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5840 | 0x67, 0x02, 0x72, 0xfe, 0xc0, 0x5d, 0xfe, 0xf8, 0x14, 0xfe, 0x03, 0x17, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5841 | 0x03, 0x5c, 0xc1, 0x0c, 0x5c, 0x67, 0x2d, 0x01, 0x0b, 0x26, 0x89, 0x01, |
| 5842 | 0xfe, 0x9e, 0x15, 0x02, 0x89, 0x01, 0x0b, 0x1c, 0x34, 0x1d, 0x4c, 0x33, |
| 5843 | 0x31, 0xdf, 0x07, 0x06, 0x23, 0x4c, 0x01, 0xf1, 0xfe, 0x42, 0x58, 0xf1, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5844 | 0xfe, 0xa4, 0x14, 0x8c, 0xfe, 0x4a, 0xf4, 0x0a, 0x17, 0x4c, 0xfe, 0x4a, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5845 | 0xf4, 0x06, 0xea, 0x32, 0x07, 0xa5, 0x8b, 0x02, 0x72, 0x03, 0x45, 0xc1, |
| 5846 | 0x0c, 0x45, 0x67, 0x2d, 0x01, 0x0b, 0x26, 0x89, 0x01, 0xfe, 0xcc, 0x15, |
| 5847 | 0x02, 0x89, 0x0f, 0x06, 0x27, 0xfe, 0xbe, 0x13, 0x26, 0xfe, 0xd4, 0x13, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5848 | 0x76, 0xfe, 0x89, 0x48, 0x01, 0x0b, 0x21, 0x76, 0x04, 0x7b, 0xfe, 0xd0, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5849 | 0x13, 0x1c, 0xfe, 0xd0, 0x13, 0x1d, 0xfe, 0xbe, 0x13, 0x67, 0x2d, 0x01, |
| 5850 | 0x0b, 0xfe, 0xd5, 0x10, 0x0f, 0x71, 0xff, 0x02, 0x00, 0x57, 0x52, 0x93, |
| 5851 | 0x1e, 0xfe, 0xff, 0x7f, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x04, 0x0f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5852 | 0x71, 0xff, 0x02, 0x00, 0x57, 0x52, 0x93, 0x1e, 0x43, 0xfe, 0x30, 0x56, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5853 | 0xfe, 0x00, 0x5c, 0x04, 0x0f, 0x71, 0xff, 0x02, 0x00, 0x57, 0x52, 0x93, |
| 5854 | 0x04, 0x0f, 0x71, 0xff, 0x02, 0x00, 0x57, 0x52, 0x93, 0xfe, 0x0b, 0x58, |
| 5855 | 0x04, 0x09, 0x5c, 0x01, 0x87, 0x09, 0x45, 0x01, 0x87, 0x04, 0xfe, 0x03, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5856 | 0xa1, 0x1e, 0x11, 0xff, 0x03, 0x00, 0x54, 0xfe, 0x00, 0xf4, 0x1f, 0x52, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5857 | 0xfe, 0x00, 0x7d, 0xfe, 0x01, 0x7d, 0xfe, 0x02, 0x7d, 0xfe, 0x03, 0x7c, |
| 5858 | 0x6a, 0x2a, 0x0c, 0x5e, 0x14, 0x5f, 0x57, 0x3f, 0x7d, 0x40, 0x04, 0xdd, |
| 5859 | 0xfe, 0x82, 0x4a, 0xfe, 0xe1, 0x1a, 0xfe, 0x83, 0x5a, 0x8d, 0x04, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5860 | 0xfe, 0x0c, 0x19, 0xfe, 0x42, 0x48, 0x50, 0x51, 0x91, 0x01, 0x0b, 0x1d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5861 | 0xfe, 0x96, 0x15, 0x33, 0x31, 0xe1, 0x01, 0x0b, 0x1d, 0xfe, 0x96, 0x15, |
| 5862 | 0x33, 0x31, 0xfe, 0xe8, 0x0a, 0xfe, 0xc1, 0x59, 0x03, 0xcd, 0x28, 0xfe, |
| 5863 | 0xcc, 0x12, 0x53, 0x05, 0x1a, 0xfe, 0xc4, 0x13, 0x21, 0x69, 0x1a, 0xee, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5864 | 0x55, 0xca, 0x6b, 0xfe, 0xdc, 0x14, 0x4d, 0x0f, 0x06, 0x18, 0xca, 0x7c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5865 | 0x30, 0xfe, 0x78, 0x10, 0xff, 0x02, 0x83, 0x55, 0xab, 0xff, 0x02, 0x83, |
| 5866 | 0x55, 0x69, 0x19, 0xae, 0x98, 0xfe, 0x30, 0x00, 0x96, 0xf2, 0x18, 0x6d, |
| 5867 | 0x0f, 0x06, 0xfe, 0x56, 0x10, 0x69, 0x0a, 0xed, 0x98, 0xfe, 0x64, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5868 | 0x96, 0xf2, 0x09, 0xfe, 0x64, 0x00, 0x18, 0x9e, 0x0f, 0x06, 0xfe, 0x28, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5869 | 0x10, 0x69, 0x06, 0xfe, 0x60, 0x13, 0x98, 0xfe, 0xc8, 0x00, 0x96, 0xf2, |
| 5870 | 0x09, 0xfe, 0xc8, 0x00, 0x18, 0x59, 0x0f, 0x06, 0x88, 0x98, 0xfe, 0x90, |
| 5871 | 0x01, 0x7a, 0xfe, 0x42, 0x15, 0x91, 0xe4, 0xfe, 0x43, 0xf4, 0x9f, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5872 | 0x56, 0xf0, 0xfe, 0x54, 0x15, 0xfe, 0x04, 0xf4, 0x71, 0xfe, 0x43, 0xf4, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5873 | 0x9e, 0xfe, 0xf3, 0x10, 0xfe, 0x40, 0x5c, 0x01, 0xfe, 0x16, 0x14, 0x1e, |
| 5874 | 0x43, 0xec, 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x6e, 0x7a, 0xfe, 0x90, |
| 5875 | 0x15, 0xc4, 0x6e, 0xfe, 0x1c, 0x10, 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5876 | 0xcc, 0x7a, 0xfe, 0x90, 0x15, 0xc4, 0xcc, 0x88, 0x51, 0x21, 0xfe, 0x4d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5877 | 0xf4, 0x00, 0xe9, 0x91, 0x0f, 0x06, 0xfe, 0xb4, 0x56, 0xfe, 0xc3, 0x58, |
| 5878 | 0x04, 0x51, 0x0f, 0x0a, 0x04, 0x16, 0x06, 0x01, 0x0b, 0x26, 0xf3, 0x16, |
| 5879 | 0x0a, 0x01, 0x0b, 0x26, 0xf3, 0x16, 0x19, 0x01, 0x0b, 0x26, 0xf3, 0x76, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5880 | 0xfe, 0x89, 0x49, 0x01, 0x0b, 0x04, 0x16, 0x06, 0x01, 0x0b, 0x26, 0xb1, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5881 | 0x16, 0x19, 0x01, 0x0b, 0x26, 0xb1, 0x16, 0x06, 0x01, 0x0b, 0x26, 0xb1, |
| 5882 | 0xfe, 0x89, 0x49, 0x01, 0x0b, 0x26, 0xb1, 0x76, 0xfe, 0x89, 0x4a, 0x01, |
| 5883 | 0x0b, 0x04, 0x51, 0x04, 0x22, 0xd3, 0x07, 0x06, 0xfe, 0x48, 0x13, 0xb8, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5884 | 0x13, 0xd3, 0xfe, 0x49, 0xf4, 0x00, 0x4d, 0x76, 0xa9, 0x67, 0xfe, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5885 | 0xec, 0xfe, 0x27, 0x01, 0xfe, 0x89, 0x48, 0xff, 0x02, 0x00, 0x10, 0x27, |
| 5886 | 0xfe, 0x2e, 0x16, 0x32, 0x07, 0xfe, 0xe3, 0x00, 0xfe, 0x20, 0x13, 0x1d, |
| 5887 | 0xfe, 0x52, 0x16, 0x21, 0x13, 0xd4, 0x01, 0x4b, 0x22, 0xd4, 0x07, 0x06, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5888 | 0x4e, 0x08, 0x54, 0x06, 0x37, 0x04, 0x09, 0x48, 0x01, 0x0e, 0xfb, 0x8e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5889 | 0x07, 0x11, 0xae, 0x09, 0x84, 0x01, 0x0e, 0x8e, 0x09, 0x5d, 0x01, 0xa8, |
| 5890 | 0x04, 0x09, 0x84, 0x01, 0x0e, 0x8e, 0xfe, 0x80, 0xe7, 0x11, 0x07, 0x11, |
| 5891 | 0x8a, 0xfe, 0x45, 0x58, 0x01, 0xf0, 0x8e, 0x04, 0x09, 0x48, 0x01, 0x0e, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5892 | 0x8e, 0x09, 0x5d, 0x01, 0xa8, 0x04, 0x09, 0x48, 0x01, 0x0e, 0xfe, 0x80, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5893 | 0x80, 0xfe, 0x80, 0x4c, 0xfe, 0x49, 0xe4, 0x11, 0xae, 0x09, 0x84, 0x01, |
| 5894 | 0x0e, 0xfe, 0x80, 0x4c, 0x09, 0x5d, 0x01, 0x87, 0x04, 0x18, 0x11, 0x75, |
| 5895 | 0x6c, 0xfe, 0x60, 0x01, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, 0x24, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5896 | 0x1c, 0xfe, 0x1d, 0xf7, 0x1b, 0x97, 0xfe, 0xee, 0x16, 0x01, 0xfe, 0xf4, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5897 | 0x17, 0xad, 0x9a, 0x1b, 0x6c, 0xfe, 0x2c, 0x01, 0xfe, 0x2f, 0x19, 0x04, |
| 5898 | 0xb9, 0x23, 0xfe, 0xde, 0x16, 0xfe, 0xda, 0x10, 0x18, 0x11, 0x75, 0x03, |
| 5899 | 0xfe, 0x64, 0x01, 0xfe, 0x00, 0xf4, 0x1f, 0xfe, 0x18, 0x58, 0x03, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5900 | 0x66, 0x01, 0xfe, 0x19, 0x58, 0x9a, 0x1f, 0xfe, 0x3c, 0x90, 0xfe, 0x30, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5901 | 0xf4, 0x06, 0xfe, 0x3c, 0x50, 0x6c, 0xfe, 0x38, 0x00, 0xfe, 0x0f, 0x79, |
| 5902 | 0xfe, 0x1c, 0xf7, 0x1f, 0x97, 0xfe, 0x38, 0x17, 0xfe, 0xb6, 0x14, 0x35, |
| 5903 | 0x04, 0xb9, 0x23, 0xfe, 0x10, 0x17, 0xfe, 0x9c, 0x10, 0x18, 0x11, 0x75, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5904 | 0xfe, 0x83, 0x5a, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, 0x1d, 0xf7, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5905 | 0x2e, 0x97, 0xfe, 0x5a, 0x17, 0xfe, 0x94, 0x14, 0xec, 0x9a, 0x2e, 0x6c, |
| 5906 | 0x1a, 0xfe, 0xaf, 0x19, 0xfe, 0x98, 0xe7, 0x00, 0x04, 0xb9, 0x23, 0xfe, |
| 5907 | 0x4e, 0x17, 0xfe, 0x6c, 0x10, 0x18, 0x11, 0x75, 0xfe, 0x30, 0xbc, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5908 | 0xb2, 0xbc, 0x9a, 0xcb, 0x6c, 0x1a, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5909 | 0xcb, 0x97, 0xfe, 0x92, 0x17, 0xfe, 0x5c, 0x14, 0x35, 0x04, 0xb9, 0x23, |
| 5910 | 0xfe, 0x7e, 0x17, 0xfe, 0x42, 0x10, 0xfe, 0x02, 0xf6, 0x11, 0x75, 0xfe, |
| 5911 | 0x18, 0xfe, 0x60, 0xfe, 0x19, 0xfe, 0x61, 0xfe, 0x03, 0xa1, 0xfe, 0x1d, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5912 | 0xf7, 0x5b, 0x97, 0xfe, 0xb8, 0x17, 0xfe, 0x36, 0x14, 0xfe, 0x1c, 0x13, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5913 | 0x9a, 0x5b, 0x41, 0xfe, 0x83, 0x58, 0xfe, 0xaf, 0x19, 0xfe, 0x80, 0xe7, |
| 5914 | 0x11, 0xfe, 0x81, 0xe7, 0x11, 0x12, 0xfe, 0xdd, 0x00, 0x6a, 0x2a, 0x04, |
| 5915 | 0x6a, 0x2a, 0xfe, 0x12, 0x45, 0x23, 0xfe, 0xa8, 0x17, 0x15, 0x06, 0x39, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5916 | 0xa0, 0xb4, 0x02, 0x2b, 0xfe, 0x39, 0xf0, 0xfe, 0xfc, 0x17, 0x21, 0x04, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5917 | 0xfe, 0x7e, 0x18, 0x1e, 0x19, 0x66, 0x0f, 0x0d, 0x04, 0x75, 0x03, 0xd2, |
| 5918 | 0x1e, 0x06, 0xfe, 0xef, 0x12, 0xfe, 0xe1, 0x10, 0x7c, 0x6f, 0x4f, 0x32, |
| 5919 | 0x07, 0x2f, 0xfe, 0x3c, 0x13, 0xf1, 0xfe, 0x42, 0x13, 0x42, 0x92, 0x09, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5920 | 0x48, 0x01, 0x0e, 0xbb, 0xeb, 0xfe, 0x41, 0x48, 0xfe, 0x45, 0x48, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5921 | 0xf0, 0xfe, 0x00, 0xcc, 0xbb, 0xfe, 0xf3, 0x13, 0x43, 0x78, 0x07, 0x11, |
| 5922 | 0xac, 0x09, 0x84, 0x01, 0x0e, 0xfe, 0x80, 0x4c, 0x01, 0x73, 0xfe, 0x16, |
| 5923 | 0x10, 0x07, 0x82, 0x8b, 0xfe, 0x40, 0x14, 0xfe, 0x24, 0x12, 0xfe, 0x14, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5924 | 0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0x1c, 0x18, 0x18, 0x0a, 0x04, 0xfe, 0x9c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5925 | 0xe7, 0x0a, 0x10, 0xfe, 0x15, 0x00, 0x64, 0x79, 0x2a, 0x01, 0xe3, 0x18, |
| 5926 | 0x06, 0x04, 0x42, 0x92, 0x08, 0x54, 0x1b, 0x37, 0x12, 0x2f, 0x01, 0x73, |
| 5927 | 0x18, 0x06, 0x04, 0xfe, 0x38, 0x90, 0xfe, 0xba, 0x90, 0x3a, 0xce, 0x3b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5928 | 0xcf, 0xfe, 0x48, 0x55, 0x35, 0xfe, 0xc9, 0x55, 0x04, 0x22, 0xa3, 0x77, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5929 | 0x13, 0xa3, 0x04, 0x09, 0xa4, 0x01, 0x0e, 0xfe, 0x41, 0x48, 0x09, 0x46, |
| 5930 | 0x01, 0x0e, 0xfe, 0x49, 0x44, 0x17, 0xfe, 0xe8, 0x18, 0x77, 0x78, 0x04, |
| 5931 | 0x09, 0x48, 0x01, 0x0e, 0x07, 0x11, 0x4e, 0x09, 0x5d, 0x01, 0xa8, 0x09, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5932 | 0x46, 0x01, 0x0e, 0x77, 0x78, 0x04, 0xfe, 0x4e, 0xe4, 0x19, 0x6b, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5933 | 0x1c, 0x19, 0x03, 0xfe, 0x90, 0x00, 0xfe, 0x3a, 0x45, 0xfe, 0x2c, 0x10, |
| 5934 | 0xfe, 0x4e, 0xe4, 0xc9, 0x6b, 0xfe, 0x2e, 0x19, 0x03, 0xfe, 0x92, 0x00, |
| 5935 | 0xfe, 0x02, 0xe6, 0x1a, 0xe5, 0xfe, 0x4e, 0xe4, 0xfe, 0x0b, 0x00, 0x6b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5936 | 0xfe, 0x40, 0x19, 0x03, 0xfe, 0x94, 0x00, 0xfe, 0x02, 0xe6, 0x1f, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5937 | 0x08, 0x10, 0x03, 0xfe, 0x96, 0x00, 0xfe, 0x02, 0xe6, 0x6d, 0xfe, 0x4e, |
| 5938 | 0x45, 0xea, 0xba, 0xff, 0x04, 0x68, 0x54, 0xe7, 0x1e, 0x6e, 0xfe, 0x08, |
| 5939 | 0x1c, 0xfe, 0x67, 0x19, 0xfe, 0x0a, 0x1c, 0xfe, 0x1a, 0xf4, 0xfe, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5940 | 0x04, 0xea, 0xfe, 0x48, 0xf4, 0x19, 0x7a, 0xfe, 0x74, 0x19, 0x0f, 0x19, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5941 | 0x04, 0x07, 0x7e, 0xfe, 0x5a, 0xf0, 0xfe, 0x84, 0x19, 0x25, 0xfe, 0x09, |
| 5942 | 0x00, 0xfe, 0x34, 0x10, 0x07, 0x1a, 0xfe, 0x5a, 0xf0, 0xfe, 0x92, 0x19, |
| 5943 | 0x25, 0xca, 0xfe, 0x26, 0x10, 0x07, 0x19, 0x66, 0x25, 0x6d, 0xe5, 0x07, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5944 | 0x0a, 0x66, 0x25, 0x9e, 0xfe, 0x0e, 0x10, 0x07, 0x06, 0x66, 0x25, 0x59, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5945 | 0xa9, 0xb8, 0x04, 0x15, 0xfe, 0x09, 0x00, 0x01, 0x36, 0xfe, 0x04, 0xfe, |
| 5946 | 0x81, 0x03, 0x83, 0xfe, 0x40, 0x5c, 0x04, 0x1c, 0xf7, 0xfe, 0x14, 0xf0, |
| 5947 | 0x0b, 0x27, 0xfe, 0xd6, 0x19, 0x1c, 0xf7, 0x7b, 0xf7, 0xfe, 0x82, 0xf0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5948 | 0xfe, 0xda, 0x19, 0x04, 0xff, 0xcc, 0x00, 0x00, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5949 | }; |
| 5950 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5951 | static unsigned short _adv_asc38C0800_size = sizeof(_adv_asc38C0800_buf); /* 0x14E1 */ |
| 5952 | static ADV_DCNT _adv_asc38C0800_chksum = 0x050D3FD8UL; /* Expanded little-endian checksum. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5953 | |
| 5954 | /* Microcode buffer is kept after initialization for error recovery. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5955 | static unsigned char _adv_asc38C1600_buf[] = { |
| 5956 | 0x00, 0x00, 0x00, 0xf2, 0x00, 0x16, 0x00, 0xfc, 0x00, 0x10, 0x00, 0xf0, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5957 | 0x18, 0xe4, 0x01, 0x00, 0x04, 0x1e, 0x48, 0xe4, 0x03, 0xf6, 0xf7, 0x13, |
| 5958 | 0x2e, 0x1e, 0x02, 0x00, 0x07, 0x17, 0xc0, 0x5f, 0x00, 0xfa, 0xff, 0xff, |
| 5959 | 0x04, 0x00, 0x00, 0xf6, 0x09, 0xe7, 0x82, 0xe7, 0x85, 0xf0, 0x86, 0xf0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5960 | 0x4e, 0x10, 0x9e, 0xe7, 0xff, 0x00, 0x55, 0xf0, 0x01, 0xf6, 0x03, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5961 | 0x98, 0x57, 0x01, 0xe6, 0x00, 0xea, 0x00, 0xec, 0x01, 0xfa, 0x18, 0xf4, |
| 5962 | 0x08, 0x00, 0xf0, 0x1d, 0x38, 0x54, 0x32, 0xf0, 0x10, 0x00, 0xc2, 0x0e, |
| 5963 | 0x1e, 0xf0, 0xd5, 0xf0, 0xbc, 0x00, 0x4b, 0xe4, 0x00, 0xe6, 0xb1, 0xf0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5964 | 0xb4, 0x00, 0x02, 0x13, 0x3e, 0x1c, 0xc8, 0x47, 0x3e, 0x00, 0xd8, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5965 | 0x06, 0x13, 0x0c, 0x1c, 0x5e, 0x1e, 0x00, 0x57, 0xc8, 0x57, 0x01, 0xfc, |
| 5966 | 0xbc, 0x0e, 0xa2, 0x12, 0xb9, 0x54, 0x00, 0x80, 0x62, 0x0a, 0x5a, 0x12, |
| 5967 | 0xc8, 0x15, 0x3e, 0x1e, 0x18, 0x40, 0xbd, 0x56, 0x03, 0xe6, 0x01, 0xea, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5968 | 0x5c, 0xf0, 0x0f, 0x00, 0x20, 0x00, 0x6c, 0x01, 0x6e, 0x01, 0x04, 0x12, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5969 | 0x04, 0x13, 0xbb, 0x55, 0x3c, 0x56, 0x3e, 0x57, 0x03, 0x58, 0x4a, 0xe4, |
| 5970 | 0x40, 0x00, 0xb6, 0x00, 0xbb, 0x00, 0xc0, 0x00, 0x00, 0x01, 0x01, 0x01, |
| 5971 | 0x3e, 0x01, 0x58, 0x0a, 0x44, 0x10, 0x0a, 0x12, 0x4c, 0x1c, 0x4e, 0x1c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5972 | 0x02, 0x4a, 0x30, 0xe4, 0x05, 0xe6, 0x0c, 0x00, 0x3c, 0x00, 0x80, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5973 | 0x24, 0x01, 0x3c, 0x01, 0x68, 0x01, 0x6a, 0x01, 0x70, 0x01, 0x72, 0x01, |
| 5974 | 0x74, 0x01, 0x76, 0x01, 0x78, 0x01, 0x7c, 0x01, 0xc6, 0x0e, 0x0c, 0x10, |
| 5975 | 0xac, 0x12, 0xae, 0x12, 0x16, 0x1a, 0x32, 0x1c, 0x6e, 0x1e, 0x02, 0x48, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5976 | 0x3a, 0x55, 0xc9, 0x57, 0x02, 0xee, 0x5b, 0xf0, 0x03, 0xf7, 0x06, 0xf7, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5977 | 0x03, 0xfc, 0x06, 0x00, 0x1e, 0x00, 0xbe, 0x00, 0xe1, 0x00, 0x0c, 0x12, |
| 5978 | 0x18, 0x1a, 0x70, 0x1a, 0x30, 0x1c, 0x38, 0x1c, 0x10, 0x44, 0x00, 0x4c, |
| 5979 | 0xb0, 0x57, 0x40, 0x5c, 0x4d, 0xe4, 0x04, 0xea, 0x5d, 0xf0, 0xa7, 0xf0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5980 | 0x04, 0xf6, 0x02, 0xfc, 0x05, 0x00, 0x09, 0x00, 0x19, 0x00, 0x32, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5981 | 0x33, 0x00, 0x34, 0x00, 0x36, 0x00, 0x98, 0x00, 0x9e, 0x00, 0xcc, 0x00, |
| 5982 | 0x20, 0x01, 0x4e, 0x01, 0x79, 0x01, 0x3c, 0x09, 0x68, 0x0d, 0x02, 0x10, |
| 5983 | 0x04, 0x10, 0x3a, 0x10, 0x08, 0x12, 0x0a, 0x13, 0x40, 0x16, 0x50, 0x16, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5984 | 0x00, 0x17, 0x4a, 0x19, 0x00, 0x4e, 0x00, 0x54, 0x01, 0x58, 0x00, 0xdc, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5985 | 0x05, 0xf0, 0x09, 0xf0, 0x59, 0xf0, 0xb8, 0xf0, 0x48, 0xf4, 0x0e, 0xf7, |
| 5986 | 0x0a, 0x00, 0x9b, 0x00, 0x9c, 0x00, 0xa4, 0x00, 0xb5, 0x00, 0xba, 0x00, |
| 5987 | 0xd0, 0x00, 0xe7, 0x00, 0xf0, 0x03, 0x69, 0x08, 0xe9, 0x09, 0x5c, 0x0c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5988 | 0xb6, 0x12, 0xbc, 0x19, 0xd8, 0x1b, 0x20, 0x1c, 0x34, 0x1c, 0x36, 0x1c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5989 | 0x42, 0x1d, 0x08, 0x44, 0x38, 0x44, 0x91, 0x44, 0x0a, 0x45, 0x48, 0x46, |
| 5990 | 0x89, 0x48, 0x68, 0x54, 0x83, 0x55, 0x83, 0x59, 0x31, 0xe4, 0x02, 0xe6, |
| 5991 | 0x07, 0xf0, 0x08, 0xf0, 0x0b, 0xf0, 0x0c, 0xf0, 0x4b, 0xf4, 0x04, 0xf8, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5992 | 0x05, 0xf8, 0x02, 0xfa, 0x03, 0xfa, 0x04, 0xfc, 0x05, 0xfc, 0x07, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5993 | 0xa8, 0x00, 0xaa, 0x00, 0xb9, 0x00, 0xe0, 0x00, 0xe5, 0x00, 0x22, 0x01, |
| 5994 | 0x26, 0x01, 0x60, 0x01, 0x7a, 0x01, 0x82, 0x01, 0xc8, 0x01, 0xca, 0x01, |
| 5995 | 0x86, 0x02, 0x6a, 0x03, 0x18, 0x05, 0xb2, 0x07, 0x68, 0x08, 0x10, 0x0d, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 5996 | 0x06, 0x10, 0x0a, 0x10, 0x0e, 0x10, 0x12, 0x10, 0x60, 0x10, 0xed, 0x10, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 5997 | 0xf3, 0x10, 0x06, 0x12, 0x10, 0x12, 0x1e, 0x12, 0x0c, 0x13, 0x0e, 0x13, |
| 5998 | 0x10, 0x13, 0xfe, 0x9c, 0xf0, 0x35, 0x05, 0xfe, 0xec, 0x0e, 0xff, 0x10, |
| 5999 | 0x00, 0x00, 0xe9, 0xfe, 0x34, 0x1f, 0x00, 0xe8, 0xfe, 0x88, 0x01, 0xff, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6000 | 0x03, 0x00, 0x00, 0xfe, 0x93, 0x15, 0xfe, 0x0f, 0x05, 0xff, 0x38, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6001 | 0x00, 0xfe, 0x57, 0x24, 0x00, 0xfe, 0x4c, 0x00, 0x65, 0xff, 0x04, 0x00, |
| 6002 | 0x00, 0x1a, 0xff, 0x09, 0x00, 0x00, 0xff, 0x08, 0x01, 0x01, 0xff, 0x08, |
| 6003 | 0xff, 0xff, 0xff, 0x27, 0x00, 0x00, 0xff, 0x10, 0xff, 0xff, 0xff, 0x13, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6004 | 0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, 0x00, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6005 | 0xfe, 0x04, 0xf7, 0xe8, 0x37, 0x7d, 0x0d, 0x01, 0xfe, 0x4a, 0x11, 0xfe, |
| 6006 | 0x04, 0xf7, 0xe8, 0x7d, 0x0d, 0x51, 0x37, 0xfe, 0x3d, 0xf0, 0xfe, 0x0c, |
| 6007 | 0x02, 0xfe, 0x20, 0xf0, 0xbc, 0xfe, 0x91, 0xf0, 0xfe, 0xf8, 0x01, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6008 | 0x90, 0xf0, 0xfe, 0xf8, 0x01, 0xfe, 0x8f, 0xf0, 0xbc, 0x03, 0x67, 0x4d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6009 | 0x05, 0xfe, 0x08, 0x0f, 0x01, 0xfe, 0x78, 0x0f, 0xfe, 0xdd, 0x12, 0x05, |
| 6010 | 0xfe, 0x0e, 0x03, 0xfe, 0x28, 0x1c, 0x03, 0xfe, 0xa6, 0x00, 0xfe, 0xd1, |
| 6011 | 0x12, 0x3e, 0x22, 0xfe, 0xa6, 0x00, 0xac, 0xfe, 0x48, 0xf0, 0xfe, 0x90, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6012 | 0x02, 0xfe, 0x49, 0xf0, 0xfe, 0xaa, 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xc8, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6013 | 0x02, 0xfe, 0x46, 0xf0, 0xfe, 0x5a, 0x02, 0xfe, 0x47, 0xf0, 0xfe, 0x60, |
| 6014 | 0x02, 0xfe, 0x43, 0xf0, 0xfe, 0x4e, 0x02, 0xfe, 0x44, 0xf0, 0xfe, 0x52, |
| 6015 | 0x02, 0xfe, 0x45, 0xf0, 0xfe, 0x56, 0x02, 0x1c, 0x0d, 0xa2, 0x1c, 0x07, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6016 | 0x22, 0xb7, 0x05, 0x35, 0xfe, 0x00, 0x1c, 0xfe, 0xf1, 0x10, 0xfe, 0x02, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6017 | 0x1c, 0xf5, 0xfe, 0x1e, 0x1c, 0xfe, 0xe9, 0x10, 0x01, 0x5f, 0xfe, 0xe7, |
| 6018 | 0x10, 0xfe, 0x06, 0xfc, 0xde, 0x0a, 0x81, 0x01, 0xa3, 0x05, 0x35, 0x1f, |
| 6019 | 0x95, 0x47, 0xb8, 0x01, 0xfe, 0xe4, 0x11, 0x0a, 0x81, 0x01, 0x5c, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6020 | 0xbd, 0x10, 0x0a, 0x81, 0x01, 0x5c, 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6021 | 0xfe, 0x58, 0x1c, 0x1c, 0x07, 0x22, 0xb7, 0x37, 0x2a, 0x35, 0xfe, 0x3d, |
| 6022 | 0xf0, 0xfe, 0x0c, 0x02, 0x2b, 0xfe, 0x9e, 0x02, 0xfe, 0x5a, 0x1c, 0xfe, |
| 6023 | 0x12, 0x1c, 0xfe, 0x14, 0x1c, 0x1f, 0xfe, 0x30, 0x00, 0x47, 0xb8, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6024 | 0xfe, 0xd4, 0x11, 0x1c, 0x07, 0x22, 0xb7, 0x05, 0xe9, 0x21, 0x2c, 0x09, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6025 | 0x1a, 0x31, 0xfe, 0x69, 0x10, 0x1c, 0x07, 0x22, 0xb7, 0xfe, 0x04, 0xec, |
| 6026 | 0x2c, 0x60, 0x01, 0xfe, 0x1e, 0x1e, 0x20, 0x2c, 0xfe, 0x05, 0xf6, 0xde, |
| 6027 | 0x01, 0xfe, 0x62, 0x1b, 0x01, 0x0c, 0x61, 0x4a, 0x44, 0x15, 0x56, 0x51, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6028 | 0x01, 0xfe, 0x9e, 0x1e, 0x01, 0xfe, 0x96, 0x1a, 0x05, 0x35, 0x0a, 0x57, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6029 | 0x01, 0x18, 0x09, 0x00, 0x36, 0x01, 0x85, 0xfe, 0x18, 0x10, 0xfe, 0x41, |
| 6030 | 0x58, 0x0a, 0xba, 0x01, 0x18, 0xfe, 0xc8, 0x54, 0x7b, 0xfe, 0x1c, 0x03, |
| 6031 | 0x01, 0xfe, 0x96, 0x1a, 0x05, 0x35, 0x37, 0x60, 0xfe, 0x02, 0xe8, 0x30, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6032 | 0xfe, 0xbf, 0x57, 0xfe, 0x9e, 0x43, 0xfe, 0x77, 0x57, 0xfe, 0x27, 0xf0, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6033 | 0xfe, 0xe4, 0x01, 0xfe, 0x07, 0x4b, 0xfe, 0x20, 0xf0, 0xbc, 0xfe, 0x40, |
| 6034 | 0x1c, 0x2a, 0xeb, 0xfe, 0x26, 0xf0, 0xfe, 0x66, 0x03, 0xfe, 0xa0, 0xf0, |
| 6035 | 0xfe, 0x54, 0x03, 0xfe, 0x11, 0xf0, 0xbc, 0xfe, 0xef, 0x10, 0xfe, 0x9f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6036 | 0xf0, 0xfe, 0x74, 0x03, 0xfe, 0x46, 0x1c, 0x19, 0xfe, 0x11, 0x00, 0x05, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6037 | 0x70, 0x37, 0xfe, 0x48, 0x1c, 0xfe, 0x46, 0x1c, 0x01, 0x0c, 0x06, 0x28, |
| 6038 | 0xfe, 0x18, 0x13, 0x26, 0x21, 0xb9, 0xc7, 0x20, 0xb9, 0x0a, 0x57, 0x01, |
| 6039 | 0x18, 0xc7, 0x89, 0x01, 0xfe, 0xc8, 0x1a, 0x15, 0xe1, 0x2a, 0xeb, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6040 | 0x01, 0xf0, 0xeb, 0xfe, 0x82, 0xf0, 0xfe, 0xa4, 0x03, 0xfe, 0x9c, 0x32, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6041 | 0x15, 0xfe, 0xe4, 0x00, 0x2f, 0xfe, 0xb6, 0x03, 0x2a, 0x3c, 0x16, 0xfe, |
| 6042 | 0xc6, 0x03, 0x01, 0x41, 0xfe, 0x06, 0xf0, 0xfe, 0xd6, 0x03, 0xaf, 0xa0, |
| 6043 | 0xfe, 0x0a, 0xf0, 0xfe, 0xa2, 0x07, 0x05, 0x29, 0x03, 0x81, 0x1e, 0x1b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6044 | 0xfe, 0x24, 0x05, 0x1f, 0x63, 0x01, 0x42, 0x8f, 0xfe, 0x70, 0x02, 0x05, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6045 | 0xea, 0xfe, 0x46, 0x1c, 0x37, 0x7d, 0x1d, 0xfe, 0x67, 0x1b, 0xfe, 0xbf, |
| 6046 | 0x57, 0xfe, 0x77, 0x57, 0xfe, 0x48, 0x1c, 0x75, 0x01, 0xa6, 0x86, 0x0a, |
| 6047 | 0x57, 0x01, 0x18, 0x09, 0x00, 0x1b, 0xec, 0x0a, 0xe1, 0x01, 0x18, 0x77, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6048 | 0x50, 0x40, 0x8d, 0x30, 0x03, 0x81, 0x1e, 0xf8, 0x1f, 0x63, 0x01, 0x42, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6049 | 0x8f, 0xfe, 0x70, 0x02, 0x05, 0xea, 0xd7, 0x99, 0xd8, 0x9c, 0x2a, 0x29, |
| 6050 | 0x2f, 0xfe, 0x4e, 0x04, 0x16, 0xfe, 0x4a, 0x04, 0x7e, 0xfe, 0xa0, 0x00, |
| 6051 | 0xfe, 0x9b, 0x57, 0xfe, 0x54, 0x12, 0x32, 0xff, 0x02, 0x00, 0x10, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6052 | 0x08, 0x16, 0xfe, 0x02, 0x05, 0x32, 0x01, 0x08, 0x16, 0x29, 0x27, 0x25, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6053 | 0xee, 0xfe, 0x4c, 0x44, 0xfe, 0x58, 0x12, 0x50, 0xfe, 0x44, 0x48, 0x13, |
| 6054 | 0x34, 0xfe, 0x4c, 0x54, 0x7b, 0xec, 0x60, 0x8d, 0x30, 0x01, 0xfe, 0x4e, |
| 6055 | 0x1e, 0xfe, 0x48, 0x47, 0xfe, 0x7c, 0x13, 0x01, 0x0c, 0x06, 0x28, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6056 | 0x32, 0x13, 0x01, 0x43, 0x09, 0x9b, 0xfe, 0x68, 0x13, 0xfe, 0x26, 0x10, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6057 | 0x13, 0x34, 0xfe, 0x4c, 0x54, 0x7b, 0xec, 0x01, 0xfe, 0x4e, 0x1e, 0xfe, |
| 6058 | 0x48, 0x47, 0xfe, 0x54, 0x13, 0x01, 0x0c, 0x06, 0x28, 0xa5, 0x01, 0x43, |
| 6059 | 0x09, 0x9b, 0xfe, 0x40, 0x13, 0x01, 0x0c, 0x06, 0x28, 0xf9, 0x1f, 0x7f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6060 | 0x01, 0x0c, 0x06, 0x07, 0x4d, 0x1f, 0xfe, 0x0d, 0x00, 0x01, 0x42, 0x8f, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6061 | 0xfe, 0xa4, 0x0e, 0x05, 0x29, 0x32, 0x15, 0xfe, 0xe6, 0x00, 0x0f, 0xfe, |
| 6062 | 0x1c, 0x90, 0x04, 0xfe, 0x9c, 0x93, 0x3a, 0x0b, 0x0e, 0x8b, 0x02, 0x1f, |
| 6063 | 0x7f, 0x01, 0x42, 0x05, 0x35, 0xfe, 0x42, 0x5b, 0x7d, 0x1d, 0xfe, 0x46, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6064 | 0x59, 0xfe, 0xbf, 0x57, 0xfe, 0x77, 0x57, 0x0f, 0xfe, 0x87, 0x80, 0x04, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6065 | 0xfe, 0x87, 0x83, 0xfe, 0xc9, 0x47, 0x0b, 0x0e, 0xd0, 0x65, 0x01, 0x0c, |
| 6066 | 0x06, 0x0d, 0xfe, 0x98, 0x13, 0x0f, 0xfe, 0x20, 0x80, 0x04, 0xfe, 0xa0, |
| 6067 | 0x83, 0x33, 0x0b, 0x0e, 0x09, 0x1d, 0xfe, 0x84, 0x12, 0x01, 0x38, 0x06, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6068 | 0x07, 0xfe, 0x70, 0x13, 0x03, 0xfe, 0xa2, 0x00, 0x1e, 0x1b, 0xfe, 0xda, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6069 | 0x05, 0xd0, 0x54, 0x01, 0x38, 0x06, 0x0d, 0xfe, 0x58, 0x13, 0x03, 0xfe, |
| 6070 | 0xa0, 0x00, 0x1e, 0xfe, 0x50, 0x12, 0x5e, 0xff, 0x02, 0x00, 0x10, 0x2f, |
| 6071 | 0xfe, 0x90, 0x05, 0x2a, 0x3c, 0xcc, 0xff, 0x02, 0x00, 0x10, 0x2f, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6072 | 0x9e, 0x05, 0x17, 0xfe, 0xf4, 0x05, 0x15, 0xfe, 0xe3, 0x00, 0x26, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6073 | 0x38, 0xfe, 0x4a, 0xf0, 0xfe, 0xc0, 0x05, 0xfe, 0x49, 0xf0, 0xfe, 0xba, |
| 6074 | 0x05, 0x71, 0x2e, 0xfe, 0x21, 0x00, 0xf1, 0x2e, 0xfe, 0x22, 0x00, 0xa2, |
| 6075 | 0x2e, 0x4a, 0xfe, 0x09, 0x48, 0xff, 0x02, 0x00, 0x10, 0x2f, 0xfe, 0xd0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6076 | 0x05, 0x17, 0xfe, 0xf4, 0x05, 0xfe, 0xe2, 0x08, 0x01, 0x38, 0x06, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6077 | 0x1c, 0x00, 0x4d, 0x01, 0xa7, 0x2e, 0x07, 0x20, 0xe4, 0x47, 0xfe, 0x27, |
| 6078 | 0x01, 0x01, 0x0c, 0x06, 0x28, 0xfe, 0x24, 0x12, 0x3e, 0x01, 0x84, 0x1f, |
| 6079 | 0x7f, 0x01, 0x0c, 0x06, 0x07, 0x4d, 0x1f, 0xfe, 0x0d, 0x00, 0x01, 0x42, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6080 | 0x8f, 0xfe, 0xa4, 0x0e, 0x05, 0x29, 0x03, 0xe6, 0x1e, 0xfe, 0xca, 0x13, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6081 | 0x03, 0xb6, 0x1e, 0xfe, 0x40, 0x12, 0x03, 0x66, 0x1e, 0xfe, 0x38, 0x13, |
| 6082 | 0x3e, 0x01, 0x84, 0x17, 0xfe, 0x72, 0x06, 0x0a, 0x07, 0x01, 0x38, 0x06, |
| 6083 | 0x24, 0xfe, 0x02, 0x12, 0x4f, 0x01, 0xfe, 0x56, 0x19, 0x16, 0xfe, 0x68, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6084 | 0x06, 0x15, 0x82, 0x01, 0x41, 0x15, 0xe2, 0x03, 0x66, 0x8a, 0x10, 0x66, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6085 | 0x03, 0x9a, 0x1e, 0xfe, 0x70, 0x12, 0x03, 0x55, 0x1e, 0xfe, 0x68, 0x13, |
| 6086 | 0x01, 0xc6, 0x09, 0x12, 0x48, 0xfe, 0x92, 0x06, 0x2e, 0x12, 0x01, 0xfe, |
| 6087 | 0xac, 0x1d, 0xfe, 0x43, 0x48, 0x62, 0x80, 0x13, 0x58, 0xff, 0x02, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6088 | 0x57, 0x52, 0xad, 0x23, 0x3f, 0x4e, 0x62, 0x49, 0x3e, 0x01, 0x84, 0x17, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6089 | 0xfe, 0xea, 0x06, 0x01, 0x38, 0x06, 0x12, 0xf7, 0x45, 0x0a, 0x95, 0x01, |
| 6090 | 0xfe, 0x84, 0x19, 0x16, 0xfe, 0xe0, 0x06, 0x15, 0x82, 0x01, 0x41, 0x15, |
| 6091 | 0xe2, 0x03, 0x55, 0x8a, 0x10, 0x55, 0x1c, 0x07, 0x01, 0x84, 0xfe, 0xae, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6092 | 0x10, 0x03, 0x6f, 0x1e, 0xfe, 0x9e, 0x13, 0x3e, 0x01, 0x84, 0x03, 0x9a, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6093 | 0x1e, 0xfe, 0x1a, 0x12, 0x01, 0x38, 0x06, 0x12, 0xfc, 0x01, 0xc6, 0x01, |
| 6094 | 0xfe, 0xac, 0x1d, 0xfe, 0x43, 0x48, 0x62, 0x80, 0xf0, 0x45, 0x0a, 0x95, |
| 6095 | 0x03, 0xb6, 0x1e, 0xf8, 0x01, 0x38, 0x06, 0x24, 0x36, 0xfe, 0x02, 0xf6, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6096 | 0x07, 0x71, 0x78, 0x8c, 0x00, 0x4d, 0x62, 0x49, 0x3e, 0x2d, 0x93, 0x4e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6097 | 0xd0, 0x0d, 0x17, 0xfe, 0x9a, 0x07, 0x01, 0xfe, 0xc0, 0x19, 0x16, 0xfe, |
| 6098 | 0x90, 0x07, 0x26, 0x20, 0x9e, 0x15, 0x82, 0x01, 0x41, 0x15, 0xe2, 0x21, |
| 6099 | 0x9e, 0x09, 0x07, 0xfb, 0x03, 0xe6, 0xfe, 0x58, 0x57, 0x10, 0xe6, 0x05, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6100 | 0xfe, 0x2a, 0x06, 0x03, 0x6f, 0x8a, 0x10, 0x6f, 0x1c, 0x07, 0x01, 0x84, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6101 | 0xfe, 0x9c, 0x32, 0x5f, 0x75, 0x01, 0xa6, 0x86, 0x15, 0xfe, 0xe2, 0x00, |
| 6102 | 0x2f, 0xed, 0x2a, 0x3c, 0xfe, 0x0a, 0xf0, 0xfe, 0xce, 0x07, 0xae, 0xfe, |
| 6103 | 0x96, 0x08, 0xfe, 0x06, 0xf0, 0xfe, 0x9e, 0x08, 0xaf, 0xa0, 0x05, 0x29, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6104 | 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x2e, 0x12, 0x14, 0x1d, 0x01, 0x08, 0x14, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6105 | 0x00, 0x01, 0x08, 0x14, 0x00, 0x01, 0x08, 0x14, 0x00, 0x01, 0x08, 0xfe, |
| 6106 | 0x99, 0xa4, 0x01, 0x08, 0x14, 0x00, 0x05, 0xfe, 0xc6, 0x09, 0x01, 0x76, |
| 6107 | 0x06, 0x12, 0xfe, 0x3a, 0x12, 0x01, 0x0c, 0x06, 0x12, 0xfe, 0x30, 0x13, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6108 | 0x14, 0xfe, 0x1b, 0x00, 0x01, 0x08, 0x14, 0x00, 0x01, 0x08, 0x14, 0x00, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6109 | 0x01, 0x08, 0x14, 0x00, 0x01, 0x08, 0x14, 0x07, 0x01, 0x08, 0x14, 0x00, |
| 6110 | 0x05, 0xef, 0x7c, 0x4a, 0x78, 0x4f, 0x0f, 0xfe, 0x9a, 0x81, 0x04, 0xfe, |
| 6111 | 0x9a, 0x83, 0xfe, 0xcb, 0x47, 0x0b, 0x0e, 0x2d, 0x28, 0x48, 0xfe, 0x6c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6112 | 0x08, 0x0a, 0x28, 0xfe, 0x09, 0x6f, 0xca, 0xfe, 0xca, 0x45, 0xfe, 0x32, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6113 | 0x12, 0x53, 0x63, 0x4e, 0x7c, 0x97, 0x2f, 0xfe, 0x7e, 0x08, 0x2a, 0x3c, |
| 6114 | 0xfe, 0x0a, 0xf0, 0xfe, 0x6c, 0x08, 0xaf, 0xa0, 0xae, 0xfe, 0x96, 0x08, |
| 6115 | 0x05, 0x29, 0x01, 0x41, 0x05, 0xed, 0x14, 0x24, 0x05, 0xed, 0xfe, 0x9c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6116 | 0xf7, 0x9f, 0x01, 0xfe, 0xae, 0x1e, 0xfe, 0x18, 0x58, 0x01, 0xfe, 0xbe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6117 | 0x1e, 0xfe, 0x99, 0x58, 0xfe, 0x78, 0x18, 0xfe, 0xf9, 0x18, 0x8e, 0xfe, |
| 6118 | 0x16, 0x09, 0x10, 0x6a, 0x22, 0x6b, 0x01, 0x0c, 0x61, 0x54, 0x44, 0x21, |
| 6119 | 0x2c, 0x09, 0x1a, 0xf8, 0x77, 0x01, 0xfe, 0x7e, 0x1e, 0x47, 0x2c, 0x7a, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6120 | 0x30, 0xf0, 0xfe, 0x83, 0xe7, 0xfe, 0x3f, 0x00, 0x71, 0xfe, 0x03, 0x40, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6121 | 0x01, 0x0c, 0x61, 0x65, 0x44, 0x01, 0xc2, 0xc8, 0xfe, 0x1f, 0x40, 0x20, |
| 6122 | 0x6e, 0x01, 0xfe, 0x6a, 0x16, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0xfe, |
| 6123 | 0x44, 0x51, 0xfe, 0xc6, 0x51, 0xfe, 0x10, 0x10, 0x01, 0xfe, 0xce, 0x1e, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6124 | 0x01, 0xfe, 0xde, 0x1e, 0x10, 0x68, 0x22, 0x69, 0x01, 0xfe, 0xee, 0x1e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6125 | 0x01, 0xfe, 0xfe, 0x1e, 0xfe, 0x40, 0x50, 0xfe, 0xc2, 0x50, 0x10, 0x4b, |
| 6126 | 0x22, 0x4c, 0xfe, 0x8a, 0x10, 0x01, 0x0c, 0x06, 0x54, 0xfe, 0x50, 0x12, |
| 6127 | 0x01, 0xfe, 0xae, 0x1e, 0x01, 0xfe, 0xbe, 0x1e, 0x10, 0x6a, 0x22, 0x6b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6128 | 0x01, 0x0c, 0x06, 0x65, 0x4e, 0x01, 0xc2, 0x0f, 0xfe, 0x1f, 0x80, 0x04, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6129 | 0xfe, 0x9f, 0x83, 0x33, 0x0b, 0x0e, 0x20, 0x6e, 0x0f, 0xfe, 0x44, 0x90, |
| 6130 | 0x04, 0xfe, 0xc4, 0x93, 0x3a, 0x0b, 0xfe, 0xc6, 0x90, 0x04, 0xfe, 0xc6, |
| 6131 | 0x93, 0x79, 0x0b, 0x0e, 0x10, 0x6c, 0x22, 0x6d, 0x01, 0xfe, 0xce, 0x1e, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6132 | 0x01, 0xfe, 0xde, 0x1e, 0x10, 0x68, 0x22, 0x69, 0x0f, 0xfe, 0x40, 0x90, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6133 | 0x04, 0xfe, 0xc0, 0x93, 0x3a, 0x0b, 0xfe, 0xc2, 0x90, 0x04, 0xfe, 0xc2, |
| 6134 | 0x93, 0x79, 0x0b, 0x0e, 0x10, 0x4b, 0x22, 0x4c, 0x10, 0x64, 0x22, 0x34, |
| 6135 | 0x01, 0x0c, 0x61, 0x24, 0x44, 0x37, 0x13, 0xfe, 0x4e, 0x11, 0x2f, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6136 | 0xde, 0x09, 0xfe, 0x9e, 0xf0, 0xfe, 0xf2, 0x09, 0xfe, 0x01, 0x48, 0x1b, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6137 | 0x3c, 0x37, 0x88, 0xf5, 0xd4, 0xfe, 0x1e, 0x0a, 0xd5, 0xfe, 0x42, 0x0a, |
| 6138 | 0xd2, 0xfe, 0x1e, 0x0a, 0xd3, 0xfe, 0x42, 0x0a, 0xae, 0xfe, 0x12, 0x0a, |
| 6139 | 0xfe, 0x06, 0xf0, 0xfe, 0x18, 0x0a, 0xaf, 0xa0, 0x05, 0x29, 0x01, 0x41, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6140 | 0xfe, 0xc1, 0x10, 0x14, 0x24, 0xfe, 0xc1, 0x10, 0x01, 0x76, 0x06, 0x07, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6141 | 0xfe, 0x14, 0x12, 0x01, 0x76, 0x06, 0x0d, 0x5d, 0x01, 0x0c, 0x06, 0x0d, |
| 6142 | 0xfe, 0x74, 0x12, 0xfe, 0x2e, 0x1c, 0x05, 0xfe, 0x1a, 0x0c, 0x01, 0x76, |
| 6143 | 0x06, 0x07, 0x5d, 0x01, 0x76, 0x06, 0x0d, 0x41, 0xfe, 0x2c, 0x1c, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6144 | 0xaa, 0xf0, 0xfe, 0xce, 0x0a, 0xfe, 0xac, 0xf0, 0xfe, 0x66, 0x0a, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6145 | 0x92, 0x10, 0xc4, 0xf6, 0xfe, 0xad, 0xf0, 0xfe, 0x72, 0x0a, 0x05, 0xfe, |
| 6146 | 0x1a, 0x0c, 0xc5, 0xfe, 0xe7, 0x10, 0xfe, 0x2b, 0xf0, 0xbf, 0xfe, 0x6b, |
| 6147 | 0x18, 0x23, 0xfe, 0x00, 0xfe, 0xfe, 0x1c, 0x12, 0xac, 0xfe, 0xd2, 0xf0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6148 | 0xbf, 0xfe, 0x76, 0x18, 0x23, 0x1d, 0x1b, 0xbf, 0x03, 0xe3, 0x23, 0x07, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6149 | 0x1b, 0xbf, 0xd4, 0x5b, 0xd5, 0x5b, 0xd2, 0x5b, 0xd3, 0x5b, 0xc4, 0xc5, |
| 6150 | 0xfe, 0xa9, 0x10, 0x75, 0x5e, 0x32, 0x1f, 0x7f, 0x01, 0x42, 0x19, 0xfe, |
| 6151 | 0x35, 0x00, 0xfe, 0x01, 0xf0, 0x70, 0x19, 0x98, 0x05, 0x70, 0xfe, 0x74, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6152 | 0x18, 0x23, 0xfe, 0x00, 0xf8, 0x1b, 0x5b, 0x7d, 0x12, 0x01, 0xfe, 0x78, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6153 | 0x0f, 0x4d, 0x01, 0xfe, 0x96, 0x1a, 0x21, 0x30, 0x77, 0x7d, 0x1d, 0x05, |
| 6154 | 0x5b, 0x01, 0x0c, 0x06, 0x0d, 0x2b, 0xfe, 0xe2, 0x0b, 0x01, 0x0c, 0x06, |
| 6155 | 0x54, 0xfe, 0xa6, 0x12, 0x01, 0x0c, 0x06, 0x24, 0xfe, 0x88, 0x13, 0x21, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6156 | 0x6e, 0xc7, 0x01, 0xfe, 0x1e, 0x1f, 0x0f, 0xfe, 0x83, 0x80, 0x04, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6157 | 0x83, 0x83, 0xfe, 0xc9, 0x47, 0x0b, 0x0e, 0xfe, 0xc8, 0x44, 0xfe, 0x42, |
| 6158 | 0x13, 0x0f, 0xfe, 0x04, 0x91, 0x04, 0xfe, 0x84, 0x93, 0xfe, 0xca, 0x57, |
| 6159 | 0x0b, 0xfe, 0x86, 0x91, 0x04, 0xfe, 0x86, 0x93, 0xfe, 0xcb, 0x57, 0x0b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6160 | 0x0e, 0x7a, 0x30, 0xfe, 0x40, 0x59, 0xfe, 0xc1, 0x59, 0x8e, 0x40, 0x03, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6161 | 0x6a, 0x3b, 0x6b, 0x10, 0x97, 0x22, 0x98, 0xd9, 0x6a, 0xda, 0x6b, 0x01, |
| 6162 | 0xc2, 0xc8, 0x7a, 0x30, 0x20, 0x6e, 0xdb, 0x64, 0xdc, 0x34, 0x91, 0x6c, |
| 6163 | 0x7e, 0x6d, 0xfe, 0x44, 0x55, 0xfe, 0xe5, 0x55, 0xfe, 0x04, 0xfa, 0x64, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6164 | 0xfe, 0x05, 0xfa, 0x34, 0x01, 0xfe, 0x6a, 0x16, 0xa3, 0x26, 0x10, 0x97, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6165 | 0x10, 0x98, 0x91, 0x6c, 0x7e, 0x6d, 0xfe, 0x14, 0x10, 0x01, 0x0c, 0x06, |
| 6166 | 0x24, 0x1b, 0x40, 0x91, 0x4b, 0x7e, 0x4c, 0x01, 0x0c, 0x06, 0xfe, 0xf7, |
| 6167 | 0x00, 0x44, 0x03, 0x68, 0x3b, 0x69, 0xfe, 0x10, 0x58, 0xfe, 0x91, 0x58, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6168 | 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0x05, 0x5b, 0x01, 0x0c, 0x06, 0x24, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6169 | 0x1b, 0x40, 0x01, 0x0c, 0x06, 0xfe, 0xf7, 0x00, 0x44, 0x78, 0x01, 0xfe, |
| 6170 | 0x8e, 0x1e, 0x4f, 0x0f, 0xfe, 0x10, 0x90, 0x04, 0xfe, 0x90, 0x93, 0x3a, |
| 6171 | 0x0b, 0xfe, 0x92, 0x90, 0x04, 0xfe, 0x92, 0x93, 0x79, 0x0b, 0x0e, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6172 | 0xbd, 0x10, 0x01, 0x43, 0x09, 0xbb, 0x1b, 0xfe, 0x6e, 0x0a, 0x15, 0xbb, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6173 | 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x14, 0x13, 0x03, 0x4b, 0x3b, 0x4c, 0x8e, |
| 6174 | 0xfe, 0x6e, 0x0a, 0xfe, 0x0c, 0x58, 0xfe, 0x8d, 0x58, 0x05, 0x5b, 0x26, |
| 6175 | 0x3e, 0x0f, 0xfe, 0x19, 0x80, 0x04, 0xfe, 0x99, 0x83, 0x33, 0x0b, 0x0e, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6176 | 0xfe, 0xe5, 0x10, 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x1a, 0x12, 0xfe, 0x6c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6177 | 0x19, 0xfe, 0x19, 0x41, 0xfe, 0x6b, 0x18, 0xac, 0xfe, 0xd1, 0xf0, 0xef, |
| 6178 | 0x1f, 0x92, 0x01, 0x42, 0x19, 0xfe, 0x44, 0x00, 0xfe, 0x90, 0x10, 0xfe, |
| 6179 | 0x6c, 0x19, 0xd9, 0x4b, 0xfe, 0xed, 0x19, 0xda, 0x4c, 0xfe, 0x0c, 0x51, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6180 | 0xfe, 0x8e, 0x51, 0xfe, 0x6b, 0x18, 0x23, 0xfe, 0x00, 0xff, 0x31, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6181 | 0x76, 0x10, 0xac, 0xfe, 0xd2, 0xf0, 0xfe, 0xba, 0x0c, 0xfe, 0x76, 0x18, |
| 6182 | 0x23, 0x1d, 0x5d, 0x03, 0xe3, 0x23, 0x07, 0xfe, 0x08, 0x13, 0x19, 0xfe, |
| 6183 | 0x16, 0x00, 0x05, 0x70, 0xfe, 0xd1, 0xf0, 0xfe, 0xcc, 0x0c, 0x1f, 0x92, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6184 | 0x01, 0x42, 0x19, 0xfe, 0x17, 0x00, 0x5c, 0xfe, 0xce, 0xf0, 0xfe, 0xd2, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6185 | 0x0c, 0xfe, 0x3e, 0x10, 0xfe, 0xcd, 0xf0, 0xfe, 0xde, 0x0c, 0x19, 0xfe, |
| 6186 | 0x22, 0x00, 0x05, 0x70, 0xfe, 0xcb, 0xf0, 0xfe, 0xea, 0x0c, 0x19, 0xfe, |
| 6187 | 0x24, 0x00, 0x05, 0x70, 0xfe, 0xd0, 0xf0, 0xfe, 0xf4, 0x0c, 0x19, 0x94, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6188 | 0xfe, 0x1c, 0x10, 0xfe, 0xcf, 0xf0, 0xfe, 0xfe, 0x0c, 0x19, 0x4a, 0xf3, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6189 | 0xfe, 0xcc, 0xf0, 0xef, 0x01, 0x76, 0x06, 0x24, 0x4d, 0x19, 0xfe, 0x12, |
| 6190 | 0x00, 0x37, 0x13, 0xfe, 0x4e, 0x11, 0x2f, 0xfe, 0x16, 0x0d, 0xfe, 0x9e, |
| 6191 | 0xf0, 0xfe, 0x2a, 0x0d, 0xfe, 0x01, 0x48, 0x1b, 0x3c, 0x37, 0x88, 0xf5, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6192 | 0xd4, 0x29, 0xd5, 0x29, 0xd2, 0x29, 0xd3, 0x29, 0x37, 0xfe, 0x9c, 0x32, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6193 | 0x2f, 0xfe, 0x3e, 0x0d, 0x2a, 0x3c, 0xae, 0xfe, 0x62, 0x0d, 0xaf, 0xa0, |
| 6194 | 0xd4, 0x9f, 0xd5, 0x9f, 0xd2, 0x9f, 0xd3, 0x9f, 0x05, 0x29, 0x01, 0x41, |
| 6195 | 0xfe, 0xd3, 0x10, 0x15, 0xfe, 0xe8, 0x00, 0xc4, 0xc5, 0x75, 0xd7, 0x99, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6196 | 0xd8, 0x9c, 0xfe, 0x89, 0xf0, 0x29, 0x27, 0x25, 0xbe, 0xd7, 0x99, 0xd8, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6197 | 0x9c, 0x2f, 0xfe, 0x8c, 0x0d, 0x16, 0x29, 0x27, 0x25, 0xbd, 0xfe, 0x01, |
| 6198 | 0x48, 0xa4, 0x19, 0xfe, 0x42, 0x00, 0x05, 0x70, 0x90, 0x07, 0xfe, 0x81, |
| 6199 | 0x49, 0x1b, 0xfe, 0x64, 0x0e, 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x44, 0x13, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6200 | 0x19, 0x00, 0x2d, 0x0d, 0xfe, 0x54, 0x12, 0x2d, 0xfe, 0x28, 0x00, 0x2b, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6201 | 0xfe, 0xda, 0x0e, 0x0a, 0x57, 0x01, 0x18, 0x09, 0x00, 0x36, 0x46, 0xfe, |
| 6202 | 0x28, 0x00, 0xfe, 0xfa, 0x10, 0x01, 0xfe, 0xf4, 0x1c, 0x01, 0xfe, 0x00, |
| 6203 | 0x1d, 0x0a, 0xba, 0x01, 0xfe, 0x58, 0x10, 0x40, 0x15, 0x56, 0x01, 0x85, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6204 | 0x05, 0x35, 0x19, 0xfe, 0x44, 0x00, 0x2d, 0x0d, 0xf7, 0x46, 0x0d, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6205 | 0xcc, 0x10, 0x01, 0xa7, 0x46, 0x0d, 0xfe, 0xc2, 0x10, 0x01, 0xa7, 0x0f, |
| 6206 | 0xfe, 0x19, 0x82, 0x04, 0xfe, 0x99, 0x83, 0xfe, 0xcc, 0x47, 0x0b, 0x0e, |
| 6207 | 0xfe, 0x34, 0x46, 0xa5, 0x46, 0x0d, 0x19, 0xfe, 0x43, 0x00, 0xfe, 0xa2, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6208 | 0x10, 0x01, 0x0c, 0x61, 0x0d, 0x44, 0x01, 0xfe, 0xf4, 0x1c, 0x01, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6209 | 0x00, 0x1d, 0x40, 0x15, 0x56, 0x01, 0x85, 0x7d, 0x0d, 0x40, 0x51, 0x01, |
| 6210 | 0xfe, 0x9e, 0x1e, 0x05, 0xfe, 0x3a, 0x03, 0x01, 0x0c, 0x06, 0x0d, 0x5d, |
| 6211 | 0x46, 0x0d, 0x19, 0x00, 0xfe, 0x62, 0x10, 0x01, 0x76, 0x06, 0x12, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6212 | 0x5c, 0x12, 0x01, 0x0c, 0x06, 0x12, 0xfe, 0x52, 0x13, 0xfe, 0x1c, 0x1c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6213 | 0xfe, 0x9d, 0xf0, 0xfe, 0x8e, 0x0e, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, |
| 6214 | 0xfe, 0x94, 0x0e, 0x01, 0x0c, 0x61, 0x12, 0x44, 0xfe, 0x9f, 0x10, 0x19, |
| 6215 | 0xfe, 0x15, 0x00, 0xfe, 0x04, 0xe6, 0x0d, 0x4f, 0xfe, 0x2e, 0x10, 0x19, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6216 | 0xfe, 0x13, 0x00, 0xfe, 0x10, 0x10, 0x19, 0xfe, 0x47, 0x00, 0xf1, 0x19, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6217 | 0xfe, 0x41, 0x00, 0xa2, 0x19, 0xfe, 0x24, 0x00, 0x86, 0xc4, 0xc5, 0x75, |
| 6218 | 0x03, 0x81, 0x1e, 0x2b, 0xea, 0x4f, 0xfe, 0x04, 0xe6, 0x12, 0xfe, 0x9d, |
| 6219 | 0x41, 0xfe, 0x1c, 0x42, 0x40, 0x01, 0xf4, 0x05, 0x35, 0xfe, 0x12, 0x1c, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6220 | 0x1f, 0x0d, 0x47, 0xb5, 0xc3, 0x1f, 0xfe, 0x31, 0x00, 0x47, 0xb8, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6221 | 0xfe, 0xd4, 0x11, 0x05, 0xe9, 0x51, 0xfe, 0x06, 0xec, 0xe0, 0xfe, 0x0e, |
| 6222 | 0x47, 0x46, 0x28, 0xfe, 0xce, 0x45, 0x31, 0x51, 0xfe, 0x06, 0xea, 0xe0, |
| 6223 | 0xfe, 0x47, 0x4b, 0x45, 0xfe, 0x75, 0x57, 0x03, 0x67, 0xfe, 0x98, 0x56, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6224 | 0xfe, 0x38, 0x12, 0x0a, 0x5a, 0x01, 0x18, 0xfe, 0x44, 0x48, 0x60, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6225 | 0x0c, 0x06, 0x28, 0xfe, 0x18, 0x13, 0x0a, 0x57, 0x01, 0x18, 0x3e, 0xfe, |
| 6226 | 0x41, 0x58, 0x0a, 0xba, 0xfe, 0xfa, 0x14, 0xfe, 0x49, 0x54, 0xb0, 0xfe, |
| 6227 | 0x5e, 0x0f, 0x05, 0xfe, 0x3a, 0x03, 0x0a, 0x67, 0xfe, 0xe0, 0x14, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6228 | 0x0e, 0x47, 0x46, 0x28, 0xfe, 0xce, 0x45, 0x31, 0x51, 0xfe, 0xce, 0x47, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6229 | 0xfe, 0xad, 0x13, 0x05, 0x35, 0x21, 0x2c, 0x09, 0x1a, 0xfe, 0x98, 0x12, |
| 6230 | 0x26, 0x20, 0x96, 0x20, 0xe7, 0xfe, 0x08, 0x1c, 0xfe, 0x7c, 0x19, 0xfe, |
| 6231 | 0xfd, 0x19, 0xfe, 0x0a, 0x1c, 0x03, 0xe5, 0xfe, 0x48, 0x55, 0xa5, 0x3b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6232 | 0xfe, 0x62, 0x01, 0xfe, 0xc9, 0x55, 0x31, 0xfe, 0x74, 0x10, 0x01, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6233 | 0xf0, 0x1a, 0x03, 0xfe, 0x38, 0x01, 0x3b, 0xfe, 0x3a, 0x01, 0x8e, 0xfe, |
| 6234 | 0x1e, 0x10, 0xfe, 0x02, 0xec, 0xe7, 0x53, 0x00, 0x36, 0xfe, 0x04, 0xec, |
| 6235 | 0x2c, 0x60, 0xfe, 0x05, 0xf6, 0xfe, 0x34, 0x01, 0x01, 0xfe, 0x62, 0x1b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6236 | 0x01, 0xfe, 0xce, 0x1e, 0xb2, 0x11, 0xfe, 0x18, 0x13, 0xca, 0xfe, 0x02, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6237 | 0xea, 0xe7, 0x53, 0x92, 0xfe, 0xc3, 0x13, 0x1f, 0x12, 0x47, 0xb5, 0xc3, |
| 6238 | 0xfe, 0x2a, 0x10, 0x03, 0xfe, 0x38, 0x01, 0x23, 0xfe, 0xf0, 0xff, 0x10, |
| 6239 | 0xe5, 0x03, 0xfe, 0x3a, 0x01, 0x10, 0xfe, 0x62, 0x01, 0x01, 0xfe, 0x1e, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6240 | 0x1e, 0x20, 0x2c, 0x15, 0x56, 0x01, 0xfe, 0x9e, 0x1e, 0x13, 0x07, 0x02, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6241 | 0x26, 0x02, 0x21, 0x96, 0xc7, 0x20, 0x96, 0x09, 0x92, 0xfe, 0x79, 0x13, |
| 6242 | 0x1f, 0x1d, 0x47, 0xb5, 0xc3, 0xfe, 0xe1, 0x10, 0xcf, 0xfe, 0x03, 0xdc, |
| 6243 | 0xfe, 0x73, 0x57, 0xfe, 0x80, 0x5d, 0x02, 0xcf, 0xfe, 0x03, 0xdc, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6244 | 0x5b, 0x57, 0xfe, 0x80, 0x5d, 0x02, 0xfe, 0x03, 0x57, 0xcf, 0x26, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6245 | 0x00, 0xcc, 0x02, 0xfe, 0x03, 0x57, 0xcf, 0x89, 0x02, 0x01, 0x0c, 0x06, |
| 6246 | 0x4a, 0xfe, 0x4e, 0x13, 0x0f, 0xfe, 0x1c, 0x80, 0x04, 0xfe, 0x9c, 0x83, |
| 6247 | 0x33, 0x0b, 0x0e, 0x09, 0x07, 0xfe, 0x3a, 0x13, 0x0f, 0xfe, 0x1e, 0x80, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6248 | 0x04, 0xfe, 0x9e, 0x83, 0x33, 0x0b, 0x0e, 0xfe, 0x2a, 0x13, 0x0f, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6249 | 0x1d, 0x80, 0x04, 0xfe, 0x9d, 0x83, 0xfe, 0xf9, 0x13, 0x0e, 0xfe, 0x1c, |
| 6250 | 0x13, 0x01, 0xfe, 0xee, 0x1e, 0xac, 0xfe, 0x14, 0x13, 0x01, 0xfe, 0xfe, |
| 6251 | 0x1e, 0xfe, 0x81, 0x58, 0xfa, 0x01, 0xfe, 0x0e, 0x1f, 0xfe, 0x30, 0xf4, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6252 | 0x0d, 0xfe, 0x3c, 0x50, 0xa2, 0x01, 0xfe, 0x92, 0x1b, 0x01, 0x43, 0x09, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6253 | 0x56, 0xfb, 0x01, 0xfe, 0xc8, 0x1a, 0x01, 0x0c, 0x06, 0x28, 0xa4, 0x01, |
| 6254 | 0xfe, 0xf4, 0x1c, 0x01, 0xfe, 0x00, 0x1d, 0x15, 0xfe, 0xe9, 0x00, 0x01, |
| 6255 | 0x0c, 0x06, 0x4a, 0xfe, 0x4e, 0x13, 0x01, 0xfe, 0x22, 0x1b, 0xfe, 0x1e, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6256 | 0x1c, 0x0f, 0xfe, 0x14, 0x90, 0x04, 0xfe, 0x94, 0x93, 0x3a, 0x0b, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6257 | 0x96, 0x90, 0x04, 0xfe, 0x96, 0x93, 0x79, 0x0b, 0x0e, 0x10, 0xfe, 0x64, |
| 6258 | 0x01, 0x22, 0xfe, 0x66, 0x01, 0x01, 0x0c, 0x06, 0x65, 0xf9, 0x0f, 0xfe, |
| 6259 | 0x03, 0x80, 0x04, 0xfe, 0x83, 0x83, 0x33, 0x0b, 0x0e, 0x77, 0xfe, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6260 | 0xec, 0x2c, 0xfe, 0x80, 0x40, 0x20, 0x2c, 0x7a, 0x30, 0x15, 0xdf, 0x40, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6261 | 0x21, 0x2c, 0xfe, 0x00, 0x40, 0x8d, 0x2c, 0x02, 0xfe, 0x08, 0x1c, 0x03, |
| 6262 | 0xfe, 0xac, 0x00, 0xfe, 0x06, 0x58, 0x03, 0xfe, 0xae, 0x00, 0xfe, 0x07, |
| 6263 | 0x58, 0x03, 0xfe, 0xb0, 0x00, 0xfe, 0x08, 0x58, 0x03, 0xfe, 0xb2, 0x00, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6264 | 0xfe, 0x09, 0x58, 0xfe, 0x0a, 0x1c, 0x2e, 0x49, 0x20, 0xe0, 0x26, 0x10, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6265 | 0x66, 0x10, 0x55, 0x10, 0x6f, 0x13, 0x57, 0x52, 0x4f, 0x1c, 0x28, 0xfe, |
| 6266 | 0x90, 0x4d, 0xfe, 0x91, 0x54, 0x2b, 0xfe, 0x88, 0x11, 0x46, 0x1a, 0x13, |
| 6267 | 0x5a, 0x52, 0x1c, 0x4a, 0xfe, 0x90, 0x4d, 0xfe, 0x91, 0x54, 0x2b, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6268 | 0x9e, 0x11, 0x2e, 0x1a, 0x20, 0x2c, 0x90, 0x34, 0x60, 0x21, 0x2c, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6269 | 0x00, 0x40, 0x8d, 0x2c, 0x15, 0xdf, 0xfe, 0x14, 0x56, 0xfe, 0xd6, 0xf0, |
| 6270 | 0xfe, 0xb2, 0x11, 0xfe, 0x12, 0x1c, 0x75, 0xfe, 0x14, 0x1c, 0xfe, 0x10, |
| 6271 | 0x1c, 0xfe, 0x18, 0x1c, 0x02, 0x51, 0xfe, 0x0c, 0x14, 0xfe, 0x0e, 0x47, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6272 | 0xfe, 0x07, 0xe6, 0x28, 0xfe, 0xce, 0x47, 0xfe, 0xf5, 0x13, 0x02, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6273 | 0xa7, 0x90, 0x34, 0x60, 0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x42, |
| 6274 | 0x13, 0xfe, 0x02, 0x80, 0x09, 0x56, 0xfe, 0x34, 0x13, 0x0a, 0x5a, 0x01, |
| 6275 | 0x18, 0xcb, 0xfe, 0x36, 0x12, 0xfe, 0x41, 0x48, 0xfe, 0x45, 0x48, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6276 | 0xfe, 0xb2, 0x16, 0xfe, 0x00, 0xcc, 0xcb, 0xfe, 0xf3, 0x13, 0x3f, 0x89, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6277 | 0x09, 0x1a, 0xa5, 0x0a, 0x9d, 0x01, 0x18, 0xfe, 0x80, 0x5c, 0x01, 0x85, |
| 6278 | 0xf2, 0x09, 0x9b, 0xa4, 0xfe, 0x14, 0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0xec, |
| 6279 | 0x11, 0x02, 0xfe, 0x44, 0x58, 0x77, 0xfe, 0x01, 0xec, 0xb8, 0xfe, 0x9e, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6280 | 0x40, 0xfe, 0x9d, 0xe7, 0x00, 0xfe, 0x9c, 0xe7, 0x12, 0x8d, 0x30, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6281 | 0xf4, 0xfe, 0xdd, 0x10, 0x37, 0xd7, 0x99, 0xd8, 0x9c, 0x27, 0x25, 0xee, |
| 6282 | 0x09, 0x12, 0xfe, 0x48, 0x12, 0x09, 0x0d, 0xfe, 0x56, 0x12, 0x09, 0x1d, |
| 6283 | 0xfe, 0x30, 0x12, 0x09, 0xdd, 0x1b, 0xfe, 0xc4, 0x13, 0x09, 0xfe, 0x23, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6284 | 0x00, 0x1b, 0xfe, 0xd0, 0x13, 0x09, 0x07, 0x1b, 0xfe, 0x34, 0x14, 0x09, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6285 | 0x24, 0xfe, 0x12, 0x12, 0x09, 0x00, 0x1b, 0x29, 0x1f, 0xdd, 0x01, 0x42, |
| 6286 | 0xa1, 0x32, 0x01, 0x08, 0xae, 0x41, 0x02, 0x32, 0xfe, 0x62, 0x08, 0x0a, |
| 6287 | 0xe1, 0x01, 0xfe, 0x58, 0x10, 0x15, 0x9b, 0x05, 0x35, 0x32, 0x01, 0x43, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6288 | 0x09, 0xbb, 0xfe, 0xd7, 0x13, 0x91, 0x4b, 0x7e, 0x4c, 0x8e, 0xfe, 0x80, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6289 | 0x13, 0x01, 0x0c, 0x06, 0x54, 0xfe, 0x72, 0x12, 0xdb, 0x64, 0xdc, 0x34, |
| 6290 | 0xfe, 0x44, 0x55, 0xfe, 0xe5, 0x55, 0xb0, 0xfe, 0x4a, 0x13, 0x21, 0x6e, |
| 6291 | 0xfe, 0x26, 0x13, 0x03, 0x97, 0x3b, 0x98, 0x8e, 0xfe, 0xb6, 0x0e, 0x10, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6292 | 0x6a, 0x22, 0x6b, 0x26, 0x10, 0x97, 0x10, 0x98, 0x01, 0xc2, 0x2e, 0x49, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6293 | 0x88, 0x20, 0x6e, 0x01, 0xfe, 0x6a, 0x16, 0xdb, 0x64, 0xdc, 0x34, 0xfe, |
| 6294 | 0x04, 0x55, 0xfe, 0xa5, 0x55, 0xfe, 0x04, 0xfa, 0x64, 0xfe, 0x05, 0xfa, |
| 6295 | 0x34, 0xfe, 0x8f, 0x10, 0x03, 0x6c, 0x3b, 0x6d, 0xfe, 0x40, 0x56, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6296 | 0xe1, 0x56, 0x10, 0x6c, 0x22, 0x6d, 0x71, 0xdb, 0x64, 0xdc, 0x34, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6297 | 0x44, 0x55, 0xfe, 0xe5, 0x55, 0x03, 0x68, 0x3b, 0x69, 0xfe, 0x00, 0x56, |
| 6298 | 0xfe, 0xa1, 0x56, 0x10, 0x68, 0x22, 0x69, 0x01, 0x0c, 0x06, 0x54, 0xf9, |
| 6299 | 0x21, 0x6e, 0xfe, 0x1f, 0x40, 0x03, 0x6a, 0x3b, 0x6b, 0xfe, 0x2c, 0x50, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6300 | 0xfe, 0xae, 0x50, 0x03, 0x6c, 0x3b, 0x6d, 0xfe, 0x44, 0x50, 0xfe, 0xc6, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6301 | 0x50, 0x03, 0x68, 0x3b, 0x69, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0x03, |
| 6302 | 0x4b, 0x3b, 0x4c, 0xfe, 0x40, 0x50, 0xfe, 0xc2, 0x50, 0x05, 0x73, 0x2e, |
| 6303 | 0x07, 0x20, 0x9e, 0x05, 0x72, 0x32, 0x01, 0x08, 0x16, 0x3d, 0x27, 0x25, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6304 | 0xee, 0x09, 0x07, 0x2b, 0x3d, 0x01, 0x43, 0x09, 0xbb, 0x2b, 0x72, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6305 | 0xa6, 0x23, 0x3f, 0x1b, 0x3d, 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x1e, 0x13, |
| 6306 | 0x91, 0x4b, 0x7e, 0x4c, 0xfe, 0x0a, 0x55, 0x31, 0xfe, 0x8b, 0x55, 0xd9, |
| 6307 | 0x4b, 0xda, 0x4c, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0x05, 0x72, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6308 | 0xfe, 0x8e, 0x1e, 0xca, 0xfe, 0x19, 0x41, 0x05, 0x72, 0x32, 0x01, 0x08, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6309 | 0x2a, 0x3c, 0x16, 0xc0, 0x27, 0x25, 0xbe, 0x2d, 0x1d, 0xc0, 0x2d, 0x0d, |
| 6310 | 0x83, 0x2d, 0x7f, 0x1b, 0xfe, 0x66, 0x15, 0x05, 0x3d, 0x01, 0x08, 0x2a, |
| 6311 | 0x3c, 0x16, 0xc0, 0x27, 0x25, 0xbd, 0x09, 0x1d, 0x2b, 0x3d, 0x01, 0x08, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6312 | 0x16, 0xc0, 0x27, 0x25, 0xfe, 0xe8, 0x09, 0xfe, 0xc2, 0x49, 0x50, 0x03, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6313 | 0xb6, 0x1e, 0x83, 0x01, 0x38, 0x06, 0x24, 0x31, 0xa1, 0xfe, 0xbb, 0x45, |
| 6314 | 0x2d, 0x00, 0xa4, 0x46, 0x07, 0x90, 0x3f, 0x01, 0xfe, 0xf8, 0x15, 0x01, |
| 6315 | 0xa6, 0x86, 0xfe, 0x4b, 0x45, 0xfe, 0x20, 0x13, 0x01, 0x43, 0x09, 0x82, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6316 | 0xfe, 0x16, 0x13, 0x03, 0x9a, 0x1e, 0x5d, 0x03, 0x55, 0x1e, 0x31, 0x5e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6317 | 0x05, 0x72, 0xfe, 0xc0, 0x5d, 0x01, 0xa7, 0xfe, 0x03, 0x17, 0x03, 0x66, |
| 6318 | 0x8a, 0x10, 0x66, 0x5e, 0x32, 0x01, 0x08, 0x17, 0x73, 0x01, 0xfe, 0x56, |
| 6319 | 0x19, 0x05, 0x73, 0x01, 0x08, 0x2a, 0x3c, 0x16, 0x3d, 0x27, 0x25, 0xbd, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6320 | 0x09, 0x07, 0x2b, 0x3d, 0x01, 0xfe, 0xbe, 0x16, 0xfe, 0x42, 0x58, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6321 | 0xe8, 0x14, 0x01, 0xa6, 0x86, 0xfe, 0x4a, 0xf4, 0x0d, 0x1b, 0x3d, 0xfe, |
| 6322 | 0x4a, 0xf4, 0x07, 0xfe, 0x0e, 0x12, 0x01, 0x43, 0x09, 0x82, 0x4e, 0x05, |
| 6323 | 0x72, 0x03, 0x55, 0x8a, 0x10, 0x55, 0x5e, 0x32, 0x01, 0x08, 0x17, 0x73, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6324 | 0x01, 0xfe, 0x84, 0x19, 0x05, 0x73, 0x01, 0x08, 0x2a, 0x3c, 0x16, 0x3d, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6325 | 0x27, 0x25, 0xbd, 0x09, 0x12, 0x2b, 0x3d, 0x01, 0xfe, 0xe8, 0x17, 0x8b, |
| 6326 | 0xfe, 0xaa, 0x14, 0xfe, 0xb6, 0x14, 0x86, 0xa8, 0xb2, 0x0d, 0x1b, 0x3d, |
| 6327 | 0xb2, 0x07, 0xfe, 0x0e, 0x12, 0x01, 0x43, 0x09, 0x82, 0x4e, 0x05, 0x72, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6328 | 0x03, 0x6f, 0x8a, 0x10, 0x6f, 0x5e, 0x32, 0x01, 0x08, 0x17, 0x73, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6329 | 0xfe, 0xc0, 0x19, 0x05, 0x73, 0x13, 0x07, 0x2f, 0xfe, 0xcc, 0x15, 0x17, |
| 6330 | 0xfe, 0xe2, 0x15, 0x5f, 0xcc, 0x01, 0x08, 0x26, 0x5f, 0x02, 0x8f, 0xfe, |
| 6331 | 0xde, 0x15, 0x2a, 0xfe, 0xde, 0x15, 0x16, 0xfe, 0xcc, 0x15, 0x5e, 0x32, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6332 | 0x01, 0x08, 0xfe, 0xd5, 0x10, 0x13, 0x58, 0xff, 0x02, 0x00, 0x57, 0x52, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6333 | 0xad, 0x23, 0xfe, 0xff, 0x7f, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x02, |
| 6334 | 0x13, 0x58, 0xff, 0x02, 0x00, 0x57, 0x52, 0xad, 0x23, 0x3f, 0xfe, 0x30, |
| 6335 | 0x56, 0xfe, 0x00, 0x5c, 0x02, 0x13, 0x58, 0xff, 0x02, 0x00, 0x57, 0x52, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6336 | 0xad, 0x02, 0x13, 0x58, 0xff, 0x02, 0x00, 0x57, 0x52, 0xfe, 0x00, 0x5e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6337 | 0x02, 0x13, 0x58, 0xff, 0x02, 0x00, 0x57, 0x52, 0xad, 0xfe, 0x0b, 0x58, |
| 6338 | 0x02, 0x0a, 0x66, 0x01, 0x5c, 0x0a, 0x55, 0x01, 0x5c, 0x0a, 0x6f, 0x01, |
| 6339 | 0x5c, 0x02, 0x01, 0xfe, 0x1e, 0x1f, 0x23, 0x1a, 0xff, 0x03, 0x00, 0x54, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6340 | 0xfe, 0x00, 0xf4, 0x24, 0x52, 0x0f, 0xfe, 0x00, 0x7c, 0x04, 0xfe, 0x07, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6341 | 0x7c, 0x3a, 0x0b, 0x0e, 0xfe, 0x00, 0x71, 0xfe, 0xf9, 0x18, 0xfe, 0x7a, |
| 6342 | 0x19, 0xfe, 0xfb, 0x19, 0xfe, 0x1a, 0xf7, 0x00, 0xfe, 0x1b, 0xf7, 0x00, |
| 6343 | 0x7a, 0x30, 0x10, 0x68, 0x22, 0x69, 0xd9, 0x6c, 0xda, 0x6d, 0x02, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6344 | 0x62, 0x08, 0xfe, 0x82, 0x4a, 0xfe, 0xe1, 0x1a, 0xfe, 0x83, 0x5a, 0x77, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6345 | 0x02, 0x01, 0xc6, 0xfe, 0x42, 0x48, 0x4f, 0x50, 0x45, 0x01, 0x08, 0x16, |
| 6346 | 0xfe, 0xe0, 0x17, 0x27, 0x25, 0xbe, 0x01, 0x08, 0x16, 0xfe, 0xe0, 0x17, |
| 6347 | 0x27, 0x25, 0xfe, 0xe8, 0x0a, 0xfe, 0xc1, 0x59, 0x03, 0x9a, 0x1e, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6348 | 0xda, 0x12, 0x01, 0x38, 0x06, 0x12, 0xfe, 0xd0, 0x13, 0x26, 0x53, 0x12, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6349 | 0x48, 0xfe, 0x08, 0x17, 0xd1, 0x12, 0x53, 0x12, 0xfe, 0x1e, 0x13, 0x2d, |
| 6350 | 0xb4, 0x7b, 0xfe, 0x26, 0x17, 0x4d, 0x13, 0x07, 0x1c, 0xb4, 0x90, 0x04, |
| 6351 | 0xfe, 0x78, 0x10, 0xff, 0x02, 0x83, 0x55, 0xf1, 0xff, 0x02, 0x83, 0x55, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6352 | 0x53, 0x1d, 0xfe, 0x12, 0x13, 0xd6, 0xfe, 0x30, 0x00, 0xb0, 0xfe, 0x80, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6353 | 0x17, 0x1c, 0x63, 0x13, 0x07, 0xfe, 0x56, 0x10, 0x53, 0x0d, 0xfe, 0x16, |
| 6354 | 0x13, 0xd6, 0xfe, 0x64, 0x00, 0xb0, 0xfe, 0x80, 0x17, 0x0a, 0xfe, 0x64, |
| 6355 | 0x00, 0x1c, 0x94, 0x13, 0x07, 0xfe, 0x28, 0x10, 0x53, 0x07, 0xfe, 0x60, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6356 | 0x13, 0xd6, 0xfe, 0xc8, 0x00, 0xb0, 0xfe, 0x80, 0x17, 0x0a, 0xfe, 0xc8, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6357 | 0x00, 0x1c, 0x95, 0x13, 0x07, 0x71, 0xd6, 0xfe, 0x90, 0x01, 0x48, 0xfe, |
| 6358 | 0x8c, 0x17, 0x45, 0xf3, 0xfe, 0x43, 0xf4, 0x96, 0xfe, 0x56, 0xf0, 0xfe, |
| 6359 | 0x9e, 0x17, 0xfe, 0x04, 0xf4, 0x58, 0xfe, 0x43, 0xf4, 0x94, 0xf6, 0x8b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6360 | 0x01, 0xfe, 0x24, 0x16, 0x23, 0x3f, 0xfc, 0xa8, 0x8c, 0x49, 0x48, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6361 | 0xda, 0x17, 0x62, 0x49, 0xfe, 0x1c, 0x10, 0xa8, 0x8c, 0x80, 0x48, 0xfe, |
| 6362 | 0xda, 0x17, 0x62, 0x80, 0x71, 0x50, 0x26, 0xfe, 0x4d, 0xf4, 0x00, 0xf7, |
| 6363 | 0x45, 0x13, 0x07, 0xfe, 0xb4, 0x56, 0xfe, 0xc3, 0x58, 0x02, 0x50, 0x13, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6364 | 0x0d, 0x02, 0x50, 0x3e, 0x78, 0x4f, 0x45, 0x01, 0x08, 0x16, 0xa9, 0x27, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6365 | 0x25, 0xbe, 0xfe, 0x03, 0xea, 0xfe, 0x7e, 0x01, 0x01, 0x08, 0x16, 0xa9, |
| 6366 | 0x27, 0x25, 0xfe, 0xe9, 0x0a, 0x01, 0x08, 0x16, 0xa9, 0x27, 0x25, 0xfe, |
| 6367 | 0xe9, 0x0a, 0xfe, 0x05, 0xea, 0xfe, 0x7f, 0x01, 0x01, 0x08, 0x16, 0xa9, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6368 | 0x27, 0x25, 0xfe, 0x69, 0x09, 0xfe, 0x02, 0xea, 0xfe, 0x80, 0x01, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6369 | 0x08, 0x16, 0xa9, 0x27, 0x25, 0xfe, 0xe8, 0x08, 0x47, 0xfe, 0x81, 0x01, |
| 6370 | 0x03, 0xb6, 0x1e, 0x83, 0x01, 0x38, 0x06, 0x24, 0x31, 0xa2, 0x78, 0xf2, |
| 6371 | 0x53, 0x07, 0x36, 0xfe, 0x34, 0xf4, 0x3f, 0xa1, 0x78, 0x03, 0x9a, 0x1e, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6372 | 0x83, 0x01, 0x38, 0x06, 0x12, 0x31, 0xf0, 0x4f, 0x45, 0xfe, 0x90, 0x10, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6373 | 0xfe, 0x40, 0x5a, 0x23, 0x3f, 0xfb, 0x8c, 0x49, 0x48, 0xfe, 0xaa, 0x18, |
| 6374 | 0x62, 0x49, 0x71, 0x8c, 0x80, 0x48, 0xfe, 0xaa, 0x18, 0x62, 0x80, 0xfe, |
| 6375 | 0xb4, 0x56, 0xfe, 0x40, 0x5d, 0x01, 0xc6, 0x01, 0xfe, 0xac, 0x1d, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6376 | 0x02, 0x17, 0xfe, 0xc8, 0x45, 0xfe, 0x5a, 0xf0, 0xfe, 0xc0, 0x18, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6377 | 0x43, 0x48, 0x2d, 0x93, 0x36, 0xfe, 0x34, 0xf4, 0xfe, 0x00, 0x11, 0xfe, |
| 6378 | 0x40, 0x10, 0x2d, 0xb4, 0x36, 0xfe, 0x34, 0xf4, 0x04, 0xfe, 0x34, 0x10, |
| 6379 | 0x2d, 0xfe, 0x0b, 0x00, 0x36, 0x46, 0x63, 0xfe, 0x28, 0x10, 0xfe, 0xc0, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6380 | 0x49, 0xff, 0x02, 0x00, 0x54, 0xb2, 0xfe, 0x90, 0x01, 0x48, 0xfe, 0xfa, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6381 | 0x18, 0x45, 0xfe, 0x1c, 0xf4, 0x3f, 0xf3, 0xfe, 0x40, 0xf4, 0x96, 0xfe, |
| 6382 | 0x56, 0xf0, 0xfe, 0x0c, 0x19, 0xfe, 0x04, 0xf4, 0x58, 0xfe, 0x40, 0xf4, |
| 6383 | 0x94, 0xf6, 0x3e, 0x2d, 0x93, 0x4e, 0xd0, 0x0d, 0x21, 0xfe, 0x7f, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6384 | 0xfe, 0xc8, 0x46, 0xfe, 0x24, 0x13, 0x8c, 0x00, 0x5d, 0x26, 0x21, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6385 | 0x7e, 0x01, 0xfe, 0xc8, 0x45, 0xfe, 0x14, 0x13, 0x21, 0xfe, 0x80, 0x01, |
| 6386 | 0xfe, 0x48, 0x45, 0xfa, 0x21, 0xfe, 0x81, 0x01, 0xfe, 0xc8, 0x44, 0x4e, |
| 6387 | 0x26, 0x02, 0x13, 0x07, 0x02, 0x78, 0x45, 0x50, 0x13, 0x0d, 0x02, 0x14, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6388 | 0x07, 0x01, 0x08, 0x17, 0xfe, 0x82, 0x19, 0x14, 0x0d, 0x01, 0x08, 0x17, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6389 | 0xfe, 0x82, 0x19, 0x14, 0x1d, 0x01, 0x08, 0x17, 0xfe, 0x82, 0x19, 0x5f, |
| 6390 | 0xfe, 0x89, 0x49, 0x01, 0x08, 0x02, 0x14, 0x07, 0x01, 0x08, 0x17, 0xc1, |
| 6391 | 0x14, 0x1d, 0x01, 0x08, 0x17, 0xc1, 0x14, 0x07, 0x01, 0x08, 0x17, 0xc1, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6392 | 0xfe, 0x89, 0x49, 0x01, 0x08, 0x17, 0xc1, 0x5f, 0xfe, 0x89, 0x4a, 0x01, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6393 | 0x08, 0x02, 0x50, 0x02, 0x14, 0x07, 0x01, 0x08, 0x17, 0x74, 0x14, 0x7f, |
| 6394 | 0x01, 0x08, 0x17, 0x74, 0x14, 0x12, 0x01, 0x08, 0x17, 0x74, 0xfe, 0x89, |
| 6395 | 0x49, 0x01, 0x08, 0x17, 0x74, 0x14, 0x00, 0x01, 0x08, 0x17, 0x74, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6396 | 0x89, 0x4a, 0x01, 0x08, 0x17, 0x74, 0xfe, 0x09, 0x49, 0x01, 0x08, 0x17, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6397 | 0x74, 0x5f, 0xcc, 0x01, 0x08, 0x02, 0x21, 0xe4, 0x09, 0x07, 0xfe, 0x4c, |
| 6398 | 0x13, 0xc8, 0x20, 0xe4, 0xfe, 0x49, 0xf4, 0x00, 0x4d, 0x5f, 0xa1, 0x5e, |
| 6399 | 0xfe, 0x01, 0xec, 0xfe, 0x27, 0x01, 0xcc, 0xff, 0x02, 0x00, 0x10, 0x2f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6400 | 0xfe, 0x3e, 0x1a, 0x01, 0x43, 0x09, 0xfe, 0xe3, 0x00, 0xfe, 0x22, 0x13, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6401 | 0x16, 0xfe, 0x64, 0x1a, 0x26, 0x20, 0x9e, 0x01, 0x41, 0x21, 0x9e, 0x09, |
| 6402 | 0x07, 0x5d, 0x01, 0x0c, 0x61, 0x07, 0x44, 0x02, 0x0a, 0x5a, 0x01, 0x18, |
| 6403 | 0xfe, 0x00, 0x40, 0xaa, 0x09, 0x1a, 0xfe, 0x12, 0x13, 0x0a, 0x9d, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6404 | 0x18, 0xaa, 0x0a, 0x67, 0x01, 0xa3, 0x02, 0x0a, 0x9d, 0x01, 0x18, 0xaa, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6405 | 0xfe, 0x80, 0xe7, 0x1a, 0x09, 0x1a, 0x5d, 0xfe, 0x45, 0x58, 0x01, 0xfe, |
| 6406 | 0xb2, 0x16, 0xaa, 0x02, 0x0a, 0x5a, 0x01, 0x18, 0xaa, 0x0a, 0x67, 0x01, |
| 6407 | 0xa3, 0x02, 0x0a, 0x5a, 0x01, 0x18, 0x01, 0xfe, 0x7e, 0x1e, 0xfe, 0x80, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6408 | 0x4c, 0xfe, 0x49, 0xe4, 0x1a, 0xfe, 0x12, 0x13, 0x0a, 0x9d, 0x01, 0x18, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6409 | 0xfe, 0x80, 0x4c, 0x0a, 0x67, 0x01, 0x5c, 0x02, 0x1c, 0x1a, 0x87, 0x7c, |
| 6410 | 0xe5, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, 0x24, 0x1c, 0xfe, 0x1d, |
| 6411 | 0xf7, 0x28, 0xb1, 0xfe, 0x04, 0x1b, 0x01, 0xfe, 0x2a, 0x1c, 0xfa, 0xb3, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6412 | 0x28, 0x7c, 0xfe, 0x2c, 0x01, 0xfe, 0x2f, 0x19, 0x02, 0xc9, 0x2b, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6413 | 0xf4, 0x1a, 0xfe, 0xfa, 0x10, 0x1c, 0x1a, 0x87, 0x03, 0xfe, 0x64, 0x01, |
| 6414 | 0xfe, 0x00, 0xf4, 0x24, 0xfe, 0x18, 0x58, 0x03, 0xfe, 0x66, 0x01, 0xfe, |
| 6415 | 0x19, 0x58, 0xb3, 0x24, 0x01, 0xfe, 0x0e, 0x1f, 0xfe, 0x30, 0xf4, 0x07, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6416 | 0xfe, 0x3c, 0x50, 0x7c, 0xfe, 0x38, 0x00, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6417 | 0xf7, 0x24, 0xb1, 0xfe, 0x50, 0x1b, 0xfe, 0xd4, 0x14, 0x31, 0x02, 0xc9, |
| 6418 | 0x2b, 0xfe, 0x26, 0x1b, 0xfe, 0xba, 0x10, 0x1c, 0x1a, 0x87, 0xfe, 0x83, |
| 6419 | 0x5a, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, 0x1d, 0xf7, 0x54, 0xb1, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6420 | 0xfe, 0x72, 0x1b, 0xfe, 0xb2, 0x14, 0xfc, 0xb3, 0x54, 0x7c, 0x12, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6421 | 0xaf, 0x19, 0xfe, 0x98, 0xe7, 0x00, 0x02, 0xc9, 0x2b, 0xfe, 0x66, 0x1b, |
| 6422 | 0xfe, 0x8a, 0x10, 0x1c, 0x1a, 0x87, 0x8b, 0x0f, 0xfe, 0x30, 0x90, 0x04, |
| 6423 | 0xfe, 0xb0, 0x93, 0x3a, 0x0b, 0xfe, 0x18, 0x58, 0xfe, 0x32, 0x90, 0x04, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6424 | 0xfe, 0xb2, 0x93, 0x3a, 0x0b, 0xfe, 0x19, 0x58, 0x0e, 0xa8, 0xb3, 0x4a, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6425 | 0x7c, 0x12, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7, 0x4a, 0xb1, 0xfe, 0xc6, |
| 6426 | 0x1b, 0xfe, 0x5e, 0x14, 0x31, 0x02, 0xc9, 0x2b, 0xfe, 0x96, 0x1b, 0x5c, |
| 6427 | 0xfe, 0x02, 0xf6, 0x1a, 0x87, 0xfe, 0x18, 0xfe, 0x6a, 0xfe, 0x19, 0xfe, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6428 | 0x6b, 0x01, 0xfe, 0x1e, 0x1f, 0xfe, 0x1d, 0xf7, 0x65, 0xb1, 0xfe, 0xee, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6429 | 0x1b, 0xfe, 0x36, 0x14, 0xfe, 0x1c, 0x13, 0xb3, 0x65, 0x3e, 0xfe, 0x83, |
| 6430 | 0x58, 0xfe, 0xaf, 0x19, 0xfe, 0x80, 0xe7, 0x1a, 0xfe, 0x81, 0xe7, 0x1a, |
| 6431 | 0x15, 0xfe, 0xdd, 0x00, 0x7a, 0x30, 0x02, 0x7a, 0x30, 0xfe, 0x12, 0x45, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6432 | 0x2b, 0xfe, 0xdc, 0x1b, 0x1f, 0x07, 0x47, 0xb5, 0xc3, 0x05, 0x35, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6433 | 0x39, 0xf0, 0x75, 0x26, 0x02, 0xfe, 0x7e, 0x18, 0x23, 0x1d, 0x36, 0x13, |
| 6434 | 0x11, 0x02, 0x87, 0x03, 0xe3, 0x23, 0x07, 0xfe, 0xef, 0x12, 0xfe, 0xe1, |
| 6435 | 0x10, 0x90, 0x34, 0x60, 0xfe, 0x02, 0x80, 0x09, 0x56, 0xfe, 0x3c, 0x13, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6436 | 0xfe, 0x82, 0x14, 0xfe, 0x42, 0x13, 0x51, 0xfe, 0x06, 0x83, 0x0a, 0x5a, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6437 | 0x01, 0x18, 0xcb, 0xfe, 0x3e, 0x12, 0xfe, 0x41, 0x48, 0xfe, 0x45, 0x48, |
| 6438 | 0x01, 0xfe, 0xb2, 0x16, 0xfe, 0x00, 0xcc, 0xcb, 0xfe, 0xf3, 0x13, 0x3f, |
| 6439 | 0x89, 0x09, 0x1a, 0xa5, 0x0a, 0x9d, 0x01, 0x18, 0xfe, 0x80, 0x4c, 0x01, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6440 | 0x85, 0xfe, 0x16, 0x10, 0x09, 0x9b, 0x4e, 0xfe, 0x40, 0x14, 0xfe, 0x24, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6441 | 0x12, 0xfe, 0x14, 0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0x52, 0x1c, 0x1c, 0x0d, |
| 6442 | 0x02, 0xfe, 0x9c, 0xe7, 0x0d, 0x19, 0xfe, 0x15, 0x00, 0x40, 0x8d, 0x30, |
| 6443 | 0x01, 0xf4, 0x1c, 0x07, 0x02, 0x51, 0xfe, 0x06, 0x83, 0xfe, 0x18, 0x80, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6444 | 0x61, 0x28, 0x44, 0x15, 0x56, 0x01, 0x85, 0x1c, 0x07, 0x02, 0xfe, 0x38, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6445 | 0x90, 0xfe, 0xba, 0x90, 0x91, 0xde, 0x7e, 0xdf, 0xfe, 0x48, 0x55, 0x31, |
| 6446 | 0xfe, 0xc9, 0x55, 0x02, 0x21, 0xb9, 0x88, 0x20, 0xb9, 0x02, 0x0a, 0xba, |
| 6447 | 0x01, 0x18, 0xfe, 0x41, 0x48, 0x0a, 0x57, 0x01, 0x18, 0xfe, 0x49, 0x44, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6448 | 0x1b, 0xfe, 0x1e, 0x1d, 0x88, 0x89, 0x02, 0x0a, 0x5a, 0x01, 0x18, 0x09, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6449 | 0x1a, 0xa4, 0x0a, 0x67, 0x01, 0xa3, 0x0a, 0x57, 0x01, 0x18, 0x88, 0x89, |
| 6450 | 0x02, 0xfe, 0x4e, 0xe4, 0x1d, 0x7b, 0xfe, 0x52, 0x1d, 0x03, 0xfe, 0x90, |
| 6451 | 0x00, 0xfe, 0x3a, 0x45, 0xfe, 0x2c, 0x10, 0xfe, 0x4e, 0xe4, 0xdd, 0x7b, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6452 | 0xfe, 0x64, 0x1d, 0x03, 0xfe, 0x92, 0x00, 0xd1, 0x12, 0xfe, 0x1a, 0x10, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6453 | 0xfe, 0x4e, 0xe4, 0xfe, 0x0b, 0x00, 0x7b, 0xfe, 0x76, 0x1d, 0x03, 0xfe, |
| 6454 | 0x94, 0x00, 0xd1, 0x24, 0xfe, 0x08, 0x10, 0x03, 0xfe, 0x96, 0x00, 0xd1, |
| 6455 | 0x63, 0xfe, 0x4e, 0x45, 0x83, 0xca, 0xff, 0x04, 0x68, 0x54, 0xfe, 0xf1, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6456 | 0x10, 0x23, 0x49, 0xfe, 0x08, 0x1c, 0xfe, 0x67, 0x19, 0xfe, 0x0a, 0x1c, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6457 | 0xfe, 0x1a, 0xf4, 0xfe, 0x00, 0x04, 0x83, 0xb2, 0x1d, 0x48, 0xfe, 0xaa, |
| 6458 | 0x1d, 0x13, 0x1d, 0x02, 0x09, 0x92, 0xfe, 0x5a, 0xf0, 0xfe, 0xba, 0x1d, |
| 6459 | 0x2e, 0x93, 0xfe, 0x34, 0x10, 0x09, 0x12, 0xfe, 0x5a, 0xf0, 0xfe, 0xc8, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6460 | 0x1d, 0x2e, 0xb4, 0xfe, 0x26, 0x10, 0x09, 0x1d, 0x36, 0x2e, 0x63, 0xfe, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6461 | 0x1a, 0x10, 0x09, 0x0d, 0x36, 0x2e, 0x94, 0xf2, 0x09, 0x07, 0x36, 0x2e, |
| 6462 | 0x95, 0xa1, 0xc8, 0x02, 0x1f, 0x93, 0x01, 0x42, 0xfe, 0x04, 0xfe, 0x99, |
| 6463 | 0x03, 0x9c, 0x8b, 0x02, 0x2a, 0xfe, 0x1c, 0x1e, 0xfe, 0x14, 0xf0, 0x08, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6464 | 0x2f, 0xfe, 0x0c, 0x1e, 0x2a, 0xfe, 0x1c, 0x1e, 0x8f, 0xfe, 0x1c, 0x1e, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6465 | 0xfe, 0x82, 0xf0, 0xfe, 0x10, 0x1e, 0x02, 0x0f, 0x3f, 0x04, 0xfe, 0x80, |
| 6466 | 0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x18, 0x80, 0x04, 0xfe, 0x98, |
| 6467 | 0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x02, 0x80, 0x04, 0xfe, 0x82, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6468 | 0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x06, 0x80, 0x04, 0xfe, 0x86, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6469 | 0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x1b, 0x80, 0x04, 0xfe, 0x9b, |
| 6470 | 0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x04, 0x80, 0x04, 0xfe, 0x84, |
| 6471 | 0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x80, 0x80, 0x04, 0xfe, 0x80, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6472 | 0x83, 0xfe, 0xc9, 0x47, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x19, 0x81, 0x04, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6473 | 0xfe, 0x99, 0x83, 0xfe, 0xca, 0x47, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x06, |
| 6474 | 0x83, 0x04, 0xfe, 0x86, 0x83, 0xfe, 0xce, 0x47, 0x0b, 0x0e, 0x02, 0x0f, |
| 6475 | 0xfe, 0x2c, 0x90, 0x04, 0xfe, 0xac, 0x93, 0x3a, 0x0b, 0x0e, 0x02, 0x0f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6476 | 0xfe, 0xae, 0x90, 0x04, 0xfe, 0xae, 0x93, 0x79, 0x0b, 0x0e, 0x02, 0x0f, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6477 | 0xfe, 0x08, 0x90, 0x04, 0xfe, 0x88, 0x93, 0x3a, 0x0b, 0x0e, 0x02, 0x0f, |
| 6478 | 0xfe, 0x8a, 0x90, 0x04, 0xfe, 0x8a, 0x93, 0x79, 0x0b, 0x0e, 0x02, 0x0f, |
| 6479 | 0xfe, 0x0c, 0x90, 0x04, 0xfe, 0x8c, 0x93, 0x3a, 0x0b, 0x0e, 0x02, 0x0f, |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6480 | 0xfe, 0x8e, 0x90, 0x04, 0xfe, 0x8e, 0x93, 0x79, 0x0b, 0x0e, 0x02, 0x0f, |
Matthew Wilcox | 629d688 | 2007-09-09 08:56:29 -0600 | [diff] [blame] | 6481 | 0xfe, 0x3c, 0x90, 0x04, 0xfe, 0xbc, 0x93, 0x3a, 0x0b, 0x0e, 0x02, 0x8b, |
| 6482 | 0x0f, 0xfe, 0x03, 0x80, 0x04, 0xfe, 0x83, 0x83, 0x33, 0x0b, 0x77, 0x0e, |
| 6483 | 0xa8, 0x02, 0xff, 0x66, 0x00, 0x00, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6484 | }; |
| 6485 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6486 | static unsigned short _adv_asc38C1600_size = sizeof(_adv_asc38C1600_buf); /* 0x1673 */ |
| 6487 | static ADV_DCNT _adv_asc38C1600_chksum = 0x0604EF77UL; /* Expanded little-endian checksum. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6488 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6489 | static void AscInitQLinkVar(ASC_DVC_VAR *asc_dvc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6490 | { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6491 | PortAddr iop_base; |
| 6492 | int i; |
| 6493 | ushort lram_addr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6494 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6495 | iop_base = asc_dvc->iop_base; |
| 6496 | AscPutRiscVarFreeQHead(iop_base, 1); |
| 6497 | AscPutRiscVarDoneQTail(iop_base, asc_dvc->max_total_qng); |
| 6498 | AscPutVarFreeQHead(iop_base, 1); |
| 6499 | AscPutVarDoneQTail(iop_base, asc_dvc->max_total_qng); |
| 6500 | AscWriteLramByte(iop_base, ASCV_BUSY_QHEAD_B, |
| 6501 | (uchar)((int)asc_dvc->max_total_qng + 1)); |
| 6502 | AscWriteLramByte(iop_base, ASCV_DISC1_QHEAD_B, |
| 6503 | (uchar)((int)asc_dvc->max_total_qng + 2)); |
| 6504 | AscWriteLramByte(iop_base, (ushort)ASCV_TOTAL_READY_Q_B, |
| 6505 | asc_dvc->max_total_qng); |
| 6506 | AscWriteLramWord(iop_base, ASCV_ASCDVC_ERR_CODE_W, 0); |
| 6507 | AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); |
| 6508 | AscWriteLramByte(iop_base, ASCV_STOP_CODE_B, 0); |
| 6509 | AscWriteLramByte(iop_base, ASCV_SCSIBUSY_B, 0); |
| 6510 | AscWriteLramByte(iop_base, ASCV_WTM_FLAG_B, 0); |
| 6511 | AscPutQDoneInProgress(iop_base, 0); |
| 6512 | lram_addr = ASC_QADR_BEG; |
| 6513 | for (i = 0; i < 32; i++, lram_addr += 2) { |
| 6514 | AscWriteLramWord(iop_base, lram_addr, 0); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6515 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6516 | } |
| 6517 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6518 | static ushort AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc) |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 6519 | { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6520 | int i; |
| 6521 | ushort warn_code; |
| 6522 | PortAddr iop_base; |
| 6523 | ASC_PADDR phy_addr; |
| 6524 | ASC_DCNT phy_size; |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 6525 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6526 | iop_base = asc_dvc->iop_base; |
| 6527 | warn_code = 0; |
| 6528 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 6529 | AscPutMCodeInitSDTRAtID(iop_base, i, |
| 6530 | asc_dvc->cfg->sdtr_period_offset[i]); |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 6531 | } |
| 6532 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6533 | AscInitQLinkVar(asc_dvc); |
| 6534 | AscWriteLramByte(iop_base, ASCV_DISC_ENABLE_B, |
| 6535 | asc_dvc->cfg->disc_enable); |
| 6536 | AscWriteLramByte(iop_base, ASCV_HOSTSCSI_ID_B, |
| 6537 | ASC_TID_TO_TARGET_ID(asc_dvc->cfg->chip_scsi_id)); |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 6538 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6539 | /* Align overrun buffer on an 8 byte boundary. */ |
| 6540 | phy_addr = virt_to_bus(asc_dvc->cfg->overrun_buf); |
| 6541 | phy_addr = cpu_to_le32((phy_addr + 7) & ~0x7); |
| 6542 | AscMemDWordCopyPtrToLram(iop_base, ASCV_OVERRUN_PADDR_D, |
| 6543 | (uchar *)&phy_addr, 1); |
| 6544 | phy_size = cpu_to_le32(ASC_OVERRUN_BSIZE - 8); |
| 6545 | AscMemDWordCopyPtrToLram(iop_base, ASCV_OVERRUN_BSIZE_D, |
| 6546 | (uchar *)&phy_size, 1); |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 6547 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6548 | asc_dvc->cfg->mcode_date = |
| 6549 | AscReadLramWord(iop_base, (ushort)ASCV_MC_DATE_W); |
| 6550 | asc_dvc->cfg->mcode_version = |
| 6551 | AscReadLramWord(iop_base, (ushort)ASCV_MC_VER_W); |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 6552 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6553 | AscSetPCAddr(iop_base, ASC_MCODE_START_ADDR); |
| 6554 | if (AscGetPCAddr(iop_base) != ASC_MCODE_START_ADDR) { |
| 6555 | asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR; |
| 6556 | return warn_code; |
| 6557 | } |
| 6558 | if (AscStartChip(iop_base) != 1) { |
| 6559 | asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP; |
| 6560 | return warn_code; |
| 6561 | } |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 6562 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6563 | return warn_code; |
| 6564 | } |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 6565 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6566 | static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc) |
| 6567 | { |
| 6568 | ushort warn_code; |
| 6569 | PortAddr iop_base; |
| 6570 | |
| 6571 | iop_base = asc_dvc->iop_base; |
| 6572 | warn_code = 0; |
| 6573 | if ((asc_dvc->dvc_cntl & ASC_CNTL_RESET_SCSI) && |
| 6574 | !(asc_dvc->init_state & ASC_INIT_RESET_SCSI_DONE)) { |
| 6575 | AscResetChipAndScsiBus(asc_dvc); |
| 6576 | mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */ |
| 6577 | } |
| 6578 | asc_dvc->init_state |= ASC_INIT_STATE_BEG_LOAD_MC; |
| 6579 | if (asc_dvc->err_code != 0) |
| 6580 | return UW_ERR; |
| 6581 | if (!AscFindSignature(asc_dvc->iop_base)) { |
| 6582 | asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; |
| 6583 | return warn_code; |
| 6584 | } |
| 6585 | AscDisableInterrupt(iop_base); |
| 6586 | warn_code |= AscInitLram(asc_dvc); |
| 6587 | if (asc_dvc->err_code != 0) |
| 6588 | return UW_ERR; |
| 6589 | ASC_DBG1(1, "AscInitAsc1000Driver: _asc_mcode_chksum 0x%lx\n", |
| 6590 | (ulong)_asc_mcode_chksum); |
| 6591 | if (AscLoadMicroCode(iop_base, 0, _asc_mcode_buf, |
| 6592 | _asc_mcode_size) != _asc_mcode_chksum) { |
| 6593 | asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM; |
| 6594 | return warn_code; |
| 6595 | } |
| 6596 | warn_code |= AscInitMicroCodeVar(asc_dvc); |
| 6597 | asc_dvc->init_state |= ASC_INIT_STATE_END_LOAD_MC; |
| 6598 | AscEnableInterrupt(iop_base); |
| 6599 | return warn_code; |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 6600 | } |
| 6601 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6602 | /* |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 6603 | * Load the Microcode |
| 6604 | * |
| 6605 | * Write the microcode image to RISC memory starting at address 0. |
| 6606 | * |
| 6607 | * The microcode is stored compressed in the following format: |
| 6608 | * |
| 6609 | * 254 word (508 byte) table indexed by byte code followed |
| 6610 | * by the following byte codes: |
| 6611 | * |
| 6612 | * 1-Byte Code: |
| 6613 | * 00: Emit word 0 in table. |
| 6614 | * 01: Emit word 1 in table. |
| 6615 | * . |
| 6616 | * FD: Emit word 253 in table. |
| 6617 | * |
| 6618 | * Multi-Byte Code: |
| 6619 | * FE WW WW: (3 byte code) Word to emit is the next word WW WW. |
| 6620 | * FF BB WW WW: (4 byte code) Emit BB count times next word WW WW. |
| 6621 | * |
| 6622 | * Returns 0 or an error if the checksum doesn't match |
| 6623 | */ |
| 6624 | static int AdvLoadMicrocode(AdvPortAddr iop_base, unsigned char *buf, int size, |
| 6625 | int memsize, int chksum) |
| 6626 | { |
| 6627 | int i, j, end, len = 0; |
| 6628 | ADV_DCNT sum; |
| 6629 | |
| 6630 | AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0); |
| 6631 | |
| 6632 | for (i = 253 * 2; i < size; i++) { |
| 6633 | if (buf[i] == 0xff) { |
| 6634 | unsigned short word = (buf[i + 3] << 8) | buf[i + 2]; |
| 6635 | for (j = 0; j < buf[i + 1]; j++) { |
| 6636 | AdvWriteWordAutoIncLram(iop_base, word); |
| 6637 | len += 2; |
| 6638 | } |
| 6639 | i += 3; |
| 6640 | } else if (buf[i] == 0xfe) { |
| 6641 | unsigned short word = (buf[i + 2] << 8) | buf[i + 1]; |
| 6642 | AdvWriteWordAutoIncLram(iop_base, word); |
| 6643 | i += 2; |
| 6644 | len += 2; |
| 6645 | } else { |
| 6646 | unsigned char off = buf[i] * 2; |
| 6647 | unsigned short word = (buf[off + 1] << 8) | buf[off]; |
| 6648 | AdvWriteWordAutoIncLram(iop_base, word); |
| 6649 | len += 2; |
| 6650 | } |
| 6651 | } |
| 6652 | |
| 6653 | end = len; |
| 6654 | |
| 6655 | while (len < memsize) { |
| 6656 | AdvWriteWordAutoIncLram(iop_base, 0); |
| 6657 | len += 2; |
| 6658 | } |
| 6659 | |
| 6660 | /* Verify the microcode checksum. */ |
| 6661 | sum = 0; |
| 6662 | AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0); |
| 6663 | |
| 6664 | for (len = 0; len < end; len += 2) { |
| 6665 | sum += AdvReadWordAutoIncLram(iop_base); |
| 6666 | } |
| 6667 | |
| 6668 | if (sum != chksum) |
| 6669 | return ASC_IERR_MCODE_CHKSUM; |
| 6670 | |
| 6671 | return 0; |
| 6672 | } |
| 6673 | |
| 6674 | /* |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 6675 | * DvcGetPhyAddr() |
| 6676 | * |
| 6677 | * Return the physical address of 'vaddr' and set '*lenp' to the |
| 6678 | * number of physically contiguous bytes that follow 'vaddr'. |
| 6679 | * 'flag' indicates the type of structure whose physical address |
| 6680 | * is being translated. |
| 6681 | * |
| 6682 | * Note: Because Linux currently doesn't page the kernel and all |
| 6683 | * kernel buffers are physically contiguous, leave '*lenp' unchanged. |
| 6684 | */ |
| 6685 | ADV_PADDR |
| 6686 | DvcGetPhyAddr(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq, |
| 6687 | uchar *vaddr, ADV_SDCNT *lenp, int flag) |
| 6688 | { |
| 6689 | ADV_PADDR paddr = virt_to_bus(vaddr); |
| 6690 | |
| 6691 | ASC_DBG4(4, "DvcGetPhyAddr: vaddr 0x%p, lenp 0x%p *lenp %lu, paddr 0x%lx\n", |
| 6692 | vaddr, lenp, (ulong)*((ulong *)lenp), (ulong)paddr); |
| 6693 | |
| 6694 | return paddr; |
| 6695 | } |
| 6696 | |
| 6697 | static void AdvBuildCarrierFreelist(struct adv_dvc_var *asc_dvc) |
| 6698 | { |
| 6699 | ADV_CARR_T *carrp; |
| 6700 | ADV_SDCNT buf_size; |
| 6701 | ADV_PADDR carr_paddr; |
| 6702 | |
| 6703 | BUG_ON(!asc_dvc->carrier_buf); |
| 6704 | |
| 6705 | carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf); |
| 6706 | asc_dvc->carr_freelist = NULL; |
| 6707 | if (carrp == asc_dvc->carrier_buf) { |
| 6708 | buf_size = ADV_CARRIER_BUFSIZE; |
| 6709 | } else { |
| 6710 | buf_size = ADV_CARRIER_BUFSIZE - sizeof(ADV_CARR_T); |
| 6711 | } |
| 6712 | |
| 6713 | do { |
| 6714 | /* Get physical address of the carrier 'carrp'. */ |
| 6715 | ADV_DCNT contig_len = sizeof(ADV_CARR_T); |
| 6716 | carr_paddr = cpu_to_le32(DvcGetPhyAddr(asc_dvc, NULL, |
| 6717 | (uchar *)carrp, |
| 6718 | (ADV_SDCNT *)&contig_len, |
| 6719 | ADV_IS_CARRIER_FLAG)); |
| 6720 | |
| 6721 | buf_size -= sizeof(ADV_CARR_T); |
| 6722 | |
| 6723 | /* |
| 6724 | * If the current carrier is not physically contiguous, then |
| 6725 | * maybe there was a page crossing. Try the next carrier |
| 6726 | * aligned start address. |
| 6727 | */ |
| 6728 | if (contig_len < sizeof(ADV_CARR_T)) { |
| 6729 | carrp++; |
| 6730 | continue; |
| 6731 | } |
| 6732 | |
| 6733 | carrp->carr_pa = carr_paddr; |
| 6734 | carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp)); |
| 6735 | |
| 6736 | /* |
| 6737 | * Insert the carrier at the beginning of the freelist. |
| 6738 | */ |
| 6739 | carrp->next_vpa = |
| 6740 | cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist)); |
| 6741 | asc_dvc->carr_freelist = carrp; |
| 6742 | |
| 6743 | carrp++; |
| 6744 | } while (buf_size > 0); |
| 6745 | } |
| 6746 | |
| 6747 | /* |
| 6748 | * Send an idle command to the chip and wait for completion. |
| 6749 | * |
| 6750 | * Command completion is polled for once per microsecond. |
| 6751 | * |
| 6752 | * The function can be called from anywhere including an interrupt handler. |
| 6753 | * But the function is not re-entrant, so it uses the DvcEnter/LeaveCritical() |
| 6754 | * functions to prevent reentrancy. |
| 6755 | * |
| 6756 | * Return Values: |
| 6757 | * ADV_TRUE - command completed successfully |
| 6758 | * ADV_FALSE - command failed |
| 6759 | * ADV_ERROR - command timed out |
| 6760 | */ |
| 6761 | static int |
| 6762 | AdvSendIdleCmd(ADV_DVC_VAR *asc_dvc, |
| 6763 | ushort idle_cmd, ADV_DCNT idle_cmd_parameter) |
| 6764 | { |
| 6765 | int result; |
| 6766 | ADV_DCNT i, j; |
| 6767 | AdvPortAddr iop_base; |
| 6768 | |
| 6769 | iop_base = asc_dvc->iop_base; |
| 6770 | |
| 6771 | /* |
| 6772 | * Clear the idle command status which is set by the microcode |
| 6773 | * to a non-zero value to indicate when the command is completed. |
| 6774 | * The non-zero result is one of the IDLE_CMD_STATUS_* values |
| 6775 | */ |
| 6776 | AdvWriteWordLram(iop_base, ASC_MC_IDLE_CMD_STATUS, (ushort)0); |
| 6777 | |
| 6778 | /* |
| 6779 | * Write the idle command value after the idle command parameter |
| 6780 | * has been written to avoid a race condition. If the order is not |
| 6781 | * followed, the microcode may process the idle command before the |
| 6782 | * parameters have been written to LRAM. |
| 6783 | */ |
| 6784 | AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IDLE_CMD_PARAMETER, |
| 6785 | cpu_to_le32(idle_cmd_parameter)); |
| 6786 | AdvWriteWordLram(iop_base, ASC_MC_IDLE_CMD, idle_cmd); |
| 6787 | |
| 6788 | /* |
| 6789 | * Tickle the RISC to tell it to process the idle command. |
| 6790 | */ |
| 6791 | AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_B); |
| 6792 | if (asc_dvc->chip_type == ADV_CHIP_ASC3550) { |
| 6793 | /* |
| 6794 | * Clear the tickle value. In the ASC-3550 the RISC flag |
| 6795 | * command 'clr_tickle_b' does not work unless the host |
| 6796 | * value is cleared. |
| 6797 | */ |
| 6798 | AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_NOP); |
| 6799 | } |
| 6800 | |
| 6801 | /* Wait for up to 100 millisecond for the idle command to timeout. */ |
| 6802 | for (i = 0; i < SCSI_WAIT_100_MSEC; i++) { |
| 6803 | /* Poll once each microsecond for command completion. */ |
| 6804 | for (j = 0; j < SCSI_US_PER_MSEC; j++) { |
| 6805 | AdvReadWordLram(iop_base, ASC_MC_IDLE_CMD_STATUS, |
| 6806 | result); |
| 6807 | if (result != 0) |
| 6808 | return result; |
| 6809 | udelay(1); |
| 6810 | } |
| 6811 | } |
| 6812 | |
| 6813 | BUG(); /* The idle command should never timeout. */ |
| 6814 | return ADV_ERROR; |
| 6815 | } |
| 6816 | |
| 6817 | /* |
| 6818 | * Reset SCSI Bus and purge all outstanding requests. |
| 6819 | * |
| 6820 | * Return Value: |
| 6821 | * ADV_TRUE(1) - All requests are purged and SCSI Bus is reset. |
| 6822 | * ADV_FALSE(0) - Microcode command failed. |
| 6823 | * ADV_ERROR(-1) - Microcode command timed-out. Microcode or IC |
| 6824 | * may be hung which requires driver recovery. |
| 6825 | */ |
| 6826 | static int AdvResetSB(ADV_DVC_VAR *asc_dvc) |
| 6827 | { |
| 6828 | int status; |
| 6829 | |
| 6830 | /* |
| 6831 | * Send the SCSI Bus Reset idle start idle command which asserts |
| 6832 | * the SCSI Bus Reset signal. |
| 6833 | */ |
| 6834 | status = AdvSendIdleCmd(asc_dvc, (ushort)IDLE_CMD_SCSI_RESET_START, 0L); |
| 6835 | if (status != ADV_TRUE) { |
| 6836 | return status; |
| 6837 | } |
| 6838 | |
| 6839 | /* |
| 6840 | * Delay for the specified SCSI Bus Reset hold time. |
| 6841 | * |
| 6842 | * The hold time delay is done on the host because the RISC has no |
| 6843 | * microsecond accurate timer. |
| 6844 | */ |
| 6845 | udelay(ASC_SCSI_RESET_HOLD_TIME_US); |
| 6846 | |
| 6847 | /* |
| 6848 | * Send the SCSI Bus Reset end idle command which de-asserts |
| 6849 | * the SCSI Bus Reset signal and purges any pending requests. |
| 6850 | */ |
| 6851 | status = AdvSendIdleCmd(asc_dvc, (ushort)IDLE_CMD_SCSI_RESET_END, 0L); |
| 6852 | if (status != ADV_TRUE) { |
| 6853 | return status; |
| 6854 | } |
| 6855 | |
| 6856 | mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */ |
| 6857 | |
| 6858 | return status; |
| 6859 | } |
| 6860 | |
| 6861 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6862 | * Initialize the ASC-3550. |
| 6863 | * |
| 6864 | * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR. |
| 6865 | * |
| 6866 | * For a non-fatal error return a warning code. If there are no warnings |
| 6867 | * then 0 is returned. |
| 6868 | * |
| 6869 | * Needed after initialization for error recovery. |
| 6870 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6871 | static int AdvInitAsc3550Driver(ADV_DVC_VAR *asc_dvc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6872 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6873 | AdvPortAddr iop_base; |
| 6874 | ushort warn_code; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6875 | int begin_addr; |
| 6876 | int end_addr; |
| 6877 | ushort code_sum; |
| 6878 | int word; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6879 | int i; |
| 6880 | ushort scsi_cfg1; |
| 6881 | uchar tid; |
| 6882 | ushort bios_mem[ASC_MC_BIOSLEN / 2]; /* BIOS RISC Memory 0x40-0x8F. */ |
| 6883 | ushort wdtr_able = 0, sdtr_able, tagqng_able; |
| 6884 | uchar max_cmd[ADV_MAX_TID + 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6885 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6886 | /* If there is already an error, don't continue. */ |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 6887 | if (asc_dvc->err_code != 0) |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6888 | return ADV_ERROR; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6889 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6890 | /* |
| 6891 | * The caller must set 'chip_type' to ADV_CHIP_ASC3550. |
| 6892 | */ |
| 6893 | if (asc_dvc->chip_type != ADV_CHIP_ASC3550) { |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 6894 | asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6895 | return ADV_ERROR; |
| 6896 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6897 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6898 | warn_code = 0; |
| 6899 | iop_base = asc_dvc->iop_base; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6900 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6901 | /* |
| 6902 | * Save the RISC memory BIOS region before writing the microcode. |
| 6903 | * The BIOS may already be loaded and using its RISC LRAM region |
| 6904 | * so its region must be saved and restored. |
| 6905 | * |
| 6906 | * Note: This code makes the assumption, which is currently true, |
| 6907 | * that a chip reset does not clear RISC LRAM. |
| 6908 | */ |
| 6909 | for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) { |
| 6910 | AdvReadWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), |
| 6911 | bios_mem[i]); |
| 6912 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6913 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6914 | /* |
| 6915 | * Save current per TID negotiated values. |
| 6916 | */ |
| 6917 | if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] == 0x55AA) { |
| 6918 | ushort bios_version, major, minor; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6919 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6920 | bios_version = |
| 6921 | bios_mem[(ASC_MC_BIOS_VERSION - ASC_MC_BIOSMEM) / 2]; |
| 6922 | major = (bios_version >> 12) & 0xF; |
| 6923 | minor = (bios_version >> 8) & 0xF; |
| 6924 | if (major < 3 || (major == 3 && minor == 1)) { |
| 6925 | /* BIOS 3.1 and earlier location of 'wdtr_able' variable. */ |
| 6926 | AdvReadWordLram(iop_base, 0x120, wdtr_able); |
| 6927 | } else { |
| 6928 | AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); |
| 6929 | } |
| 6930 | } |
| 6931 | AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); |
| 6932 | AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able); |
| 6933 | for (tid = 0; tid <= ADV_MAX_TID; tid++) { |
| 6934 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid, |
| 6935 | max_cmd[tid]); |
| 6936 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6937 | |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 6938 | asc_dvc->err_code = AdvLoadMicrocode(iop_base, _adv_asc3550_buf, |
| 6939 | _adv_asc3550_size, ADV_3550_MEMSIZE, |
| 6940 | _adv_asc3550_chksum); |
| 6941 | if (asc_dvc->err_code) |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6942 | return ADV_ERROR; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6943 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6944 | /* |
| 6945 | * Restore the RISC memory BIOS region. |
| 6946 | */ |
| 6947 | for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) { |
| 6948 | AdvWriteWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), |
| 6949 | bios_mem[i]); |
| 6950 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6951 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6952 | /* |
| 6953 | * Calculate and write the microcode code checksum to the microcode |
| 6954 | * code checksum location ASC_MC_CODE_CHK_SUM (0x2C). |
| 6955 | */ |
| 6956 | AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, begin_addr); |
| 6957 | AdvReadWordLram(iop_base, ASC_MC_CODE_END_ADDR, end_addr); |
| 6958 | code_sum = 0; |
| 6959 | AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, begin_addr); |
| 6960 | for (word = begin_addr; word < end_addr; word += 2) { |
| 6961 | code_sum += AdvReadWordAutoIncLram(iop_base); |
| 6962 | } |
| 6963 | AdvWriteWordLram(iop_base, ASC_MC_CODE_CHK_SUM, code_sum); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6964 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6965 | /* |
| 6966 | * Read and save microcode version and date. |
| 6967 | */ |
| 6968 | AdvReadWordLram(iop_base, ASC_MC_VERSION_DATE, |
| 6969 | asc_dvc->cfg->mcode_date); |
| 6970 | AdvReadWordLram(iop_base, ASC_MC_VERSION_NUM, |
| 6971 | asc_dvc->cfg->mcode_version); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6972 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6973 | /* |
| 6974 | * Set the chip type to indicate the ASC3550. |
| 6975 | */ |
| 6976 | AdvWriteWordLram(iop_base, ASC_MC_CHIP_TYPE, ADV_CHIP_ASC3550); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6977 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6978 | /* |
| 6979 | * If the PCI Configuration Command Register "Parity Error Response |
| 6980 | * Control" Bit was clear (0), then set the microcode variable |
| 6981 | * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode |
| 6982 | * to ignore DMA parity errors. |
| 6983 | */ |
| 6984 | if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) { |
| 6985 | AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word); |
| 6986 | word |= CONTROL_FLAG_IGNORE_PERR; |
| 6987 | AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word); |
| 6988 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6989 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6990 | /* |
| 6991 | * For ASC-3550, setting the START_CTL_EMFU [3:2] bits sets a FIFO |
| 6992 | * threshold of 128 bytes. This register is only accessible to the host. |
| 6993 | */ |
| 6994 | AdvWriteByteRegister(iop_base, IOPB_DMA_CFG0, |
| 6995 | START_CTL_EMFU | READ_CMD_MRM); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6996 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 6997 | /* |
| 6998 | * Microcode operating variables for WDTR, SDTR, and command tag |
Matthew Wilcox | 47d853c | 2007-07-26 11:41:33 -0400 | [diff] [blame] | 6999 | * queuing will be set in slave_configure() based on what a |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7000 | * device reports it is capable of in Inquiry byte 7. |
| 7001 | * |
| 7002 | * If SCSI Bus Resets have been disabled, then directly set |
| 7003 | * SDTR and WDTR from the EEPROM configuration. This will allow |
| 7004 | * the BIOS and warm boot to work without a SCSI bus hang on |
| 7005 | * the Inquiry caused by host and target mismatched DTR values. |
| 7006 | * Without the SCSI Bus Reset, before an Inquiry a device can't |
| 7007 | * be assumed to be in Asynchronous, Narrow mode. |
| 7008 | */ |
| 7009 | if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) { |
| 7010 | AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, |
| 7011 | asc_dvc->wdtr_able); |
| 7012 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, |
| 7013 | asc_dvc->sdtr_able); |
| 7014 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7015 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7016 | /* |
| 7017 | * Set microcode operating variables for SDTR_SPEED1, SDTR_SPEED2, |
| 7018 | * SDTR_SPEED3, and SDTR_SPEED4 based on the ULTRA EEPROM per TID |
| 7019 | * bitmask. These values determine the maximum SDTR speed negotiated |
| 7020 | * with a device. |
| 7021 | * |
| 7022 | * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2, |
| 7023 | * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them |
| 7024 | * without determining here whether the device supports SDTR. |
| 7025 | * |
| 7026 | * 4-bit speed SDTR speed name |
| 7027 | * =========== =============== |
| 7028 | * 0000b (0x0) SDTR disabled |
| 7029 | * 0001b (0x1) 5 Mhz |
| 7030 | * 0010b (0x2) 10 Mhz |
| 7031 | * 0011b (0x3) 20 Mhz (Ultra) |
| 7032 | * 0100b (0x4) 40 Mhz (LVD/Ultra2) |
| 7033 | * 0101b (0x5) 80 Mhz (LVD2/Ultra3) |
| 7034 | * 0110b (0x6) Undefined |
| 7035 | * . |
| 7036 | * 1111b (0xF) Undefined |
| 7037 | */ |
| 7038 | word = 0; |
| 7039 | for (tid = 0; tid <= ADV_MAX_TID; tid++) { |
| 7040 | if (ADV_TID_TO_TIDMASK(tid) & asc_dvc->ultra_able) { |
| 7041 | /* Set Ultra speed for TID 'tid'. */ |
| 7042 | word |= (0x3 << (4 * (tid % 4))); |
| 7043 | } else { |
| 7044 | /* Set Fast speed for TID 'tid'. */ |
| 7045 | word |= (0x2 << (4 * (tid % 4))); |
| 7046 | } |
| 7047 | if (tid == 3) { /* Check if done with sdtr_speed1. */ |
| 7048 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, word); |
| 7049 | word = 0; |
| 7050 | } else if (tid == 7) { /* Check if done with sdtr_speed2. */ |
| 7051 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, word); |
| 7052 | word = 0; |
| 7053 | } else if (tid == 11) { /* Check if done with sdtr_speed3. */ |
| 7054 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, word); |
| 7055 | word = 0; |
| 7056 | } else if (tid == 15) { /* Check if done with sdtr_speed4. */ |
| 7057 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, word); |
| 7058 | /* End of loop. */ |
| 7059 | } |
| 7060 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7061 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7062 | /* |
| 7063 | * Set microcode operating variable for the disconnect per TID bitmask. |
| 7064 | */ |
| 7065 | AdvWriteWordLram(iop_base, ASC_MC_DISC_ENABLE, |
| 7066 | asc_dvc->cfg->disc_enable); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7067 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7068 | /* |
| 7069 | * Set SCSI_CFG0 Microcode Default Value. |
| 7070 | * |
| 7071 | * The microcode will set the SCSI_CFG0 register using this value |
| 7072 | * after it is started below. |
| 7073 | */ |
| 7074 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG0, |
| 7075 | PARITY_EN | QUEUE_128 | SEL_TMO_LONG | OUR_ID_EN | |
| 7076 | asc_dvc->chip_scsi_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7077 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7078 | /* |
| 7079 | * Determine SCSI_CFG1 Microcode Default Value. |
| 7080 | * |
| 7081 | * The microcode will set the SCSI_CFG1 register using this value |
| 7082 | * after it is started below. |
| 7083 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7084 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7085 | /* Read current SCSI_CFG1 Register value. */ |
| 7086 | scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7087 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7088 | /* |
| 7089 | * If all three connectors are in use, return an error. |
| 7090 | */ |
| 7091 | if ((scsi_cfg1 & CABLE_ILLEGAL_A) == 0 || |
| 7092 | (scsi_cfg1 & CABLE_ILLEGAL_B) == 0) { |
| 7093 | asc_dvc->err_code |= ASC_IERR_ILLEGAL_CONNECTION; |
| 7094 | return ADV_ERROR; |
| 7095 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7096 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7097 | /* |
| 7098 | * If the internal narrow cable is reversed all of the SCSI_CTRL |
| 7099 | * register signals will be set. Check for and return an error if |
| 7100 | * this condition is found. |
| 7101 | */ |
| 7102 | if ((AdvReadWordRegister(iop_base, IOPW_SCSI_CTRL) & 0x3F07) == 0x3F07) { |
| 7103 | asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE; |
| 7104 | return ADV_ERROR; |
| 7105 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7106 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7107 | /* |
| 7108 | * If this is a differential board and a single-ended device |
| 7109 | * is attached to one of the connectors, return an error. |
| 7110 | */ |
| 7111 | if ((scsi_cfg1 & DIFF_MODE) && (scsi_cfg1 & DIFF_SENSE) == 0) { |
| 7112 | asc_dvc->err_code |= ASC_IERR_SINGLE_END_DEVICE; |
| 7113 | return ADV_ERROR; |
| 7114 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7115 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7116 | /* |
| 7117 | * If automatic termination control is enabled, then set the |
| 7118 | * termination value based on a table listed in a_condor.h. |
| 7119 | * |
| 7120 | * If manual termination was specified with an EEPROM setting |
| 7121 | * then 'termination' was set-up in AdvInitFrom3550EEPROM() and |
| 7122 | * is ready to be 'ored' into SCSI_CFG1. |
| 7123 | */ |
| 7124 | if (asc_dvc->cfg->termination == 0) { |
| 7125 | /* |
| 7126 | * The software always controls termination by setting TERM_CTL_SEL. |
| 7127 | * If TERM_CTL_SEL were set to 0, the hardware would set termination. |
| 7128 | */ |
| 7129 | asc_dvc->cfg->termination |= TERM_CTL_SEL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7130 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7131 | switch (scsi_cfg1 & CABLE_DETECT) { |
| 7132 | /* TERM_CTL_H: on, TERM_CTL_L: on */ |
| 7133 | case 0x3: |
| 7134 | case 0x7: |
| 7135 | case 0xB: |
| 7136 | case 0xD: |
| 7137 | case 0xE: |
| 7138 | case 0xF: |
| 7139 | asc_dvc->cfg->termination |= (TERM_CTL_H | TERM_CTL_L); |
| 7140 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7141 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7142 | /* TERM_CTL_H: on, TERM_CTL_L: off */ |
| 7143 | case 0x1: |
| 7144 | case 0x5: |
| 7145 | case 0x9: |
| 7146 | case 0xA: |
| 7147 | case 0xC: |
| 7148 | asc_dvc->cfg->termination |= TERM_CTL_H; |
| 7149 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7150 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7151 | /* TERM_CTL_H: off, TERM_CTL_L: off */ |
| 7152 | case 0x2: |
| 7153 | case 0x6: |
| 7154 | break; |
| 7155 | } |
| 7156 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7157 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7158 | /* |
| 7159 | * Clear any set TERM_CTL_H and TERM_CTL_L bits. |
| 7160 | */ |
| 7161 | scsi_cfg1 &= ~TERM_CTL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7162 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7163 | /* |
| 7164 | * Invert the TERM_CTL_H and TERM_CTL_L bits and then |
| 7165 | * set 'scsi_cfg1'. The TERM_POL bit does not need to be |
| 7166 | * referenced, because the hardware internally inverts |
| 7167 | * the Termination High and Low bits if TERM_POL is set. |
| 7168 | */ |
| 7169 | scsi_cfg1 |= (TERM_CTL_SEL | (~asc_dvc->cfg->termination & TERM_CTL)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7170 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7171 | /* |
| 7172 | * Set SCSI_CFG1 Microcode Default Value |
| 7173 | * |
| 7174 | * Set filter value and possibly modified termination control |
| 7175 | * bits in the Microcode SCSI_CFG1 Register Value. |
| 7176 | * |
| 7177 | * The microcode will set the SCSI_CFG1 register using this value |
| 7178 | * after it is started below. |
| 7179 | */ |
| 7180 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG1, |
| 7181 | FLTR_DISABLE | scsi_cfg1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7182 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7183 | /* |
| 7184 | * Set MEM_CFG Microcode Default Value |
| 7185 | * |
| 7186 | * The microcode will set the MEM_CFG register using this value |
| 7187 | * after it is started below. |
| 7188 | * |
| 7189 | * MEM_CFG may be accessed as a word or byte, but only bits 0-7 |
| 7190 | * are defined. |
| 7191 | * |
| 7192 | * ASC-3550 has 8KB internal memory. |
| 7193 | */ |
| 7194 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG, |
| 7195 | BIOS_EN | RAM_SZ_8KB); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7196 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7197 | /* |
| 7198 | * Set SEL_MASK Microcode Default Value |
| 7199 | * |
| 7200 | * The microcode will set the SEL_MASK register using this value |
| 7201 | * after it is started below. |
| 7202 | */ |
| 7203 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK, |
| 7204 | ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7205 | |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 7206 | AdvBuildCarrierFreelist(asc_dvc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7207 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7208 | /* |
| 7209 | * Set-up the Host->RISC Initiator Command Queue (ICQ). |
| 7210 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7211 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7212 | if ((asc_dvc->icq_sp = asc_dvc->carr_freelist) == NULL) { |
| 7213 | asc_dvc->err_code |= ASC_IERR_NO_CARRIER; |
| 7214 | return ADV_ERROR; |
| 7215 | } |
| 7216 | asc_dvc->carr_freelist = (ADV_CARR_T *) |
| 7217 | ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->icq_sp->next_vpa)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7218 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7219 | /* |
| 7220 | * The first command issued will be placed in the stopper carrier. |
| 7221 | */ |
| 7222 | asc_dvc->icq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7223 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7224 | /* |
| 7225 | * Set RISC ICQ physical address start value. |
| 7226 | */ |
| 7227 | AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7228 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7229 | /* |
| 7230 | * Set-up the RISC->Host Initiator Response Queue (IRQ). |
| 7231 | */ |
| 7232 | if ((asc_dvc->irq_sp = asc_dvc->carr_freelist) == NULL) { |
| 7233 | asc_dvc->err_code |= ASC_IERR_NO_CARRIER; |
| 7234 | return ADV_ERROR; |
| 7235 | } |
| 7236 | asc_dvc->carr_freelist = (ADV_CARR_T *) |
| 7237 | ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->next_vpa)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7238 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7239 | /* |
| 7240 | * The first command completed by the RISC will be placed in |
| 7241 | * the stopper. |
| 7242 | * |
| 7243 | * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is |
| 7244 | * completed the RISC will set the ASC_RQ_STOPPER bit. |
| 7245 | */ |
| 7246 | asc_dvc->irq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7247 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7248 | /* |
| 7249 | * Set RISC IRQ physical address start value. |
| 7250 | */ |
| 7251 | AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa); |
| 7252 | asc_dvc->carr_pending_cnt = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7253 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7254 | AdvWriteByteRegister(iop_base, IOPB_INTR_ENABLES, |
| 7255 | (ADV_INTR_ENABLE_HOST_INTR | |
| 7256 | ADV_INTR_ENABLE_GLOBAL_INTR)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7257 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7258 | AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, word); |
| 7259 | AdvWriteWordRegister(iop_base, IOPW_PC, word); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7260 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7261 | /* finally, finally, gentlemen, start your engine */ |
| 7262 | AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_RUN); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7263 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7264 | /* |
| 7265 | * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus |
| 7266 | * Resets should be performed. The RISC has to be running |
| 7267 | * to issue a SCSI Bus Reset. |
| 7268 | */ |
| 7269 | if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) { |
| 7270 | /* |
| 7271 | * If the BIOS Signature is present in memory, restore the |
| 7272 | * BIOS Handshake Configuration Table and do not perform |
| 7273 | * a SCSI Bus Reset. |
| 7274 | */ |
| 7275 | if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] == |
| 7276 | 0x55AA) { |
| 7277 | /* |
| 7278 | * Restore per TID negotiated values. |
| 7279 | */ |
| 7280 | AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); |
| 7281 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); |
| 7282 | AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE, |
| 7283 | tagqng_able); |
| 7284 | for (tid = 0; tid <= ADV_MAX_TID; tid++) { |
| 7285 | AdvWriteByteLram(iop_base, |
| 7286 | ASC_MC_NUMBER_OF_MAX_CMD + tid, |
| 7287 | max_cmd[tid]); |
| 7288 | } |
| 7289 | } else { |
| 7290 | if (AdvResetSB(asc_dvc) != ADV_TRUE) { |
| 7291 | warn_code = ASC_WARN_BUSRESET_ERROR; |
| 7292 | } |
| 7293 | } |
| 7294 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7295 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7296 | return warn_code; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7297 | } |
| 7298 | |
| 7299 | /* |
| 7300 | * Initialize the ASC-38C0800. |
| 7301 | * |
| 7302 | * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR. |
| 7303 | * |
| 7304 | * For a non-fatal error return a warning code. If there are no warnings |
| 7305 | * then 0 is returned. |
| 7306 | * |
| 7307 | * Needed after initialization for error recovery. |
| 7308 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7309 | static int AdvInitAsc38C0800Driver(ADV_DVC_VAR *asc_dvc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7310 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7311 | AdvPortAddr iop_base; |
| 7312 | ushort warn_code; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7313 | int begin_addr; |
| 7314 | int end_addr; |
| 7315 | ushort code_sum; |
| 7316 | int word; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7317 | int i; |
| 7318 | ushort scsi_cfg1; |
| 7319 | uchar byte; |
| 7320 | uchar tid; |
| 7321 | ushort bios_mem[ASC_MC_BIOSLEN / 2]; /* BIOS RISC Memory 0x40-0x8F. */ |
| 7322 | ushort wdtr_able, sdtr_able, tagqng_able; |
| 7323 | uchar max_cmd[ADV_MAX_TID + 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7324 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7325 | /* If there is already an error, don't continue. */ |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7326 | if (asc_dvc->err_code != 0) |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7327 | return ADV_ERROR; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7328 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7329 | /* |
| 7330 | * The caller must set 'chip_type' to ADV_CHIP_ASC38C0800. |
| 7331 | */ |
| 7332 | if (asc_dvc->chip_type != ADV_CHIP_ASC38C0800) { |
| 7333 | asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE; |
| 7334 | return ADV_ERROR; |
| 7335 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7336 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7337 | warn_code = 0; |
| 7338 | iop_base = asc_dvc->iop_base; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7339 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7340 | /* |
| 7341 | * Save the RISC memory BIOS region before writing the microcode. |
| 7342 | * The BIOS may already be loaded and using its RISC LRAM region |
| 7343 | * so its region must be saved and restored. |
| 7344 | * |
| 7345 | * Note: This code makes the assumption, which is currently true, |
| 7346 | * that a chip reset does not clear RISC LRAM. |
| 7347 | */ |
| 7348 | for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) { |
| 7349 | AdvReadWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), |
| 7350 | bios_mem[i]); |
| 7351 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7352 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7353 | /* |
| 7354 | * Save current per TID negotiated values. |
| 7355 | */ |
| 7356 | AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); |
| 7357 | AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); |
| 7358 | AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able); |
| 7359 | for (tid = 0; tid <= ADV_MAX_TID; tid++) { |
| 7360 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid, |
| 7361 | max_cmd[tid]); |
| 7362 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7363 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7364 | /* |
| 7365 | * RAM BIST (RAM Built-In Self Test) |
| 7366 | * |
| 7367 | * Address : I/O base + offset 0x38h register (byte). |
| 7368 | * Function: Bit 7-6(RW) : RAM mode |
| 7369 | * Normal Mode : 0x00 |
| 7370 | * Pre-test Mode : 0x40 |
| 7371 | * RAM Test Mode : 0x80 |
| 7372 | * Bit 5 : unused |
| 7373 | * Bit 4(RO) : Done bit |
| 7374 | * Bit 3-0(RO) : Status |
| 7375 | * Host Error : 0x08 |
| 7376 | * Int_RAM Error : 0x04 |
| 7377 | * RISC Error : 0x02 |
| 7378 | * SCSI Error : 0x01 |
| 7379 | * No Error : 0x00 |
| 7380 | * |
| 7381 | * Note: RAM BIST code should be put right here, before loading the |
| 7382 | * microcode and after saving the RISC memory BIOS region. |
| 7383 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7384 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7385 | /* |
| 7386 | * LRAM Pre-test |
| 7387 | * |
| 7388 | * Write PRE_TEST_MODE (0x40) to register and wait for 10 milliseconds. |
| 7389 | * If Done bit not set or low nibble not PRE_TEST_VALUE (0x05), return |
| 7390 | * an error. Reset to NORMAL_MODE (0x00) and do again. If cannot reset |
| 7391 | * to NORMAL_MODE, return an error too. |
| 7392 | */ |
| 7393 | for (i = 0; i < 2; i++) { |
| 7394 | AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, PRE_TEST_MODE); |
Matthew Wilcox | b009bef | 2007-09-09 08:56:38 -0600 | [diff] [blame] | 7395 | mdelay(10); /* Wait for 10ms before reading back. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7396 | byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST); |
| 7397 | if ((byte & RAM_TEST_DONE) == 0 |
| 7398 | || (byte & 0x0F) != PRE_TEST_VALUE) { |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7399 | asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7400 | return ADV_ERROR; |
| 7401 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7402 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7403 | AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE); |
Matthew Wilcox | b009bef | 2007-09-09 08:56:38 -0600 | [diff] [blame] | 7404 | mdelay(10); /* Wait for 10ms before reading back. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7405 | if (AdvReadByteRegister(iop_base, IOPB_RAM_BIST) |
| 7406 | != NORMAL_VALUE) { |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7407 | asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7408 | return ADV_ERROR; |
| 7409 | } |
| 7410 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7411 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7412 | /* |
| 7413 | * LRAM Test - It takes about 1.5 ms to run through the test. |
| 7414 | * |
| 7415 | * Write RAM_TEST_MODE (0x80) to register and wait for 10 milliseconds. |
| 7416 | * If Done bit not set or Status not 0, save register byte, set the |
| 7417 | * err_code, and return an error. |
| 7418 | */ |
| 7419 | AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, RAM_TEST_MODE); |
Matthew Wilcox | b009bef | 2007-09-09 08:56:38 -0600 | [diff] [blame] | 7420 | mdelay(10); /* Wait for 10ms before checking status. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7421 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7422 | byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST); |
| 7423 | if ((byte & RAM_TEST_DONE) == 0 || (byte & RAM_TEST_STATUS) != 0) { |
| 7424 | /* Get here if Done bit not set or Status not 0. */ |
| 7425 | asc_dvc->bist_err_code = byte; /* for BIOS display message */ |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7426 | asc_dvc->err_code = ASC_IERR_BIST_RAM_TEST; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7427 | return ADV_ERROR; |
| 7428 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7429 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7430 | /* We need to reset back to normal mode after LRAM test passes. */ |
| 7431 | AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7432 | |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7433 | asc_dvc->err_code = AdvLoadMicrocode(iop_base, _adv_asc38C0800_buf, |
| 7434 | _adv_asc38C0800_size, ADV_38C0800_MEMSIZE, |
| 7435 | _adv_asc38C0800_chksum); |
| 7436 | if (asc_dvc->err_code) |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7437 | return ADV_ERROR; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7438 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7439 | /* |
| 7440 | * Restore the RISC memory BIOS region. |
| 7441 | */ |
| 7442 | for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) { |
| 7443 | AdvWriteWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), |
| 7444 | bios_mem[i]); |
| 7445 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7446 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7447 | /* |
| 7448 | * Calculate and write the microcode code checksum to the microcode |
| 7449 | * code checksum location ASC_MC_CODE_CHK_SUM (0x2C). |
| 7450 | */ |
| 7451 | AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, begin_addr); |
| 7452 | AdvReadWordLram(iop_base, ASC_MC_CODE_END_ADDR, end_addr); |
| 7453 | code_sum = 0; |
| 7454 | AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, begin_addr); |
| 7455 | for (word = begin_addr; word < end_addr; word += 2) { |
| 7456 | code_sum += AdvReadWordAutoIncLram(iop_base); |
| 7457 | } |
| 7458 | AdvWriteWordLram(iop_base, ASC_MC_CODE_CHK_SUM, code_sum); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7459 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7460 | /* |
| 7461 | * Read microcode version and date. |
| 7462 | */ |
| 7463 | AdvReadWordLram(iop_base, ASC_MC_VERSION_DATE, |
| 7464 | asc_dvc->cfg->mcode_date); |
| 7465 | AdvReadWordLram(iop_base, ASC_MC_VERSION_NUM, |
| 7466 | asc_dvc->cfg->mcode_version); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7467 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7468 | /* |
| 7469 | * Set the chip type to indicate the ASC38C0800. |
| 7470 | */ |
| 7471 | AdvWriteWordLram(iop_base, ASC_MC_CHIP_TYPE, ADV_CHIP_ASC38C0800); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7472 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7473 | /* |
| 7474 | * Write 1 to bit 14 'DIS_TERM_DRV' in the SCSI_CFG1 register. |
| 7475 | * When DIS_TERM_DRV set to 1, C_DET[3:0] will reflect current |
| 7476 | * cable detection and then we are able to read C_DET[3:0]. |
| 7477 | * |
| 7478 | * Note: We will reset DIS_TERM_DRV to 0 in the 'Set SCSI_CFG1 |
| 7479 | * Microcode Default Value' section below. |
| 7480 | */ |
| 7481 | scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1); |
| 7482 | AdvWriteWordRegister(iop_base, IOPW_SCSI_CFG1, |
| 7483 | scsi_cfg1 | DIS_TERM_DRV); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7484 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7485 | /* |
| 7486 | * If the PCI Configuration Command Register "Parity Error Response |
| 7487 | * Control" Bit was clear (0), then set the microcode variable |
| 7488 | * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode |
| 7489 | * to ignore DMA parity errors. |
| 7490 | */ |
| 7491 | if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) { |
| 7492 | AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word); |
| 7493 | word |= CONTROL_FLAG_IGNORE_PERR; |
| 7494 | AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word); |
| 7495 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7496 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7497 | /* |
| 7498 | * For ASC-38C0800, set FIFO_THRESH_80B [6:4] bits and START_CTL_TH [3:2] |
| 7499 | * bits for the default FIFO threshold. |
| 7500 | * |
| 7501 | * Note: ASC-38C0800 FIFO threshold has been changed to 256 bytes. |
| 7502 | * |
| 7503 | * For DMA Errata #4 set the BC_THRESH_ENB bit. |
| 7504 | */ |
| 7505 | AdvWriteByteRegister(iop_base, IOPB_DMA_CFG0, |
| 7506 | BC_THRESH_ENB | FIFO_THRESH_80B | START_CTL_TH | |
| 7507 | READ_CMD_MRM); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7508 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7509 | /* |
| 7510 | * Microcode operating variables for WDTR, SDTR, and command tag |
Matthew Wilcox | 47d853c | 2007-07-26 11:41:33 -0400 | [diff] [blame] | 7511 | * queuing will be set in slave_configure() based on what a |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7512 | * device reports it is capable of in Inquiry byte 7. |
| 7513 | * |
| 7514 | * If SCSI Bus Resets have been disabled, then directly set |
| 7515 | * SDTR and WDTR from the EEPROM configuration. This will allow |
| 7516 | * the BIOS and warm boot to work without a SCSI bus hang on |
| 7517 | * the Inquiry caused by host and target mismatched DTR values. |
| 7518 | * Without the SCSI Bus Reset, before an Inquiry a device can't |
| 7519 | * be assumed to be in Asynchronous, Narrow mode. |
| 7520 | */ |
| 7521 | if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) { |
| 7522 | AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, |
| 7523 | asc_dvc->wdtr_able); |
| 7524 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, |
| 7525 | asc_dvc->sdtr_able); |
| 7526 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7527 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7528 | /* |
| 7529 | * Set microcode operating variables for DISC and SDTR_SPEED1, |
| 7530 | * SDTR_SPEED2, SDTR_SPEED3, and SDTR_SPEED4 based on the EEPROM |
| 7531 | * configuration values. |
| 7532 | * |
| 7533 | * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2, |
| 7534 | * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them |
| 7535 | * without determining here whether the device supports SDTR. |
| 7536 | */ |
| 7537 | AdvWriteWordLram(iop_base, ASC_MC_DISC_ENABLE, |
| 7538 | asc_dvc->cfg->disc_enable); |
| 7539 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1); |
| 7540 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2); |
| 7541 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3); |
| 7542 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7543 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7544 | /* |
| 7545 | * Set SCSI_CFG0 Microcode Default Value. |
| 7546 | * |
| 7547 | * The microcode will set the SCSI_CFG0 register using this value |
| 7548 | * after it is started below. |
| 7549 | */ |
| 7550 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG0, |
| 7551 | PARITY_EN | QUEUE_128 | SEL_TMO_LONG | OUR_ID_EN | |
| 7552 | asc_dvc->chip_scsi_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7553 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7554 | /* |
| 7555 | * Determine SCSI_CFG1 Microcode Default Value. |
| 7556 | * |
| 7557 | * The microcode will set the SCSI_CFG1 register using this value |
| 7558 | * after it is started below. |
| 7559 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7560 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7561 | /* Read current SCSI_CFG1 Register value. */ |
| 7562 | scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7563 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7564 | /* |
| 7565 | * If the internal narrow cable is reversed all of the SCSI_CTRL |
| 7566 | * register signals will be set. Check for and return an error if |
| 7567 | * this condition is found. |
| 7568 | */ |
| 7569 | if ((AdvReadWordRegister(iop_base, IOPW_SCSI_CTRL) & 0x3F07) == 0x3F07) { |
| 7570 | asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE; |
| 7571 | return ADV_ERROR; |
| 7572 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7573 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7574 | /* |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7575 | * All kind of combinations of devices attached to one of four |
| 7576 | * connectors are acceptable except HVD device attached. For example, |
| 7577 | * LVD device can be attached to SE connector while SE device attached |
| 7578 | * to LVD connector. If LVD device attached to SE connector, it only |
| 7579 | * runs up to Ultra speed. |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7580 | * |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7581 | * If an HVD device is attached to one of LVD connectors, return an |
| 7582 | * error. However, there is no way to detect HVD device attached to |
| 7583 | * SE connectors. |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7584 | */ |
| 7585 | if (scsi_cfg1 & HVD) { |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7586 | asc_dvc->err_code = ASC_IERR_HVD_DEVICE; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7587 | return ADV_ERROR; |
| 7588 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7589 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7590 | /* |
| 7591 | * If either SE or LVD automatic termination control is enabled, then |
| 7592 | * set the termination value based on a table listed in a_condor.h. |
| 7593 | * |
| 7594 | * If manual termination was specified with an EEPROM setting then |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7595 | * 'termination' was set-up in AdvInitFrom38C0800EEPROM() and is ready |
| 7596 | * to be 'ored' into SCSI_CFG1. |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7597 | */ |
| 7598 | if ((asc_dvc->cfg->termination & TERM_SE) == 0) { |
| 7599 | /* SE automatic termination control is enabled. */ |
| 7600 | switch (scsi_cfg1 & C_DET_SE) { |
| 7601 | /* TERM_SE_HI: on, TERM_SE_LO: on */ |
| 7602 | case 0x1: |
| 7603 | case 0x2: |
| 7604 | case 0x3: |
| 7605 | asc_dvc->cfg->termination |= TERM_SE; |
| 7606 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7607 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7608 | /* TERM_SE_HI: on, TERM_SE_LO: off */ |
| 7609 | case 0x0: |
| 7610 | asc_dvc->cfg->termination |= TERM_SE_HI; |
| 7611 | break; |
| 7612 | } |
| 7613 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7614 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7615 | if ((asc_dvc->cfg->termination & TERM_LVD) == 0) { |
| 7616 | /* LVD automatic termination control is enabled. */ |
| 7617 | switch (scsi_cfg1 & C_DET_LVD) { |
| 7618 | /* TERM_LVD_HI: on, TERM_LVD_LO: on */ |
| 7619 | case 0x4: |
| 7620 | case 0x8: |
| 7621 | case 0xC: |
| 7622 | asc_dvc->cfg->termination |= TERM_LVD; |
| 7623 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7624 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7625 | /* TERM_LVD_HI: off, TERM_LVD_LO: off */ |
| 7626 | case 0x0: |
| 7627 | break; |
| 7628 | } |
| 7629 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7630 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7631 | /* |
| 7632 | * Clear any set TERM_SE and TERM_LVD bits. |
| 7633 | */ |
| 7634 | scsi_cfg1 &= (~TERM_SE & ~TERM_LVD); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7635 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7636 | /* |
| 7637 | * Invert the TERM_SE and TERM_LVD bits and then set 'scsi_cfg1'. |
| 7638 | */ |
| 7639 | scsi_cfg1 |= (~asc_dvc->cfg->termination & 0xF0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7640 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7641 | /* |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7642 | * Clear BIG_ENDIAN, DIS_TERM_DRV, Terminator Polarity and HVD/LVD/SE |
| 7643 | * bits and set possibly modified termination control bits in the |
| 7644 | * Microcode SCSI_CFG1 Register Value. |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7645 | */ |
| 7646 | scsi_cfg1 &= (~BIG_ENDIAN & ~DIS_TERM_DRV & ~TERM_POL & ~HVD_LVD_SE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7647 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7648 | /* |
| 7649 | * Set SCSI_CFG1 Microcode Default Value |
| 7650 | * |
| 7651 | * Set possibly modified termination control and reset DIS_TERM_DRV |
| 7652 | * bits in the Microcode SCSI_CFG1 Register Value. |
| 7653 | * |
| 7654 | * The microcode will set the SCSI_CFG1 register using this value |
| 7655 | * after it is started below. |
| 7656 | */ |
| 7657 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG1, scsi_cfg1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7658 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7659 | /* |
| 7660 | * Set MEM_CFG Microcode Default Value |
| 7661 | * |
| 7662 | * The microcode will set the MEM_CFG register using this value |
| 7663 | * after it is started below. |
| 7664 | * |
| 7665 | * MEM_CFG may be accessed as a word or byte, but only bits 0-7 |
| 7666 | * are defined. |
| 7667 | * |
| 7668 | * ASC-38C0800 has 16KB internal memory. |
| 7669 | */ |
| 7670 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG, |
| 7671 | BIOS_EN | RAM_SZ_16KB); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7672 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7673 | /* |
| 7674 | * Set SEL_MASK Microcode Default Value |
| 7675 | * |
| 7676 | * The microcode will set the SEL_MASK register using this value |
| 7677 | * after it is started below. |
| 7678 | */ |
| 7679 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK, |
| 7680 | ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7681 | |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 7682 | AdvBuildCarrierFreelist(asc_dvc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7683 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7684 | /* |
| 7685 | * Set-up the Host->RISC Initiator Command Queue (ICQ). |
| 7686 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7687 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7688 | if ((asc_dvc->icq_sp = asc_dvc->carr_freelist) == NULL) { |
| 7689 | asc_dvc->err_code |= ASC_IERR_NO_CARRIER; |
| 7690 | return ADV_ERROR; |
| 7691 | } |
| 7692 | asc_dvc->carr_freelist = (ADV_CARR_T *) |
| 7693 | ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->icq_sp->next_vpa)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7694 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7695 | /* |
| 7696 | * The first command issued will be placed in the stopper carrier. |
| 7697 | */ |
| 7698 | asc_dvc->icq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7699 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7700 | /* |
| 7701 | * Set RISC ICQ physical address start value. |
| 7702 | * carr_pa is LE, must be native before write |
| 7703 | */ |
| 7704 | AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7705 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7706 | /* |
| 7707 | * Set-up the RISC->Host Initiator Response Queue (IRQ). |
| 7708 | */ |
| 7709 | if ((asc_dvc->irq_sp = asc_dvc->carr_freelist) == NULL) { |
| 7710 | asc_dvc->err_code |= ASC_IERR_NO_CARRIER; |
| 7711 | return ADV_ERROR; |
| 7712 | } |
| 7713 | asc_dvc->carr_freelist = (ADV_CARR_T *) |
| 7714 | ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->next_vpa)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7715 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7716 | /* |
| 7717 | * The first command completed by the RISC will be placed in |
| 7718 | * the stopper. |
| 7719 | * |
| 7720 | * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is |
| 7721 | * completed the RISC will set the ASC_RQ_STOPPER bit. |
| 7722 | */ |
| 7723 | asc_dvc->irq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7724 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7725 | /* |
| 7726 | * Set RISC IRQ physical address start value. |
| 7727 | * |
| 7728 | * carr_pa is LE, must be native before write * |
| 7729 | */ |
| 7730 | AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa); |
| 7731 | asc_dvc->carr_pending_cnt = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7732 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7733 | AdvWriteByteRegister(iop_base, IOPB_INTR_ENABLES, |
| 7734 | (ADV_INTR_ENABLE_HOST_INTR | |
| 7735 | ADV_INTR_ENABLE_GLOBAL_INTR)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7736 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7737 | AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, word); |
| 7738 | AdvWriteWordRegister(iop_base, IOPW_PC, word); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7739 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7740 | /* finally, finally, gentlemen, start your engine */ |
| 7741 | AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_RUN); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7742 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7743 | /* |
| 7744 | * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus |
| 7745 | * Resets should be performed. The RISC has to be running |
| 7746 | * to issue a SCSI Bus Reset. |
| 7747 | */ |
| 7748 | if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) { |
| 7749 | /* |
| 7750 | * If the BIOS Signature is present in memory, restore the |
| 7751 | * BIOS Handshake Configuration Table and do not perform |
| 7752 | * a SCSI Bus Reset. |
| 7753 | */ |
| 7754 | if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] == |
| 7755 | 0x55AA) { |
| 7756 | /* |
| 7757 | * Restore per TID negotiated values. |
| 7758 | */ |
| 7759 | AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); |
| 7760 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); |
| 7761 | AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE, |
| 7762 | tagqng_able); |
| 7763 | for (tid = 0; tid <= ADV_MAX_TID; tid++) { |
| 7764 | AdvWriteByteLram(iop_base, |
| 7765 | ASC_MC_NUMBER_OF_MAX_CMD + tid, |
| 7766 | max_cmd[tid]); |
| 7767 | } |
| 7768 | } else { |
| 7769 | if (AdvResetSB(asc_dvc) != ADV_TRUE) { |
| 7770 | warn_code = ASC_WARN_BUSRESET_ERROR; |
| 7771 | } |
| 7772 | } |
| 7773 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7774 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7775 | return warn_code; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7776 | } |
| 7777 | |
| 7778 | /* |
| 7779 | * Initialize the ASC-38C1600. |
| 7780 | * |
| 7781 | * On failure set the ASC_DVC_VAR field 'err_code' and return ADV_ERROR. |
| 7782 | * |
| 7783 | * For a non-fatal error return a warning code. If there are no warnings |
| 7784 | * then 0 is returned. |
| 7785 | * |
| 7786 | * Needed after initialization for error recovery. |
| 7787 | */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7788 | static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7789 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7790 | AdvPortAddr iop_base; |
| 7791 | ushort warn_code; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7792 | int begin_addr; |
| 7793 | int end_addr; |
| 7794 | ushort code_sum; |
| 7795 | long word; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7796 | int i; |
| 7797 | ushort scsi_cfg1; |
| 7798 | uchar byte; |
| 7799 | uchar tid; |
| 7800 | ushort bios_mem[ASC_MC_BIOSLEN / 2]; /* BIOS RISC Memory 0x40-0x8F. */ |
| 7801 | ushort wdtr_able, sdtr_able, ppr_able, tagqng_able; |
| 7802 | uchar max_cmd[ASC_MAX_TID + 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7803 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7804 | /* If there is already an error, don't continue. */ |
| 7805 | if (asc_dvc->err_code != 0) { |
| 7806 | return ADV_ERROR; |
| 7807 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7808 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7809 | /* |
| 7810 | * The caller must set 'chip_type' to ADV_CHIP_ASC38C1600. |
| 7811 | */ |
| 7812 | if (asc_dvc->chip_type != ADV_CHIP_ASC38C1600) { |
| 7813 | asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE; |
| 7814 | return ADV_ERROR; |
| 7815 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7816 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7817 | warn_code = 0; |
| 7818 | iop_base = asc_dvc->iop_base; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7819 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7820 | /* |
| 7821 | * Save the RISC memory BIOS region before writing the microcode. |
| 7822 | * The BIOS may already be loaded and using its RISC LRAM region |
| 7823 | * so its region must be saved and restored. |
| 7824 | * |
| 7825 | * Note: This code makes the assumption, which is currently true, |
| 7826 | * that a chip reset does not clear RISC LRAM. |
| 7827 | */ |
| 7828 | for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) { |
| 7829 | AdvReadWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), |
| 7830 | bios_mem[i]); |
| 7831 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7832 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7833 | /* |
| 7834 | * Save current per TID negotiated values. |
| 7835 | */ |
| 7836 | AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); |
| 7837 | AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); |
| 7838 | AdvReadWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able); |
| 7839 | AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able); |
| 7840 | for (tid = 0; tid <= ASC_MAX_TID; tid++) { |
| 7841 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid, |
| 7842 | max_cmd[tid]); |
| 7843 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7844 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7845 | /* |
| 7846 | * RAM BIST (Built-In Self Test) |
| 7847 | * |
| 7848 | * Address : I/O base + offset 0x38h register (byte). |
| 7849 | * Function: Bit 7-6(RW) : RAM mode |
| 7850 | * Normal Mode : 0x00 |
| 7851 | * Pre-test Mode : 0x40 |
| 7852 | * RAM Test Mode : 0x80 |
| 7853 | * Bit 5 : unused |
| 7854 | * Bit 4(RO) : Done bit |
| 7855 | * Bit 3-0(RO) : Status |
| 7856 | * Host Error : 0x08 |
| 7857 | * Int_RAM Error : 0x04 |
| 7858 | * RISC Error : 0x02 |
| 7859 | * SCSI Error : 0x01 |
| 7860 | * No Error : 0x00 |
| 7861 | * |
| 7862 | * Note: RAM BIST code should be put right here, before loading the |
| 7863 | * microcode and after saving the RISC memory BIOS region. |
| 7864 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7865 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7866 | /* |
| 7867 | * LRAM Pre-test |
| 7868 | * |
| 7869 | * Write PRE_TEST_MODE (0x40) to register and wait for 10 milliseconds. |
| 7870 | * If Done bit not set or low nibble not PRE_TEST_VALUE (0x05), return |
| 7871 | * an error. Reset to NORMAL_MODE (0x00) and do again. If cannot reset |
| 7872 | * to NORMAL_MODE, return an error too. |
| 7873 | */ |
| 7874 | for (i = 0; i < 2; i++) { |
| 7875 | AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, PRE_TEST_MODE); |
Matthew Wilcox | b009bef | 2007-09-09 08:56:38 -0600 | [diff] [blame] | 7876 | mdelay(10); /* Wait for 10ms before reading back. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7877 | byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST); |
| 7878 | if ((byte & RAM_TEST_DONE) == 0 |
| 7879 | || (byte & 0x0F) != PRE_TEST_VALUE) { |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7880 | asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7881 | return ADV_ERROR; |
| 7882 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7883 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7884 | AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE); |
Matthew Wilcox | b009bef | 2007-09-09 08:56:38 -0600 | [diff] [blame] | 7885 | mdelay(10); /* Wait for 10ms before reading back. */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7886 | if (AdvReadByteRegister(iop_base, IOPB_RAM_BIST) |
| 7887 | != NORMAL_VALUE) { |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7888 | asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7889 | return ADV_ERROR; |
| 7890 | } |
| 7891 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7892 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7893 | /* |
| 7894 | * LRAM Test - It takes about 1.5 ms to run through the test. |
| 7895 | * |
| 7896 | * Write RAM_TEST_MODE (0x80) to register and wait for 10 milliseconds. |
| 7897 | * If Done bit not set or Status not 0, save register byte, set the |
| 7898 | * err_code, and return an error. |
| 7899 | */ |
| 7900 | AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, RAM_TEST_MODE); |
Matthew Wilcox | b009bef | 2007-09-09 08:56:38 -0600 | [diff] [blame] | 7901 | mdelay(10); /* Wait for 10ms before checking status. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7902 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7903 | byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST); |
| 7904 | if ((byte & RAM_TEST_DONE) == 0 || (byte & RAM_TEST_STATUS) != 0) { |
| 7905 | /* Get here if Done bit not set or Status not 0. */ |
| 7906 | asc_dvc->bist_err_code = byte; /* for BIOS display message */ |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7907 | asc_dvc->err_code = ASC_IERR_BIST_RAM_TEST; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7908 | return ADV_ERROR; |
| 7909 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7910 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7911 | /* We need to reset back to normal mode after LRAM test passes. */ |
| 7912 | AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7913 | |
Matthew Wilcox | b9d9661 | 2007-09-09 08:56:28 -0600 | [diff] [blame] | 7914 | asc_dvc->err_code = AdvLoadMicrocode(iop_base, _adv_asc38C1600_buf, |
| 7915 | _adv_asc38C1600_size, ADV_38C1600_MEMSIZE, |
| 7916 | _adv_asc38C1600_chksum); |
| 7917 | if (asc_dvc->err_code) |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7918 | return ADV_ERROR; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7919 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7920 | /* |
| 7921 | * Restore the RISC memory BIOS region. |
| 7922 | */ |
| 7923 | for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) { |
| 7924 | AdvWriteWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), |
| 7925 | bios_mem[i]); |
| 7926 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7927 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7928 | /* |
| 7929 | * Calculate and write the microcode code checksum to the microcode |
| 7930 | * code checksum location ASC_MC_CODE_CHK_SUM (0x2C). |
| 7931 | */ |
| 7932 | AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, begin_addr); |
| 7933 | AdvReadWordLram(iop_base, ASC_MC_CODE_END_ADDR, end_addr); |
| 7934 | code_sum = 0; |
| 7935 | AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, begin_addr); |
| 7936 | for (word = begin_addr; word < end_addr; word += 2) { |
| 7937 | code_sum += AdvReadWordAutoIncLram(iop_base); |
| 7938 | } |
| 7939 | AdvWriteWordLram(iop_base, ASC_MC_CODE_CHK_SUM, code_sum); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7940 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7941 | /* |
| 7942 | * Read microcode version and date. |
| 7943 | */ |
| 7944 | AdvReadWordLram(iop_base, ASC_MC_VERSION_DATE, |
| 7945 | asc_dvc->cfg->mcode_date); |
| 7946 | AdvReadWordLram(iop_base, ASC_MC_VERSION_NUM, |
| 7947 | asc_dvc->cfg->mcode_version); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7948 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7949 | /* |
| 7950 | * Set the chip type to indicate the ASC38C1600. |
| 7951 | */ |
| 7952 | AdvWriteWordLram(iop_base, ASC_MC_CHIP_TYPE, ADV_CHIP_ASC38C1600); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7953 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7954 | /* |
| 7955 | * Write 1 to bit 14 'DIS_TERM_DRV' in the SCSI_CFG1 register. |
| 7956 | * When DIS_TERM_DRV set to 1, C_DET[3:0] will reflect current |
| 7957 | * cable detection and then we are able to read C_DET[3:0]. |
| 7958 | * |
| 7959 | * Note: We will reset DIS_TERM_DRV to 0 in the 'Set SCSI_CFG1 |
| 7960 | * Microcode Default Value' section below. |
| 7961 | */ |
| 7962 | scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1); |
| 7963 | AdvWriteWordRegister(iop_base, IOPW_SCSI_CFG1, |
| 7964 | scsi_cfg1 | DIS_TERM_DRV); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7965 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7966 | /* |
| 7967 | * If the PCI Configuration Command Register "Parity Error Response |
| 7968 | * Control" Bit was clear (0), then set the microcode variable |
| 7969 | * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode |
| 7970 | * to ignore DMA parity errors. |
| 7971 | */ |
| 7972 | if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) { |
| 7973 | AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word); |
| 7974 | word |= CONTROL_FLAG_IGNORE_PERR; |
| 7975 | AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word); |
| 7976 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7977 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7978 | /* |
| 7979 | * If the BIOS control flag AIPP (Asynchronous Information |
| 7980 | * Phase Protection) disable bit is not set, then set the firmware |
| 7981 | * 'control_flag' CONTROL_FLAG_ENABLE_AIPP bit to enable |
| 7982 | * AIPP checking and encoding. |
| 7983 | */ |
| 7984 | if ((asc_dvc->bios_ctrl & BIOS_CTRL_AIPP_DIS) == 0) { |
| 7985 | AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word); |
| 7986 | word |= CONTROL_FLAG_ENABLE_AIPP; |
| 7987 | AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word); |
| 7988 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7989 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7990 | /* |
| 7991 | * For ASC-38C1600 use DMA_CFG0 default values: FIFO_THRESH_80B [6:4], |
| 7992 | * and START_CTL_TH [3:2]. |
| 7993 | */ |
| 7994 | AdvWriteByteRegister(iop_base, IOPB_DMA_CFG0, |
| 7995 | FIFO_THRESH_80B | START_CTL_TH | READ_CMD_MRM); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7996 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 7997 | /* |
| 7998 | * Microcode operating variables for WDTR, SDTR, and command tag |
Matthew Wilcox | 47d853c | 2007-07-26 11:41:33 -0400 | [diff] [blame] | 7999 | * queuing will be set in slave_configure() based on what a |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8000 | * device reports it is capable of in Inquiry byte 7. |
| 8001 | * |
| 8002 | * If SCSI Bus Resets have been disabled, then directly set |
| 8003 | * SDTR and WDTR from the EEPROM configuration. This will allow |
| 8004 | * the BIOS and warm boot to work without a SCSI bus hang on |
| 8005 | * the Inquiry caused by host and target mismatched DTR values. |
| 8006 | * Without the SCSI Bus Reset, before an Inquiry a device can't |
| 8007 | * be assumed to be in Asynchronous, Narrow mode. |
| 8008 | */ |
| 8009 | if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) { |
| 8010 | AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, |
| 8011 | asc_dvc->wdtr_able); |
| 8012 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, |
| 8013 | asc_dvc->sdtr_able); |
| 8014 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8015 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8016 | /* |
| 8017 | * Set microcode operating variables for DISC and SDTR_SPEED1, |
| 8018 | * SDTR_SPEED2, SDTR_SPEED3, and SDTR_SPEED4 based on the EEPROM |
| 8019 | * configuration values. |
| 8020 | * |
| 8021 | * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2, |
| 8022 | * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them |
| 8023 | * without determining here whether the device supports SDTR. |
| 8024 | */ |
| 8025 | AdvWriteWordLram(iop_base, ASC_MC_DISC_ENABLE, |
| 8026 | asc_dvc->cfg->disc_enable); |
| 8027 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1); |
| 8028 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2); |
| 8029 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3); |
| 8030 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8031 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8032 | /* |
| 8033 | * Set SCSI_CFG0 Microcode Default Value. |
| 8034 | * |
| 8035 | * The microcode will set the SCSI_CFG0 register using this value |
| 8036 | * after it is started below. |
| 8037 | */ |
| 8038 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG0, |
| 8039 | PARITY_EN | QUEUE_128 | SEL_TMO_LONG | OUR_ID_EN | |
| 8040 | asc_dvc->chip_scsi_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8041 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8042 | /* |
| 8043 | * Calculate SCSI_CFG1 Microcode Default Value. |
| 8044 | * |
| 8045 | * The microcode will set the SCSI_CFG1 register using this value |
| 8046 | * after it is started below. |
| 8047 | * |
| 8048 | * Each ASC-38C1600 function has only two cable detect bits. |
| 8049 | * The bus mode override bits are in IOPB_SOFT_OVER_WR. |
| 8050 | */ |
| 8051 | scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8052 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8053 | /* |
| 8054 | * If the cable is reversed all of the SCSI_CTRL register signals |
| 8055 | * will be set. Check for and return an error if this condition is |
| 8056 | * found. |
| 8057 | */ |
| 8058 | if ((AdvReadWordRegister(iop_base, IOPW_SCSI_CTRL) & 0x3F07) == 0x3F07) { |
| 8059 | asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE; |
| 8060 | return ADV_ERROR; |
| 8061 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8062 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8063 | /* |
| 8064 | * Each ASC-38C1600 function has two connectors. Only an HVD device |
| 8065 | * can not be connected to either connector. An LVD device or SE device |
| 8066 | * may be connected to either connecor. If an SE device is connected, |
| 8067 | * then at most Ultra speed (20 Mhz) can be used on both connectors. |
| 8068 | * |
| 8069 | * If an HVD device is attached, return an error. |
| 8070 | */ |
| 8071 | if (scsi_cfg1 & HVD) { |
| 8072 | asc_dvc->err_code |= ASC_IERR_HVD_DEVICE; |
| 8073 | return ADV_ERROR; |
| 8074 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8075 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8076 | /* |
| 8077 | * Each function in the ASC-38C1600 uses only the SE cable detect and |
| 8078 | * termination because there are two connectors for each function. Each |
| 8079 | * function may use either LVD or SE mode. Corresponding the SE automatic |
| 8080 | * termination control EEPROM bits are used for each function. Each |
| 8081 | * function has its own EEPROM. If SE automatic control is enabled for |
| 8082 | * the function, then set the termination value based on a table listed |
| 8083 | * in a_condor.h. |
| 8084 | * |
| 8085 | * If manual termination is specified in the EEPROM for the function, |
| 8086 | * then 'termination' was set-up in AscInitFrom38C1600EEPROM() and is |
| 8087 | * ready to be 'ored' into SCSI_CFG1. |
| 8088 | */ |
| 8089 | if ((asc_dvc->cfg->termination & TERM_SE) == 0) { |
Matthew Wilcox | 13ac2d9 | 2007-07-30 08:10:23 -0600 | [diff] [blame] | 8090 | struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8091 | /* SE automatic termination control is enabled. */ |
| 8092 | switch (scsi_cfg1 & C_DET_SE) { |
| 8093 | /* TERM_SE_HI: on, TERM_SE_LO: on */ |
| 8094 | case 0x1: |
| 8095 | case 0x2: |
| 8096 | case 0x3: |
| 8097 | asc_dvc->cfg->termination |= TERM_SE; |
| 8098 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8099 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8100 | case 0x0: |
Matthew Wilcox | 13ac2d9 | 2007-07-30 08:10:23 -0600 | [diff] [blame] | 8101 | if (PCI_FUNC(pdev->devfn) == 0) { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8102 | /* Function 0 - TERM_SE_HI: off, TERM_SE_LO: off */ |
| 8103 | } else { |
| 8104 | /* Function 1 - TERM_SE_HI: on, TERM_SE_LO: off */ |
| 8105 | asc_dvc->cfg->termination |= TERM_SE_HI; |
| 8106 | } |
| 8107 | break; |
| 8108 | } |
| 8109 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8110 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8111 | /* |
| 8112 | * Clear any set TERM_SE bits. |
| 8113 | */ |
| 8114 | scsi_cfg1 &= ~TERM_SE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8115 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8116 | /* |
| 8117 | * Invert the TERM_SE bits and then set 'scsi_cfg1'. |
| 8118 | */ |
| 8119 | scsi_cfg1 |= (~asc_dvc->cfg->termination & TERM_SE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8120 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8121 | /* |
| 8122 | * Clear Big Endian and Terminator Polarity bits and set possibly |
| 8123 | * modified termination control bits in the Microcode SCSI_CFG1 |
| 8124 | * Register Value. |
| 8125 | * |
| 8126 | * Big Endian bit is not used even on big endian machines. |
| 8127 | */ |
| 8128 | scsi_cfg1 &= (~BIG_ENDIAN & ~DIS_TERM_DRV & ~TERM_POL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8129 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8130 | /* |
| 8131 | * Set SCSI_CFG1 Microcode Default Value |
| 8132 | * |
| 8133 | * Set possibly modified termination control bits in the Microcode |
| 8134 | * SCSI_CFG1 Register Value. |
| 8135 | * |
| 8136 | * The microcode will set the SCSI_CFG1 register using this value |
| 8137 | * after it is started below. |
| 8138 | */ |
| 8139 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG1, scsi_cfg1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8140 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8141 | /* |
| 8142 | * Set MEM_CFG Microcode Default Value |
| 8143 | * |
| 8144 | * The microcode will set the MEM_CFG register using this value |
| 8145 | * after it is started below. |
| 8146 | * |
| 8147 | * MEM_CFG may be accessed as a word or byte, but only bits 0-7 |
| 8148 | * are defined. |
| 8149 | * |
| 8150 | * ASC-38C1600 has 32KB internal memory. |
| 8151 | * |
| 8152 | * XXX - Since ASC38C1600 Rev.3 has a Local RAM failure issue, we come |
| 8153 | * out a special 16K Adv Library and Microcode version. After the issue |
| 8154 | * resolved, we should turn back to the 32K support. Both a_condor.h and |
| 8155 | * mcode.sas files also need to be updated. |
| 8156 | * |
| 8157 | * AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG, |
| 8158 | * BIOS_EN | RAM_SZ_32KB); |
| 8159 | */ |
| 8160 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG, |
| 8161 | BIOS_EN | RAM_SZ_16KB); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8162 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8163 | /* |
| 8164 | * Set SEL_MASK Microcode Default Value |
| 8165 | * |
| 8166 | * The microcode will set the SEL_MASK register using this value |
| 8167 | * after it is started below. |
| 8168 | */ |
| 8169 | AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK, |
| 8170 | ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8171 | |
Matthew Wilcox | a9f4a59 | 2007-09-09 08:56:27 -0600 | [diff] [blame] | 8172 | AdvBuildCarrierFreelist(asc_dvc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8173 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8174 | /* |
| 8175 | * Set-up the Host->RISC Initiator Command Queue (ICQ). |
| 8176 | */ |
| 8177 | if ((asc_dvc->icq_sp = asc_dvc->carr_freelist) == NULL) { |
| 8178 | asc_dvc->err_code |= ASC_IERR_NO_CARRIER; |
| 8179 | return ADV_ERROR; |
| 8180 | } |
| 8181 | asc_dvc->carr_freelist = (ADV_CARR_T *) |
| 8182 | ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->icq_sp->next_vpa)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8183 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8184 | /* |
| 8185 | * The first command issued will be placed in the stopper carrier. |
| 8186 | */ |
| 8187 | asc_dvc->icq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8188 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8189 | /* |
| 8190 | * Set RISC ICQ physical address start value. Initialize the |
| 8191 | * COMMA register to the same value otherwise the RISC will |
| 8192 | * prematurely detect a command is available. |
| 8193 | */ |
| 8194 | AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa); |
| 8195 | AdvWriteDWordRegister(iop_base, IOPDW_COMMA, |
| 8196 | le32_to_cpu(asc_dvc->icq_sp->carr_pa)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8197 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8198 | /* |
| 8199 | * Set-up the RISC->Host Initiator Response Queue (IRQ). |
| 8200 | */ |
| 8201 | if ((asc_dvc->irq_sp = asc_dvc->carr_freelist) == NULL) { |
| 8202 | asc_dvc->err_code |= ASC_IERR_NO_CARRIER; |
| 8203 | return ADV_ERROR; |
| 8204 | } |
| 8205 | asc_dvc->carr_freelist = (ADV_CARR_T *) |
| 8206 | ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->next_vpa)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8207 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8208 | /* |
| 8209 | * The first command completed by the RISC will be placed in |
| 8210 | * the stopper. |
| 8211 | * |
| 8212 | * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is |
| 8213 | * completed the RISC will set the ASC_RQ_STOPPER bit. |
| 8214 | */ |
| 8215 | asc_dvc->irq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8216 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8217 | /* |
| 8218 | * Set RISC IRQ physical address start value. |
| 8219 | */ |
| 8220 | AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa); |
| 8221 | asc_dvc->carr_pending_cnt = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8222 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8223 | AdvWriteByteRegister(iop_base, IOPB_INTR_ENABLES, |
| 8224 | (ADV_INTR_ENABLE_HOST_INTR | |
| 8225 | ADV_INTR_ENABLE_GLOBAL_INTR)); |
| 8226 | AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, word); |
| 8227 | AdvWriteWordRegister(iop_base, IOPW_PC, word); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8228 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8229 | /* finally, finally, gentlemen, start your engine */ |
| 8230 | AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_RUN); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8231 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8232 | /* |
| 8233 | * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus |
| 8234 | * Resets should be performed. The RISC has to be running |
| 8235 | * to issue a SCSI Bus Reset. |
| 8236 | */ |
| 8237 | if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) { |
| 8238 | /* |
| 8239 | * If the BIOS Signature is present in memory, restore the |
| 8240 | * per TID microcode operating variables. |
| 8241 | */ |
| 8242 | if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] == |
| 8243 | 0x55AA) { |
| 8244 | /* |
| 8245 | * Restore per TID negotiated values. |
| 8246 | */ |
| 8247 | AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); |
| 8248 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); |
| 8249 | AdvWriteWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able); |
| 8250 | AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE, |
| 8251 | tagqng_able); |
| 8252 | for (tid = 0; tid <= ASC_MAX_TID; tid++) { |
| 8253 | AdvWriteByteLram(iop_base, |
| 8254 | ASC_MC_NUMBER_OF_MAX_CMD + tid, |
| 8255 | max_cmd[tid]); |
| 8256 | } |
| 8257 | } else { |
| 8258 | if (AdvResetSB(asc_dvc) != ADV_TRUE) { |
| 8259 | warn_code = ASC_WARN_BUSRESET_ERROR; |
| 8260 | } |
| 8261 | } |
| 8262 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8263 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 8264 | return warn_code; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8265 | } |
| 8266 | |
| 8267 | /* |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 8268 | * Reset chip and SCSI Bus. |
| 8269 | * |
| 8270 | * Return Value: |
| 8271 | * ADV_TRUE(1) - Chip re-initialization and SCSI Bus Reset successful. |
| 8272 | * ADV_FALSE(0) - Chip re-initialization and SCSI Bus Reset failure. |
| 8273 | */ |
| 8274 | static int AdvResetChipAndSB(ADV_DVC_VAR *asc_dvc) |
| 8275 | { |
| 8276 | int status; |
| 8277 | ushort wdtr_able, sdtr_able, tagqng_able; |
| 8278 | ushort ppr_able = 0; |
| 8279 | uchar tid, max_cmd[ADV_MAX_TID + 1]; |
| 8280 | AdvPortAddr iop_base; |
| 8281 | ushort bios_sig; |
| 8282 | |
| 8283 | iop_base = asc_dvc->iop_base; |
| 8284 | |
| 8285 | /* |
| 8286 | * Save current per TID negotiated values. |
| 8287 | */ |
| 8288 | AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); |
| 8289 | AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); |
| 8290 | if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { |
| 8291 | AdvReadWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able); |
| 8292 | } |
| 8293 | AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able); |
| 8294 | for (tid = 0; tid <= ADV_MAX_TID; tid++) { |
| 8295 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid, |
| 8296 | max_cmd[tid]); |
| 8297 | } |
| 8298 | |
| 8299 | /* |
| 8300 | * Force the AdvInitAsc3550/38C0800Driver() function to |
| 8301 | * perform a SCSI Bus Reset by clearing the BIOS signature word. |
| 8302 | * The initialization functions assumes a SCSI Bus Reset is not |
| 8303 | * needed if the BIOS signature word is present. |
| 8304 | */ |
| 8305 | AdvReadWordLram(iop_base, ASC_MC_BIOS_SIGNATURE, bios_sig); |
| 8306 | AdvWriteWordLram(iop_base, ASC_MC_BIOS_SIGNATURE, 0); |
| 8307 | |
| 8308 | /* |
| 8309 | * Stop chip and reset it. |
| 8310 | */ |
| 8311 | AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_STOP); |
| 8312 | AdvWriteWordRegister(iop_base, IOPW_CTRL_REG, ADV_CTRL_REG_CMD_RESET); |
| 8313 | mdelay(100); |
| 8314 | AdvWriteWordRegister(iop_base, IOPW_CTRL_REG, |
| 8315 | ADV_CTRL_REG_CMD_WR_IO_REG); |
| 8316 | |
| 8317 | /* |
| 8318 | * Reset Adv Library error code, if any, and try |
| 8319 | * re-initializing the chip. |
| 8320 | */ |
| 8321 | asc_dvc->err_code = 0; |
| 8322 | if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { |
| 8323 | status = AdvInitAsc38C1600Driver(asc_dvc); |
| 8324 | } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { |
| 8325 | status = AdvInitAsc38C0800Driver(asc_dvc); |
| 8326 | } else { |
| 8327 | status = AdvInitAsc3550Driver(asc_dvc); |
| 8328 | } |
| 8329 | |
| 8330 | /* Translate initialization return value to status value. */ |
| 8331 | if (status == 0) { |
| 8332 | status = ADV_TRUE; |
| 8333 | } else { |
| 8334 | status = ADV_FALSE; |
| 8335 | } |
| 8336 | |
| 8337 | /* |
| 8338 | * Restore the BIOS signature word. |
| 8339 | */ |
| 8340 | AdvWriteWordLram(iop_base, ASC_MC_BIOS_SIGNATURE, bios_sig); |
| 8341 | |
| 8342 | /* |
| 8343 | * Restore per TID negotiated values. |
| 8344 | */ |
| 8345 | AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); |
| 8346 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); |
| 8347 | if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { |
| 8348 | AdvWriteWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able); |
| 8349 | } |
| 8350 | AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able); |
| 8351 | for (tid = 0; tid <= ADV_MAX_TID; tid++) { |
| 8352 | AdvWriteByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid, |
| 8353 | max_cmd[tid]); |
| 8354 | } |
| 8355 | |
| 8356 | return status; |
| 8357 | } |
| 8358 | |
| 8359 | /* |
| 8360 | * adv_async_callback() - Adv Library asynchronous event callback function. |
| 8361 | */ |
| 8362 | static void adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code) |
| 8363 | { |
| 8364 | switch (code) { |
| 8365 | case ADV_ASYNC_SCSI_BUS_RESET_DET: |
| 8366 | /* |
| 8367 | * The firmware detected a SCSI Bus reset. |
| 8368 | */ |
| 8369 | ASC_DBG(0, |
| 8370 | "adv_async_callback: ADV_ASYNC_SCSI_BUS_RESET_DET\n"); |
| 8371 | break; |
| 8372 | |
| 8373 | case ADV_ASYNC_RDMA_FAILURE: |
| 8374 | /* |
| 8375 | * Handle RDMA failure by resetting the SCSI Bus and |
| 8376 | * possibly the chip if it is unresponsive. Log the error |
| 8377 | * with a unique code. |
| 8378 | */ |
| 8379 | ASC_DBG(0, "adv_async_callback: ADV_ASYNC_RDMA_FAILURE\n"); |
| 8380 | AdvResetChipAndSB(adv_dvc_varp); |
| 8381 | break; |
| 8382 | |
| 8383 | case ADV_HOST_SCSI_BUS_RESET: |
| 8384 | /* |
| 8385 | * Host generated SCSI bus reset occurred. |
| 8386 | */ |
| 8387 | ASC_DBG(0, "adv_async_callback: ADV_HOST_SCSI_BUS_RESET\n"); |
| 8388 | break; |
| 8389 | |
| 8390 | default: |
| 8391 | ASC_DBG1(0, "DvcAsyncCallBack: unknown code 0x%x\n", code); |
| 8392 | break; |
| 8393 | } |
| 8394 | } |
| 8395 | |
| 8396 | /* |
| 8397 | * adv_isr_callback() - Second Level Interrupt Handler called by AdvISR(). |
| 8398 | * |
| 8399 | * Callback function for the Wide SCSI Adv Library. |
| 8400 | */ |
| 8401 | static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) |
| 8402 | { |
| 8403 | asc_board_t *boardp; |
| 8404 | adv_req_t *reqp; |
| 8405 | adv_sgblk_t *sgblkp; |
| 8406 | struct scsi_cmnd *scp; |
| 8407 | struct Scsi_Host *shost; |
| 8408 | ADV_DCNT resid_cnt; |
| 8409 | |
| 8410 | ASC_DBG2(1, "adv_isr_callback: adv_dvc_varp 0x%lx, scsiqp 0x%lx\n", |
| 8411 | (ulong)adv_dvc_varp, (ulong)scsiqp); |
| 8412 | ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp); |
| 8413 | |
| 8414 | /* |
| 8415 | * Get the adv_req_t structure for the command that has been |
| 8416 | * completed. The adv_req_t structure actually contains the |
| 8417 | * completed ADV_SCSI_REQ_Q structure. |
| 8418 | */ |
| 8419 | reqp = (adv_req_t *)ADV_U32_TO_VADDR(scsiqp->srb_ptr); |
| 8420 | ASC_DBG1(1, "adv_isr_callback: reqp 0x%lx\n", (ulong)reqp); |
| 8421 | if (reqp == NULL) { |
| 8422 | ASC_PRINT("adv_isr_callback: reqp is NULL\n"); |
| 8423 | return; |
| 8424 | } |
| 8425 | |
| 8426 | /* |
| 8427 | * Get the struct scsi_cmnd structure and Scsi_Host structure for the |
| 8428 | * command that has been completed. |
| 8429 | * |
| 8430 | * Note: The adv_req_t request structure and adv_sgblk_t structure, |
| 8431 | * if any, are dropped, because a board structure pointer can not be |
| 8432 | * determined. |
| 8433 | */ |
| 8434 | scp = reqp->cmndp; |
| 8435 | ASC_DBG1(1, "adv_isr_callback: scp 0x%lx\n", (ulong)scp); |
| 8436 | if (scp == NULL) { |
| 8437 | ASC_PRINT |
| 8438 | ("adv_isr_callback: scp is NULL; adv_req_t dropped.\n"); |
| 8439 | return; |
| 8440 | } |
| 8441 | ASC_DBG_PRT_CDB(2, scp->cmnd, scp->cmd_len); |
| 8442 | |
| 8443 | shost = scp->device->host; |
| 8444 | ASC_STATS(shost, callback); |
| 8445 | ASC_DBG1(1, "adv_isr_callback: shost 0x%lx\n", (ulong)shost); |
| 8446 | |
| 8447 | boardp = ASC_BOARDP(shost); |
| 8448 | BUG_ON(adv_dvc_varp != &boardp->dvc_var.adv_dvc_var); |
| 8449 | |
| 8450 | /* |
| 8451 | * 'done_status' contains the command's ending status. |
| 8452 | */ |
| 8453 | switch (scsiqp->done_status) { |
| 8454 | case QD_NO_ERROR: |
| 8455 | ASC_DBG(2, "adv_isr_callback: QD_NO_ERROR\n"); |
| 8456 | scp->result = 0; |
| 8457 | |
| 8458 | /* |
| 8459 | * Check for an underrun condition. |
| 8460 | * |
| 8461 | * If there was no error and an underrun condition, then |
| 8462 | * then return the number of underrun bytes. |
| 8463 | */ |
| 8464 | resid_cnt = le32_to_cpu(scsiqp->data_cnt); |
| 8465 | if (scp->request_bufflen != 0 && resid_cnt != 0 && |
| 8466 | resid_cnt <= scp->request_bufflen) { |
| 8467 | ASC_DBG1(1, |
| 8468 | "adv_isr_callback: underrun condition %lu bytes\n", |
| 8469 | (ulong)resid_cnt); |
| 8470 | scp->resid = resid_cnt; |
| 8471 | } |
| 8472 | break; |
| 8473 | |
| 8474 | case QD_WITH_ERROR: |
| 8475 | ASC_DBG(2, "adv_isr_callback: QD_WITH_ERROR\n"); |
| 8476 | switch (scsiqp->host_status) { |
| 8477 | case QHSTA_NO_ERROR: |
| 8478 | if (scsiqp->scsi_status == SAM_STAT_CHECK_CONDITION) { |
| 8479 | ASC_DBG(2, |
| 8480 | "adv_isr_callback: SAM_STAT_CHECK_CONDITION\n"); |
| 8481 | ASC_DBG_PRT_SENSE(2, scp->sense_buffer, |
| 8482 | sizeof(scp->sense_buffer)); |
| 8483 | /* |
| 8484 | * Note: The 'status_byte()' macro used by |
| 8485 | * target drivers defined in scsi.h shifts the |
| 8486 | * status byte returned by host drivers right |
| 8487 | * by 1 bit. This is why target drivers also |
| 8488 | * use right shifted status byte definitions. |
| 8489 | * For instance target drivers use |
| 8490 | * CHECK_CONDITION, defined to 0x1, instead of |
| 8491 | * the SCSI defined check condition value of |
| 8492 | * 0x2. Host drivers are supposed to return |
| 8493 | * the status byte as it is defined by SCSI. |
| 8494 | */ |
| 8495 | scp->result = DRIVER_BYTE(DRIVER_SENSE) | |
| 8496 | STATUS_BYTE(scsiqp->scsi_status); |
| 8497 | } else { |
| 8498 | scp->result = STATUS_BYTE(scsiqp->scsi_status); |
| 8499 | } |
| 8500 | break; |
| 8501 | |
| 8502 | default: |
| 8503 | /* Some other QHSTA error occurred. */ |
| 8504 | ASC_DBG1(1, "adv_isr_callback: host_status 0x%x\n", |
| 8505 | scsiqp->host_status); |
| 8506 | scp->result = HOST_BYTE(DID_BAD_TARGET); |
| 8507 | break; |
| 8508 | } |
| 8509 | break; |
| 8510 | |
| 8511 | case QD_ABORTED_BY_HOST: |
| 8512 | ASC_DBG(1, "adv_isr_callback: QD_ABORTED_BY_HOST\n"); |
| 8513 | scp->result = |
| 8514 | HOST_BYTE(DID_ABORT) | STATUS_BYTE(scsiqp->scsi_status); |
| 8515 | break; |
| 8516 | |
| 8517 | default: |
| 8518 | ASC_DBG1(1, "adv_isr_callback: done_status 0x%x\n", |
| 8519 | scsiqp->done_status); |
| 8520 | scp->result = |
| 8521 | HOST_BYTE(DID_ERROR) | STATUS_BYTE(scsiqp->scsi_status); |
| 8522 | break; |
| 8523 | } |
| 8524 | |
| 8525 | /* |
| 8526 | * If the 'init_tidmask' bit isn't already set for the target and the |
| 8527 | * current request finished normally, then set the bit for the target |
| 8528 | * to indicate that a device is present. |
| 8529 | */ |
| 8530 | if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 && |
| 8531 | scsiqp->done_status == QD_NO_ERROR && |
| 8532 | scsiqp->host_status == QHSTA_NO_ERROR) { |
| 8533 | boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id); |
| 8534 | } |
| 8535 | |
| 8536 | asc_scsi_done(scp); |
| 8537 | |
| 8538 | /* |
| 8539 | * Free all 'adv_sgblk_t' structures allocated for the request. |
| 8540 | */ |
| 8541 | while ((sgblkp = reqp->sgblkp) != NULL) { |
| 8542 | /* Remove 'sgblkp' from the request list. */ |
| 8543 | reqp->sgblkp = sgblkp->next_sgblkp; |
| 8544 | |
| 8545 | /* Add 'sgblkp' to the board free list. */ |
| 8546 | sgblkp->next_sgblkp = boardp->adv_sgblkp; |
| 8547 | boardp->adv_sgblkp = sgblkp; |
| 8548 | } |
| 8549 | |
| 8550 | /* |
| 8551 | * Free the adv_req_t structure used with the command by adding |
| 8552 | * it back to the board free list. |
| 8553 | */ |
| 8554 | reqp->next_reqp = boardp->adv_reqp; |
| 8555 | boardp->adv_reqp = reqp; |
| 8556 | |
| 8557 | ASC_DBG(1, "adv_isr_callback: done\n"); |
| 8558 | |
| 8559 | return; |
| 8560 | } |
| 8561 | |
| 8562 | /* |
| 8563 | * Adv Library Interrupt Service Routine |
| 8564 | * |
| 8565 | * This function is called by a driver's interrupt service routine. |
| 8566 | * The function disables and re-enables interrupts. |
| 8567 | * |
| 8568 | * When a microcode idle command is completed, the ADV_DVC_VAR |
| 8569 | * 'idle_cmd_done' field is set to ADV_TRUE. |
| 8570 | * |
| 8571 | * Note: AdvISR() can be called when interrupts are disabled or even |
| 8572 | * when there is no hardware interrupt condition present. It will |
| 8573 | * always check for completed idle commands and microcode requests. |
| 8574 | * This is an important feature that shouldn't be changed because it |
| 8575 | * allows commands to be completed from polling mode loops. |
| 8576 | * |
| 8577 | * Return: |
| 8578 | * ADV_TRUE(1) - interrupt was pending |
| 8579 | * ADV_FALSE(0) - no interrupt was pending |
| 8580 | */ |
| 8581 | static int AdvISR(ADV_DVC_VAR *asc_dvc) |
| 8582 | { |
| 8583 | AdvPortAddr iop_base; |
| 8584 | uchar int_stat; |
| 8585 | ushort target_bit; |
| 8586 | ADV_CARR_T *free_carrp; |
| 8587 | ADV_VADDR irq_next_vpa; |
| 8588 | ADV_SCSI_REQ_Q *scsiq; |
| 8589 | |
| 8590 | iop_base = asc_dvc->iop_base; |
| 8591 | |
| 8592 | /* Reading the register clears the interrupt. */ |
| 8593 | int_stat = AdvReadByteRegister(iop_base, IOPB_INTR_STATUS_REG); |
| 8594 | |
| 8595 | if ((int_stat & (ADV_INTR_STATUS_INTRA | ADV_INTR_STATUS_INTRB | |
| 8596 | ADV_INTR_STATUS_INTRC)) == 0) { |
| 8597 | return ADV_FALSE; |
| 8598 | } |
| 8599 | |
| 8600 | /* |
| 8601 | * Notify the driver of an asynchronous microcode condition by |
| 8602 | * calling the adv_async_callback function. The function |
| 8603 | * is passed the microcode ASC_MC_INTRB_CODE byte value. |
| 8604 | */ |
| 8605 | if (int_stat & ADV_INTR_STATUS_INTRB) { |
| 8606 | uchar intrb_code; |
| 8607 | |
| 8608 | AdvReadByteLram(iop_base, ASC_MC_INTRB_CODE, intrb_code); |
| 8609 | |
| 8610 | if (asc_dvc->chip_type == ADV_CHIP_ASC3550 || |
| 8611 | asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { |
| 8612 | if (intrb_code == ADV_ASYNC_CARRIER_READY_FAILURE && |
| 8613 | asc_dvc->carr_pending_cnt != 0) { |
| 8614 | AdvWriteByteRegister(iop_base, IOPB_TICKLE, |
| 8615 | ADV_TICKLE_A); |
| 8616 | if (asc_dvc->chip_type == ADV_CHIP_ASC3550) { |
| 8617 | AdvWriteByteRegister(iop_base, |
| 8618 | IOPB_TICKLE, |
| 8619 | ADV_TICKLE_NOP); |
| 8620 | } |
| 8621 | } |
| 8622 | } |
| 8623 | |
| 8624 | adv_async_callback(asc_dvc, intrb_code); |
| 8625 | } |
| 8626 | |
| 8627 | /* |
| 8628 | * Check if the IRQ stopper carrier contains a completed request. |
| 8629 | */ |
| 8630 | while (((irq_next_vpa = |
| 8631 | le32_to_cpu(asc_dvc->irq_sp->next_vpa)) & ASC_RQ_DONE) != 0) { |
| 8632 | /* |
| 8633 | * Get a pointer to the newly completed ADV_SCSI_REQ_Q structure. |
| 8634 | * The RISC will have set 'areq_vpa' to a virtual address. |
| 8635 | * |
| 8636 | * The firmware will have copied the ASC_SCSI_REQ_Q.scsiq_ptr |
| 8637 | * field to the carrier ADV_CARR_T.areq_vpa field. The conversion |
| 8638 | * below complements the conversion of ASC_SCSI_REQ_Q.scsiq_ptr' |
| 8639 | * in AdvExeScsiQueue(). |
| 8640 | */ |
| 8641 | scsiq = (ADV_SCSI_REQ_Q *) |
| 8642 | ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->areq_vpa)); |
| 8643 | |
| 8644 | /* |
| 8645 | * Request finished with good status and the queue was not |
| 8646 | * DMAed to host memory by the firmware. Set all status fields |
| 8647 | * to indicate good status. |
| 8648 | */ |
| 8649 | if ((irq_next_vpa & ASC_RQ_GOOD) != 0) { |
| 8650 | scsiq->done_status = QD_NO_ERROR; |
| 8651 | scsiq->host_status = scsiq->scsi_status = 0; |
| 8652 | scsiq->data_cnt = 0L; |
| 8653 | } |
| 8654 | |
| 8655 | /* |
| 8656 | * Advance the stopper pointer to the next carrier |
| 8657 | * ignoring the lower four bits. Free the previous |
| 8658 | * stopper carrier. |
| 8659 | */ |
| 8660 | free_carrp = asc_dvc->irq_sp; |
| 8661 | asc_dvc->irq_sp = (ADV_CARR_T *) |
| 8662 | ADV_U32_TO_VADDR(ASC_GET_CARRP(irq_next_vpa)); |
| 8663 | |
| 8664 | free_carrp->next_vpa = |
| 8665 | cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist)); |
| 8666 | asc_dvc->carr_freelist = free_carrp; |
| 8667 | asc_dvc->carr_pending_cnt--; |
| 8668 | |
| 8669 | target_bit = ADV_TID_TO_TIDMASK(scsiq->target_id); |
| 8670 | |
| 8671 | /* |
| 8672 | * Clear request microcode control flag. |
| 8673 | */ |
| 8674 | scsiq->cntl = 0; |
| 8675 | |
| 8676 | /* |
| 8677 | * Notify the driver of the completed request by passing |
| 8678 | * the ADV_SCSI_REQ_Q pointer to its callback function. |
| 8679 | */ |
| 8680 | scsiq->a_flag |= ADV_SCSIQ_DONE; |
| 8681 | adv_isr_callback(asc_dvc, scsiq); |
| 8682 | /* |
| 8683 | * Note: After the driver callback function is called, 'scsiq' |
| 8684 | * can no longer be referenced. |
| 8685 | * |
| 8686 | * Fall through and continue processing other completed |
| 8687 | * requests... |
| 8688 | */ |
| 8689 | } |
| 8690 | return ADV_TRUE; |
| 8691 | } |
| 8692 | |
| 8693 | static int AscSetLibErrorCode(ASC_DVC_VAR *asc_dvc, ushort err_code) |
| 8694 | { |
| 8695 | if (asc_dvc->err_code == 0) { |
| 8696 | asc_dvc->err_code = err_code; |
| 8697 | AscWriteLramWord(asc_dvc->iop_base, ASCV_ASCDVC_ERR_CODE_W, |
| 8698 | err_code); |
| 8699 | } |
| 8700 | return err_code; |
| 8701 | } |
| 8702 | |
| 8703 | static void AscAckInterrupt(PortAddr iop_base) |
| 8704 | { |
| 8705 | uchar host_flag; |
| 8706 | uchar risc_flag; |
| 8707 | ushort loop; |
| 8708 | |
| 8709 | loop = 0; |
| 8710 | do { |
| 8711 | risc_flag = AscReadLramByte(iop_base, ASCV_RISC_FLAG_B); |
| 8712 | if (loop++ > 0x7FFF) { |
| 8713 | break; |
| 8714 | } |
| 8715 | } while ((risc_flag & ASC_RISC_FLAG_GEN_INT) != 0); |
| 8716 | host_flag = |
| 8717 | AscReadLramByte(iop_base, |
| 8718 | ASCV_HOST_FLAG_B) & (~ASC_HOST_FLAG_ACK_INT); |
| 8719 | AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, |
| 8720 | (uchar)(host_flag | ASC_HOST_FLAG_ACK_INT)); |
| 8721 | AscSetChipStatus(iop_base, CIW_INT_ACK); |
| 8722 | loop = 0; |
| 8723 | while (AscGetChipStatus(iop_base) & CSW_INT_PENDING) { |
| 8724 | AscSetChipStatus(iop_base, CIW_INT_ACK); |
| 8725 | if (loop++ > 3) { |
| 8726 | break; |
| 8727 | } |
| 8728 | } |
| 8729 | AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, host_flag); |
| 8730 | return; |
| 8731 | } |
| 8732 | |
| 8733 | static uchar AscGetSynPeriodIndex(ASC_DVC_VAR *asc_dvc, uchar syn_time) |
| 8734 | { |
| 8735 | uchar *period_table; |
| 8736 | int max_index; |
| 8737 | int min_index; |
| 8738 | int i; |
| 8739 | |
| 8740 | period_table = asc_dvc->sdtr_period_tbl; |
| 8741 | max_index = (int)asc_dvc->max_sdtr_index; |
| 8742 | min_index = (int)asc_dvc->host_init_sdtr_index; |
| 8743 | if ((syn_time <= period_table[max_index])) { |
| 8744 | for (i = min_index; i < (max_index - 1); i++) { |
| 8745 | if (syn_time <= period_table[i]) { |
| 8746 | return (uchar)i; |
| 8747 | } |
| 8748 | } |
| 8749 | return (uchar)max_index; |
| 8750 | } else { |
| 8751 | return (uchar)(max_index + 1); |
| 8752 | } |
| 8753 | } |
| 8754 | |
| 8755 | static uchar |
| 8756 | AscMsgOutSDTR(ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar sdtr_offset) |
| 8757 | { |
| 8758 | EXT_MSG sdtr_buf; |
| 8759 | uchar sdtr_period_index; |
| 8760 | PortAddr iop_base; |
| 8761 | |
| 8762 | iop_base = asc_dvc->iop_base; |
| 8763 | sdtr_buf.msg_type = EXTENDED_MESSAGE; |
| 8764 | sdtr_buf.msg_len = MS_SDTR_LEN; |
| 8765 | sdtr_buf.msg_req = EXTENDED_SDTR; |
| 8766 | sdtr_buf.xfer_period = sdtr_period; |
| 8767 | sdtr_offset &= ASC_SYN_MAX_OFFSET; |
| 8768 | sdtr_buf.req_ack_offset = sdtr_offset; |
| 8769 | sdtr_period_index = AscGetSynPeriodIndex(asc_dvc, sdtr_period); |
| 8770 | if (sdtr_period_index <= asc_dvc->max_sdtr_index) { |
| 8771 | AscMemWordCopyPtrToLram(iop_base, ASCV_MSGOUT_BEG, |
| 8772 | (uchar *)&sdtr_buf, |
| 8773 | sizeof(EXT_MSG) >> 1); |
| 8774 | return ((sdtr_period_index << 4) | sdtr_offset); |
| 8775 | } else { |
| 8776 | sdtr_buf.req_ack_offset = 0; |
| 8777 | AscMemWordCopyPtrToLram(iop_base, ASCV_MSGOUT_BEG, |
| 8778 | (uchar *)&sdtr_buf, |
| 8779 | sizeof(EXT_MSG) >> 1); |
| 8780 | return 0; |
| 8781 | } |
| 8782 | } |
| 8783 | |
| 8784 | static uchar |
| 8785 | AscCalSDTRData(ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar syn_offset) |
| 8786 | { |
| 8787 | uchar byte; |
| 8788 | uchar sdtr_period_ix; |
| 8789 | |
| 8790 | sdtr_period_ix = AscGetSynPeriodIndex(asc_dvc, sdtr_period); |
| 8791 | if (sdtr_period_ix > asc_dvc->max_sdtr_index) { |
| 8792 | return 0xFF; |
| 8793 | } |
| 8794 | byte = (sdtr_period_ix << 4) | (syn_offset & ASC_SYN_MAX_OFFSET); |
| 8795 | return byte; |
| 8796 | } |
| 8797 | |
| 8798 | static int AscSetChipSynRegAtID(PortAddr iop_base, uchar id, uchar sdtr_data) |
| 8799 | { |
| 8800 | ASC_SCSI_BIT_ID_TYPE org_id; |
| 8801 | int i; |
| 8802 | int sta = TRUE; |
| 8803 | |
| 8804 | AscSetBank(iop_base, 1); |
| 8805 | org_id = AscReadChipDvcID(iop_base); |
| 8806 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 8807 | if (org_id == (0x01 << i)) |
| 8808 | break; |
| 8809 | } |
| 8810 | org_id = (ASC_SCSI_BIT_ID_TYPE) i; |
| 8811 | AscWriteChipDvcID(iop_base, id); |
| 8812 | if (AscReadChipDvcID(iop_base) == (0x01 << id)) { |
| 8813 | AscSetBank(iop_base, 0); |
| 8814 | AscSetChipSyn(iop_base, sdtr_data); |
| 8815 | if (AscGetChipSyn(iop_base) != sdtr_data) { |
| 8816 | sta = FALSE; |
| 8817 | } |
| 8818 | } else { |
| 8819 | sta = FALSE; |
| 8820 | } |
| 8821 | AscSetBank(iop_base, 1); |
| 8822 | AscWriteChipDvcID(iop_base, org_id); |
| 8823 | AscSetBank(iop_base, 0); |
| 8824 | return (sta); |
| 8825 | } |
| 8826 | |
| 8827 | static void AscSetChipSDTR(PortAddr iop_base, uchar sdtr_data, uchar tid_no) |
| 8828 | { |
| 8829 | AscSetChipSynRegAtID(iop_base, tid_no, sdtr_data); |
| 8830 | AscPutMCodeSDTRDoneAtID(iop_base, tid_no, sdtr_data); |
| 8831 | } |
| 8832 | |
| 8833 | static int AscIsrChipHalted(ASC_DVC_VAR *asc_dvc) |
| 8834 | { |
| 8835 | EXT_MSG ext_msg; |
| 8836 | EXT_MSG out_msg; |
| 8837 | ushort halt_q_addr; |
| 8838 | int sdtr_accept; |
| 8839 | ushort int_halt_code; |
| 8840 | ASC_SCSI_BIT_ID_TYPE scsi_busy; |
| 8841 | ASC_SCSI_BIT_ID_TYPE target_id; |
| 8842 | PortAddr iop_base; |
| 8843 | uchar tag_code; |
| 8844 | uchar q_status; |
| 8845 | uchar halt_qp; |
| 8846 | uchar sdtr_data; |
| 8847 | uchar target_ix; |
| 8848 | uchar q_cntl, tid_no; |
| 8849 | uchar cur_dvc_qng; |
| 8850 | uchar asyn_sdtr; |
| 8851 | uchar scsi_status; |
| 8852 | asc_board_t *boardp; |
| 8853 | |
| 8854 | BUG_ON(!asc_dvc->drv_ptr); |
| 8855 | boardp = asc_dvc->drv_ptr; |
| 8856 | |
| 8857 | iop_base = asc_dvc->iop_base; |
| 8858 | int_halt_code = AscReadLramWord(iop_base, ASCV_HALTCODE_W); |
| 8859 | |
| 8860 | halt_qp = AscReadLramByte(iop_base, ASCV_CURCDB_B); |
| 8861 | halt_q_addr = ASC_QNO_TO_QADDR(halt_qp); |
| 8862 | target_ix = AscReadLramByte(iop_base, |
| 8863 | (ushort)(halt_q_addr + |
| 8864 | (ushort)ASC_SCSIQ_B_TARGET_IX)); |
| 8865 | q_cntl = AscReadLramByte(iop_base, |
| 8866 | (ushort)(halt_q_addr + (ushort)ASC_SCSIQ_B_CNTL)); |
| 8867 | tid_no = ASC_TIX_TO_TID(target_ix); |
| 8868 | target_id = (uchar)ASC_TID_TO_TARGET_ID(tid_no); |
| 8869 | if (asc_dvc->pci_fix_asyn_xfer & target_id) { |
| 8870 | asyn_sdtr = ASYN_SDTR_DATA_FIX_PCI_REV_AB; |
| 8871 | } else { |
| 8872 | asyn_sdtr = 0; |
| 8873 | } |
| 8874 | if (int_halt_code == ASC_HALT_DISABLE_ASYN_USE_SYN_FIX) { |
| 8875 | if (asc_dvc->pci_fix_asyn_xfer & target_id) { |
| 8876 | AscSetChipSDTR(iop_base, 0, tid_no); |
| 8877 | boardp->sdtr_data[tid_no] = 0; |
| 8878 | } |
| 8879 | AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); |
| 8880 | return (0); |
| 8881 | } else if (int_halt_code == ASC_HALT_ENABLE_ASYN_USE_SYN_FIX) { |
| 8882 | if (asc_dvc->pci_fix_asyn_xfer & target_id) { |
| 8883 | AscSetChipSDTR(iop_base, asyn_sdtr, tid_no); |
| 8884 | boardp->sdtr_data[tid_no] = asyn_sdtr; |
| 8885 | } |
| 8886 | AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); |
| 8887 | return (0); |
| 8888 | } else if (int_halt_code == ASC_HALT_EXTMSG_IN) { |
| 8889 | AscMemWordCopyPtrFromLram(iop_base, |
| 8890 | ASCV_MSGIN_BEG, |
| 8891 | (uchar *)&ext_msg, |
| 8892 | sizeof(EXT_MSG) >> 1); |
| 8893 | |
| 8894 | if (ext_msg.msg_type == EXTENDED_MESSAGE && |
| 8895 | ext_msg.msg_req == EXTENDED_SDTR && |
| 8896 | ext_msg.msg_len == MS_SDTR_LEN) { |
| 8897 | sdtr_accept = TRUE; |
| 8898 | if ((ext_msg.req_ack_offset > ASC_SYN_MAX_OFFSET)) { |
| 8899 | |
| 8900 | sdtr_accept = FALSE; |
| 8901 | ext_msg.req_ack_offset = ASC_SYN_MAX_OFFSET; |
| 8902 | } |
| 8903 | if ((ext_msg.xfer_period < |
| 8904 | asc_dvc->sdtr_period_tbl[asc_dvc-> |
| 8905 | host_init_sdtr_index]) |
| 8906 | || (ext_msg.xfer_period > |
| 8907 | asc_dvc->sdtr_period_tbl[asc_dvc-> |
| 8908 | max_sdtr_index])) { |
| 8909 | sdtr_accept = FALSE; |
| 8910 | ext_msg.xfer_period = |
| 8911 | asc_dvc->sdtr_period_tbl[asc_dvc-> |
| 8912 | host_init_sdtr_index]; |
| 8913 | } |
| 8914 | if (sdtr_accept) { |
| 8915 | sdtr_data = |
| 8916 | AscCalSDTRData(asc_dvc, ext_msg.xfer_period, |
| 8917 | ext_msg.req_ack_offset); |
| 8918 | if ((sdtr_data == 0xFF)) { |
| 8919 | |
| 8920 | q_cntl |= QC_MSG_OUT; |
| 8921 | asc_dvc->init_sdtr &= ~target_id; |
| 8922 | asc_dvc->sdtr_done &= ~target_id; |
| 8923 | AscSetChipSDTR(iop_base, asyn_sdtr, |
| 8924 | tid_no); |
| 8925 | boardp->sdtr_data[tid_no] = asyn_sdtr; |
| 8926 | } |
| 8927 | } |
| 8928 | if (ext_msg.req_ack_offset == 0) { |
| 8929 | |
| 8930 | q_cntl &= ~QC_MSG_OUT; |
| 8931 | asc_dvc->init_sdtr &= ~target_id; |
| 8932 | asc_dvc->sdtr_done &= ~target_id; |
| 8933 | AscSetChipSDTR(iop_base, asyn_sdtr, tid_no); |
| 8934 | } else { |
| 8935 | if (sdtr_accept && (q_cntl & QC_MSG_OUT)) { |
| 8936 | |
| 8937 | q_cntl &= ~QC_MSG_OUT; |
| 8938 | asc_dvc->sdtr_done |= target_id; |
| 8939 | asc_dvc->init_sdtr |= target_id; |
| 8940 | asc_dvc->pci_fix_asyn_xfer &= |
| 8941 | ~target_id; |
| 8942 | sdtr_data = |
| 8943 | AscCalSDTRData(asc_dvc, |
| 8944 | ext_msg.xfer_period, |
| 8945 | ext_msg. |
| 8946 | req_ack_offset); |
| 8947 | AscSetChipSDTR(iop_base, sdtr_data, |
| 8948 | tid_no); |
| 8949 | boardp->sdtr_data[tid_no] = sdtr_data; |
| 8950 | } else { |
| 8951 | |
| 8952 | q_cntl |= QC_MSG_OUT; |
| 8953 | AscMsgOutSDTR(asc_dvc, |
| 8954 | ext_msg.xfer_period, |
| 8955 | ext_msg.req_ack_offset); |
| 8956 | asc_dvc->pci_fix_asyn_xfer &= |
| 8957 | ~target_id; |
| 8958 | sdtr_data = |
| 8959 | AscCalSDTRData(asc_dvc, |
| 8960 | ext_msg.xfer_period, |
| 8961 | ext_msg. |
| 8962 | req_ack_offset); |
| 8963 | AscSetChipSDTR(iop_base, sdtr_data, |
| 8964 | tid_no); |
| 8965 | boardp->sdtr_data[tid_no] = sdtr_data; |
| 8966 | asc_dvc->sdtr_done |= target_id; |
| 8967 | asc_dvc->init_sdtr |= target_id; |
| 8968 | } |
| 8969 | } |
| 8970 | |
| 8971 | AscWriteLramByte(iop_base, |
| 8972 | (ushort)(halt_q_addr + |
| 8973 | (ushort)ASC_SCSIQ_B_CNTL), |
| 8974 | q_cntl); |
| 8975 | AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); |
| 8976 | return (0); |
| 8977 | } else if (ext_msg.msg_type == EXTENDED_MESSAGE && |
| 8978 | ext_msg.msg_req == EXTENDED_WDTR && |
| 8979 | ext_msg.msg_len == MS_WDTR_LEN) { |
| 8980 | |
| 8981 | ext_msg.wdtr_width = 0; |
| 8982 | AscMemWordCopyPtrToLram(iop_base, |
| 8983 | ASCV_MSGOUT_BEG, |
| 8984 | (uchar *)&ext_msg, |
| 8985 | sizeof(EXT_MSG) >> 1); |
| 8986 | q_cntl |= QC_MSG_OUT; |
| 8987 | AscWriteLramByte(iop_base, |
| 8988 | (ushort)(halt_q_addr + |
| 8989 | (ushort)ASC_SCSIQ_B_CNTL), |
| 8990 | q_cntl); |
| 8991 | AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); |
| 8992 | return (0); |
| 8993 | } else { |
| 8994 | |
| 8995 | ext_msg.msg_type = MESSAGE_REJECT; |
| 8996 | AscMemWordCopyPtrToLram(iop_base, |
| 8997 | ASCV_MSGOUT_BEG, |
| 8998 | (uchar *)&ext_msg, |
| 8999 | sizeof(EXT_MSG) >> 1); |
| 9000 | q_cntl |= QC_MSG_OUT; |
| 9001 | AscWriteLramByte(iop_base, |
| 9002 | (ushort)(halt_q_addr + |
| 9003 | (ushort)ASC_SCSIQ_B_CNTL), |
| 9004 | q_cntl); |
| 9005 | AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); |
| 9006 | return (0); |
| 9007 | } |
| 9008 | } else if (int_halt_code == ASC_HALT_CHK_CONDITION) { |
| 9009 | |
| 9010 | q_cntl |= QC_REQ_SENSE; |
| 9011 | |
| 9012 | if ((asc_dvc->init_sdtr & target_id) != 0) { |
| 9013 | |
| 9014 | asc_dvc->sdtr_done &= ~target_id; |
| 9015 | |
| 9016 | sdtr_data = AscGetMCodeInitSDTRAtID(iop_base, tid_no); |
| 9017 | q_cntl |= QC_MSG_OUT; |
| 9018 | AscMsgOutSDTR(asc_dvc, |
| 9019 | asc_dvc-> |
| 9020 | sdtr_period_tbl[(sdtr_data >> 4) & |
| 9021 | (uchar)(asc_dvc-> |
| 9022 | max_sdtr_index - |
| 9023 | 1)], |
| 9024 | (uchar)(sdtr_data & (uchar) |
| 9025 | ASC_SYN_MAX_OFFSET)); |
| 9026 | } |
| 9027 | |
| 9028 | AscWriteLramByte(iop_base, |
| 9029 | (ushort)(halt_q_addr + |
| 9030 | (ushort)ASC_SCSIQ_B_CNTL), q_cntl); |
| 9031 | |
| 9032 | tag_code = AscReadLramByte(iop_base, |
| 9033 | (ushort)(halt_q_addr + (ushort) |
| 9034 | ASC_SCSIQ_B_TAG_CODE)); |
| 9035 | tag_code &= 0xDC; |
| 9036 | if ((asc_dvc->pci_fix_asyn_xfer & target_id) |
| 9037 | && !(asc_dvc->pci_fix_asyn_xfer_always & target_id) |
| 9038 | ) { |
| 9039 | |
| 9040 | tag_code |= (ASC_TAG_FLAG_DISABLE_DISCONNECT |
| 9041 | | ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX); |
| 9042 | |
| 9043 | } |
| 9044 | AscWriteLramByte(iop_base, |
| 9045 | (ushort)(halt_q_addr + |
| 9046 | (ushort)ASC_SCSIQ_B_TAG_CODE), |
| 9047 | tag_code); |
| 9048 | |
| 9049 | q_status = AscReadLramByte(iop_base, |
| 9050 | (ushort)(halt_q_addr + (ushort) |
| 9051 | ASC_SCSIQ_B_STATUS)); |
| 9052 | q_status |= (QS_READY | QS_BUSY); |
| 9053 | AscWriteLramByte(iop_base, |
| 9054 | (ushort)(halt_q_addr + |
| 9055 | (ushort)ASC_SCSIQ_B_STATUS), |
| 9056 | q_status); |
| 9057 | |
| 9058 | scsi_busy = AscReadLramByte(iop_base, (ushort)ASCV_SCSIBUSY_B); |
| 9059 | scsi_busy &= ~target_id; |
| 9060 | AscWriteLramByte(iop_base, (ushort)ASCV_SCSIBUSY_B, scsi_busy); |
| 9061 | |
| 9062 | AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); |
| 9063 | return (0); |
| 9064 | } else if (int_halt_code == ASC_HALT_SDTR_REJECTED) { |
| 9065 | |
| 9066 | AscMemWordCopyPtrFromLram(iop_base, |
| 9067 | ASCV_MSGOUT_BEG, |
| 9068 | (uchar *)&out_msg, |
| 9069 | sizeof(EXT_MSG) >> 1); |
| 9070 | |
| 9071 | if ((out_msg.msg_type == EXTENDED_MESSAGE) && |
| 9072 | (out_msg.msg_len == MS_SDTR_LEN) && |
| 9073 | (out_msg.msg_req == EXTENDED_SDTR)) { |
| 9074 | |
| 9075 | asc_dvc->init_sdtr &= ~target_id; |
| 9076 | asc_dvc->sdtr_done &= ~target_id; |
| 9077 | AscSetChipSDTR(iop_base, asyn_sdtr, tid_no); |
| 9078 | boardp->sdtr_data[tid_no] = asyn_sdtr; |
| 9079 | } |
| 9080 | q_cntl &= ~QC_MSG_OUT; |
| 9081 | AscWriteLramByte(iop_base, |
| 9082 | (ushort)(halt_q_addr + |
| 9083 | (ushort)ASC_SCSIQ_B_CNTL), q_cntl); |
| 9084 | AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); |
| 9085 | return (0); |
| 9086 | } else if (int_halt_code == ASC_HALT_SS_QUEUE_FULL) { |
| 9087 | |
| 9088 | scsi_status = AscReadLramByte(iop_base, |
| 9089 | (ushort)((ushort)halt_q_addr + |
| 9090 | (ushort) |
| 9091 | ASC_SCSIQ_SCSI_STATUS)); |
| 9092 | cur_dvc_qng = |
| 9093 | AscReadLramByte(iop_base, |
| 9094 | (ushort)((ushort)ASC_QADR_BEG + |
| 9095 | (ushort)target_ix)); |
| 9096 | if ((cur_dvc_qng > 0) && (asc_dvc->cur_dvc_qng[tid_no] > 0)) { |
| 9097 | |
| 9098 | scsi_busy = AscReadLramByte(iop_base, |
| 9099 | (ushort)ASCV_SCSIBUSY_B); |
| 9100 | scsi_busy |= target_id; |
| 9101 | AscWriteLramByte(iop_base, |
| 9102 | (ushort)ASCV_SCSIBUSY_B, scsi_busy); |
| 9103 | asc_dvc->queue_full_or_busy |= target_id; |
| 9104 | |
| 9105 | if (scsi_status == SAM_STAT_TASK_SET_FULL) { |
| 9106 | if (cur_dvc_qng > ASC_MIN_TAGGED_CMD) { |
| 9107 | cur_dvc_qng -= 1; |
| 9108 | asc_dvc->max_dvc_qng[tid_no] = |
| 9109 | cur_dvc_qng; |
| 9110 | |
| 9111 | AscWriteLramByte(iop_base, |
| 9112 | (ushort)((ushort) |
| 9113 | ASCV_MAX_DVC_QNG_BEG |
| 9114 | + (ushort) |
| 9115 | tid_no), |
| 9116 | cur_dvc_qng); |
| 9117 | |
| 9118 | /* |
| 9119 | * Set the device queue depth to the |
| 9120 | * number of active requests when the |
| 9121 | * QUEUE FULL condition was encountered. |
| 9122 | */ |
| 9123 | boardp->queue_full |= target_id; |
| 9124 | boardp->queue_full_cnt[tid_no] = |
| 9125 | cur_dvc_qng; |
| 9126 | } |
| 9127 | } |
| 9128 | } |
| 9129 | AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); |
| 9130 | return (0); |
| 9131 | } |
| 9132 | #if CC_VERY_LONG_SG_LIST |
| 9133 | else if (int_halt_code == ASC_HALT_HOST_COPY_SG_LIST_TO_RISC) { |
| 9134 | uchar q_no; |
| 9135 | ushort q_addr; |
| 9136 | uchar sg_wk_q_no; |
| 9137 | uchar first_sg_wk_q_no; |
| 9138 | ASC_SCSI_Q *scsiq; /* Ptr to driver request. */ |
| 9139 | ASC_SG_HEAD *sg_head; /* Ptr to driver SG request. */ |
| 9140 | ASC_SG_LIST_Q scsi_sg_q; /* Structure written to queue. */ |
| 9141 | ushort sg_list_dwords; |
| 9142 | ushort sg_entry_cnt; |
| 9143 | uchar next_qp; |
| 9144 | int i; |
| 9145 | |
| 9146 | q_no = AscReadLramByte(iop_base, (ushort)ASCV_REQ_SG_LIST_QP); |
| 9147 | if (q_no == ASC_QLINK_END) |
| 9148 | return 0; |
| 9149 | |
| 9150 | q_addr = ASC_QNO_TO_QADDR(q_no); |
| 9151 | |
| 9152 | /* |
| 9153 | * Convert the request's SRB pointer to a host ASC_SCSI_REQ |
| 9154 | * structure pointer using a macro provided by the driver. |
| 9155 | * The ASC_SCSI_REQ pointer provides a pointer to the |
| 9156 | * host ASC_SG_HEAD structure. |
| 9157 | */ |
| 9158 | /* Read request's SRB pointer. */ |
| 9159 | scsiq = (ASC_SCSI_Q *) |
| 9160 | ASC_SRB2SCSIQ(ASC_U32_TO_VADDR(AscReadLramDWord(iop_base, |
| 9161 | (ushort) |
| 9162 | (q_addr + |
| 9163 | ASC_SCSIQ_D_SRBPTR)))); |
| 9164 | |
| 9165 | /* |
| 9166 | * Get request's first and working SG queue. |
| 9167 | */ |
| 9168 | sg_wk_q_no = AscReadLramByte(iop_base, |
| 9169 | (ushort)(q_addr + |
| 9170 | ASC_SCSIQ_B_SG_WK_QP)); |
| 9171 | |
| 9172 | first_sg_wk_q_no = AscReadLramByte(iop_base, |
| 9173 | (ushort)(q_addr + |
| 9174 | ASC_SCSIQ_B_FIRST_SG_WK_QP)); |
| 9175 | |
| 9176 | /* |
| 9177 | * Reset request's working SG queue back to the |
| 9178 | * first SG queue. |
| 9179 | */ |
| 9180 | AscWriteLramByte(iop_base, |
| 9181 | (ushort)(q_addr + |
| 9182 | (ushort)ASC_SCSIQ_B_SG_WK_QP), |
| 9183 | first_sg_wk_q_no); |
| 9184 | |
| 9185 | sg_head = scsiq->sg_head; |
| 9186 | |
| 9187 | /* |
| 9188 | * Set sg_entry_cnt to the number of SG elements |
| 9189 | * that will be completed on this interrupt. |
| 9190 | * |
| 9191 | * Note: The allocated SG queues contain ASC_MAX_SG_LIST - 1 |
| 9192 | * SG elements. The data_cnt and data_addr fields which |
| 9193 | * add 1 to the SG element capacity are not used when |
| 9194 | * restarting SG handling after a halt. |
| 9195 | */ |
| 9196 | if (scsiq->remain_sg_entry_cnt > (ASC_MAX_SG_LIST - 1)) { |
| 9197 | sg_entry_cnt = ASC_MAX_SG_LIST - 1; |
| 9198 | |
| 9199 | /* |
| 9200 | * Keep track of remaining number of SG elements that |
| 9201 | * will need to be handled on the next interrupt. |
| 9202 | */ |
| 9203 | scsiq->remain_sg_entry_cnt -= (ASC_MAX_SG_LIST - 1); |
| 9204 | } else { |
| 9205 | sg_entry_cnt = scsiq->remain_sg_entry_cnt; |
| 9206 | scsiq->remain_sg_entry_cnt = 0; |
| 9207 | } |
| 9208 | |
| 9209 | /* |
| 9210 | * Copy SG elements into the list of allocated SG queues. |
| 9211 | * |
| 9212 | * Last index completed is saved in scsiq->next_sg_index. |
| 9213 | */ |
| 9214 | next_qp = first_sg_wk_q_no; |
| 9215 | q_addr = ASC_QNO_TO_QADDR(next_qp); |
| 9216 | scsi_sg_q.sg_head_qp = q_no; |
| 9217 | scsi_sg_q.cntl = QCSG_SG_XFER_LIST; |
| 9218 | for (i = 0; i < sg_head->queue_cnt; i++) { |
| 9219 | scsi_sg_q.seq_no = i + 1; |
| 9220 | if (sg_entry_cnt > ASC_SG_LIST_PER_Q) { |
| 9221 | sg_list_dwords = (uchar)(ASC_SG_LIST_PER_Q * 2); |
| 9222 | sg_entry_cnt -= ASC_SG_LIST_PER_Q; |
| 9223 | /* |
| 9224 | * After very first SG queue RISC FW uses next |
| 9225 | * SG queue first element then checks sg_list_cnt |
| 9226 | * against zero and then decrements, so set |
| 9227 | * sg_list_cnt 1 less than number of SG elements |
| 9228 | * in each SG queue. |
| 9229 | */ |
| 9230 | scsi_sg_q.sg_list_cnt = ASC_SG_LIST_PER_Q - 1; |
| 9231 | scsi_sg_q.sg_cur_list_cnt = |
| 9232 | ASC_SG_LIST_PER_Q - 1; |
| 9233 | } else { |
| 9234 | /* |
| 9235 | * This is the last SG queue in the list of |
| 9236 | * allocated SG queues. If there are more |
| 9237 | * SG elements than will fit in the allocated |
| 9238 | * queues, then set the QCSG_SG_XFER_MORE flag. |
| 9239 | */ |
| 9240 | if (scsiq->remain_sg_entry_cnt != 0) { |
| 9241 | scsi_sg_q.cntl |= QCSG_SG_XFER_MORE; |
| 9242 | } else { |
| 9243 | scsi_sg_q.cntl |= QCSG_SG_XFER_END; |
| 9244 | } |
| 9245 | /* equals sg_entry_cnt * 2 */ |
| 9246 | sg_list_dwords = sg_entry_cnt << 1; |
| 9247 | scsi_sg_q.sg_list_cnt = sg_entry_cnt - 1; |
| 9248 | scsi_sg_q.sg_cur_list_cnt = sg_entry_cnt - 1; |
| 9249 | sg_entry_cnt = 0; |
| 9250 | } |
| 9251 | |
| 9252 | scsi_sg_q.q_no = next_qp; |
| 9253 | AscMemWordCopyPtrToLram(iop_base, |
| 9254 | q_addr + ASC_SCSIQ_SGHD_CPY_BEG, |
| 9255 | (uchar *)&scsi_sg_q, |
| 9256 | sizeof(ASC_SG_LIST_Q) >> 1); |
| 9257 | |
| 9258 | AscMemDWordCopyPtrToLram(iop_base, |
| 9259 | q_addr + ASC_SGQ_LIST_BEG, |
| 9260 | (uchar *)&sg_head-> |
| 9261 | sg_list[scsiq->next_sg_index], |
| 9262 | sg_list_dwords); |
| 9263 | |
| 9264 | scsiq->next_sg_index += ASC_SG_LIST_PER_Q; |
| 9265 | |
| 9266 | /* |
| 9267 | * If the just completed SG queue contained the |
| 9268 | * last SG element, then no more SG queues need |
| 9269 | * to be written. |
| 9270 | */ |
| 9271 | if (scsi_sg_q.cntl & QCSG_SG_XFER_END) { |
| 9272 | break; |
| 9273 | } |
| 9274 | |
| 9275 | next_qp = AscReadLramByte(iop_base, |
| 9276 | (ushort)(q_addr + |
| 9277 | ASC_SCSIQ_B_FWD)); |
| 9278 | q_addr = ASC_QNO_TO_QADDR(next_qp); |
| 9279 | } |
| 9280 | |
| 9281 | /* |
| 9282 | * Clear the halt condition so the RISC will be restarted |
| 9283 | * after the return. |
| 9284 | */ |
| 9285 | AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); |
| 9286 | return (0); |
| 9287 | } |
| 9288 | #endif /* CC_VERY_LONG_SG_LIST */ |
| 9289 | return (0); |
| 9290 | } |
| 9291 | |
| 9292 | /* |
| 9293 | * void |
| 9294 | * DvcGetQinfo(PortAddr iop_base, ushort s_addr, uchar *inbuf, int words) |
| 9295 | * |
| 9296 | * Calling/Exit State: |
| 9297 | * none |
| 9298 | * |
| 9299 | * Description: |
| 9300 | * Input an ASC_QDONE_INFO structure from the chip |
| 9301 | */ |
| 9302 | static void |
| 9303 | DvcGetQinfo(PortAddr iop_base, ushort s_addr, uchar *inbuf, int words) |
| 9304 | { |
| 9305 | int i; |
| 9306 | ushort word; |
| 9307 | |
| 9308 | AscSetChipLramAddr(iop_base, s_addr); |
| 9309 | for (i = 0; i < 2 * words; i += 2) { |
| 9310 | if (i == 10) { |
| 9311 | continue; |
| 9312 | } |
| 9313 | word = inpw(iop_base + IOP_RAM_DATA); |
| 9314 | inbuf[i] = word & 0xff; |
| 9315 | inbuf[i + 1] = (word >> 8) & 0xff; |
| 9316 | } |
| 9317 | ASC_DBG_PRT_HEX(2, "DvcGetQinfo", inbuf, 2 * words); |
| 9318 | } |
| 9319 | |
| 9320 | static uchar |
| 9321 | _AscCopyLramScsiDoneQ(PortAddr iop_base, |
| 9322 | ushort q_addr, |
| 9323 | ASC_QDONE_INFO *scsiq, ASC_DCNT max_dma_count) |
| 9324 | { |
| 9325 | ushort _val; |
| 9326 | uchar sg_queue_cnt; |
| 9327 | |
| 9328 | DvcGetQinfo(iop_base, |
| 9329 | q_addr + ASC_SCSIQ_DONE_INFO_BEG, |
| 9330 | (uchar *)scsiq, |
| 9331 | (sizeof(ASC_SCSIQ_2) + sizeof(ASC_SCSIQ_3)) / 2); |
| 9332 | |
| 9333 | _val = AscReadLramWord(iop_base, |
| 9334 | (ushort)(q_addr + (ushort)ASC_SCSIQ_B_STATUS)); |
| 9335 | scsiq->q_status = (uchar)_val; |
| 9336 | scsiq->q_no = (uchar)(_val >> 8); |
| 9337 | _val = AscReadLramWord(iop_base, |
| 9338 | (ushort)(q_addr + (ushort)ASC_SCSIQ_B_CNTL)); |
| 9339 | scsiq->cntl = (uchar)_val; |
| 9340 | sg_queue_cnt = (uchar)(_val >> 8); |
| 9341 | _val = AscReadLramWord(iop_base, |
| 9342 | (ushort)(q_addr + |
| 9343 | (ushort)ASC_SCSIQ_B_SENSE_LEN)); |
| 9344 | scsiq->sense_len = (uchar)_val; |
| 9345 | scsiq->extra_bytes = (uchar)(_val >> 8); |
| 9346 | |
| 9347 | /* |
| 9348 | * Read high word of remain bytes from alternate location. |
| 9349 | */ |
| 9350 | scsiq->remain_bytes = (((ADV_DCNT)AscReadLramWord(iop_base, |
| 9351 | (ushort)(q_addr + |
| 9352 | (ushort) |
| 9353 | ASC_SCSIQ_W_ALT_DC1))) |
| 9354 | << 16); |
| 9355 | /* |
| 9356 | * Read low word of remain bytes from original location. |
| 9357 | */ |
| 9358 | scsiq->remain_bytes += AscReadLramWord(iop_base, |
| 9359 | (ushort)(q_addr + (ushort) |
| 9360 | ASC_SCSIQ_DW_REMAIN_XFER_CNT)); |
| 9361 | |
| 9362 | scsiq->remain_bytes &= max_dma_count; |
| 9363 | return sg_queue_cnt; |
| 9364 | } |
| 9365 | |
| 9366 | /* |
| 9367 | * asc_isr_callback() - Second Level Interrupt Handler called by AscISR(). |
| 9368 | * |
| 9369 | * Interrupt callback function for the Narrow SCSI Asc Library. |
| 9370 | */ |
| 9371 | static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep) |
| 9372 | { |
| 9373 | asc_board_t *boardp; |
| 9374 | struct scsi_cmnd *scp; |
| 9375 | struct Scsi_Host *shost; |
| 9376 | |
| 9377 | ASC_DBG2(1, "asc_isr_callback: asc_dvc_varp 0x%lx, qdonep 0x%lx\n", |
| 9378 | (ulong)asc_dvc_varp, (ulong)qdonep); |
| 9379 | ASC_DBG_PRT_ASC_QDONE_INFO(2, qdonep); |
| 9380 | |
| 9381 | /* |
| 9382 | * Get the struct scsi_cmnd structure and Scsi_Host structure for the |
| 9383 | * command that has been completed. |
| 9384 | */ |
| 9385 | scp = (struct scsi_cmnd *)ASC_U32_TO_VADDR(qdonep->d2.srb_ptr); |
| 9386 | ASC_DBG1(1, "asc_isr_callback: scp 0x%lx\n", (ulong)scp); |
| 9387 | |
| 9388 | if (scp == NULL) { |
| 9389 | ASC_PRINT("asc_isr_callback: scp is NULL\n"); |
| 9390 | return; |
| 9391 | } |
| 9392 | ASC_DBG_PRT_CDB(2, scp->cmnd, scp->cmd_len); |
| 9393 | |
| 9394 | shost = scp->device->host; |
| 9395 | ASC_STATS(shost, callback); |
| 9396 | ASC_DBG1(1, "asc_isr_callback: shost 0x%lx\n", (ulong)shost); |
| 9397 | |
| 9398 | boardp = ASC_BOARDP(shost); |
| 9399 | BUG_ON(asc_dvc_varp != &boardp->dvc_var.asc_dvc_var); |
| 9400 | |
| 9401 | /* |
| 9402 | * 'qdonep' contains the command's ending status. |
| 9403 | */ |
| 9404 | switch (qdonep->d3.done_stat) { |
| 9405 | case QD_NO_ERROR: |
| 9406 | ASC_DBG(2, "asc_isr_callback: QD_NO_ERROR\n"); |
| 9407 | scp->result = 0; |
| 9408 | |
| 9409 | /* |
| 9410 | * Check for an underrun condition. |
| 9411 | * |
| 9412 | * If there was no error and an underrun condition, then |
| 9413 | * return the number of underrun bytes. |
| 9414 | */ |
| 9415 | if (scp->request_bufflen != 0 && qdonep->remain_bytes != 0 && |
| 9416 | qdonep->remain_bytes <= scp->request_bufflen) { |
| 9417 | ASC_DBG1(1, |
| 9418 | "asc_isr_callback: underrun condition %u bytes\n", |
| 9419 | (unsigned)qdonep->remain_bytes); |
| 9420 | scp->resid = qdonep->remain_bytes; |
| 9421 | } |
| 9422 | break; |
| 9423 | |
| 9424 | case QD_WITH_ERROR: |
| 9425 | ASC_DBG(2, "asc_isr_callback: QD_WITH_ERROR\n"); |
| 9426 | switch (qdonep->d3.host_stat) { |
| 9427 | case QHSTA_NO_ERROR: |
| 9428 | if (qdonep->d3.scsi_stat == SAM_STAT_CHECK_CONDITION) { |
| 9429 | ASC_DBG(2, |
| 9430 | "asc_isr_callback: SAM_STAT_CHECK_CONDITION\n"); |
| 9431 | ASC_DBG_PRT_SENSE(2, scp->sense_buffer, |
| 9432 | sizeof(scp->sense_buffer)); |
| 9433 | /* |
| 9434 | * Note: The 'status_byte()' macro used by |
| 9435 | * target drivers defined in scsi.h shifts the |
| 9436 | * status byte returned by host drivers right |
| 9437 | * by 1 bit. This is why target drivers also |
| 9438 | * use right shifted status byte definitions. |
| 9439 | * For instance target drivers use |
| 9440 | * CHECK_CONDITION, defined to 0x1, instead of |
| 9441 | * the SCSI defined check condition value of |
| 9442 | * 0x2. Host drivers are supposed to return |
| 9443 | * the status byte as it is defined by SCSI. |
| 9444 | */ |
| 9445 | scp->result = DRIVER_BYTE(DRIVER_SENSE) | |
| 9446 | STATUS_BYTE(qdonep->d3.scsi_stat); |
| 9447 | } else { |
| 9448 | scp->result = STATUS_BYTE(qdonep->d3.scsi_stat); |
| 9449 | } |
| 9450 | break; |
| 9451 | |
| 9452 | default: |
| 9453 | /* QHSTA error occurred */ |
| 9454 | ASC_DBG1(1, "asc_isr_callback: host_stat 0x%x\n", |
| 9455 | qdonep->d3.host_stat); |
| 9456 | scp->result = HOST_BYTE(DID_BAD_TARGET); |
| 9457 | break; |
| 9458 | } |
| 9459 | break; |
| 9460 | |
| 9461 | case QD_ABORTED_BY_HOST: |
| 9462 | ASC_DBG(1, "asc_isr_callback: QD_ABORTED_BY_HOST\n"); |
| 9463 | scp->result = |
| 9464 | HOST_BYTE(DID_ABORT) | MSG_BYTE(qdonep->d3. |
| 9465 | scsi_msg) | |
| 9466 | STATUS_BYTE(qdonep->d3.scsi_stat); |
| 9467 | break; |
| 9468 | |
| 9469 | default: |
| 9470 | ASC_DBG1(1, "asc_isr_callback: done_stat 0x%x\n", |
| 9471 | qdonep->d3.done_stat); |
| 9472 | scp->result = |
| 9473 | HOST_BYTE(DID_ERROR) | MSG_BYTE(qdonep->d3. |
| 9474 | scsi_msg) | |
| 9475 | STATUS_BYTE(qdonep->d3.scsi_stat); |
| 9476 | break; |
| 9477 | } |
| 9478 | |
| 9479 | /* |
| 9480 | * If the 'init_tidmask' bit isn't already set for the target and the |
| 9481 | * current request finished normally, then set the bit for the target |
| 9482 | * to indicate that a device is present. |
| 9483 | */ |
| 9484 | if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 && |
| 9485 | qdonep->d3.done_stat == QD_NO_ERROR && |
| 9486 | qdonep->d3.host_stat == QHSTA_NO_ERROR) { |
| 9487 | boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id); |
| 9488 | } |
| 9489 | |
| 9490 | asc_scsi_done(scp); |
| 9491 | |
| 9492 | return; |
| 9493 | } |
| 9494 | |
| 9495 | static int AscIsrQDone(ASC_DVC_VAR *asc_dvc) |
| 9496 | { |
| 9497 | uchar next_qp; |
| 9498 | uchar n_q_used; |
| 9499 | uchar sg_list_qp; |
| 9500 | uchar sg_queue_cnt; |
| 9501 | uchar q_cnt; |
| 9502 | uchar done_q_tail; |
| 9503 | uchar tid_no; |
| 9504 | ASC_SCSI_BIT_ID_TYPE scsi_busy; |
| 9505 | ASC_SCSI_BIT_ID_TYPE target_id; |
| 9506 | PortAddr iop_base; |
| 9507 | ushort q_addr; |
| 9508 | ushort sg_q_addr; |
| 9509 | uchar cur_target_qng; |
| 9510 | ASC_QDONE_INFO scsiq_buf; |
| 9511 | ASC_QDONE_INFO *scsiq; |
| 9512 | int false_overrun; |
| 9513 | |
| 9514 | iop_base = asc_dvc->iop_base; |
| 9515 | n_q_used = 1; |
| 9516 | scsiq = (ASC_QDONE_INFO *)&scsiq_buf; |
| 9517 | done_q_tail = (uchar)AscGetVarDoneQTail(iop_base); |
| 9518 | q_addr = ASC_QNO_TO_QADDR(done_q_tail); |
| 9519 | next_qp = AscReadLramByte(iop_base, |
| 9520 | (ushort)(q_addr + (ushort)ASC_SCSIQ_B_FWD)); |
| 9521 | if (next_qp != ASC_QLINK_END) { |
| 9522 | AscPutVarDoneQTail(iop_base, next_qp); |
| 9523 | q_addr = ASC_QNO_TO_QADDR(next_qp); |
| 9524 | sg_queue_cnt = _AscCopyLramScsiDoneQ(iop_base, q_addr, scsiq, |
| 9525 | asc_dvc->max_dma_count); |
| 9526 | AscWriteLramByte(iop_base, |
| 9527 | (ushort)(q_addr + |
| 9528 | (ushort)ASC_SCSIQ_B_STATUS), |
| 9529 | (uchar)(scsiq-> |
| 9530 | q_status & (uchar)~(QS_READY | |
| 9531 | QS_ABORTED))); |
| 9532 | tid_no = ASC_TIX_TO_TID(scsiq->d2.target_ix); |
| 9533 | target_id = ASC_TIX_TO_TARGET_ID(scsiq->d2.target_ix); |
| 9534 | if ((scsiq->cntl & QC_SG_HEAD) != 0) { |
| 9535 | sg_q_addr = q_addr; |
| 9536 | sg_list_qp = next_qp; |
| 9537 | for (q_cnt = 0; q_cnt < sg_queue_cnt; q_cnt++) { |
| 9538 | sg_list_qp = AscReadLramByte(iop_base, |
| 9539 | (ushort)(sg_q_addr |
| 9540 | + (ushort) |
| 9541 | ASC_SCSIQ_B_FWD)); |
| 9542 | sg_q_addr = ASC_QNO_TO_QADDR(sg_list_qp); |
| 9543 | if (sg_list_qp == ASC_QLINK_END) { |
| 9544 | AscSetLibErrorCode(asc_dvc, |
| 9545 | ASCQ_ERR_SG_Q_LINKS); |
| 9546 | scsiq->d3.done_stat = QD_WITH_ERROR; |
| 9547 | scsiq->d3.host_stat = |
| 9548 | QHSTA_D_QDONE_SG_LIST_CORRUPTED; |
| 9549 | goto FATAL_ERR_QDONE; |
| 9550 | } |
| 9551 | AscWriteLramByte(iop_base, |
| 9552 | (ushort)(sg_q_addr + (ushort) |
| 9553 | ASC_SCSIQ_B_STATUS), |
| 9554 | QS_FREE); |
| 9555 | } |
| 9556 | n_q_used = sg_queue_cnt + 1; |
| 9557 | AscPutVarDoneQTail(iop_base, sg_list_qp); |
| 9558 | } |
| 9559 | if (asc_dvc->queue_full_or_busy & target_id) { |
| 9560 | cur_target_qng = AscReadLramByte(iop_base, |
| 9561 | (ushort)((ushort) |
| 9562 | ASC_QADR_BEG |
| 9563 | + (ushort) |
| 9564 | scsiq->d2. |
| 9565 | target_ix)); |
| 9566 | if (cur_target_qng < asc_dvc->max_dvc_qng[tid_no]) { |
| 9567 | scsi_busy = AscReadLramByte(iop_base, (ushort) |
| 9568 | ASCV_SCSIBUSY_B); |
| 9569 | scsi_busy &= ~target_id; |
| 9570 | AscWriteLramByte(iop_base, |
| 9571 | (ushort)ASCV_SCSIBUSY_B, |
| 9572 | scsi_busy); |
| 9573 | asc_dvc->queue_full_or_busy &= ~target_id; |
| 9574 | } |
| 9575 | } |
| 9576 | if (asc_dvc->cur_total_qng >= n_q_used) { |
| 9577 | asc_dvc->cur_total_qng -= n_q_used; |
| 9578 | if (asc_dvc->cur_dvc_qng[tid_no] != 0) { |
| 9579 | asc_dvc->cur_dvc_qng[tid_no]--; |
| 9580 | } |
| 9581 | } else { |
| 9582 | AscSetLibErrorCode(asc_dvc, ASCQ_ERR_CUR_QNG); |
| 9583 | scsiq->d3.done_stat = QD_WITH_ERROR; |
| 9584 | goto FATAL_ERR_QDONE; |
| 9585 | } |
| 9586 | if ((scsiq->d2.srb_ptr == 0UL) || |
| 9587 | ((scsiq->q_status & QS_ABORTED) != 0)) { |
| 9588 | return (0x11); |
| 9589 | } else if (scsiq->q_status == QS_DONE) { |
| 9590 | false_overrun = FALSE; |
| 9591 | if (scsiq->extra_bytes != 0) { |
| 9592 | scsiq->remain_bytes += |
| 9593 | (ADV_DCNT)scsiq->extra_bytes; |
| 9594 | } |
| 9595 | if (scsiq->d3.done_stat == QD_WITH_ERROR) { |
| 9596 | if (scsiq->d3.host_stat == |
| 9597 | QHSTA_M_DATA_OVER_RUN) { |
| 9598 | if ((scsiq-> |
| 9599 | cntl & (QC_DATA_IN | QC_DATA_OUT)) |
| 9600 | == 0) { |
| 9601 | scsiq->d3.done_stat = |
| 9602 | QD_NO_ERROR; |
| 9603 | scsiq->d3.host_stat = |
| 9604 | QHSTA_NO_ERROR; |
| 9605 | } else if (false_overrun) { |
| 9606 | scsiq->d3.done_stat = |
| 9607 | QD_NO_ERROR; |
| 9608 | scsiq->d3.host_stat = |
| 9609 | QHSTA_NO_ERROR; |
| 9610 | } |
| 9611 | } else if (scsiq->d3.host_stat == |
| 9612 | QHSTA_M_HUNG_REQ_SCSI_BUS_RESET) { |
| 9613 | AscStopChip(iop_base); |
| 9614 | AscSetChipControl(iop_base, |
| 9615 | (uchar)(CC_SCSI_RESET |
| 9616 | | CC_HALT)); |
| 9617 | udelay(60); |
| 9618 | AscSetChipControl(iop_base, CC_HALT); |
| 9619 | AscSetChipStatus(iop_base, |
| 9620 | CIW_CLR_SCSI_RESET_INT); |
| 9621 | AscSetChipStatus(iop_base, 0); |
| 9622 | AscSetChipControl(iop_base, 0); |
| 9623 | } |
| 9624 | } |
| 9625 | if ((scsiq->cntl & QC_NO_CALLBACK) == 0) { |
| 9626 | asc_isr_callback(asc_dvc, scsiq); |
| 9627 | } else { |
| 9628 | if ((AscReadLramByte(iop_base, |
| 9629 | (ushort)(q_addr + (ushort) |
| 9630 | ASC_SCSIQ_CDB_BEG)) |
| 9631 | == START_STOP)) { |
| 9632 | asc_dvc->unit_not_ready &= ~target_id; |
| 9633 | if (scsiq->d3.done_stat != QD_NO_ERROR) { |
| 9634 | asc_dvc->start_motor &= |
| 9635 | ~target_id; |
| 9636 | } |
| 9637 | } |
| 9638 | } |
| 9639 | return (1); |
| 9640 | } else { |
| 9641 | AscSetLibErrorCode(asc_dvc, ASCQ_ERR_Q_STATUS); |
| 9642 | FATAL_ERR_QDONE: |
| 9643 | if ((scsiq->cntl & QC_NO_CALLBACK) == 0) { |
| 9644 | asc_isr_callback(asc_dvc, scsiq); |
| 9645 | } |
| 9646 | return (0x80); |
| 9647 | } |
| 9648 | } |
| 9649 | return (0); |
| 9650 | } |
| 9651 | |
| 9652 | static int AscISR(ASC_DVC_VAR *asc_dvc) |
| 9653 | { |
| 9654 | ASC_CS_TYPE chipstat; |
| 9655 | PortAddr iop_base; |
| 9656 | ushort saved_ram_addr; |
| 9657 | uchar ctrl_reg; |
| 9658 | uchar saved_ctrl_reg; |
| 9659 | int int_pending; |
| 9660 | int status; |
| 9661 | uchar host_flag; |
| 9662 | |
| 9663 | iop_base = asc_dvc->iop_base; |
| 9664 | int_pending = FALSE; |
| 9665 | |
| 9666 | if (AscIsIntPending(iop_base) == 0) |
| 9667 | return int_pending; |
| 9668 | |
| 9669 | if ((asc_dvc->init_state & ASC_INIT_STATE_END_LOAD_MC) == 0) { |
| 9670 | return ERR; |
| 9671 | } |
| 9672 | if (asc_dvc->in_critical_cnt != 0) { |
| 9673 | AscSetLibErrorCode(asc_dvc, ASCQ_ERR_ISR_ON_CRITICAL); |
| 9674 | return ERR; |
| 9675 | } |
| 9676 | if (asc_dvc->is_in_int) { |
| 9677 | AscSetLibErrorCode(asc_dvc, ASCQ_ERR_ISR_RE_ENTRY); |
| 9678 | return ERR; |
| 9679 | } |
| 9680 | asc_dvc->is_in_int = TRUE; |
| 9681 | ctrl_reg = AscGetChipControl(iop_base); |
| 9682 | saved_ctrl_reg = ctrl_reg & (~(CC_SCSI_RESET | CC_CHIP_RESET | |
| 9683 | CC_SINGLE_STEP | CC_DIAG | CC_TEST)); |
| 9684 | chipstat = AscGetChipStatus(iop_base); |
| 9685 | if (chipstat & CSW_SCSI_RESET_LATCH) { |
| 9686 | if (!(asc_dvc->bus_type & (ASC_IS_VL | ASC_IS_EISA))) { |
| 9687 | int i = 10; |
| 9688 | int_pending = TRUE; |
| 9689 | asc_dvc->sdtr_done = 0; |
| 9690 | saved_ctrl_reg &= (uchar)(~CC_HALT); |
| 9691 | while ((AscGetChipStatus(iop_base) & |
| 9692 | CSW_SCSI_RESET_ACTIVE) && (i-- > 0)) { |
| 9693 | mdelay(100); |
| 9694 | } |
| 9695 | AscSetChipControl(iop_base, (CC_CHIP_RESET | CC_HALT)); |
| 9696 | AscSetChipControl(iop_base, CC_HALT); |
| 9697 | AscSetChipStatus(iop_base, CIW_CLR_SCSI_RESET_INT); |
| 9698 | AscSetChipStatus(iop_base, 0); |
| 9699 | chipstat = AscGetChipStatus(iop_base); |
| 9700 | } |
| 9701 | } |
| 9702 | saved_ram_addr = AscGetChipLramAddr(iop_base); |
| 9703 | host_flag = AscReadLramByte(iop_base, |
| 9704 | ASCV_HOST_FLAG_B) & |
| 9705 | (uchar)(~ASC_HOST_FLAG_IN_ISR); |
| 9706 | AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, |
| 9707 | (uchar)(host_flag | (uchar)ASC_HOST_FLAG_IN_ISR)); |
| 9708 | if ((chipstat & CSW_INT_PENDING) || (int_pending)) { |
| 9709 | AscAckInterrupt(iop_base); |
| 9710 | int_pending = TRUE; |
| 9711 | if ((chipstat & CSW_HALTED) && (ctrl_reg & CC_SINGLE_STEP)) { |
| 9712 | if (AscIsrChipHalted(asc_dvc) == ERR) { |
| 9713 | goto ISR_REPORT_QDONE_FATAL_ERROR; |
| 9714 | } else { |
| 9715 | saved_ctrl_reg &= (uchar)(~CC_HALT); |
| 9716 | } |
| 9717 | } else { |
| 9718 | ISR_REPORT_QDONE_FATAL_ERROR: |
| 9719 | if ((asc_dvc->dvc_cntl & ASC_CNTL_INT_MULTI_Q) != 0) { |
| 9720 | while (((status = |
| 9721 | AscIsrQDone(asc_dvc)) & 0x01) != 0) { |
| 9722 | } |
| 9723 | } else { |
| 9724 | do { |
| 9725 | if ((status = |
| 9726 | AscIsrQDone(asc_dvc)) == 1) { |
| 9727 | break; |
| 9728 | } |
| 9729 | } while (status == 0x11); |
| 9730 | } |
| 9731 | if ((status & 0x80) != 0) |
| 9732 | int_pending = ERR; |
| 9733 | } |
| 9734 | } |
| 9735 | AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, host_flag); |
| 9736 | AscSetChipLramAddr(iop_base, saved_ram_addr); |
| 9737 | AscSetChipControl(iop_base, saved_ctrl_reg); |
| 9738 | asc_dvc->is_in_int = FALSE; |
| 9739 | return int_pending; |
| 9740 | } |
| 9741 | |
| 9742 | /* |
| 9743 | * advansys_reset() |
| 9744 | * |
| 9745 | * Reset the bus associated with the command 'scp'. |
| 9746 | * |
| 9747 | * This function runs its own thread. Interrupts must be blocked but |
| 9748 | * sleeping is allowed and no locking other than for host structures is |
| 9749 | * required. Returns SUCCESS or FAILED. |
| 9750 | */ |
| 9751 | static int advansys_reset(struct scsi_cmnd *scp) |
| 9752 | { |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9753 | struct Scsi_Host *shost = scp->device->host; |
| 9754 | struct asc_board *boardp = ASC_BOARDP(shost); |
| 9755 | unsigned long flags; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9756 | int status; |
| 9757 | int ret = SUCCESS; |
| 9758 | |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9759 | ASC_DBG1(1, "advansys_reset: 0x%p\n", scp); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9760 | |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9761 | ASC_STATS(shost, reset); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9762 | |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9763 | scmd_printk(KERN_INFO, scp, "SCSI bus reset started...\n"); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9764 | |
| 9765 | if (ASC_NARROW_BOARD(boardp)) { |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9766 | ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9767 | |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9768 | /* Reset the chip and SCSI bus. */ |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9769 | ASC_DBG(1, "advansys_reset: before AscInitAsc1000Driver()\n"); |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9770 | status = AscInitAsc1000Driver(asc_dvc); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9771 | |
| 9772 | /* Refer to ASC_IERR_* defintions for meaning of 'err_code'. */ |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9773 | if (asc_dvc->err_code) { |
| 9774 | scmd_printk(KERN_INFO, scp, "SCSI bus reset error: " |
| 9775 | "0x%x\n", asc_dvc->err_code); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9776 | ret = FAILED; |
| 9777 | } else if (status) { |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9778 | scmd_printk(KERN_INFO, scp, "SCSI bus reset warning: " |
| 9779 | "0x%x\n", status); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9780 | } else { |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9781 | scmd_printk(KERN_INFO, scp, "SCSI bus reset " |
| 9782 | "successful\n"); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9783 | } |
| 9784 | |
| 9785 | ASC_DBG(1, "advansys_reset: after AscInitAsc1000Driver()\n"); |
| 9786 | spin_lock_irqsave(&boardp->lock, flags); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9787 | } else { |
| 9788 | /* |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9789 | * If the suggest reset bus flags are set, then reset the bus. |
| 9790 | * Otherwise only reset the device. |
| 9791 | */ |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9792 | ADV_DVC_VAR *adv_dvc = &boardp->dvc_var.adv_dvc_var; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9793 | |
| 9794 | /* |
| 9795 | * Reset the target's SCSI bus. |
| 9796 | */ |
| 9797 | ASC_DBG(1, "advansys_reset: before AdvResetChipAndSB()\n"); |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9798 | switch (AdvResetChipAndSB(adv_dvc)) { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9799 | case ASC_TRUE: |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9800 | scmd_printk(KERN_INFO, scp, "SCSI bus reset " |
| 9801 | "successful\n"); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9802 | break; |
| 9803 | case ASC_FALSE: |
| 9804 | default: |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9805 | scmd_printk(KERN_INFO, scp, "SCSI bus reset error\n"); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9806 | ret = FAILED; |
| 9807 | break; |
| 9808 | } |
| 9809 | spin_lock_irqsave(&boardp->lock, flags); |
Matthew Wilcox | 52fa077 | 2007-10-02 21:55:26 -0400 | [diff] [blame^] | 9810 | AdvISR(adv_dvc); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9811 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9812 | |
| 9813 | /* Save the time of the most recently completed reset. */ |
| 9814 | boardp->last_reset = jiffies; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 9815 | spin_unlock_irqrestore(&boardp->lock, flags); |
| 9816 | |
| 9817 | ASC_DBG1(1, "advansys_reset: ret %d\n", ret); |
| 9818 | |
| 9819 | return ret; |
| 9820 | } |
| 9821 | |
| 9822 | /* |
| 9823 | * advansys_biosparam() |
| 9824 | * |
| 9825 | * Translate disk drive geometry if the "BIOS greater than 1 GB" |
| 9826 | * support is enabled for a drive. |
| 9827 | * |
| 9828 | * ip (information pointer) is an int array with the following definition: |
| 9829 | * ip[0]: heads |
| 9830 | * ip[1]: sectors |
| 9831 | * ip[2]: cylinders |
| 9832 | */ |
| 9833 | static int |
| 9834 | advansys_biosparam(struct scsi_device *sdev, struct block_device *bdev, |
| 9835 | sector_t capacity, int ip[]) |
| 9836 | { |
| 9837 | asc_board_t *boardp; |
| 9838 | |
| 9839 | ASC_DBG(1, "advansys_biosparam: begin\n"); |
| 9840 | ASC_STATS(sdev->host, biosparam); |
| 9841 | boardp = ASC_BOARDP(sdev->host); |
| 9842 | if (ASC_NARROW_BOARD(boardp)) { |
| 9843 | if ((boardp->dvc_var.asc_dvc_var.dvc_cntl & |
| 9844 | ASC_CNTL_BIOS_GT_1GB) && capacity > 0x200000) { |
| 9845 | ip[0] = 255; |
| 9846 | ip[1] = 63; |
| 9847 | } else { |
| 9848 | ip[0] = 64; |
| 9849 | ip[1] = 32; |
| 9850 | } |
| 9851 | } else { |
| 9852 | if ((boardp->dvc_var.adv_dvc_var.bios_ctrl & |
| 9853 | BIOS_CTRL_EXTENDED_XLAT) && capacity > 0x200000) { |
| 9854 | ip[0] = 255; |
| 9855 | ip[1] = 63; |
| 9856 | } else { |
| 9857 | ip[0] = 64; |
| 9858 | ip[1] = 32; |
| 9859 | } |
| 9860 | } |
| 9861 | ip[2] = (unsigned long)capacity / (ip[0] * ip[1]); |
| 9862 | ASC_DBG(1, "advansys_biosparam: end\n"); |
| 9863 | return 0; |
| 9864 | } |
| 9865 | |
| 9866 | /* |
| 9867 | * First-level interrupt handler. |
| 9868 | * |
| 9869 | * 'dev_id' is a pointer to the interrupting adapter's Scsi_Host. |
| 9870 | */ |
| 9871 | static irqreturn_t advansys_interrupt(int irq, void *dev_id) |
| 9872 | { |
| 9873 | unsigned long flags; |
| 9874 | struct Scsi_Host *shost = dev_id; |
| 9875 | asc_board_t *boardp = ASC_BOARDP(shost); |
| 9876 | irqreturn_t result = IRQ_NONE; |
| 9877 | |
| 9878 | ASC_DBG1(2, "advansys_interrupt: boardp 0x%p\n", boardp); |
| 9879 | spin_lock_irqsave(&boardp->lock, flags); |
| 9880 | if (ASC_NARROW_BOARD(boardp)) { |
| 9881 | if (AscIsIntPending(shost->io_port)) { |
| 9882 | result = IRQ_HANDLED; |
| 9883 | ASC_STATS(shost, interrupt); |
| 9884 | ASC_DBG(1, "advansys_interrupt: before AscISR()\n"); |
| 9885 | AscISR(&boardp->dvc_var.asc_dvc_var); |
| 9886 | } |
| 9887 | } else { |
| 9888 | ASC_DBG(1, "advansys_interrupt: before AdvISR()\n"); |
| 9889 | if (AdvISR(&boardp->dvc_var.adv_dvc_var)) { |
| 9890 | result = IRQ_HANDLED; |
| 9891 | ASC_STATS(shost, interrupt); |
| 9892 | } |
| 9893 | } |
| 9894 | spin_unlock_irqrestore(&boardp->lock, flags); |
| 9895 | |
| 9896 | ASC_DBG(1, "advansys_interrupt: end\n"); |
| 9897 | return result; |
| 9898 | } |
| 9899 | |
| 9900 | static int AscHostReqRiscHalt(PortAddr iop_base) |
| 9901 | { |
| 9902 | int count = 0; |
| 9903 | int sta = 0; |
| 9904 | uchar saved_stop_code; |
| 9905 | |
| 9906 | if (AscIsChipHalted(iop_base)) |
| 9907 | return (1); |
| 9908 | saved_stop_code = AscReadLramByte(iop_base, ASCV_STOP_CODE_B); |
| 9909 | AscWriteLramByte(iop_base, ASCV_STOP_CODE_B, |
| 9910 | ASC_STOP_HOST_REQ_RISC_HALT | ASC_STOP_REQ_RISC_STOP); |
| 9911 | do { |
| 9912 | if (AscIsChipHalted(iop_base)) { |
| 9913 | sta = 1; |
| 9914 | break; |
| 9915 | } |
| 9916 | mdelay(100); |
| 9917 | } while (count++ < 20); |
| 9918 | AscWriteLramByte(iop_base, ASCV_STOP_CODE_B, saved_stop_code); |
| 9919 | return (sta); |
| 9920 | } |
| 9921 | |
| 9922 | static int |
| 9923 | AscSetRunChipSynRegAtID(PortAddr iop_base, uchar tid_no, uchar sdtr_data) |
| 9924 | { |
| 9925 | int sta = FALSE; |
| 9926 | |
| 9927 | if (AscHostReqRiscHalt(iop_base)) { |
| 9928 | sta = AscSetChipSynRegAtID(iop_base, tid_no, sdtr_data); |
| 9929 | AscStartChip(iop_base); |
| 9930 | } |
| 9931 | return sta; |
| 9932 | } |
| 9933 | |
| 9934 | static void AscAsyncFix(ASC_DVC_VAR *asc_dvc, struct scsi_device *sdev) |
| 9935 | { |
| 9936 | char type = sdev->type; |
| 9937 | ASC_SCSI_BIT_ID_TYPE tid_bits = 1 << sdev->id; |
| 9938 | |
| 9939 | if (!(asc_dvc->bug_fix_cntl & ASC_BUG_FIX_ASYN_USE_SYN)) |
| 9940 | return; |
| 9941 | if (asc_dvc->init_sdtr & tid_bits) |
| 9942 | return; |
| 9943 | |
| 9944 | if ((type == TYPE_ROM) && (strncmp(sdev->vendor, "HP ", 3) == 0)) |
| 9945 | asc_dvc->pci_fix_asyn_xfer_always |= tid_bits; |
| 9946 | |
| 9947 | asc_dvc->pci_fix_asyn_xfer |= tid_bits; |
| 9948 | if ((type == TYPE_PROCESSOR) || (type == TYPE_SCANNER) || |
| 9949 | (type == TYPE_ROM) || (type == TYPE_TAPE)) |
| 9950 | asc_dvc->pci_fix_asyn_xfer &= ~tid_bits; |
| 9951 | |
| 9952 | if (asc_dvc->pci_fix_asyn_xfer & tid_bits) |
| 9953 | AscSetRunChipSynRegAtID(asc_dvc->iop_base, sdev->id, |
| 9954 | ASYN_SDTR_DATA_FIX_PCI_REV_AB); |
| 9955 | } |
| 9956 | |
| 9957 | static void |
| 9958 | advansys_narrow_slave_configure(struct scsi_device *sdev, ASC_DVC_VAR *asc_dvc) |
| 9959 | { |
| 9960 | ASC_SCSI_BIT_ID_TYPE tid_bit = 1 << sdev->id; |
| 9961 | ASC_SCSI_BIT_ID_TYPE orig_use_tagged_qng = asc_dvc->use_tagged_qng; |
| 9962 | |
| 9963 | if (sdev->lun == 0) { |
| 9964 | ASC_SCSI_BIT_ID_TYPE orig_init_sdtr = asc_dvc->init_sdtr; |
| 9965 | if ((asc_dvc->cfg->sdtr_enable & tid_bit) && sdev->sdtr) { |
| 9966 | asc_dvc->init_sdtr |= tid_bit; |
| 9967 | } else { |
| 9968 | asc_dvc->init_sdtr &= ~tid_bit; |
| 9969 | } |
| 9970 | |
| 9971 | if (orig_init_sdtr != asc_dvc->init_sdtr) |
| 9972 | AscAsyncFix(asc_dvc, sdev); |
| 9973 | } |
| 9974 | |
| 9975 | if (sdev->tagged_supported) { |
| 9976 | if (asc_dvc->cfg->cmd_qng_enabled & tid_bit) { |
| 9977 | if (sdev->lun == 0) { |
| 9978 | asc_dvc->cfg->can_tagged_qng |= tid_bit; |
| 9979 | asc_dvc->use_tagged_qng |= tid_bit; |
| 9980 | } |
| 9981 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, |
| 9982 | asc_dvc->max_dvc_qng[sdev->id]); |
| 9983 | } |
| 9984 | } else { |
| 9985 | if (sdev->lun == 0) { |
| 9986 | asc_dvc->cfg->can_tagged_qng &= ~tid_bit; |
| 9987 | asc_dvc->use_tagged_qng &= ~tid_bit; |
| 9988 | } |
| 9989 | scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); |
| 9990 | } |
| 9991 | |
| 9992 | if ((sdev->lun == 0) && |
| 9993 | (orig_use_tagged_qng != asc_dvc->use_tagged_qng)) { |
| 9994 | AscWriteLramByte(asc_dvc->iop_base, ASCV_DISC_ENABLE_B, |
| 9995 | asc_dvc->cfg->disc_enable); |
| 9996 | AscWriteLramByte(asc_dvc->iop_base, ASCV_USE_TAGGED_QNG_B, |
| 9997 | asc_dvc->use_tagged_qng); |
| 9998 | AscWriteLramByte(asc_dvc->iop_base, ASCV_CAN_TAGGED_QNG_B, |
| 9999 | asc_dvc->cfg->can_tagged_qng); |
| 10000 | |
| 10001 | asc_dvc->max_dvc_qng[sdev->id] = |
| 10002 | asc_dvc->cfg->max_tag_qng[sdev->id]; |
| 10003 | AscWriteLramByte(asc_dvc->iop_base, |
| 10004 | (ushort)(ASCV_MAX_DVC_QNG_BEG + sdev->id), |
| 10005 | asc_dvc->max_dvc_qng[sdev->id]); |
| 10006 | } |
| 10007 | } |
| 10008 | |
| 10009 | /* |
| 10010 | * Wide Transfers |
| 10011 | * |
| 10012 | * If the EEPROM enabled WDTR for the device and the device supports wide |
| 10013 | * bus (16 bit) transfers, then turn on the device's 'wdtr_able' bit and |
| 10014 | * write the new value to the microcode. |
| 10015 | */ |
| 10016 | static void |
| 10017 | advansys_wide_enable_wdtr(AdvPortAddr iop_base, unsigned short tidmask) |
| 10018 | { |
| 10019 | unsigned short cfg_word; |
| 10020 | AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, cfg_word); |
| 10021 | if ((cfg_word & tidmask) != 0) |
| 10022 | return; |
| 10023 | |
| 10024 | cfg_word |= tidmask; |
| 10025 | AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, cfg_word); |
| 10026 | |
| 10027 | /* |
| 10028 | * Clear the microcode SDTR and WDTR negotiation done indicators for |
| 10029 | * the target to cause it to negotiate with the new setting set above. |
| 10030 | * WDTR when accepted causes the target to enter asynchronous mode, so |
| 10031 | * SDTR must be negotiated. |
| 10032 | */ |
| 10033 | AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, cfg_word); |
| 10034 | cfg_word &= ~tidmask; |
| 10035 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_DONE, cfg_word); |
| 10036 | AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, cfg_word); |
| 10037 | cfg_word &= ~tidmask; |
| 10038 | AdvWriteWordLram(iop_base, ASC_MC_WDTR_DONE, cfg_word); |
| 10039 | } |
| 10040 | |
| 10041 | /* |
| 10042 | * Synchronous Transfers |
| 10043 | * |
| 10044 | * If the EEPROM enabled SDTR for the device and the device |
| 10045 | * supports synchronous transfers, then turn on the device's |
| 10046 | * 'sdtr_able' bit. Write the new value to the microcode. |
| 10047 | */ |
| 10048 | static void |
| 10049 | advansys_wide_enable_sdtr(AdvPortAddr iop_base, unsigned short tidmask) |
| 10050 | { |
| 10051 | unsigned short cfg_word; |
| 10052 | AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, cfg_word); |
| 10053 | if ((cfg_word & tidmask) != 0) |
| 10054 | return; |
| 10055 | |
| 10056 | cfg_word |= tidmask; |
| 10057 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, cfg_word); |
| 10058 | |
| 10059 | /* |
| 10060 | * Clear the microcode "SDTR negotiation" done indicator for the |
| 10061 | * target to cause it to negotiate with the new setting set above. |
| 10062 | */ |
| 10063 | AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, cfg_word); |
| 10064 | cfg_word &= ~tidmask; |
| 10065 | AdvWriteWordLram(iop_base, ASC_MC_SDTR_DONE, cfg_word); |
| 10066 | } |
| 10067 | |
| 10068 | /* |
| 10069 | * PPR (Parallel Protocol Request) Capable |
| 10070 | * |
| 10071 | * If the device supports DT mode, then it must be PPR capable. |
| 10072 | * The PPR message will be used in place of the SDTR and WDTR |
| 10073 | * messages to negotiate synchronous speed and offset, transfer |
| 10074 | * width, and protocol options. |
| 10075 | */ |
| 10076 | static void advansys_wide_enable_ppr(ADV_DVC_VAR *adv_dvc, |
| 10077 | AdvPortAddr iop_base, unsigned short tidmask) |
| 10078 | { |
| 10079 | AdvReadWordLram(iop_base, ASC_MC_PPR_ABLE, adv_dvc->ppr_able); |
| 10080 | adv_dvc->ppr_able |= tidmask; |
| 10081 | AdvWriteWordLram(iop_base, ASC_MC_PPR_ABLE, adv_dvc->ppr_able); |
| 10082 | } |
| 10083 | |
| 10084 | static void |
| 10085 | advansys_wide_slave_configure(struct scsi_device *sdev, ADV_DVC_VAR *adv_dvc) |
| 10086 | { |
| 10087 | AdvPortAddr iop_base = adv_dvc->iop_base; |
| 10088 | unsigned short tidmask = 1 << sdev->id; |
| 10089 | |
| 10090 | if (sdev->lun == 0) { |
| 10091 | /* |
| 10092 | * Handle WDTR, SDTR, and Tag Queuing. If the feature |
| 10093 | * is enabled in the EEPROM and the device supports the |
| 10094 | * feature, then enable it in the microcode. |
| 10095 | */ |
| 10096 | |
| 10097 | if ((adv_dvc->wdtr_able & tidmask) && sdev->wdtr) |
| 10098 | advansys_wide_enable_wdtr(iop_base, tidmask); |
| 10099 | if ((adv_dvc->sdtr_able & tidmask) && sdev->sdtr) |
| 10100 | advansys_wide_enable_sdtr(iop_base, tidmask); |
| 10101 | if (adv_dvc->chip_type == ADV_CHIP_ASC38C1600 && sdev->ppr) |
| 10102 | advansys_wide_enable_ppr(adv_dvc, iop_base, tidmask); |
| 10103 | |
| 10104 | /* |
| 10105 | * Tag Queuing is disabled for the BIOS which runs in polled |
| 10106 | * mode and would see no benefit from Tag Queuing. Also by |
| 10107 | * disabling Tag Queuing in the BIOS devices with Tag Queuing |
| 10108 | * bugs will at least work with the BIOS. |
| 10109 | */ |
| 10110 | if ((adv_dvc->tagqng_able & tidmask) && |
| 10111 | sdev->tagged_supported) { |
| 10112 | unsigned short cfg_word; |
| 10113 | AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, cfg_word); |
| 10114 | cfg_word |= tidmask; |
| 10115 | AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE, |
| 10116 | cfg_word); |
| 10117 | AdvWriteByteLram(iop_base, |
| 10118 | ASC_MC_NUMBER_OF_MAX_CMD + sdev->id, |
| 10119 | adv_dvc->max_dvc_qng); |
| 10120 | } |
| 10121 | } |
| 10122 | |
| 10123 | if ((adv_dvc->tagqng_able & tidmask) && sdev->tagged_supported) { |
| 10124 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, |
| 10125 | adv_dvc->max_dvc_qng); |
| 10126 | } else { |
| 10127 | scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); |
| 10128 | } |
| 10129 | } |
| 10130 | |
| 10131 | /* |
| 10132 | * Set the number of commands to queue per device for the |
| 10133 | * specified host adapter. |
| 10134 | */ |
| 10135 | static int advansys_slave_configure(struct scsi_device *sdev) |
| 10136 | { |
| 10137 | asc_board_t *boardp = ASC_BOARDP(sdev->host); |
| 10138 | boardp->flags |= ASC_SELECT_QUEUE_DEPTHS; |
| 10139 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10140 | if (ASC_NARROW_BOARD(boardp)) |
| 10141 | advansys_narrow_slave_configure(sdev, |
| 10142 | &boardp->dvc_var.asc_dvc_var); |
| 10143 | else |
| 10144 | advansys_wide_slave_configure(sdev, |
| 10145 | &boardp->dvc_var.adv_dvc_var); |
| 10146 | |
| 10147 | return 0; |
| 10148 | } |
| 10149 | |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10150 | static int asc_build_req(asc_board_t *boardp, struct scsi_cmnd *scp, |
| 10151 | struct asc_scsi_q *asc_scsi_q) |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10152 | { |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10153 | memset(asc_scsi_q, 0, sizeof(*asc_scsi_q)); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10154 | |
| 10155 | /* |
| 10156 | * Point the ASC_SCSI_Q to the 'struct scsi_cmnd'. |
| 10157 | */ |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10158 | asc_scsi_q->q2.srb_ptr = ASC_VADDR_TO_U32(scp); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10159 | |
| 10160 | /* |
| 10161 | * Build the ASC_SCSI_Q request. |
| 10162 | */ |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10163 | asc_scsi_q->cdbptr = &scp->cmnd[0]; |
| 10164 | asc_scsi_q->q2.cdb_len = scp->cmd_len; |
| 10165 | asc_scsi_q->q1.target_id = ASC_TID_TO_TARGET_ID(scp->device->id); |
| 10166 | asc_scsi_q->q1.target_lun = scp->device->lun; |
| 10167 | asc_scsi_q->q2.target_ix = |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10168 | ASC_TIDLUN_TO_IX(scp->device->id, scp->device->lun); |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10169 | asc_scsi_q->q1.sense_addr = |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10170 | cpu_to_le32(virt_to_bus(&scp->sense_buffer[0])); |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10171 | asc_scsi_q->q1.sense_len = sizeof(scp->sense_buffer); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10172 | |
| 10173 | /* |
| 10174 | * If there are any outstanding requests for the current target, |
| 10175 | * then every 255th request send an ORDERED request. This heuristic |
| 10176 | * tries to retain the benefit of request sorting while preventing |
| 10177 | * request starvation. 255 is the max number of tags or pending commands |
| 10178 | * a device may have outstanding. |
| 10179 | * |
| 10180 | * The request count is incremented below for every successfully |
| 10181 | * started request. |
| 10182 | * |
| 10183 | */ |
| 10184 | if ((boardp->dvc_var.asc_dvc_var.cur_dvc_qng[scp->device->id] > 0) && |
| 10185 | (boardp->reqcnt[scp->device->id] % 255) == 0) { |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10186 | asc_scsi_q->q2.tag_code = MSG_ORDERED_TAG; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10187 | } else { |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10188 | asc_scsi_q->q2.tag_code = MSG_SIMPLE_TAG; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10189 | } |
| 10190 | |
| 10191 | /* |
| 10192 | * Build ASC_SCSI_Q for a contiguous buffer or a scatter-gather |
| 10193 | * buffer command. |
| 10194 | */ |
| 10195 | if (scp->use_sg == 0) { |
| 10196 | /* |
| 10197 | * CDB request of single contiguous buffer. |
| 10198 | */ |
| 10199 | ASC_STATS(scp->device->host, cont_cnt); |
| 10200 | scp->SCp.dma_handle = scp->request_bufflen ? |
| 10201 | dma_map_single(boardp->dev, scp->request_buffer, |
| 10202 | scp->request_bufflen, |
| 10203 | scp->sc_data_direction) : 0; |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10204 | asc_scsi_q->q1.data_addr = cpu_to_le32(scp->SCp.dma_handle); |
| 10205 | asc_scsi_q->q1.data_cnt = cpu_to_le32(scp->request_bufflen); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10206 | ASC_STATS_ADD(scp->device->host, cont_xfer, |
| 10207 | ASC_CEILING(scp->request_bufflen, 512)); |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10208 | asc_scsi_q->q1.sg_queue_cnt = 0; |
| 10209 | asc_scsi_q->sg_head = NULL; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10210 | } else { |
| 10211 | /* |
| 10212 | * CDB scatter-gather request list. |
| 10213 | */ |
| 10214 | int sgcnt; |
| 10215 | int use_sg; |
| 10216 | struct scatterlist *slp; |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10217 | struct asc_sg_head *asc_sg_head; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10218 | |
| 10219 | slp = (struct scatterlist *)scp->request_buffer; |
| 10220 | use_sg = dma_map_sg(boardp->dev, slp, scp->use_sg, |
| 10221 | scp->sc_data_direction); |
| 10222 | |
| 10223 | if (use_sg > scp->device->host->sg_tablesize) { |
| 10224 | ASC_PRINT3("asc_build_req: board %d: use_sg %d > " |
| 10225 | "sg_tablesize %d\n", boardp->id, use_sg, |
| 10226 | scp->device->host->sg_tablesize); |
| 10227 | dma_unmap_sg(boardp->dev, slp, scp->use_sg, |
| 10228 | scp->sc_data_direction); |
| 10229 | scp->result = HOST_BYTE(DID_ERROR); |
| 10230 | return ASC_ERROR; |
| 10231 | } |
| 10232 | |
| 10233 | ASC_STATS(scp->device->host, sg_cnt); |
| 10234 | |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10235 | asc_sg_head = kzalloc(sizeof(asc_scsi_q->sg_head) + |
| 10236 | use_sg * sizeof(struct asc_sg_list), GFP_ATOMIC); |
| 10237 | if (!asc_sg_head) { |
| 10238 | dma_unmap_sg(boardp->dev, slp, scp->use_sg, |
| 10239 | scp->sc_data_direction); |
| 10240 | scp->result = HOST_BYTE(DID_SOFT_ERROR); |
| 10241 | return ASC_ERROR; |
| 10242 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10243 | |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10244 | asc_scsi_q->q1.cntl |= QC_SG_HEAD; |
| 10245 | asc_scsi_q->sg_head = asc_sg_head; |
| 10246 | asc_scsi_q->q1.data_cnt = 0; |
| 10247 | asc_scsi_q->q1.data_addr = 0; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10248 | /* This is a byte value, otherwise it would need to be swapped. */ |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10249 | asc_sg_head->entry_cnt = asc_scsi_q->q1.sg_queue_cnt = use_sg; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10250 | ASC_STATS_ADD(scp->device->host, sg_elem, |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10251 | asc_sg_head->entry_cnt); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10252 | |
| 10253 | /* |
| 10254 | * Convert scatter-gather list into ASC_SG_HEAD list. |
| 10255 | */ |
| 10256 | for (sgcnt = 0; sgcnt < use_sg; sgcnt++, slp++) { |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10257 | asc_sg_head->sg_list[sgcnt].addr = |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10258 | cpu_to_le32(sg_dma_address(slp)); |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 10259 | asc_sg_head->sg_list[sgcnt].bytes = |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 10260 | cpu_to_le32(sg_dma_len(slp)); |
| 10261 | ASC_STATS_ADD(scp->device->host, sg_xfer, |
| 10262 | ASC_CEILING(sg_dma_len(slp), 512)); |
| 10263 | } |
| 10264 | } |
| 10265 | |
| 10266 | ASC_DBG_PRT_ASC_SCSI_Q(2, &asc_scsi_q); |
| 10267 | ASC_DBG_PRT_CDB(1, scp->cmnd, scp->cmd_len); |
| 10268 | |
| 10269 | return ASC_NOERROR; |
| 10270 | } |
| 10271 | |
| 10272 | /* |
| 10273 | * Build scatter-gather list for Adv Library (Wide Board). |
| 10274 | * |
| 10275 | * Additional ADV_SG_BLOCK structures will need to be allocated |
| 10276 | * if the total number of scatter-gather elements exceeds |
| 10277 | * NO_OF_SG_PER_BLOCK (15). The ADV_SG_BLOCK structures are |
| 10278 | * assumed to be physically contiguous. |
| 10279 | * |
| 10280 | * Return: |
| 10281 | * ADV_SUCCESS(1) - SG List successfully created |
| 10282 | * ADV_ERROR(-1) - SG List creation failed |
| 10283 | */ |
| 10284 | static int |
| 10285 | adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, struct scsi_cmnd *scp, |
| 10286 | int use_sg) |
| 10287 | { |
| 10288 | adv_sgblk_t *sgblkp; |
| 10289 | ADV_SCSI_REQ_Q *scsiqp; |
| 10290 | struct scatterlist *slp; |
| 10291 | int sg_elem_cnt; |
| 10292 | ADV_SG_BLOCK *sg_block, *prev_sg_block; |
| 10293 | ADV_PADDR sg_block_paddr; |
| 10294 | int i; |
| 10295 | |
| 10296 | scsiqp = (ADV_SCSI_REQ_Q *)ADV_32BALIGN(&reqp->scsi_req_q); |
| 10297 | slp = (struct scatterlist *)scp->request_buffer; |
| 10298 | sg_elem_cnt = use_sg; |
| 10299 | prev_sg_block = NULL; |
| 10300 | reqp->sgblkp = NULL; |
| 10301 | |
| 10302 | for (;;) { |
| 10303 | /* |
| 10304 | * Allocate a 'adv_sgblk_t' structure from the board free |
| 10305 | * list. One 'adv_sgblk_t' structure holds NO_OF_SG_PER_BLOCK |
| 10306 | * (15) scatter-gather elements. |
| 10307 | */ |
| 10308 | if ((sgblkp = boardp->adv_sgblkp) == NULL) { |
| 10309 | ASC_DBG(1, "adv_get_sglist: no free adv_sgblk_t\n"); |
| 10310 | ASC_STATS(scp->device->host, adv_build_nosg); |
| 10311 | |
| 10312 | /* |
| 10313 | * Allocation failed. Free 'adv_sgblk_t' structures |
| 10314 | * already allocated for the request. |
| 10315 | */ |
| 10316 | while ((sgblkp = reqp->sgblkp) != NULL) { |
| 10317 | /* Remove 'sgblkp' from the request list. */ |
| 10318 | reqp->sgblkp = sgblkp->next_sgblkp; |
| 10319 | |
| 10320 | /* Add 'sgblkp' to the board free list. */ |
| 10321 | sgblkp->next_sgblkp = boardp->adv_sgblkp; |
| 10322 | boardp->adv_sgblkp = sgblkp; |
| 10323 | } |
| 10324 | return ASC_BUSY; |
| 10325 | } |
| 10326 | |
| 10327 | /* Complete 'adv_sgblk_t' board allocation. */ |
| 10328 | boardp->adv_sgblkp = sgblkp->next_sgblkp; |
| 10329 | sgblkp->next_sgblkp = NULL; |
| 10330 | |
| 10331 | /* |
| 10332 | * Get 8 byte aligned virtual and physical addresses |
| 10333 | * for the allocated ADV_SG_BLOCK structure. |
| 10334 | */ |
| 10335 | sg_block = (ADV_SG_BLOCK *)ADV_8BALIGN(&sgblkp->sg_block); |
| 10336 | sg_block_paddr = virt_to_bus(sg_block); |
| 10337 | |
| 10338 | /* |
| 10339 | * Check if this is the first 'adv_sgblk_t' for the |
| 10340 | * request. |
| 10341 | */ |
| 10342 | if (reqp->sgblkp == NULL) { |
| 10343 | /* Request's first scatter-gather block. */ |
| 10344 | reqp->sgblkp = sgblkp; |
| 10345 | |
| 10346 | /* |
| 10347 | * Set ADV_SCSI_REQ_T ADV_SG_BLOCK virtual and physical |
| 10348 | * address pointers. |
| 10349 | */ |
| 10350 | scsiqp->sg_list_ptr = sg_block; |
| 10351 | scsiqp->sg_real_addr = cpu_to_le32(sg_block_paddr); |
| 10352 | } else { |
| 10353 | /* Request's second or later scatter-gather block. */ |
| 10354 | sgblkp->next_sgblkp = reqp->sgblkp; |
| 10355 | reqp->sgblkp = sgblkp; |
| 10356 | |
| 10357 | /* |
| 10358 | * Point the previous ADV_SG_BLOCK structure to |
| 10359 | * the newly allocated ADV_SG_BLOCK structure. |
| 10360 | */ |
| 10361 | prev_sg_block->sg_ptr = cpu_to_le32(sg_block_paddr); |
| 10362 | } |
| 10363 | |
| 10364 | for (i = 0; i < NO_OF_SG_PER_BLOCK; i++) { |
| 10365 | sg_block->sg_list[i].sg_addr = |
| 10366 | cpu_to_le32(sg_dma_address(slp)); |
| 10367 | sg_block->sg_list[i].sg_count = |
| 10368 | cpu_to_le32(sg_dma_len(slp)); |
| 10369 | ASC_STATS_ADD(scp->device->host, sg_xfer, |
| 10370 | ASC_CEILING(sg_dma_len(slp), 512)); |
| 10371 | |
| 10372 | if (--sg_elem_cnt == 0) { /* Last ADV_SG_BLOCK and scatter-gather entry. */ |
| 10373 | sg_block->sg_cnt = i + 1; |
| 10374 | sg_block->sg_ptr = 0L; /* Last ADV_SG_BLOCK in list. */ |
| 10375 | return ADV_SUCCESS; |
| 10376 | } |
| 10377 | slp++; |
| 10378 | } |
| 10379 | sg_block->sg_cnt = NO_OF_SG_PER_BLOCK; |
| 10380 | prev_sg_block = sg_block; |
| 10381 | } |
| 10382 | } |
| 10383 | |
| 10384 | /* |
| 10385 | * Build a request structure for the Adv Library (Wide Board). |
| 10386 | * |
| 10387 | * If an adv_req_t can not be allocated to issue the request, |
| 10388 | * then return ASC_BUSY. If an error occurs, then return ASC_ERROR. |
| 10389 | * |
| 10390 | * Multi-byte fields in the ASC_SCSI_REQ_Q that are used by the |
| 10391 | * microcode for DMA addresses or math operations are byte swapped |
| 10392 | * to little-endian order. |
| 10393 | */ |
| 10394 | static int |
| 10395 | adv_build_req(asc_board_t *boardp, struct scsi_cmnd *scp, |
| 10396 | ADV_SCSI_REQ_Q **adv_scsiqpp) |
| 10397 | { |
| 10398 | adv_req_t *reqp; |
| 10399 | ADV_SCSI_REQ_Q *scsiqp; |
| 10400 | int i; |
| 10401 | int ret; |
| 10402 | |
| 10403 | /* |
| 10404 | * Allocate an adv_req_t structure from the board to execute |
| 10405 | * the command. |
| 10406 | */ |
| 10407 | if (boardp->adv_reqp == NULL) { |
| 10408 | ASC_DBG(1, "adv_build_req: no free adv_req_t\n"); |
| 10409 | ASC_STATS(scp->device->host, adv_build_noreq); |
| 10410 | return ASC_BUSY; |
| 10411 | } else { |
| 10412 | reqp = boardp->adv_reqp; |
| 10413 | boardp->adv_reqp = reqp->next_reqp; |
| 10414 | reqp->next_reqp = NULL; |
| 10415 | } |
| 10416 | |
| 10417 | /* |
| 10418 | * Get 32-byte aligned ADV_SCSI_REQ_Q and ADV_SG_BLOCK pointers. |
| 10419 | */ |
| 10420 | scsiqp = (ADV_SCSI_REQ_Q *)ADV_32BALIGN(&reqp->scsi_req_q); |
| 10421 | |
| 10422 | /* |
| 10423 | * Initialize the structure. |
| 10424 | */ |
| 10425 | scsiqp->cntl = scsiqp->scsi_cntl = scsiqp->done_status = 0; |
| 10426 | |
| 10427 | /* |
| 10428 | * Set the ADV_SCSI_REQ_Q 'srb_ptr' to point to the adv_req_t structure. |
| 10429 | */ |
| 10430 | scsiqp->srb_ptr = ASC_VADDR_TO_U32(reqp); |
| 10431 | |
| 10432 | /* |
| 10433 | * Set the adv_req_t 'cmndp' to point to the struct scsi_cmnd structure. |
| 10434 | */ |
| 10435 | reqp->cmndp = scp; |
| 10436 | |
| 10437 | /* |
| 10438 | * Build the ADV_SCSI_REQ_Q request. |
| 10439 | */ |
| 10440 | |
| 10441 | /* Set CDB length and copy it to the request structure. */ |
| 10442 | scsiqp->cdb_len = scp->cmd_len; |
| 10443 | /* Copy first 12 CDB bytes to cdb[]. */ |
| 10444 | for (i = 0; i < scp->cmd_len && i < 12; i++) { |
| 10445 | scsiqp->cdb[i] = scp->cmnd[i]; |
| 10446 | } |
| 10447 | /* Copy last 4 CDB bytes, if present, to cdb16[]. */ |
| 10448 | for (; i < scp->cmd_len; i++) { |
| 10449 | scsiqp->cdb16[i - 12] = scp->cmnd[i]; |
| 10450 | } |
| 10451 | |
| 10452 | scsiqp->target_id = scp->device->id; |
| 10453 | scsiqp->target_lun = scp->device->lun; |
| 10454 | |
| 10455 | scsiqp->sense_addr = cpu_to_le32(virt_to_bus(&scp->sense_buffer[0])); |
| 10456 | scsiqp->sense_len = sizeof(scp->sense_buffer); |
| 10457 | |
| 10458 | /* |
| 10459 | * Build ADV_SCSI_REQ_Q for a contiguous buffer or a scatter-gather |
| 10460 | * buffer command. |
| 10461 | */ |
| 10462 | |
| 10463 | scsiqp->data_cnt = cpu_to_le32(scp->request_bufflen); |
| 10464 | scsiqp->vdata_addr = scp->request_buffer; |
| 10465 | scsiqp->data_addr = cpu_to_le32(virt_to_bus(scp->request_buffer)); |
| 10466 | |
| 10467 | if (scp->use_sg == 0) { |
| 10468 | /* |
| 10469 | * CDB request of single contiguous buffer. |
| 10470 | */ |
| 10471 | reqp->sgblkp = NULL; |
| 10472 | scsiqp->data_cnt = cpu_to_le32(scp->request_bufflen); |
| 10473 | if (scp->request_bufflen) { |
| 10474 | scsiqp->vdata_addr = scp->request_buffer; |
| 10475 | scp->SCp.dma_handle = |
| 10476 | dma_map_single(boardp->dev, scp->request_buffer, |
| 10477 | scp->request_bufflen, |
| 10478 | scp->sc_data_direction); |
| 10479 | } else { |
| 10480 | scsiqp->vdata_addr = NULL; |
| 10481 | scp->SCp.dma_handle = 0; |
| 10482 | } |
| 10483 | scsiqp->data_addr = cpu_to_le32(scp->SCp.dma_handle); |
| 10484 | scsiqp->sg_list_ptr = NULL; |
| 10485 | scsiqp->sg_real_addr = 0; |
| 10486 | ASC_STATS(scp->device->host, cont_cnt); |
| 10487 | ASC_STATS_ADD(scp->device->host, cont_xfer, |
| 10488 | ASC_CEILING(scp->request_bufflen, 512)); |
| 10489 | } else { |
| 10490 | /* |
| 10491 | * CDB scatter-gather request list. |
| 10492 | */ |
| 10493 | struct scatterlist *slp; |
| 10494 | int use_sg; |
| 10495 | |
| 10496 | slp = (struct scatterlist *)scp->request_buffer; |
| 10497 | use_sg = dma_map_sg(boardp->dev, slp, scp->use_sg, |
| 10498 | scp->sc_data_direction); |
| 10499 | |
| 10500 | if (use_sg > ADV_MAX_SG_LIST) { |
| 10501 | ASC_PRINT3("adv_build_req: board %d: use_sg %d > " |
| 10502 | "ADV_MAX_SG_LIST %d\n", boardp->id, use_sg, |
| 10503 | scp->device->host->sg_tablesize); |
| 10504 | dma_unmap_sg(boardp->dev, slp, scp->use_sg, |
| 10505 | scp->sc_data_direction); |
| 10506 | scp->result = HOST_BYTE(DID_ERROR); |
| 10507 | |
| 10508 | /* |
| 10509 | * Free the 'adv_req_t' structure by adding it back |
| 10510 | * to the board free list. |
| 10511 | */ |
| 10512 | reqp->next_reqp = boardp->adv_reqp; |
| 10513 | boardp->adv_reqp = reqp; |
| 10514 | |
| 10515 | return ASC_ERROR; |
| 10516 | } |
| 10517 | |
| 10518 | ret = adv_get_sglist(boardp, reqp, scp, use_sg); |
| 10519 | if (ret != ADV_SUCCESS) { |
| 10520 | /* |
| 10521 | * Free the adv_req_t structure by adding it back to |
| 10522 | * the board free list. |
| 10523 | */ |
| 10524 | reqp->next_reqp = boardp->adv_reqp; |
| 10525 | boardp->adv_reqp = reqp; |
| 10526 | |
| 10527 | return ret; |
| 10528 | } |
| 10529 | |
| 10530 | ASC_STATS(scp->device->host, sg_cnt); |
| 10531 | ASC_STATS_ADD(scp->device->host, sg_elem, use_sg); |
| 10532 | } |
| 10533 | |
| 10534 | ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp); |
| 10535 | ASC_DBG_PRT_CDB(1, scp->cmnd, scp->cmd_len); |
| 10536 | |
| 10537 | *adv_scsiqpp = scsiqp; |
| 10538 | |
| 10539 | return ASC_NOERROR; |
| 10540 | } |
| 10541 | |
| 10542 | static int AscSgListToQueue(int sg_list) |
| 10543 | { |
| 10544 | int n_sg_list_qs; |
| 10545 | |
| 10546 | n_sg_list_qs = ((sg_list - 1) / ASC_SG_LIST_PER_Q); |
| 10547 | if (((sg_list - 1) % ASC_SG_LIST_PER_Q) != 0) |
| 10548 | n_sg_list_qs++; |
| 10549 | return n_sg_list_qs + 1; |
| 10550 | } |
| 10551 | |
| 10552 | static uint |
| 10553 | AscGetNumOfFreeQueue(ASC_DVC_VAR *asc_dvc, uchar target_ix, uchar n_qs) |
| 10554 | { |
| 10555 | uint cur_used_qs; |
| 10556 | uint cur_free_qs; |
| 10557 | ASC_SCSI_BIT_ID_TYPE target_id; |
| 10558 | uchar tid_no; |
| 10559 | |
| 10560 | target_id = ASC_TIX_TO_TARGET_ID(target_ix); |
| 10561 | tid_no = ASC_TIX_TO_TID(target_ix); |
| 10562 | if ((asc_dvc->unit_not_ready & target_id) || |
| 10563 | (asc_dvc->queue_full_or_busy & target_id)) { |
| 10564 | return 0; |
| 10565 | } |
| 10566 | if (n_qs == 1) { |
| 10567 | cur_used_qs = (uint) asc_dvc->cur_total_qng + |
| 10568 | (uint) asc_dvc->last_q_shortage + (uint) ASC_MIN_FREE_Q; |
| 10569 | } else { |
| 10570 | cur_used_qs = (uint) asc_dvc->cur_total_qng + |
| 10571 | (uint) ASC_MIN_FREE_Q; |
| 10572 | } |
| 10573 | if ((uint) (cur_used_qs + n_qs) <= (uint) asc_dvc->max_total_qng) { |
| 10574 | cur_free_qs = (uint) asc_dvc->max_total_qng - cur_used_qs; |
| 10575 | if (asc_dvc->cur_dvc_qng[tid_no] >= |
| 10576 | asc_dvc->max_dvc_qng[tid_no]) { |
| 10577 | return 0; |
| 10578 | } |
| 10579 | return cur_free_qs; |
| 10580 | } |
| 10581 | if (n_qs > 1) { |
| 10582 | if ((n_qs > asc_dvc->last_q_shortage) |
| 10583 | && (n_qs <= (asc_dvc->max_total_qng - ASC_MIN_FREE_Q))) { |
| 10584 | asc_dvc->last_q_shortage = n_qs; |
| 10585 | } |
| 10586 | } |
| 10587 | return 0; |
| 10588 | } |
| 10589 | |
| 10590 | static uchar AscAllocFreeQueue(PortAddr iop_base, uchar free_q_head) |
| 10591 | { |
| 10592 | ushort q_addr; |
| 10593 | uchar next_qp; |
| 10594 | uchar q_status; |
| 10595 | |
| 10596 | q_addr = ASC_QNO_TO_QADDR(free_q_head); |
| 10597 | q_status = (uchar)AscReadLramByte(iop_base, |
| 10598 | (ushort)(q_addr + |
| 10599 | ASC_SCSIQ_B_STATUS)); |
| 10600 | next_qp = AscReadLramByte(iop_base, (ushort)(q_addr + ASC_SCSIQ_B_FWD)); |
| 10601 | if (((q_status & QS_READY) == 0) && (next_qp != ASC_QLINK_END)) |
| 10602 | return next_qp; |
| 10603 | return ASC_QLINK_END; |
| 10604 | } |
| 10605 | |
| 10606 | static uchar |
| 10607 | AscAllocMultipleFreeQueue(PortAddr iop_base, uchar free_q_head, uchar n_free_q) |
| 10608 | { |
| 10609 | uchar i; |
| 10610 | |
| 10611 | for (i = 0; i < n_free_q; i++) { |
| 10612 | free_q_head = AscAllocFreeQueue(iop_base, free_q_head); |
| 10613 | if (free_q_head == ASC_QLINK_END) |
| 10614 | break; |
| 10615 | } |
| 10616 | return free_q_head; |
| 10617 | } |
| 10618 | |
| 10619 | /* |
| 10620 | * void |
| 10621 | * DvcPutScsiQ(PortAddr iop_base, ushort s_addr, uchar *outbuf, int words) |
| 10622 | * |
| 10623 | * Calling/Exit State: |
| 10624 | * none |
| 10625 | * |
| 10626 | * Description: |
| 10627 | * Output an ASC_SCSI_Q structure to the chip |
| 10628 | */ |
| 10629 | static void |
| 10630 | DvcPutScsiQ(PortAddr iop_base, ushort s_addr, uchar *outbuf, int words) |
| 10631 | { |
| 10632 | int i; |
| 10633 | |
| 10634 | ASC_DBG_PRT_HEX(2, "DvcPutScsiQ", outbuf, 2 * words); |
| 10635 | AscSetChipLramAddr(iop_base, s_addr); |
| 10636 | for (i = 0; i < 2 * words; i += 2) { |
| 10637 | if (i == 4 || i == 20) { |
| 10638 | continue; |
| 10639 | } |
| 10640 | outpw(iop_base + IOP_RAM_DATA, |
| 10641 | ((ushort)outbuf[i + 1] << 8) | outbuf[i]); |
| 10642 | } |
| 10643 | } |
| 10644 | |
| 10645 | static int AscPutReadyQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar q_no) |
| 10646 | { |
| 10647 | ushort q_addr; |
| 10648 | uchar tid_no; |
| 10649 | uchar sdtr_data; |
| 10650 | uchar syn_period_ix; |
| 10651 | uchar syn_offset; |
| 10652 | PortAddr iop_base; |
| 10653 | |
| 10654 | iop_base = asc_dvc->iop_base; |
| 10655 | if (((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) && |
| 10656 | ((asc_dvc->sdtr_done & scsiq->q1.target_id) == 0)) { |
| 10657 | tid_no = ASC_TIX_TO_TID(scsiq->q2.target_ix); |
| 10658 | sdtr_data = AscGetMCodeInitSDTRAtID(iop_base, tid_no); |
| 10659 | syn_period_ix = |
| 10660 | (sdtr_data >> 4) & (asc_dvc->max_sdtr_index - 1); |
| 10661 | syn_offset = sdtr_data & ASC_SYN_MAX_OFFSET; |
| 10662 | AscMsgOutSDTR(asc_dvc, |
| 10663 | asc_dvc->sdtr_period_tbl[syn_period_ix], |
| 10664 | syn_offset); |
| 10665 | scsiq->q1.cntl |= QC_MSG_OUT; |
| 10666 | } |
| 10667 | q_addr = ASC_QNO_TO_QADDR(q_no); |
| 10668 | if ((scsiq->q1.target_id & asc_dvc->use_tagged_qng) == 0) { |
| 10669 | scsiq->q2.tag_code &= ~MSG_SIMPLE_TAG; |
| 10670 | } |
| 10671 | scsiq->q1.status = QS_FREE; |
| 10672 | AscMemWordCopyPtrToLram(iop_base, |
| 10673 | q_addr + ASC_SCSIQ_CDB_BEG, |
| 10674 | (uchar *)scsiq->cdbptr, scsiq->q2.cdb_len >> 1); |
| 10675 | |
| 10676 | DvcPutScsiQ(iop_base, |
| 10677 | q_addr + ASC_SCSIQ_CPY_BEG, |
| 10678 | (uchar *)&scsiq->q1.cntl, |
| 10679 | ((sizeof(ASC_SCSIQ_1) + sizeof(ASC_SCSIQ_2)) / 2) - 1); |
| 10680 | AscWriteLramWord(iop_base, |
| 10681 | (ushort)(q_addr + (ushort)ASC_SCSIQ_B_STATUS), |
| 10682 | (ushort)(((ushort)scsiq->q1. |
| 10683 | q_no << 8) | (ushort)QS_READY)); |
| 10684 | return 1; |
| 10685 | } |
| 10686 | |
| 10687 | static int |
| 10688 | AscPutReadySgListQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar q_no) |
| 10689 | { |
| 10690 | int sta; |
| 10691 | int i; |
| 10692 | ASC_SG_HEAD *sg_head; |
| 10693 | ASC_SG_LIST_Q scsi_sg_q; |
| 10694 | ASC_DCNT saved_data_addr; |
| 10695 | ASC_DCNT saved_data_cnt; |
| 10696 | PortAddr iop_base; |
| 10697 | ushort sg_list_dwords; |
| 10698 | ushort sg_index; |
| 10699 | ushort sg_entry_cnt; |
| 10700 | ushort q_addr; |
| 10701 | uchar next_qp; |
| 10702 | |
| 10703 | iop_base = asc_dvc->iop_base; |
| 10704 | sg_head = scsiq->sg_head; |
| 10705 | saved_data_addr = scsiq->q1.data_addr; |
| 10706 | saved_data_cnt = scsiq->q1.data_cnt; |
| 10707 | scsiq->q1.data_addr = (ASC_PADDR) sg_head->sg_list[0].addr; |
| 10708 | scsiq->q1.data_cnt = (ASC_DCNT) sg_head->sg_list[0].bytes; |
| 10709 | #if CC_VERY_LONG_SG_LIST |
| 10710 | /* |
| 10711 | * If sg_head->entry_cnt is greater than ASC_MAX_SG_LIST |
| 10712 | * then not all SG elements will fit in the allocated queues. |
| 10713 | * The rest of the SG elements will be copied when the RISC |
| 10714 | * completes the SG elements that fit and halts. |
| 10715 | */ |
| 10716 | if (sg_head->entry_cnt > ASC_MAX_SG_LIST) { |
| 10717 | /* |
| 10718 | * Set sg_entry_cnt to be the number of SG elements that |
| 10719 | * will fit in the allocated SG queues. It is minus 1, because |
| 10720 | * the first SG element is handled above. ASC_MAX_SG_LIST is |
| 10721 | * already inflated by 1 to account for this. For example it |
| 10722 | * may be 50 which is 1 + 7 queues * 7 SG elements. |
| 10723 | */ |
| 10724 | sg_entry_cnt = ASC_MAX_SG_LIST - 1; |
| 10725 | |
| 10726 | /* |
| 10727 | * Keep track of remaining number of SG elements that will |
| 10728 | * need to be handled from a_isr.c. |
| 10729 | */ |
| 10730 | scsiq->remain_sg_entry_cnt = |
| 10731 | sg_head->entry_cnt - ASC_MAX_SG_LIST; |
| 10732 | } else { |
| 10733 | #endif /* CC_VERY_LONG_SG_LIST */ |
| 10734 | /* |
| 10735 | * Set sg_entry_cnt to be the number of SG elements that |
| 10736 | * will fit in the allocated SG queues. It is minus 1, because |
| 10737 | * the first SG element is handled above. |
| 10738 | */ |
| 10739 | sg_entry_cnt = sg_head->entry_cnt - 1; |
| 10740 | #if CC_VERY_LONG_SG_LIST |
| 10741 | } |
| 10742 | #endif /* CC_VERY_LONG_SG_LIST */ |
| 10743 | if (sg_entry_cnt != 0) { |
| 10744 | scsiq->q1.cntl |= QC_SG_HEAD; |
| 10745 | q_addr = ASC_QNO_TO_QADDR(q_no); |
| 10746 | sg_index = 1; |
| 10747 | scsiq->q1.sg_queue_cnt = sg_head->queue_cnt; |
| 10748 | scsi_sg_q.sg_head_qp = q_no; |
| 10749 | scsi_sg_q.cntl = QCSG_SG_XFER_LIST; |
| 10750 | for (i = 0; i < sg_head->queue_cnt; i++) { |
| 10751 | scsi_sg_q.seq_no = i + 1; |
| 10752 | if (sg_entry_cnt > ASC_SG_LIST_PER_Q) { |
| 10753 | sg_list_dwords = (uchar)(ASC_SG_LIST_PER_Q * 2); |
| 10754 | sg_entry_cnt -= ASC_SG_LIST_PER_Q; |
| 10755 | if (i == 0) { |
| 10756 | scsi_sg_q.sg_list_cnt = |
| 10757 | ASC_SG_LIST_PER_Q; |
| 10758 | scsi_sg_q.sg_cur_list_cnt = |
| 10759 | ASC_SG_LIST_PER_Q; |
| 10760 | } else { |
| 10761 | scsi_sg_q.sg_list_cnt = |
| 10762 | ASC_SG_LIST_PER_Q - 1; |
| 10763 | scsi_sg_q.sg_cur_list_cnt = |
| 10764 | ASC_SG_LIST_PER_Q - 1; |
| 10765 | } |
| 10766 | } else { |
| 10767 | #if CC_VERY_LONG_SG_LIST |
| 10768 | /* |
| 10769 | * This is the last SG queue in the list of |
| 10770 | * allocated SG queues. If there are more |
| 10771 | * SG elements than will fit in the allocated |
| 10772 | * queues, then set the QCSG_SG_XFER_MORE flag. |
| 10773 | */ |
| 10774 | if (sg_head->entry_cnt > ASC_MAX_SG_LIST) { |
| 10775 | scsi_sg_q.cntl |= QCSG_SG_XFER_MORE; |
| 10776 | } else { |
| 10777 | #endif /* CC_VERY_LONG_SG_LIST */ |
| 10778 | scsi_sg_q.cntl |= QCSG_SG_XFER_END; |
| 10779 | #if CC_VERY_LONG_SG_LIST |
| 10780 | } |
| 10781 | #endif /* CC_VERY_LONG_SG_LIST */ |
| 10782 | sg_list_dwords = sg_entry_cnt << 1; |
| 10783 | if (i == 0) { |
| 10784 | scsi_sg_q.sg_list_cnt = sg_entry_cnt; |
| 10785 | scsi_sg_q.sg_cur_list_cnt = |
| 10786 | sg_entry_cnt; |
| 10787 | } else { |
| 10788 | scsi_sg_q.sg_list_cnt = |
| 10789 | sg_entry_cnt - 1; |
| 10790 | scsi_sg_q.sg_cur_list_cnt = |
| 10791 | sg_entry_cnt - 1; |
| 10792 | } |
| 10793 | sg_entry_cnt = 0; |
| 10794 | } |
| 10795 | next_qp = AscReadLramByte(iop_base, |
| 10796 | (ushort)(q_addr + |
| 10797 | ASC_SCSIQ_B_FWD)); |
| 10798 | scsi_sg_q.q_no = next_qp; |
| 10799 | q_addr = ASC_QNO_TO_QADDR(next_qp); |
| 10800 | AscMemWordCopyPtrToLram(iop_base, |
| 10801 | q_addr + ASC_SCSIQ_SGHD_CPY_BEG, |
| 10802 | (uchar *)&scsi_sg_q, |
| 10803 | sizeof(ASC_SG_LIST_Q) >> 1); |
| 10804 | AscMemDWordCopyPtrToLram(iop_base, |
| 10805 | q_addr + ASC_SGQ_LIST_BEG, |
| 10806 | (uchar *)&sg_head-> |
| 10807 | sg_list[sg_index], |
| 10808 | sg_list_dwords); |
| 10809 | sg_index += ASC_SG_LIST_PER_Q; |
| 10810 | scsiq->next_sg_index = sg_index; |
| 10811 | } |
| 10812 | } else { |
| 10813 | scsiq->q1.cntl &= ~QC_SG_HEAD; |
| 10814 | } |
| 10815 | sta = AscPutReadyQueue(asc_dvc, scsiq, q_no); |
| 10816 | scsiq->q1.data_addr = saved_data_addr; |
| 10817 | scsiq->q1.data_cnt = saved_data_cnt; |
| 10818 | return (sta); |
| 10819 | } |
| 10820 | |
| 10821 | static int |
| 10822 | AscSendScsiQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar n_q_required) |
| 10823 | { |
| 10824 | PortAddr iop_base; |
| 10825 | uchar free_q_head; |
| 10826 | uchar next_qp; |
| 10827 | uchar tid_no; |
| 10828 | uchar target_ix; |
| 10829 | int sta; |
| 10830 | |
| 10831 | iop_base = asc_dvc->iop_base; |
| 10832 | target_ix = scsiq->q2.target_ix; |
| 10833 | tid_no = ASC_TIX_TO_TID(target_ix); |
| 10834 | sta = 0; |
| 10835 | free_q_head = (uchar)AscGetVarFreeQHead(iop_base); |
| 10836 | if (n_q_required > 1) { |
| 10837 | next_qp = AscAllocMultipleFreeQueue(iop_base, free_q_head, |
| 10838 | (uchar)n_q_required); |
| 10839 | if (next_qp != ASC_QLINK_END) { |
| 10840 | asc_dvc->last_q_shortage = 0; |
| 10841 | scsiq->sg_head->queue_cnt = n_q_required - 1; |
| 10842 | scsiq->q1.q_no = free_q_head; |
| 10843 | sta = AscPutReadySgListQueue(asc_dvc, scsiq, |
| 10844 | free_q_head); |
| 10845 | } |
| 10846 | } else if (n_q_required == 1) { |
| 10847 | next_qp = AscAllocFreeQueue(iop_base, free_q_head); |
| 10848 | if (next_qp != ASC_QLINK_END) { |
| 10849 | scsiq->q1.q_no = free_q_head; |
| 10850 | sta = AscPutReadyQueue(asc_dvc, scsiq, free_q_head); |
| 10851 | } |
| 10852 | } |
| 10853 | if (sta == 1) { |
| 10854 | AscPutVarFreeQHead(iop_base, next_qp); |
| 10855 | asc_dvc->cur_total_qng += n_q_required; |
| 10856 | asc_dvc->cur_dvc_qng[tid_no]++; |
| 10857 | } |
| 10858 | return sta; |
| 10859 | } |
| 10860 | |
| 10861 | #define ASC_SYN_OFFSET_ONE_DISABLE_LIST 16 |
| 10862 | static uchar _syn_offset_one_disable_cmd[ASC_SYN_OFFSET_ONE_DISABLE_LIST] = { |
| 10863 | INQUIRY, |
| 10864 | REQUEST_SENSE, |
| 10865 | READ_CAPACITY, |
| 10866 | READ_TOC, |
| 10867 | MODE_SELECT, |
| 10868 | MODE_SENSE, |
| 10869 | MODE_SELECT_10, |
| 10870 | MODE_SENSE_10, |
| 10871 | 0xFF, |
| 10872 | 0xFF, |
| 10873 | 0xFF, |
| 10874 | 0xFF, |
| 10875 | 0xFF, |
| 10876 | 0xFF, |
| 10877 | 0xFF, |
| 10878 | 0xFF |
| 10879 | }; |
| 10880 | |
| 10881 | static int AscExeScsiQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq) |
| 10882 | { |
| 10883 | PortAddr iop_base; |
| 10884 | int sta; |
| 10885 | int n_q_required; |
| 10886 | int disable_syn_offset_one_fix; |
| 10887 | int i; |
| 10888 | ASC_PADDR addr; |
| 10889 | ushort sg_entry_cnt = 0; |
| 10890 | ushort sg_entry_cnt_minus_one = 0; |
| 10891 | uchar target_ix; |
| 10892 | uchar tid_no; |
| 10893 | uchar sdtr_data; |
| 10894 | uchar extra_bytes; |
| 10895 | uchar scsi_cmd; |
| 10896 | uchar disable_cmd; |
| 10897 | ASC_SG_HEAD *sg_head; |
| 10898 | ASC_DCNT data_cnt; |
| 10899 | |
| 10900 | iop_base = asc_dvc->iop_base; |
| 10901 | sg_head = scsiq->sg_head; |
| 10902 | if (asc_dvc->err_code != 0) |
| 10903 | return (ERR); |
| 10904 | scsiq->q1.q_no = 0; |
| 10905 | if ((scsiq->q2.tag_code & ASC_TAG_FLAG_EXTRA_BYTES) == 0) { |
| 10906 | scsiq->q1.extra_bytes = 0; |
| 10907 | } |
| 10908 | sta = 0; |
| 10909 | target_ix = scsiq->q2.target_ix; |
| 10910 | tid_no = ASC_TIX_TO_TID(target_ix); |
| 10911 | n_q_required = 1; |
| 10912 | if (scsiq->cdbptr[0] == REQUEST_SENSE) { |
| 10913 | if ((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) { |
| 10914 | asc_dvc->sdtr_done &= ~scsiq->q1.target_id; |
| 10915 | sdtr_data = AscGetMCodeInitSDTRAtID(iop_base, tid_no); |
| 10916 | AscMsgOutSDTR(asc_dvc, |
| 10917 | asc_dvc-> |
| 10918 | sdtr_period_tbl[(sdtr_data >> 4) & |
| 10919 | (uchar)(asc_dvc-> |
| 10920 | max_sdtr_index - |
| 10921 | 1)], |
| 10922 | (uchar)(sdtr_data & (uchar) |
| 10923 | ASC_SYN_MAX_OFFSET)); |
| 10924 | scsiq->q1.cntl |= (QC_MSG_OUT | QC_URGENT); |
| 10925 | } |
| 10926 | } |
| 10927 | if (asc_dvc->in_critical_cnt != 0) { |
| 10928 | AscSetLibErrorCode(asc_dvc, ASCQ_ERR_CRITICAL_RE_ENTRY); |
| 10929 | return (ERR); |
| 10930 | } |
| 10931 | asc_dvc->in_critical_cnt++; |
| 10932 | if ((scsiq->q1.cntl & QC_SG_HEAD) != 0) { |
| 10933 | if ((sg_entry_cnt = sg_head->entry_cnt) == 0) { |
| 10934 | asc_dvc->in_critical_cnt--; |
| 10935 | return (ERR); |
| 10936 | } |
| 10937 | #if !CC_VERY_LONG_SG_LIST |
| 10938 | if (sg_entry_cnt > ASC_MAX_SG_LIST) { |
| 10939 | asc_dvc->in_critical_cnt--; |
| 10940 | return (ERR); |
| 10941 | } |
| 10942 | #endif /* !CC_VERY_LONG_SG_LIST */ |
| 10943 | if (sg_entry_cnt == 1) { |
| 10944 | scsiq->q1.data_addr = |
| 10945 | (ADV_PADDR)sg_head->sg_list[0].addr; |
| 10946 | scsiq->q1.data_cnt = |
| 10947 | (ADV_DCNT)sg_head->sg_list[0].bytes; |
| 10948 | scsiq->q1.cntl &= ~(QC_SG_HEAD | QC_SG_SWAP_QUEUE); |
| 10949 | } |
| 10950 | sg_entry_cnt_minus_one = sg_entry_cnt - 1; |
| 10951 | } |
| 10952 | scsi_cmd = scsiq->cdbptr[0]; |
| 10953 | disable_syn_offset_one_fix = FALSE; |
| 10954 | if ((asc_dvc->pci_fix_asyn_xfer & scsiq->q1.target_id) && |
| 10955 | !(asc_dvc->pci_fix_asyn_xfer_always & scsiq->q1.target_id)) { |
| 10956 | if (scsiq->q1.cntl & QC_SG_HEAD) { |
| 10957 | data_cnt = 0; |
| 10958 | for (i = 0; i < sg_entry_cnt; i++) { |
| 10959 | data_cnt += |
| 10960 | (ADV_DCNT)le32_to_cpu(sg_head->sg_list[i]. |
| 10961 | bytes); |
| 10962 | } |
| 10963 | } else { |
| 10964 | data_cnt = le32_to_cpu(scsiq->q1.data_cnt); |
| 10965 | } |
| 10966 | if (data_cnt != 0UL) { |
| 10967 | if (data_cnt < 512UL) { |
| 10968 | disable_syn_offset_one_fix = TRUE; |
| 10969 | } else { |
| 10970 | for (i = 0; i < ASC_SYN_OFFSET_ONE_DISABLE_LIST; |
| 10971 | i++) { |
| 10972 | disable_cmd = |
| 10973 | _syn_offset_one_disable_cmd[i]; |
| 10974 | if (disable_cmd == 0xFF) { |
| 10975 | break; |
| 10976 | } |
| 10977 | if (scsi_cmd == disable_cmd) { |
| 10978 | disable_syn_offset_one_fix = |
| 10979 | TRUE; |
| 10980 | break; |
| 10981 | } |
| 10982 | } |
| 10983 | } |
| 10984 | } |
| 10985 | } |
| 10986 | if (disable_syn_offset_one_fix) { |
| 10987 | scsiq->q2.tag_code &= ~MSG_SIMPLE_TAG; |
| 10988 | scsiq->q2.tag_code |= (ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX | |
| 10989 | ASC_TAG_FLAG_DISABLE_DISCONNECT); |
| 10990 | } else { |
| 10991 | scsiq->q2.tag_code &= 0x27; |
| 10992 | } |
| 10993 | if ((scsiq->q1.cntl & QC_SG_HEAD) != 0) { |
| 10994 | if (asc_dvc->bug_fix_cntl) { |
| 10995 | if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) { |
| 10996 | if ((scsi_cmd == READ_6) || |
| 10997 | (scsi_cmd == READ_10)) { |
| 10998 | addr = |
| 10999 | (ADV_PADDR)le32_to_cpu(sg_head-> |
| 11000 | sg_list |
| 11001 | [sg_entry_cnt_minus_one]. |
| 11002 | addr) + |
| 11003 | (ADV_DCNT)le32_to_cpu(sg_head-> |
| 11004 | sg_list |
| 11005 | [sg_entry_cnt_minus_one]. |
| 11006 | bytes); |
| 11007 | extra_bytes = |
| 11008 | (uchar)((ushort)addr & 0x0003); |
| 11009 | if ((extra_bytes != 0) |
| 11010 | && |
| 11011 | ((scsiq->q2. |
| 11012 | tag_code & |
| 11013 | ASC_TAG_FLAG_EXTRA_BYTES) |
| 11014 | == 0)) { |
| 11015 | scsiq->q2.tag_code |= |
| 11016 | ASC_TAG_FLAG_EXTRA_BYTES; |
| 11017 | scsiq->q1.extra_bytes = |
| 11018 | extra_bytes; |
| 11019 | data_cnt = |
| 11020 | le32_to_cpu(sg_head-> |
| 11021 | sg_list |
| 11022 | [sg_entry_cnt_minus_one]. |
| 11023 | bytes); |
| 11024 | data_cnt -= |
| 11025 | (ASC_DCNT) extra_bytes; |
| 11026 | sg_head-> |
| 11027 | sg_list |
| 11028 | [sg_entry_cnt_minus_one]. |
| 11029 | bytes = |
| 11030 | cpu_to_le32(data_cnt); |
| 11031 | } |
| 11032 | } |
| 11033 | } |
| 11034 | } |
| 11035 | sg_head->entry_to_copy = sg_head->entry_cnt; |
| 11036 | #if CC_VERY_LONG_SG_LIST |
| 11037 | /* |
| 11038 | * Set the sg_entry_cnt to the maximum possible. The rest of |
| 11039 | * the SG elements will be copied when the RISC completes the |
| 11040 | * SG elements that fit and halts. |
| 11041 | */ |
| 11042 | if (sg_entry_cnt > ASC_MAX_SG_LIST) { |
| 11043 | sg_entry_cnt = ASC_MAX_SG_LIST; |
| 11044 | } |
| 11045 | #endif /* CC_VERY_LONG_SG_LIST */ |
| 11046 | n_q_required = AscSgListToQueue(sg_entry_cnt); |
| 11047 | if ((AscGetNumOfFreeQueue(asc_dvc, target_ix, n_q_required) >= |
| 11048 | (uint) n_q_required) |
| 11049 | || ((scsiq->q1.cntl & QC_URGENT) != 0)) { |
| 11050 | if ((sta = |
| 11051 | AscSendScsiQueue(asc_dvc, scsiq, |
| 11052 | n_q_required)) == 1) { |
| 11053 | asc_dvc->in_critical_cnt--; |
| 11054 | return (sta); |
| 11055 | } |
| 11056 | } |
| 11057 | } else { |
| 11058 | if (asc_dvc->bug_fix_cntl) { |
| 11059 | if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) { |
| 11060 | if ((scsi_cmd == READ_6) || |
| 11061 | (scsi_cmd == READ_10)) { |
| 11062 | addr = |
| 11063 | le32_to_cpu(scsiq->q1.data_addr) + |
| 11064 | le32_to_cpu(scsiq->q1.data_cnt); |
| 11065 | extra_bytes = |
| 11066 | (uchar)((ushort)addr & 0x0003); |
| 11067 | if ((extra_bytes != 0) |
| 11068 | && |
| 11069 | ((scsiq->q2. |
| 11070 | tag_code & |
| 11071 | ASC_TAG_FLAG_EXTRA_BYTES) |
| 11072 | == 0)) { |
| 11073 | data_cnt = |
| 11074 | le32_to_cpu(scsiq->q1. |
| 11075 | data_cnt); |
| 11076 | if (((ushort)data_cnt & 0x01FF) |
| 11077 | == 0) { |
| 11078 | scsiq->q2.tag_code |= |
| 11079 | ASC_TAG_FLAG_EXTRA_BYTES; |
| 11080 | data_cnt -= (ASC_DCNT) |
| 11081 | extra_bytes; |
| 11082 | scsiq->q1.data_cnt = |
| 11083 | cpu_to_le32 |
| 11084 | (data_cnt); |
| 11085 | scsiq->q1.extra_bytes = |
| 11086 | extra_bytes; |
| 11087 | } |
| 11088 | } |
| 11089 | } |
| 11090 | } |
| 11091 | } |
| 11092 | n_q_required = 1; |
| 11093 | if ((AscGetNumOfFreeQueue(asc_dvc, target_ix, 1) >= 1) || |
| 11094 | ((scsiq->q1.cntl & QC_URGENT) != 0)) { |
| 11095 | if ((sta = AscSendScsiQueue(asc_dvc, scsiq, |
| 11096 | n_q_required)) == 1) { |
| 11097 | asc_dvc->in_critical_cnt--; |
| 11098 | return (sta); |
| 11099 | } |
| 11100 | } |
| 11101 | } |
| 11102 | asc_dvc->in_critical_cnt--; |
| 11103 | return (sta); |
| 11104 | } |
| 11105 | |
| 11106 | /* |
| 11107 | * AdvExeScsiQueue() - Send a request to the RISC microcode program. |
| 11108 | * |
| 11109 | * Allocate a carrier structure, point the carrier to the ADV_SCSI_REQ_Q, |
| 11110 | * add the carrier to the ICQ (Initiator Command Queue), and tickle the |
| 11111 | * RISC to notify it a new command is ready to be executed. |
| 11112 | * |
| 11113 | * If 'done_status' is not set to QD_DO_RETRY, then 'error_retry' will be |
| 11114 | * set to SCSI_MAX_RETRY. |
| 11115 | * |
| 11116 | * Multi-byte fields in the ASC_SCSI_REQ_Q that are used by the microcode |
| 11117 | * for DMA addresses or math operations are byte swapped to little-endian |
| 11118 | * order. |
| 11119 | * |
| 11120 | * Return: |
| 11121 | * ADV_SUCCESS(1) - The request was successfully queued. |
| 11122 | * ADV_BUSY(0) - Resource unavailable; Retry again after pending |
| 11123 | * request completes. |
| 11124 | * ADV_ERROR(-1) - Invalid ADV_SCSI_REQ_Q request structure |
| 11125 | * host IC error. |
| 11126 | */ |
| 11127 | static int AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq) |
| 11128 | { |
| 11129 | AdvPortAddr iop_base; |
| 11130 | ADV_DCNT req_size; |
| 11131 | ADV_PADDR req_paddr; |
| 11132 | ADV_CARR_T *new_carrp; |
| 11133 | |
| 11134 | /* |
| 11135 | * The ADV_SCSI_REQ_Q 'target_id' field should never exceed ADV_MAX_TID. |
| 11136 | */ |
| 11137 | if (scsiq->target_id > ADV_MAX_TID) { |
| 11138 | scsiq->host_status = QHSTA_M_INVALID_DEVICE; |
| 11139 | scsiq->done_status = QD_WITH_ERROR; |
| 11140 | return ADV_ERROR; |
| 11141 | } |
| 11142 | |
| 11143 | iop_base = asc_dvc->iop_base; |
| 11144 | |
| 11145 | /* |
| 11146 | * Allocate a carrier ensuring at least one carrier always |
| 11147 | * remains on the freelist and initialize fields. |
| 11148 | */ |
| 11149 | if ((new_carrp = asc_dvc->carr_freelist) == NULL) { |
| 11150 | return ADV_BUSY; |
| 11151 | } |
| 11152 | asc_dvc->carr_freelist = (ADV_CARR_T *) |
| 11153 | ADV_U32_TO_VADDR(le32_to_cpu(new_carrp->next_vpa)); |
| 11154 | asc_dvc->carr_pending_cnt++; |
| 11155 | |
| 11156 | /* |
| 11157 | * Set the carrier to be a stopper by setting 'next_vpa' |
| 11158 | * to the stopper value. The current stopper will be changed |
| 11159 | * below to point to the new stopper. |
| 11160 | */ |
| 11161 | new_carrp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER); |
| 11162 | |
| 11163 | /* |
| 11164 | * Clear the ADV_SCSI_REQ_Q done flag. |
| 11165 | */ |
| 11166 | scsiq->a_flag &= ~ADV_SCSIQ_DONE; |
| 11167 | |
| 11168 | req_size = sizeof(ADV_SCSI_REQ_Q); |
| 11169 | req_paddr = DvcGetPhyAddr(asc_dvc, scsiq, (uchar *)scsiq, |
| 11170 | (ADV_SDCNT *)&req_size, ADV_IS_SCSIQ_FLAG); |
| 11171 | |
| 11172 | BUG_ON(req_paddr & 31); |
| 11173 | BUG_ON(req_size < sizeof(ADV_SCSI_REQ_Q)); |
| 11174 | |
| 11175 | /* Wait for assertion before making little-endian */ |
| 11176 | req_paddr = cpu_to_le32(req_paddr); |
| 11177 | |
| 11178 | /* Save virtual and physical address of ADV_SCSI_REQ_Q and carrier. */ |
| 11179 | scsiq->scsiq_ptr = cpu_to_le32(ADV_VADDR_TO_U32(scsiq)); |
| 11180 | scsiq->scsiq_rptr = req_paddr; |
| 11181 | |
| 11182 | scsiq->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->icq_sp)); |
| 11183 | /* |
| 11184 | * Every ADV_CARR_T.carr_pa is byte swapped to little-endian |
| 11185 | * order during initialization. |
| 11186 | */ |
| 11187 | scsiq->carr_pa = asc_dvc->icq_sp->carr_pa; |
| 11188 | |
| 11189 | /* |
| 11190 | * Use the current stopper to send the ADV_SCSI_REQ_Q command to |
| 11191 | * the microcode. The newly allocated stopper will become the new |
| 11192 | * stopper. |
| 11193 | */ |
| 11194 | asc_dvc->icq_sp->areq_vpa = req_paddr; |
| 11195 | |
| 11196 | /* |
| 11197 | * Set the 'next_vpa' pointer for the old stopper to be the |
| 11198 | * physical address of the new stopper. The RISC can only |
| 11199 | * follow physical addresses. |
| 11200 | */ |
| 11201 | asc_dvc->icq_sp->next_vpa = new_carrp->carr_pa; |
| 11202 | |
| 11203 | /* |
| 11204 | * Set the host adapter stopper pointer to point to the new carrier. |
| 11205 | */ |
| 11206 | asc_dvc->icq_sp = new_carrp; |
| 11207 | |
| 11208 | if (asc_dvc->chip_type == ADV_CHIP_ASC3550 || |
| 11209 | asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { |
| 11210 | /* |
| 11211 | * Tickle the RISC to tell it to read its Command Queue Head pointer. |
| 11212 | */ |
| 11213 | AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_A); |
| 11214 | if (asc_dvc->chip_type == ADV_CHIP_ASC3550) { |
| 11215 | /* |
| 11216 | * Clear the tickle value. In the ASC-3550 the RISC flag |
| 11217 | * command 'clr_tickle_a' does not work unless the host |
| 11218 | * value is cleared. |
| 11219 | */ |
| 11220 | AdvWriteByteRegister(iop_base, IOPB_TICKLE, |
| 11221 | ADV_TICKLE_NOP); |
| 11222 | } |
| 11223 | } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { |
| 11224 | /* |
| 11225 | * Notify the RISC a carrier is ready by writing the physical |
| 11226 | * address of the new carrier stopper to the COMMA register. |
| 11227 | */ |
| 11228 | AdvWriteDWordRegister(iop_base, IOPDW_COMMA, |
| 11229 | le32_to_cpu(new_carrp->carr_pa)); |
| 11230 | } |
| 11231 | |
| 11232 | return ADV_SUCCESS; |
| 11233 | } |
| 11234 | |
| 11235 | /* |
| 11236 | * Execute a single 'Scsi_Cmnd'. |
| 11237 | * |
| 11238 | * The function 'done' is called when the request has been completed. |
| 11239 | * |
| 11240 | * Scsi_Cmnd: |
| 11241 | * |
| 11242 | * host - board controlling device |
| 11243 | * device - device to send command |
| 11244 | * target - target of device |
| 11245 | * lun - lun of device |
| 11246 | * cmd_len - length of SCSI CDB |
| 11247 | * cmnd - buffer for SCSI 8, 10, or 12 byte CDB |
| 11248 | * use_sg - if non-zero indicates scatter-gather request with use_sg elements |
| 11249 | * |
| 11250 | * if (use_sg == 0) { |
| 11251 | * request_buffer - buffer address for request |
| 11252 | * request_bufflen - length of request buffer |
| 11253 | * } else { |
| 11254 | * request_buffer - pointer to scatterlist structure |
| 11255 | * } |
| 11256 | * |
| 11257 | * sense_buffer - sense command buffer |
| 11258 | * |
| 11259 | * result (4 bytes of an int): |
| 11260 | * Byte Meaning |
| 11261 | * 0 SCSI Status Byte Code |
| 11262 | * 1 SCSI One Byte Message Code |
| 11263 | * 2 Host Error Code |
| 11264 | * 3 Mid-Level Error Code |
| 11265 | * |
| 11266 | * host driver fields: |
| 11267 | * SCp - Scsi_Pointer used for command processing status |
| 11268 | * scsi_done - used to save caller's done function |
| 11269 | * host_scribble - used for pointer to another struct scsi_cmnd |
| 11270 | * |
| 11271 | * If this function returns ASC_NOERROR the request will be completed |
| 11272 | * from the interrupt handler. |
| 11273 | * |
| 11274 | * If this function returns ASC_ERROR the host error code has been set, |
| 11275 | * and the called must call asc_scsi_done. |
| 11276 | * |
| 11277 | * If ASC_BUSY is returned the request will be returned to the midlayer |
| 11278 | * and re-tried later. |
| 11279 | */ |
| 11280 | static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp) |
| 11281 | { |
Matthew Wilcox | 41d2493 | 2007-10-02 21:55:24 -0400 | [diff] [blame] | 11282 | int ret, err_code; |
| 11283 | asc_board_t *boardp = ASC_BOARDP(scp->device->host); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 11284 | |
Matthew Wilcox | 41d2493 | 2007-10-02 21:55:24 -0400 | [diff] [blame] | 11285 | ASC_DBG1(1, "asc_execute_scsi_cmnd: scp 0x%p\n", scp); |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 11286 | |
| 11287 | if (ASC_NARROW_BOARD(boardp)) { |
Matthew Wilcox | 41d2493 | 2007-10-02 21:55:24 -0400 | [diff] [blame] | 11288 | ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 11289 | struct asc_scsi_q asc_scsi_q; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 11290 | |
Matthew Wilcox | 41d2493 | 2007-10-02 21:55:24 -0400 | [diff] [blame] | 11291 | /* asc_build_req() can not return ASC_BUSY. */ |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 11292 | ret = asc_build_req(boardp, scp, &asc_scsi_q); |
| 11293 | if (ret == ASC_ERROR) { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 11294 | ASC_STATS(scp->device->host, build_error); |
| 11295 | return ASC_ERROR; |
| 11296 | } |
| 11297 | |
Matthew Wilcox | 41d2493 | 2007-10-02 21:55:24 -0400 | [diff] [blame] | 11298 | ret = AscExeScsiQueue(asc_dvc, &asc_scsi_q); |
Matthew Wilcox | 05848b6 | 2007-10-02 21:55:25 -0400 | [diff] [blame] | 11299 | kfree(asc_scsi_q.sg_head); |
Matthew Wilcox | 41d2493 | 2007-10-02 21:55:24 -0400 | [diff] [blame] | 11300 | err_code = asc_dvc->err_code; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 11301 | } else { |
Matthew Wilcox | 41d2493 | 2007-10-02 21:55:24 -0400 | [diff] [blame] | 11302 | ADV_DVC_VAR *adv_dvc = &boardp->dvc_var.adv_dvc_var; |
| 11303 | ADV_SCSI_REQ_Q *adv_scsiqp; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 11304 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 11305 | switch (adv_build_req(boardp, scp, &adv_scsiqp)) { |
| 11306 | case ASC_NOERROR: |
| 11307 | ASC_DBG(3, "asc_execute_scsi_cmnd: adv_build_req " |
| 11308 | "ASC_NOERROR\n"); |
| 11309 | break; |
| 11310 | case ASC_BUSY: |
| 11311 | ASC_DBG(1, "asc_execute_scsi_cmnd: adv_build_req " |
| 11312 | "ASC_BUSY\n"); |
| 11313 | /* |
| 11314 | * The asc_stats fields 'adv_build_noreq' and |
| 11315 | * 'adv_build_nosg' count wide board busy conditions. |
| 11316 | * They are updated in adv_build_req and |
| 11317 | * adv_get_sglist, respectively. |
| 11318 | */ |
| 11319 | return ASC_BUSY; |
| 11320 | case ASC_ERROR: |
| 11321 | default: |
| 11322 | ASC_DBG(1, "asc_execute_scsi_cmnd: adv_build_req " |
| 11323 | "ASC_ERROR\n"); |
| 11324 | ASC_STATS(scp->device->host, build_error); |
| 11325 | return ASC_ERROR; |
| 11326 | } |
| 11327 | |
Matthew Wilcox | 41d2493 | 2007-10-02 21:55:24 -0400 | [diff] [blame] | 11328 | ret = AdvExeScsiQueue(adv_dvc, adv_scsiqp); |
| 11329 | err_code = adv_dvc->err_code; |
| 11330 | } |
| 11331 | |
| 11332 | switch (ret) { |
| 11333 | case ASC_NOERROR: |
| 11334 | ASC_STATS(scp->device->host, exe_noerror); |
| 11335 | /* |
| 11336 | * Increment monotonically increasing per device |
| 11337 | * successful request counter. Wrapping doesn't matter. |
| 11338 | */ |
| 11339 | boardp->reqcnt[scp->device->id]++; |
| 11340 | ASC_DBG(1, "asc_execute_scsi_cmnd: ExeScsiQueue(), " |
| 11341 | "ASC_NOERROR\n"); |
| 11342 | break; |
| 11343 | case ASC_BUSY: |
| 11344 | ASC_STATS(scp->device->host, exe_busy); |
| 11345 | break; |
| 11346 | case ASC_ERROR: |
| 11347 | ASC_PRINT2("asc_execute_scsi_cmnd: board %d: ExeScsiQueue() " |
| 11348 | "ASC_ERROR, err_code 0x%x\n", boardp->id, err_code); |
| 11349 | ASC_STATS(scp->device->host, exe_error); |
| 11350 | scp->result = HOST_BYTE(DID_ERROR); |
| 11351 | break; |
| 11352 | default: |
| 11353 | ASC_PRINT2("asc_execute_scsi_cmnd: board %d: ExeScsiQueue() " |
| 11354 | "unknown, err_code 0x%x\n", boardp->id, err_code); |
| 11355 | ASC_STATS(scp->device->host, exe_unknown); |
| 11356 | scp->result = HOST_BYTE(DID_ERROR); |
| 11357 | break; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 11358 | } |
| 11359 | |
| 11360 | ASC_DBG(1, "asc_execute_scsi_cmnd: end\n"); |
| 11361 | return ret; |
| 11362 | } |
| 11363 | |
| 11364 | /* |
| 11365 | * advansys_queuecommand() - interrupt-driven I/O entrypoint. |
| 11366 | * |
| 11367 | * This function always returns 0. Command return status is saved |
| 11368 | * in the 'scp' result field. |
| 11369 | */ |
| 11370 | static int |
| 11371 | advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) |
| 11372 | { |
| 11373 | struct Scsi_Host *shost = scp->device->host; |
| 11374 | asc_board_t *boardp = ASC_BOARDP(shost); |
| 11375 | unsigned long flags; |
| 11376 | int asc_res, result = 0; |
| 11377 | |
| 11378 | ASC_STATS(shost, queuecommand); |
| 11379 | scp->scsi_done = done; |
| 11380 | |
| 11381 | /* |
| 11382 | * host_lock taken by mid-level prior to call, but need |
| 11383 | * to protect against own ISR |
| 11384 | */ |
| 11385 | spin_lock_irqsave(&boardp->lock, flags); |
| 11386 | asc_res = asc_execute_scsi_cmnd(scp); |
| 11387 | spin_unlock_irqrestore(&boardp->lock, flags); |
| 11388 | |
| 11389 | switch (asc_res) { |
| 11390 | case ASC_NOERROR: |
| 11391 | break; |
| 11392 | case ASC_BUSY: |
| 11393 | result = SCSI_MLQUEUE_HOST_BUSY; |
| 11394 | break; |
| 11395 | case ASC_ERROR: |
| 11396 | default: |
| 11397 | asc_scsi_done(scp); |
| 11398 | break; |
| 11399 | } |
| 11400 | |
| 11401 | return result; |
| 11402 | } |
| 11403 | |
| 11404 | static ushort __devinit AscGetEisaChipCfg(PortAddr iop_base) |
| 11405 | { |
| 11406 | PortAddr eisa_cfg_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) | |
| 11407 | (PortAddr) (ASC_EISA_CFG_IOP_MASK); |
| 11408 | return inpw(eisa_cfg_iop); |
| 11409 | } |
| 11410 | |
| 11411 | /* |
| 11412 | * Return the BIOS address of the adapter at the specified |
| 11413 | * I/O port and with the specified bus type. |
| 11414 | */ |
| 11415 | static unsigned short __devinit |
| 11416 | AscGetChipBiosAddress(PortAddr iop_base, unsigned short bus_type) |
| 11417 | { |
| 11418 | unsigned short cfg_lsw; |
| 11419 | unsigned short bios_addr; |
| 11420 | |
| 11421 | /* |
| 11422 | * The PCI BIOS is re-located by the motherboard BIOS. Because |
| 11423 | * of this the driver can not determine where a PCI BIOS is |
| 11424 | * loaded and executes. |
| 11425 | */ |
| 11426 | if (bus_type & ASC_IS_PCI) |
| 11427 | return 0; |
| 11428 | |
| 11429 | if ((bus_type & ASC_IS_EISA) != 0) { |
| 11430 | cfg_lsw = AscGetEisaChipCfg(iop_base); |
| 11431 | cfg_lsw &= 0x000F; |
| 11432 | bios_addr = ASC_BIOS_MIN_ADDR + cfg_lsw * ASC_BIOS_BANK_SIZE; |
| 11433 | return bios_addr; |
| 11434 | } |
| 11435 | |
| 11436 | cfg_lsw = AscGetChipCfgLsw(iop_base); |
| 11437 | |
| 11438 | /* |
| 11439 | * ISA PnP uses the top bit as the 32K BIOS flag |
| 11440 | */ |
| 11441 | if (bus_type == ASC_IS_ISAPNP) |
| 11442 | cfg_lsw &= 0x7FFF; |
| 11443 | bios_addr = ASC_BIOS_MIN_ADDR + (cfg_lsw >> 12) * ASC_BIOS_BANK_SIZE; |
| 11444 | return bios_addr; |
| 11445 | } |
| 11446 | |
| 11447 | static uchar __devinit AscSetChipScsiID(PortAddr iop_base, uchar new_host_id) |
| 11448 | { |
| 11449 | ushort cfg_lsw; |
| 11450 | |
| 11451 | if (AscGetChipScsiID(iop_base) == new_host_id) { |
| 11452 | return (new_host_id); |
| 11453 | } |
| 11454 | cfg_lsw = AscGetChipCfgLsw(iop_base); |
| 11455 | cfg_lsw &= 0xF8FF; |
| 11456 | cfg_lsw |= (ushort)((new_host_id & ASC_MAX_TID) << 8); |
| 11457 | AscSetChipCfgLsw(iop_base, cfg_lsw); |
| 11458 | return (AscGetChipScsiID(iop_base)); |
| 11459 | } |
| 11460 | |
| 11461 | static unsigned char __devinit AscGetChipScsiCtrl(PortAddr iop_base) |
| 11462 | { |
| 11463 | unsigned char sc; |
| 11464 | |
| 11465 | AscSetBank(iop_base, 1); |
| 11466 | sc = inp(iop_base + IOP_REG_SC); |
| 11467 | AscSetBank(iop_base, 0); |
| 11468 | return sc; |
| 11469 | } |
| 11470 | |
| 11471 | static unsigned char __devinit |
| 11472 | AscGetChipVersion(PortAddr iop_base, unsigned short bus_type) |
| 11473 | { |
| 11474 | if (bus_type & ASC_IS_EISA) { |
| 11475 | PortAddr eisa_iop; |
| 11476 | unsigned char revision; |
| 11477 | eisa_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) | |
| 11478 | (PortAddr) ASC_EISA_REV_IOP_MASK; |
| 11479 | revision = inp(eisa_iop); |
| 11480 | return ASC_CHIP_MIN_VER_EISA - 1 + revision; |
| 11481 | } |
| 11482 | return AscGetChipVerNo(iop_base); |
| 11483 | } |
| 11484 | |
| 11485 | static void __devinit AscToggleIRQAct(PortAddr iop_base) |
| 11486 | { |
| 11487 | AscSetChipStatus(iop_base, CIW_IRQ_ACT); |
| 11488 | AscSetChipStatus(iop_base, 0); |
| 11489 | return; |
| 11490 | } |
| 11491 | |
| 11492 | static uchar __devinit AscGetChipIRQ(PortAddr iop_base, ushort bus_type) |
| 11493 | { |
| 11494 | ushort cfg_lsw; |
| 11495 | uchar chip_irq; |
| 11496 | |
| 11497 | if ((bus_type & ASC_IS_EISA) != 0) { |
| 11498 | cfg_lsw = AscGetEisaChipCfg(iop_base); |
| 11499 | chip_irq = (uchar)(((cfg_lsw >> 8) & 0x07) + 10); |
| 11500 | if ((chip_irq == 13) || (chip_irq > 15)) { |
| 11501 | return (0); |
| 11502 | } |
| 11503 | return (chip_irq); |
| 11504 | } |
| 11505 | if ((bus_type & ASC_IS_VL) != 0) { |
| 11506 | cfg_lsw = AscGetChipCfgLsw(iop_base); |
| 11507 | chip_irq = (uchar)(((cfg_lsw >> 2) & 0x07)); |
| 11508 | if ((chip_irq == 0) || (chip_irq == 4) || (chip_irq == 7)) { |
| 11509 | return (0); |
| 11510 | } |
| 11511 | return ((uchar)(chip_irq + (ASC_MIN_IRQ_NO - 1))); |
| 11512 | } |
| 11513 | cfg_lsw = AscGetChipCfgLsw(iop_base); |
| 11514 | chip_irq = (uchar)(((cfg_lsw >> 2) & 0x03)); |
| 11515 | if (chip_irq == 3) |
| 11516 | chip_irq += (uchar)2; |
| 11517 | return ((uchar)(chip_irq + ASC_MIN_IRQ_NO)); |
| 11518 | } |
| 11519 | |
| 11520 | static uchar __devinit |
| 11521 | AscSetChipIRQ(PortAddr iop_base, uchar irq_no, ushort bus_type) |
| 11522 | { |
| 11523 | ushort cfg_lsw; |
| 11524 | |
| 11525 | if ((bus_type & ASC_IS_VL) != 0) { |
| 11526 | if (irq_no != 0) { |
| 11527 | if ((irq_no < ASC_MIN_IRQ_NO) |
| 11528 | || (irq_no > ASC_MAX_IRQ_NO)) { |
| 11529 | irq_no = 0; |
| 11530 | } else { |
| 11531 | irq_no -= (uchar)((ASC_MIN_IRQ_NO - 1)); |
| 11532 | } |
| 11533 | } |
| 11534 | cfg_lsw = (ushort)(AscGetChipCfgLsw(iop_base) & 0xFFE3); |
| 11535 | cfg_lsw |= (ushort)0x0010; |
| 11536 | AscSetChipCfgLsw(iop_base, cfg_lsw); |
| 11537 | AscToggleIRQAct(iop_base); |
| 11538 | cfg_lsw = (ushort)(AscGetChipCfgLsw(iop_base) & 0xFFE0); |
| 11539 | cfg_lsw |= (ushort)((irq_no & 0x07) << 2); |
| 11540 | AscSetChipCfgLsw(iop_base, cfg_lsw); |
| 11541 | AscToggleIRQAct(iop_base); |
| 11542 | return (AscGetChipIRQ(iop_base, bus_type)); |
| 11543 | } |
| 11544 | if ((bus_type & (ASC_IS_ISA)) != 0) { |
| 11545 | if (irq_no == 15) |
| 11546 | irq_no -= (uchar)2; |
| 11547 | irq_no -= (uchar)ASC_MIN_IRQ_NO; |
| 11548 | cfg_lsw = (ushort)(AscGetChipCfgLsw(iop_base) & 0xFFF3); |
| 11549 | cfg_lsw |= (ushort)((irq_no & 0x03) << 2); |
| 11550 | AscSetChipCfgLsw(iop_base, cfg_lsw); |
| 11551 | return (AscGetChipIRQ(iop_base, bus_type)); |
| 11552 | } |
| 11553 | return (0); |
| 11554 | } |
| 11555 | |
| 11556 | #ifdef CONFIG_ISA |
| 11557 | static void __devinit AscEnableIsaDma(uchar dma_channel) |
| 11558 | { |
| 11559 | if (dma_channel < 4) { |
| 11560 | outp(0x000B, (ushort)(0xC0 | dma_channel)); |
| 11561 | outp(0x000A, dma_channel); |
| 11562 | } else if (dma_channel < 8) { |
| 11563 | outp(0x00D6, (ushort)(0xC0 | (dma_channel - 4))); |
| 11564 | outp(0x00D4, (ushort)(dma_channel - 4)); |
| 11565 | } |
| 11566 | return; |
| 11567 | } |
| 11568 | #endif /* CONFIG_ISA */ |
| 11569 | |
| 11570 | static int AscStopQueueExe(PortAddr iop_base) |
| 11571 | { |
| 11572 | int count = 0; |
| 11573 | |
| 11574 | if (AscReadLramByte(iop_base, ASCV_STOP_CODE_B) == 0) { |
| 11575 | AscWriteLramByte(iop_base, ASCV_STOP_CODE_B, |
| 11576 | ASC_STOP_REQ_RISC_STOP); |
| 11577 | do { |
| 11578 | if (AscReadLramByte(iop_base, ASCV_STOP_CODE_B) & |
| 11579 | ASC_STOP_ACK_RISC_STOP) { |
| 11580 | return (1); |
| 11581 | } |
| 11582 | mdelay(100); |
| 11583 | } while (count++ < 20); |
| 11584 | } |
| 11585 | return (0); |
| 11586 | } |
| 11587 | |
| 11588 | static ASC_DCNT __devinit AscGetMaxDmaCount(ushort bus_type) |
| 11589 | { |
| 11590 | if (bus_type & ASC_IS_ISA) |
| 11591 | return ASC_MAX_ISA_DMA_COUNT; |
| 11592 | else if (bus_type & (ASC_IS_EISA | ASC_IS_VL)) |
| 11593 | return ASC_MAX_VL_DMA_COUNT; |
| 11594 | return ASC_MAX_PCI_DMA_COUNT; |
| 11595 | } |
| 11596 | |
| 11597 | #ifdef CONFIG_ISA |
| 11598 | static ushort __devinit AscGetIsaDmaChannel(PortAddr iop_base) |
| 11599 | { |
| 11600 | ushort channel; |
| 11601 | |
| 11602 | channel = AscGetChipCfgLsw(iop_base) & 0x0003; |
| 11603 | if (channel == 0x03) |
| 11604 | return (0); |
| 11605 | else if (channel == 0x00) |
| 11606 | return (7); |
| 11607 | return (channel + 4); |
| 11608 | } |
| 11609 | |
| 11610 | static ushort __devinit AscSetIsaDmaChannel(PortAddr iop_base, ushort dma_channel) |
| 11611 | { |
| 11612 | ushort cfg_lsw; |
| 11613 | uchar value; |
| 11614 | |
| 11615 | if ((dma_channel >= 5) && (dma_channel <= 7)) { |
| 11616 | if (dma_channel == 7) |
| 11617 | value = 0x00; |
| 11618 | else |
| 11619 | value = dma_channel - 4; |
| 11620 | cfg_lsw = AscGetChipCfgLsw(iop_base) & 0xFFFC; |
| 11621 | cfg_lsw |= value; |
| 11622 | AscSetChipCfgLsw(iop_base, cfg_lsw); |
| 11623 | return (AscGetIsaDmaChannel(iop_base)); |
| 11624 | } |
| 11625 | return 0; |
| 11626 | } |
| 11627 | |
| 11628 | static uchar __devinit AscGetIsaDmaSpeed(PortAddr iop_base) |
| 11629 | { |
| 11630 | uchar speed_value; |
| 11631 | |
| 11632 | AscSetBank(iop_base, 1); |
| 11633 | speed_value = AscReadChipDmaSpeed(iop_base); |
| 11634 | speed_value &= 0x07; |
| 11635 | AscSetBank(iop_base, 0); |
| 11636 | return speed_value; |
| 11637 | } |
| 11638 | |
| 11639 | static uchar __devinit AscSetIsaDmaSpeed(PortAddr iop_base, uchar speed_value) |
| 11640 | { |
| 11641 | speed_value &= 0x07; |
| 11642 | AscSetBank(iop_base, 1); |
| 11643 | AscWriteChipDmaSpeed(iop_base, speed_value); |
| 11644 | AscSetBank(iop_base, 0); |
| 11645 | return AscGetIsaDmaSpeed(iop_base); |
| 11646 | } |
| 11647 | #endif /* CONFIG_ISA */ |
| 11648 | |
| 11649 | static ushort __devinit AscInitAscDvcVar(ASC_DVC_VAR *asc_dvc) |
| 11650 | { |
| 11651 | int i; |
| 11652 | PortAddr iop_base; |
| 11653 | ushort warn_code; |
| 11654 | uchar chip_version; |
| 11655 | |
| 11656 | iop_base = asc_dvc->iop_base; |
| 11657 | warn_code = 0; |
| 11658 | asc_dvc->err_code = 0; |
| 11659 | if ((asc_dvc->bus_type & |
| 11660 | (ASC_IS_ISA | ASC_IS_PCI | ASC_IS_EISA | ASC_IS_VL)) == 0) { |
| 11661 | asc_dvc->err_code |= ASC_IERR_NO_BUS_TYPE; |
| 11662 | } |
| 11663 | AscSetChipControl(iop_base, CC_HALT); |
| 11664 | AscSetChipStatus(iop_base, 0); |
| 11665 | asc_dvc->bug_fix_cntl = 0; |
| 11666 | asc_dvc->pci_fix_asyn_xfer = 0; |
| 11667 | asc_dvc->pci_fix_asyn_xfer_always = 0; |
| 11668 | /* asc_dvc->init_state initalized in AscInitGetConfig(). */ |
| 11669 | asc_dvc->sdtr_done = 0; |
| 11670 | asc_dvc->cur_total_qng = 0; |
| 11671 | asc_dvc->is_in_int = 0; |
| 11672 | asc_dvc->in_critical_cnt = 0; |
| 11673 | asc_dvc->last_q_shortage = 0; |
| 11674 | asc_dvc->use_tagged_qng = 0; |
| 11675 | asc_dvc->no_scam = 0; |
| 11676 | asc_dvc->unit_not_ready = 0; |
| 11677 | asc_dvc->queue_full_or_busy = 0; |
| 11678 | asc_dvc->redo_scam = 0; |
| 11679 | asc_dvc->res2 = 0; |
| 11680 | asc_dvc->host_init_sdtr_index = 0; |
| 11681 | asc_dvc->cfg->can_tagged_qng = 0; |
| 11682 | asc_dvc->cfg->cmd_qng_enabled = 0; |
| 11683 | asc_dvc->dvc_cntl = ASC_DEF_DVC_CNTL; |
| 11684 | asc_dvc->init_sdtr = 0; |
| 11685 | asc_dvc->max_total_qng = ASC_DEF_MAX_TOTAL_QNG; |
| 11686 | asc_dvc->scsi_reset_wait = 3; |
| 11687 | asc_dvc->start_motor = ASC_SCSI_WIDTH_BIT_SET; |
| 11688 | asc_dvc->max_dma_count = AscGetMaxDmaCount(asc_dvc->bus_type); |
| 11689 | asc_dvc->cfg->sdtr_enable = ASC_SCSI_WIDTH_BIT_SET; |
| 11690 | asc_dvc->cfg->disc_enable = ASC_SCSI_WIDTH_BIT_SET; |
| 11691 | asc_dvc->cfg->chip_scsi_id = ASC_DEF_CHIP_SCSI_ID; |
| 11692 | asc_dvc->cfg->lib_serial_no = ASC_LIB_SERIAL_NUMBER; |
| 11693 | asc_dvc->cfg->lib_version = (ASC_LIB_VERSION_MAJOR << 8) | |
| 11694 | ASC_LIB_VERSION_MINOR; |
| 11695 | chip_version = AscGetChipVersion(iop_base, asc_dvc->bus_type); |
| 11696 | asc_dvc->cfg->chip_version = chip_version; |
| 11697 | asc_dvc->sdtr_period_tbl[0] = SYN_XFER_NS_0; |
| 11698 | asc_dvc->sdtr_period_tbl[1] = SYN_XFER_NS_1; |
| 11699 | asc_dvc->sdtr_period_tbl[2] = SYN_XFER_NS_2; |
| 11700 | asc_dvc->sdtr_period_tbl[3] = SYN_XFER_NS_3; |
| 11701 | asc_dvc->sdtr_period_tbl[4] = SYN_XFER_NS_4; |
| 11702 | asc_dvc->sdtr_period_tbl[5] = SYN_XFER_NS_5; |
| 11703 | asc_dvc->sdtr_period_tbl[6] = SYN_XFER_NS_6; |
| 11704 | asc_dvc->sdtr_period_tbl[7] = SYN_XFER_NS_7; |
| 11705 | asc_dvc->max_sdtr_index = 7; |
| 11706 | if ((asc_dvc->bus_type & ASC_IS_PCI) && |
| 11707 | (chip_version >= ASC_CHIP_VER_PCI_ULTRA_3150)) { |
| 11708 | asc_dvc->bus_type = ASC_IS_PCI_ULTRA; |
| 11709 | asc_dvc->sdtr_period_tbl[0] = SYN_ULTRA_XFER_NS_0; |
| 11710 | asc_dvc->sdtr_period_tbl[1] = SYN_ULTRA_XFER_NS_1; |
| 11711 | asc_dvc->sdtr_period_tbl[2] = SYN_ULTRA_XFER_NS_2; |
| 11712 | asc_dvc->sdtr_period_tbl[3] = SYN_ULTRA_XFER_NS_3; |
| 11713 | asc_dvc->sdtr_period_tbl[4] = SYN_ULTRA_XFER_NS_4; |
| 11714 | asc_dvc->sdtr_period_tbl[5] = SYN_ULTRA_XFER_NS_5; |
| 11715 | asc_dvc->sdtr_period_tbl[6] = SYN_ULTRA_XFER_NS_6; |
| 11716 | asc_dvc->sdtr_period_tbl[7] = SYN_ULTRA_XFER_NS_7; |
| 11717 | asc_dvc->sdtr_period_tbl[8] = SYN_ULTRA_XFER_NS_8; |
| 11718 | asc_dvc->sdtr_period_tbl[9] = SYN_ULTRA_XFER_NS_9; |
| 11719 | asc_dvc->sdtr_period_tbl[10] = SYN_ULTRA_XFER_NS_10; |
| 11720 | asc_dvc->sdtr_period_tbl[11] = SYN_ULTRA_XFER_NS_11; |
| 11721 | asc_dvc->sdtr_period_tbl[12] = SYN_ULTRA_XFER_NS_12; |
| 11722 | asc_dvc->sdtr_period_tbl[13] = SYN_ULTRA_XFER_NS_13; |
| 11723 | asc_dvc->sdtr_period_tbl[14] = SYN_ULTRA_XFER_NS_14; |
| 11724 | asc_dvc->sdtr_period_tbl[15] = SYN_ULTRA_XFER_NS_15; |
| 11725 | asc_dvc->max_sdtr_index = 15; |
| 11726 | if (chip_version == ASC_CHIP_VER_PCI_ULTRA_3150) { |
| 11727 | AscSetExtraControl(iop_base, |
| 11728 | (SEC_ACTIVE_NEGATE | SEC_SLEW_RATE)); |
| 11729 | } else if (chip_version >= ASC_CHIP_VER_PCI_ULTRA_3050) { |
| 11730 | AscSetExtraControl(iop_base, |
| 11731 | (SEC_ACTIVE_NEGATE | |
| 11732 | SEC_ENABLE_FILTER)); |
| 11733 | } |
| 11734 | } |
| 11735 | if (asc_dvc->bus_type == ASC_IS_PCI) { |
| 11736 | AscSetExtraControl(iop_base, |
| 11737 | (SEC_ACTIVE_NEGATE | SEC_SLEW_RATE)); |
| 11738 | } |
| 11739 | |
| 11740 | asc_dvc->cfg->isa_dma_speed = ASC_DEF_ISA_DMA_SPEED; |
| 11741 | #ifdef CONFIG_ISA |
| 11742 | if ((asc_dvc->bus_type & ASC_IS_ISA) != 0) { |
| 11743 | if (chip_version >= ASC_CHIP_MIN_VER_ISA_PNP) { |
| 11744 | AscSetChipIFC(iop_base, IFC_INIT_DEFAULT); |
| 11745 | asc_dvc->bus_type = ASC_IS_ISAPNP; |
| 11746 | } |
| 11747 | asc_dvc->cfg->isa_dma_channel = |
| 11748 | (uchar)AscGetIsaDmaChannel(iop_base); |
| 11749 | } |
| 11750 | #endif /* CONFIG_ISA */ |
| 11751 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 11752 | asc_dvc->cur_dvc_qng[i] = 0; |
| 11753 | asc_dvc->max_dvc_qng[i] = ASC_MAX_SCSI1_QNG; |
| 11754 | asc_dvc->scsiq_busy_head[i] = (ASC_SCSI_Q *)0L; |
| 11755 | asc_dvc->scsiq_busy_tail[i] = (ASC_SCSI_Q *)0L; |
| 11756 | asc_dvc->cfg->max_tag_qng[i] = ASC_MAX_INRAM_TAG_QNG; |
| 11757 | } |
| 11758 | return warn_code; |
| 11759 | } |
| 11760 | |
| 11761 | static int __devinit AscWriteEEPCmdReg(PortAddr iop_base, uchar cmd_reg) |
| 11762 | { |
| 11763 | int retry; |
| 11764 | |
| 11765 | for (retry = 0; retry < ASC_EEP_MAX_RETRY; retry++) { |
| 11766 | unsigned char read_back; |
| 11767 | AscSetChipEEPCmd(iop_base, cmd_reg); |
| 11768 | mdelay(1); |
| 11769 | read_back = AscGetChipEEPCmd(iop_base); |
| 11770 | if (read_back == cmd_reg) |
| 11771 | return 1; |
| 11772 | } |
| 11773 | return 0; |
| 11774 | } |
| 11775 | |
| 11776 | static void __devinit AscWaitEEPRead(void) |
| 11777 | { |
| 11778 | mdelay(1); |
| 11779 | } |
| 11780 | |
| 11781 | static ushort __devinit AscReadEEPWord(PortAddr iop_base, uchar addr) |
| 11782 | { |
| 11783 | ushort read_wval; |
| 11784 | uchar cmd_reg; |
| 11785 | |
| 11786 | AscWriteEEPCmdReg(iop_base, ASC_EEP_CMD_WRITE_DISABLE); |
| 11787 | AscWaitEEPRead(); |
| 11788 | cmd_reg = addr | ASC_EEP_CMD_READ; |
| 11789 | AscWriteEEPCmdReg(iop_base, cmd_reg); |
| 11790 | AscWaitEEPRead(); |
| 11791 | read_wval = AscGetChipEEPData(iop_base); |
| 11792 | AscWaitEEPRead(); |
| 11793 | return read_wval; |
| 11794 | } |
| 11795 | |
| 11796 | static ushort __devinit |
| 11797 | AscGetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) |
| 11798 | { |
| 11799 | ushort wval; |
| 11800 | ushort sum; |
| 11801 | ushort *wbuf; |
| 11802 | int cfg_beg; |
| 11803 | int cfg_end; |
| 11804 | int uchar_end_in_config = ASC_EEP_MAX_DVC_ADDR - 2; |
| 11805 | int s_addr; |
| 11806 | |
| 11807 | wbuf = (ushort *)cfg_buf; |
| 11808 | sum = 0; |
| 11809 | /* Read two config words; Byte-swapping done by AscReadEEPWord(). */ |
| 11810 | for (s_addr = 0; s_addr < 2; s_addr++, wbuf++) { |
| 11811 | *wbuf = AscReadEEPWord(iop_base, (uchar)s_addr); |
| 11812 | sum += *wbuf; |
| 11813 | } |
| 11814 | if (bus_type & ASC_IS_VL) { |
| 11815 | cfg_beg = ASC_EEP_DVC_CFG_BEG_VL; |
| 11816 | cfg_end = ASC_EEP_MAX_DVC_ADDR_VL; |
| 11817 | } else { |
| 11818 | cfg_beg = ASC_EEP_DVC_CFG_BEG; |
| 11819 | cfg_end = ASC_EEP_MAX_DVC_ADDR; |
| 11820 | } |
| 11821 | for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) { |
| 11822 | wval = AscReadEEPWord(iop_base, (uchar)s_addr); |
| 11823 | if (s_addr <= uchar_end_in_config) { |
| 11824 | /* |
| 11825 | * Swap all char fields - must unswap bytes already swapped |
| 11826 | * by AscReadEEPWord(). |
| 11827 | */ |
| 11828 | *wbuf = le16_to_cpu(wval); |
| 11829 | } else { |
| 11830 | /* Don't swap word field at the end - cntl field. */ |
| 11831 | *wbuf = wval; |
| 11832 | } |
| 11833 | sum += wval; /* Checksum treats all EEPROM data as words. */ |
| 11834 | } |
| 11835 | /* |
| 11836 | * Read the checksum word which will be compared against 'sum' |
| 11837 | * by the caller. Word field already swapped. |
| 11838 | */ |
| 11839 | *wbuf = AscReadEEPWord(iop_base, (uchar)s_addr); |
| 11840 | return sum; |
| 11841 | } |
| 11842 | |
| 11843 | static int __devinit AscTestExternalLram(ASC_DVC_VAR *asc_dvc) |
| 11844 | { |
| 11845 | PortAddr iop_base; |
| 11846 | ushort q_addr; |
| 11847 | ushort saved_word; |
| 11848 | int sta; |
| 11849 | |
| 11850 | iop_base = asc_dvc->iop_base; |
| 11851 | sta = 0; |
| 11852 | q_addr = ASC_QNO_TO_QADDR(241); |
| 11853 | saved_word = AscReadLramWord(iop_base, q_addr); |
| 11854 | AscSetChipLramAddr(iop_base, q_addr); |
| 11855 | AscSetChipLramData(iop_base, 0x55AA); |
| 11856 | mdelay(10); |
| 11857 | AscSetChipLramAddr(iop_base, q_addr); |
| 11858 | if (AscGetChipLramData(iop_base) == 0x55AA) { |
| 11859 | sta = 1; |
| 11860 | AscWriteLramWord(iop_base, q_addr, saved_word); |
| 11861 | } |
| 11862 | return (sta); |
| 11863 | } |
| 11864 | |
| 11865 | static void __devinit AscWaitEEPWrite(void) |
| 11866 | { |
| 11867 | mdelay(20); |
| 11868 | return; |
| 11869 | } |
| 11870 | |
| 11871 | static int __devinit AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg) |
| 11872 | { |
| 11873 | ushort read_back; |
| 11874 | int retry; |
| 11875 | |
| 11876 | retry = 0; |
| 11877 | while (TRUE) { |
| 11878 | AscSetChipEEPData(iop_base, data_reg); |
| 11879 | mdelay(1); |
| 11880 | read_back = AscGetChipEEPData(iop_base); |
| 11881 | if (read_back == data_reg) { |
| 11882 | return (1); |
| 11883 | } |
| 11884 | if (retry++ > ASC_EEP_MAX_RETRY) { |
| 11885 | return (0); |
| 11886 | } |
| 11887 | } |
| 11888 | } |
| 11889 | |
| 11890 | static ushort __devinit |
| 11891 | AscWriteEEPWord(PortAddr iop_base, uchar addr, ushort word_val) |
| 11892 | { |
| 11893 | ushort read_wval; |
| 11894 | |
| 11895 | read_wval = AscReadEEPWord(iop_base, addr); |
| 11896 | if (read_wval != word_val) { |
| 11897 | AscWriteEEPCmdReg(iop_base, ASC_EEP_CMD_WRITE_ABLE); |
| 11898 | AscWaitEEPRead(); |
| 11899 | AscWriteEEPDataReg(iop_base, word_val); |
| 11900 | AscWaitEEPRead(); |
| 11901 | AscWriteEEPCmdReg(iop_base, |
| 11902 | (uchar)((uchar)ASC_EEP_CMD_WRITE | addr)); |
| 11903 | AscWaitEEPWrite(); |
| 11904 | AscWriteEEPCmdReg(iop_base, ASC_EEP_CMD_WRITE_DISABLE); |
| 11905 | AscWaitEEPRead(); |
| 11906 | return (AscReadEEPWord(iop_base, addr)); |
| 11907 | } |
| 11908 | return (read_wval); |
| 11909 | } |
| 11910 | |
| 11911 | static int __devinit |
| 11912 | AscSetEEPConfigOnce(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) |
| 11913 | { |
| 11914 | int n_error; |
| 11915 | ushort *wbuf; |
| 11916 | ushort word; |
| 11917 | ushort sum; |
| 11918 | int s_addr; |
| 11919 | int cfg_beg; |
| 11920 | int cfg_end; |
| 11921 | int uchar_end_in_config = ASC_EEP_MAX_DVC_ADDR - 2; |
| 11922 | |
| 11923 | wbuf = (ushort *)cfg_buf; |
| 11924 | n_error = 0; |
| 11925 | sum = 0; |
| 11926 | /* Write two config words; AscWriteEEPWord() will swap bytes. */ |
| 11927 | for (s_addr = 0; s_addr < 2; s_addr++, wbuf++) { |
| 11928 | sum += *wbuf; |
| 11929 | if (*wbuf != AscWriteEEPWord(iop_base, (uchar)s_addr, *wbuf)) { |
| 11930 | n_error++; |
| 11931 | } |
| 11932 | } |
| 11933 | if (bus_type & ASC_IS_VL) { |
| 11934 | cfg_beg = ASC_EEP_DVC_CFG_BEG_VL; |
| 11935 | cfg_end = ASC_EEP_MAX_DVC_ADDR_VL; |
| 11936 | } else { |
| 11937 | cfg_beg = ASC_EEP_DVC_CFG_BEG; |
| 11938 | cfg_end = ASC_EEP_MAX_DVC_ADDR; |
| 11939 | } |
| 11940 | for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) { |
| 11941 | if (s_addr <= uchar_end_in_config) { |
| 11942 | /* |
| 11943 | * This is a char field. Swap char fields before they are |
| 11944 | * swapped again by AscWriteEEPWord(). |
| 11945 | */ |
| 11946 | word = cpu_to_le16(*wbuf); |
| 11947 | if (word != |
| 11948 | AscWriteEEPWord(iop_base, (uchar)s_addr, word)) { |
| 11949 | n_error++; |
| 11950 | } |
| 11951 | } else { |
| 11952 | /* Don't swap word field at the end - cntl field. */ |
| 11953 | if (*wbuf != |
| 11954 | AscWriteEEPWord(iop_base, (uchar)s_addr, *wbuf)) { |
| 11955 | n_error++; |
| 11956 | } |
| 11957 | } |
| 11958 | sum += *wbuf; /* Checksum calculated from word values. */ |
| 11959 | } |
| 11960 | /* Write checksum word. It will be swapped by AscWriteEEPWord(). */ |
| 11961 | *wbuf = sum; |
| 11962 | if (sum != AscWriteEEPWord(iop_base, (uchar)s_addr, sum)) { |
| 11963 | n_error++; |
| 11964 | } |
| 11965 | |
| 11966 | /* Read EEPROM back again. */ |
| 11967 | wbuf = (ushort *)cfg_buf; |
| 11968 | /* |
| 11969 | * Read two config words; Byte-swapping done by AscReadEEPWord(). |
| 11970 | */ |
| 11971 | for (s_addr = 0; s_addr < 2; s_addr++, wbuf++) { |
| 11972 | if (*wbuf != AscReadEEPWord(iop_base, (uchar)s_addr)) { |
| 11973 | n_error++; |
| 11974 | } |
| 11975 | } |
| 11976 | if (bus_type & ASC_IS_VL) { |
| 11977 | cfg_beg = ASC_EEP_DVC_CFG_BEG_VL; |
| 11978 | cfg_end = ASC_EEP_MAX_DVC_ADDR_VL; |
| 11979 | } else { |
| 11980 | cfg_beg = ASC_EEP_DVC_CFG_BEG; |
| 11981 | cfg_end = ASC_EEP_MAX_DVC_ADDR; |
| 11982 | } |
| 11983 | for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) { |
| 11984 | if (s_addr <= uchar_end_in_config) { |
| 11985 | /* |
| 11986 | * Swap all char fields. Must unswap bytes already swapped |
| 11987 | * by AscReadEEPWord(). |
| 11988 | */ |
| 11989 | word = |
| 11990 | le16_to_cpu(AscReadEEPWord |
| 11991 | (iop_base, (uchar)s_addr)); |
| 11992 | } else { |
| 11993 | /* Don't swap word field at the end - cntl field. */ |
| 11994 | word = AscReadEEPWord(iop_base, (uchar)s_addr); |
| 11995 | } |
| 11996 | if (*wbuf != word) { |
| 11997 | n_error++; |
| 11998 | } |
| 11999 | } |
| 12000 | /* Read checksum; Byte swapping not needed. */ |
| 12001 | if (AscReadEEPWord(iop_base, (uchar)s_addr) != sum) { |
| 12002 | n_error++; |
| 12003 | } |
| 12004 | return n_error; |
| 12005 | } |
| 12006 | |
| 12007 | static int __devinit |
| 12008 | AscSetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) |
| 12009 | { |
| 12010 | int retry; |
| 12011 | int n_error; |
| 12012 | |
| 12013 | retry = 0; |
| 12014 | while (TRUE) { |
| 12015 | if ((n_error = AscSetEEPConfigOnce(iop_base, cfg_buf, |
| 12016 | bus_type)) == 0) { |
| 12017 | break; |
| 12018 | } |
| 12019 | if (++retry > ASC_EEP_MAX_RETRY) { |
| 12020 | break; |
| 12021 | } |
| 12022 | } |
| 12023 | return n_error; |
| 12024 | } |
| 12025 | |
| 12026 | static ushort __devinit AscInitFromEEP(ASC_DVC_VAR *asc_dvc) |
| 12027 | { |
| 12028 | ASCEEP_CONFIG eep_config_buf; |
| 12029 | ASCEEP_CONFIG *eep_config; |
| 12030 | PortAddr iop_base; |
| 12031 | ushort chksum; |
| 12032 | ushort warn_code; |
| 12033 | ushort cfg_msw, cfg_lsw; |
| 12034 | int i; |
| 12035 | int write_eep = 0; |
| 12036 | |
| 12037 | iop_base = asc_dvc->iop_base; |
| 12038 | warn_code = 0; |
| 12039 | AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0x00FE); |
| 12040 | AscStopQueueExe(iop_base); |
| 12041 | if ((AscStopChip(iop_base) == FALSE) || |
| 12042 | (AscGetChipScsiCtrl(iop_base) != 0)) { |
| 12043 | asc_dvc->init_state |= ASC_INIT_RESET_SCSI_DONE; |
| 12044 | AscResetChipAndScsiBus(asc_dvc); |
| 12045 | mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */ |
| 12046 | } |
| 12047 | if (AscIsChipHalted(iop_base) == FALSE) { |
| 12048 | asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP; |
| 12049 | return (warn_code); |
| 12050 | } |
| 12051 | AscSetPCAddr(iop_base, ASC_MCODE_START_ADDR); |
| 12052 | if (AscGetPCAddr(iop_base) != ASC_MCODE_START_ADDR) { |
| 12053 | asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR; |
| 12054 | return (warn_code); |
| 12055 | } |
| 12056 | eep_config = (ASCEEP_CONFIG *)&eep_config_buf; |
| 12057 | cfg_msw = AscGetChipCfgMsw(iop_base); |
| 12058 | cfg_lsw = AscGetChipCfgLsw(iop_base); |
| 12059 | if ((cfg_msw & ASC_CFG_MSW_CLR_MASK) != 0) { |
| 12060 | cfg_msw &= ~ASC_CFG_MSW_CLR_MASK; |
| 12061 | warn_code |= ASC_WARN_CFG_MSW_RECOVER; |
| 12062 | AscSetChipCfgMsw(iop_base, cfg_msw); |
| 12063 | } |
| 12064 | chksum = AscGetEEPConfig(iop_base, eep_config, asc_dvc->bus_type); |
| 12065 | ASC_DBG1(1, "AscInitFromEEP: chksum 0x%x\n", chksum); |
| 12066 | if (chksum == 0) { |
| 12067 | chksum = 0xaa55; |
| 12068 | } |
| 12069 | if (AscGetChipStatus(iop_base) & CSW_AUTO_CONFIG) { |
| 12070 | warn_code |= ASC_WARN_AUTO_CONFIG; |
| 12071 | if (asc_dvc->cfg->chip_version == 3) { |
| 12072 | if (eep_config->cfg_lsw != cfg_lsw) { |
| 12073 | warn_code |= ASC_WARN_EEPROM_RECOVER; |
| 12074 | eep_config->cfg_lsw = |
| 12075 | AscGetChipCfgLsw(iop_base); |
| 12076 | } |
| 12077 | if (eep_config->cfg_msw != cfg_msw) { |
| 12078 | warn_code |= ASC_WARN_EEPROM_RECOVER; |
| 12079 | eep_config->cfg_msw = |
| 12080 | AscGetChipCfgMsw(iop_base); |
| 12081 | } |
| 12082 | } |
| 12083 | } |
| 12084 | eep_config->cfg_msw &= ~ASC_CFG_MSW_CLR_MASK; |
| 12085 | eep_config->cfg_lsw |= ASC_CFG0_HOST_INT_ON; |
| 12086 | ASC_DBG1(1, "AscInitFromEEP: eep_config->chksum 0x%x\n", |
| 12087 | eep_config->chksum); |
| 12088 | if (chksum != eep_config->chksum) { |
| 12089 | if (AscGetChipVersion(iop_base, asc_dvc->bus_type) == |
| 12090 | ASC_CHIP_VER_PCI_ULTRA_3050) { |
| 12091 | ASC_DBG(1, |
| 12092 | "AscInitFromEEP: chksum error ignored; EEPROM-less board\n"); |
| 12093 | eep_config->init_sdtr = 0xFF; |
| 12094 | eep_config->disc_enable = 0xFF; |
| 12095 | eep_config->start_motor = 0xFF; |
| 12096 | eep_config->use_cmd_qng = 0; |
| 12097 | eep_config->max_total_qng = 0xF0; |
| 12098 | eep_config->max_tag_qng = 0x20; |
| 12099 | eep_config->cntl = 0xBFFF; |
| 12100 | ASC_EEP_SET_CHIP_ID(eep_config, 7); |
| 12101 | eep_config->no_scam = 0; |
| 12102 | eep_config->adapter_info[0] = 0; |
| 12103 | eep_config->adapter_info[1] = 0; |
| 12104 | eep_config->adapter_info[2] = 0; |
| 12105 | eep_config->adapter_info[3] = 0; |
| 12106 | eep_config->adapter_info[4] = 0; |
| 12107 | /* Indicate EEPROM-less board. */ |
| 12108 | eep_config->adapter_info[5] = 0xBB; |
| 12109 | } else { |
| 12110 | ASC_PRINT |
| 12111 | ("AscInitFromEEP: EEPROM checksum error; Will try to re-write EEPROM.\n"); |
| 12112 | write_eep = 1; |
| 12113 | warn_code |= ASC_WARN_EEPROM_CHKSUM; |
| 12114 | } |
| 12115 | } |
| 12116 | asc_dvc->cfg->sdtr_enable = eep_config->init_sdtr; |
| 12117 | asc_dvc->cfg->disc_enable = eep_config->disc_enable; |
| 12118 | asc_dvc->cfg->cmd_qng_enabled = eep_config->use_cmd_qng; |
| 12119 | asc_dvc->cfg->isa_dma_speed = ASC_EEP_GET_DMA_SPD(eep_config); |
| 12120 | asc_dvc->start_motor = eep_config->start_motor; |
| 12121 | asc_dvc->dvc_cntl = eep_config->cntl; |
| 12122 | asc_dvc->no_scam = eep_config->no_scam; |
| 12123 | asc_dvc->cfg->adapter_info[0] = eep_config->adapter_info[0]; |
| 12124 | asc_dvc->cfg->adapter_info[1] = eep_config->adapter_info[1]; |
| 12125 | asc_dvc->cfg->adapter_info[2] = eep_config->adapter_info[2]; |
| 12126 | asc_dvc->cfg->adapter_info[3] = eep_config->adapter_info[3]; |
| 12127 | asc_dvc->cfg->adapter_info[4] = eep_config->adapter_info[4]; |
| 12128 | asc_dvc->cfg->adapter_info[5] = eep_config->adapter_info[5]; |
| 12129 | if (!AscTestExternalLram(asc_dvc)) { |
| 12130 | if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == |
| 12131 | ASC_IS_PCI_ULTRA)) { |
| 12132 | eep_config->max_total_qng = |
| 12133 | ASC_MAX_PCI_ULTRA_INRAM_TOTAL_QNG; |
| 12134 | eep_config->max_tag_qng = |
| 12135 | ASC_MAX_PCI_ULTRA_INRAM_TAG_QNG; |
| 12136 | } else { |
| 12137 | eep_config->cfg_msw |= 0x0800; |
| 12138 | cfg_msw |= 0x0800; |
| 12139 | AscSetChipCfgMsw(iop_base, cfg_msw); |
| 12140 | eep_config->max_total_qng = ASC_MAX_PCI_INRAM_TOTAL_QNG; |
| 12141 | eep_config->max_tag_qng = ASC_MAX_INRAM_TAG_QNG; |
| 12142 | } |
| 12143 | } else { |
| 12144 | } |
| 12145 | if (eep_config->max_total_qng < ASC_MIN_TOTAL_QNG) { |
| 12146 | eep_config->max_total_qng = ASC_MIN_TOTAL_QNG; |
| 12147 | } |
| 12148 | if (eep_config->max_total_qng > ASC_MAX_TOTAL_QNG) { |
| 12149 | eep_config->max_total_qng = ASC_MAX_TOTAL_QNG; |
| 12150 | } |
| 12151 | if (eep_config->max_tag_qng > eep_config->max_total_qng) { |
| 12152 | eep_config->max_tag_qng = eep_config->max_total_qng; |
| 12153 | } |
| 12154 | if (eep_config->max_tag_qng < ASC_MIN_TAG_Q_PER_DVC) { |
| 12155 | eep_config->max_tag_qng = ASC_MIN_TAG_Q_PER_DVC; |
| 12156 | } |
| 12157 | asc_dvc->max_total_qng = eep_config->max_total_qng; |
| 12158 | if ((eep_config->use_cmd_qng & eep_config->disc_enable) != |
| 12159 | eep_config->use_cmd_qng) { |
| 12160 | eep_config->disc_enable = eep_config->use_cmd_qng; |
| 12161 | warn_code |= ASC_WARN_CMD_QNG_CONFLICT; |
| 12162 | } |
| 12163 | if (asc_dvc->bus_type & (ASC_IS_ISA | ASC_IS_VL | ASC_IS_EISA)) { |
| 12164 | asc_dvc->irq_no = AscGetChipIRQ(iop_base, asc_dvc->bus_type); |
| 12165 | } |
| 12166 | ASC_EEP_SET_CHIP_ID(eep_config, |
| 12167 | ASC_EEP_GET_CHIP_ID(eep_config) & ASC_MAX_TID); |
| 12168 | asc_dvc->cfg->chip_scsi_id = ASC_EEP_GET_CHIP_ID(eep_config); |
| 12169 | if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) && |
| 12170 | !(asc_dvc->dvc_cntl & ASC_CNTL_SDTR_ENABLE_ULTRA)) { |
| 12171 | asc_dvc->host_init_sdtr_index = ASC_SDTR_ULTRA_PCI_10MB_INDEX; |
| 12172 | } |
| 12173 | |
| 12174 | for (i = 0; i <= ASC_MAX_TID; i++) { |
| 12175 | asc_dvc->dos_int13_table[i] = eep_config->dos_int13_table[i]; |
| 12176 | asc_dvc->cfg->max_tag_qng[i] = eep_config->max_tag_qng; |
| 12177 | asc_dvc->cfg->sdtr_period_offset[i] = |
| 12178 | (uchar)(ASC_DEF_SDTR_OFFSET | |
| 12179 | (asc_dvc->host_init_sdtr_index << 4)); |
| 12180 | } |
| 12181 | eep_config->cfg_msw = AscGetChipCfgMsw(iop_base); |
| 12182 | if (write_eep) { |
| 12183 | if ((i = AscSetEEPConfig(iop_base, eep_config, |
| 12184 | asc_dvc->bus_type)) != 0) { |
| 12185 | ASC_PRINT1 |
| 12186 | ("AscInitFromEEP: Failed to re-write EEPROM with %d errors.\n", |
| 12187 | i); |
| 12188 | } else { |
| 12189 | ASC_PRINT |
| 12190 | ("AscInitFromEEP: Successfully re-wrote EEPROM.\n"); |
| 12191 | } |
| 12192 | } |
| 12193 | return (warn_code); |
| 12194 | } |
| 12195 | |
| 12196 | static int __devinit AscInitGetConfig(asc_board_t *boardp) |
| 12197 | { |
| 12198 | ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; |
| 12199 | unsigned short warn_code = 0; |
| 12200 | |
| 12201 | asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG; |
| 12202 | if (asc_dvc->err_code != 0) |
| 12203 | return asc_dvc->err_code; |
| 12204 | |
| 12205 | if (AscFindSignature(asc_dvc->iop_base)) { |
| 12206 | warn_code |= AscInitAscDvcVar(asc_dvc); |
| 12207 | warn_code |= AscInitFromEEP(asc_dvc); |
| 12208 | asc_dvc->init_state |= ASC_INIT_STATE_END_GET_CFG; |
| 12209 | if (asc_dvc->scsi_reset_wait > ASC_MAX_SCSI_RESET_WAIT) |
| 12210 | asc_dvc->scsi_reset_wait = ASC_MAX_SCSI_RESET_WAIT; |
| 12211 | } else { |
| 12212 | asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; |
| 12213 | } |
| 12214 | |
| 12215 | switch (warn_code) { |
| 12216 | case 0: /* No error */ |
| 12217 | break; |
| 12218 | case ASC_WARN_IO_PORT_ROTATE: |
| 12219 | ASC_PRINT1("AscInitGetConfig: board %d: I/O port address " |
| 12220 | "modified\n", boardp->id); |
| 12221 | break; |
| 12222 | case ASC_WARN_AUTO_CONFIG: |
| 12223 | ASC_PRINT1("AscInitGetConfig: board %d: I/O port increment " |
| 12224 | "switch enabled\n", boardp->id); |
| 12225 | break; |
| 12226 | case ASC_WARN_EEPROM_CHKSUM: |
| 12227 | ASC_PRINT1("AscInitGetConfig: board %d: EEPROM checksum " |
| 12228 | "error\n", boardp->id); |
| 12229 | break; |
| 12230 | case ASC_WARN_IRQ_MODIFIED: |
| 12231 | ASC_PRINT1("AscInitGetConfig: board %d: IRQ modified\n", |
| 12232 | boardp->id); |
| 12233 | break; |
| 12234 | case ASC_WARN_CMD_QNG_CONFLICT: |
| 12235 | ASC_PRINT1("AscInitGetConfig: board %d: tag queuing enabled " |
| 12236 | "w/o disconnects\n", boardp->id); |
| 12237 | break; |
| 12238 | default: |
| 12239 | ASC_PRINT2("AscInitGetConfig: board %d: unknown warning: " |
| 12240 | "0x%x\n", boardp->id, warn_code); |
| 12241 | break; |
| 12242 | } |
| 12243 | |
| 12244 | if (asc_dvc->err_code != 0) { |
| 12245 | ASC_PRINT3("AscInitGetConfig: board %d error: init_state 0x%x, " |
| 12246 | "err_code 0x%x\n", boardp->id, asc_dvc->init_state, |
| 12247 | asc_dvc->err_code); |
| 12248 | } |
| 12249 | |
| 12250 | return asc_dvc->err_code; |
| 12251 | } |
| 12252 | |
| 12253 | static int __devinit AscInitSetConfig(struct pci_dev *pdev, asc_board_t *boardp) |
| 12254 | { |
| 12255 | ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; |
| 12256 | PortAddr iop_base = asc_dvc->iop_base; |
| 12257 | unsigned short cfg_msw; |
| 12258 | unsigned short warn_code = 0; |
| 12259 | |
| 12260 | asc_dvc->init_state |= ASC_INIT_STATE_BEG_SET_CFG; |
| 12261 | if (asc_dvc->err_code != 0) |
| 12262 | return asc_dvc->err_code; |
| 12263 | if (!AscFindSignature(asc_dvc->iop_base)) { |
| 12264 | asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; |
| 12265 | return asc_dvc->err_code; |
| 12266 | } |
| 12267 | |
| 12268 | cfg_msw = AscGetChipCfgMsw(iop_base); |
| 12269 | if ((cfg_msw & ASC_CFG_MSW_CLR_MASK) != 0) { |
| 12270 | cfg_msw &= ~ASC_CFG_MSW_CLR_MASK; |
| 12271 | warn_code |= ASC_WARN_CFG_MSW_RECOVER; |
| 12272 | AscSetChipCfgMsw(iop_base, cfg_msw); |
| 12273 | } |
| 12274 | if ((asc_dvc->cfg->cmd_qng_enabled & asc_dvc->cfg->disc_enable) != |
| 12275 | asc_dvc->cfg->cmd_qng_enabled) { |
| 12276 | asc_dvc->cfg->disc_enable = asc_dvc->cfg->cmd_qng_enabled; |
| 12277 | warn_code |= ASC_WARN_CMD_QNG_CONFLICT; |
| 12278 | } |
| 12279 | if (AscGetChipStatus(iop_base) & CSW_AUTO_CONFIG) { |
| 12280 | warn_code |= ASC_WARN_AUTO_CONFIG; |
| 12281 | } |
| 12282 | if ((asc_dvc->bus_type & (ASC_IS_ISA | ASC_IS_VL)) != 0) { |
| 12283 | if (AscSetChipIRQ(iop_base, asc_dvc->irq_no, asc_dvc->bus_type) |
| 12284 | != asc_dvc->irq_no) { |
| 12285 | asc_dvc->err_code |= ASC_IERR_SET_IRQ_NO; |
| 12286 | } |
| 12287 | } |
| 12288 | #ifdef CONFIG_PCI |
| 12289 | if (asc_dvc->bus_type & ASC_IS_PCI) { |
| 12290 | cfg_msw &= 0xFFC0; |
| 12291 | AscSetChipCfgMsw(iop_base, cfg_msw); |
| 12292 | if ((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) { |
| 12293 | } else { |
| 12294 | if ((pdev->device == PCI_DEVICE_ID_ASP_1200A) || |
| 12295 | (pdev->device == PCI_DEVICE_ID_ASP_ABP940)) { |
| 12296 | asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_IF_NOT_DWB; |
| 12297 | asc_dvc->bug_fix_cntl |= |
| 12298 | ASC_BUG_FIX_ASYN_USE_SYN; |
| 12299 | } |
| 12300 | } |
| 12301 | } else |
| 12302 | #endif /* CONFIG_PCI */ |
| 12303 | if (asc_dvc->bus_type == ASC_IS_ISAPNP) { |
| 12304 | if (AscGetChipVersion(iop_base, asc_dvc->bus_type) |
| 12305 | == ASC_CHIP_VER_ASYN_BUG) { |
| 12306 | asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_ASYN_USE_SYN; |
| 12307 | } |
| 12308 | } |
| 12309 | if (AscSetChipScsiID(iop_base, asc_dvc->cfg->chip_scsi_id) != |
| 12310 | asc_dvc->cfg->chip_scsi_id) { |
| 12311 | asc_dvc->err_code |= ASC_IERR_SET_SCSI_ID; |
| 12312 | } |
| 12313 | #ifdef CONFIG_ISA |
| 12314 | if (asc_dvc->bus_type & ASC_IS_ISA) { |
| 12315 | AscSetIsaDmaChannel(iop_base, asc_dvc->cfg->isa_dma_channel); |
| 12316 | AscSetIsaDmaSpeed(iop_base, asc_dvc->cfg->isa_dma_speed); |
| 12317 | } |
| 12318 | #endif /* CONFIG_ISA */ |
| 12319 | |
| 12320 | asc_dvc->init_state |= ASC_INIT_STATE_END_SET_CFG; |
| 12321 | |
| 12322 | switch (warn_code) { |
| 12323 | case 0: /* No error. */ |
| 12324 | break; |
| 12325 | case ASC_WARN_IO_PORT_ROTATE: |
| 12326 | ASC_PRINT1("AscInitSetConfig: board %d: I/O port address " |
| 12327 | "modified\n", boardp->id); |
| 12328 | break; |
| 12329 | case ASC_WARN_AUTO_CONFIG: |
| 12330 | ASC_PRINT1("AscInitSetConfig: board %d: I/O port increment " |
| 12331 | "switch enabled\n", boardp->id); |
| 12332 | break; |
| 12333 | case ASC_WARN_EEPROM_CHKSUM: |
| 12334 | ASC_PRINT1("AscInitSetConfig: board %d: EEPROM checksum " |
| 12335 | "error\n", boardp->id); |
| 12336 | break; |
| 12337 | case ASC_WARN_IRQ_MODIFIED: |
| 12338 | ASC_PRINT1("AscInitSetConfig: board %d: IRQ modified\n", |
| 12339 | boardp->id); |
| 12340 | break; |
| 12341 | case ASC_WARN_CMD_QNG_CONFLICT: |
| 12342 | ASC_PRINT1("AscInitSetConfig: board %d: tag queuing w/o " |
| 12343 | "disconnects\n", |
| 12344 | boardp->id); |
| 12345 | break; |
| 12346 | default: |
| 12347 | ASC_PRINT2("AscInitSetConfig: board %d: unknown warning: " |
| 12348 | "0x%x\n", boardp->id, warn_code); |
| 12349 | break; |
| 12350 | } |
| 12351 | |
| 12352 | if (asc_dvc->err_code != 0) { |
| 12353 | ASC_PRINT3("AscInitSetConfig: board %d error: init_state 0x%x, " |
| 12354 | "err_code 0x%x\n", boardp->id, asc_dvc->init_state, |
| 12355 | asc_dvc->err_code); |
| 12356 | } |
| 12357 | |
| 12358 | return asc_dvc->err_code; |
| 12359 | } |
| 12360 | |
| 12361 | /* |
| 12362 | * EEPROM Configuration. |
| 12363 | * |
| 12364 | * All drivers should use this structure to set the default EEPROM |
| 12365 | * configuration. The BIOS now uses this structure when it is built. |
| 12366 | * Additional structure information can be found in a_condor.h where |
| 12367 | * the structure is defined. |
| 12368 | * |
| 12369 | * The *_Field_IsChar structs are needed to correct for endianness. |
| 12370 | * These values are read from the board 16 bits at a time directly |
| 12371 | * into the structs. Because some fields are char, the values will be |
| 12372 | * in the wrong order. The *_Field_IsChar tells when to flip the |
| 12373 | * bytes. Data read and written to PCI memory is automatically swapped |
| 12374 | * on big-endian platforms so char fields read as words are actually being |
| 12375 | * unswapped on big-endian platforms. |
| 12376 | */ |
| 12377 | static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config __devinitdata = { |
| 12378 | ADV_EEPROM_BIOS_ENABLE, /* cfg_lsw */ |
| 12379 | 0x0000, /* cfg_msw */ |
| 12380 | 0xFFFF, /* disc_enable */ |
| 12381 | 0xFFFF, /* wdtr_able */ |
| 12382 | 0xFFFF, /* sdtr_able */ |
| 12383 | 0xFFFF, /* start_motor */ |
| 12384 | 0xFFFF, /* tagqng_able */ |
| 12385 | 0xFFFF, /* bios_scan */ |
| 12386 | 0, /* scam_tolerant */ |
| 12387 | 7, /* adapter_scsi_id */ |
| 12388 | 0, /* bios_boot_delay */ |
| 12389 | 3, /* scsi_reset_delay */ |
| 12390 | 0, /* bios_id_lun */ |
| 12391 | 0, /* termination */ |
| 12392 | 0, /* reserved1 */ |
| 12393 | 0xFFE7, /* bios_ctrl */ |
| 12394 | 0xFFFF, /* ultra_able */ |
| 12395 | 0, /* reserved2 */ |
| 12396 | ASC_DEF_MAX_HOST_QNG, /* max_host_qng */ |
| 12397 | ASC_DEF_MAX_DVC_QNG, /* max_dvc_qng */ |
| 12398 | 0, /* dvc_cntl */ |
| 12399 | 0, /* bug_fix */ |
| 12400 | 0, /* serial_number_word1 */ |
| 12401 | 0, /* serial_number_word2 */ |
| 12402 | 0, /* serial_number_word3 */ |
| 12403 | 0, /* check_sum */ |
| 12404 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} |
| 12405 | , /* oem_name[16] */ |
| 12406 | 0, /* dvc_err_code */ |
| 12407 | 0, /* adv_err_code */ |
| 12408 | 0, /* adv_err_addr */ |
| 12409 | 0, /* saved_dvc_err_code */ |
| 12410 | 0, /* saved_adv_err_code */ |
| 12411 | 0, /* saved_adv_err_addr */ |
| 12412 | 0 /* num_of_err */ |
| 12413 | }; |
| 12414 | |
| 12415 | static ADVEEP_3550_CONFIG ADVEEP_3550_Config_Field_IsChar __devinitdata = { |
| 12416 | 0, /* cfg_lsw */ |
| 12417 | 0, /* cfg_msw */ |
| 12418 | 0, /* -disc_enable */ |
| 12419 | 0, /* wdtr_able */ |
| 12420 | 0, /* sdtr_able */ |
| 12421 | 0, /* start_motor */ |
| 12422 | 0, /* tagqng_able */ |
| 12423 | 0, /* bios_scan */ |
| 12424 | 0, /* scam_tolerant */ |
| 12425 | 1, /* adapter_scsi_id */ |
| 12426 | 1, /* bios_boot_delay */ |
| 12427 | 1, /* scsi_reset_delay */ |
| 12428 | 1, /* bios_id_lun */ |
| 12429 | 1, /* termination */ |
| 12430 | 1, /* reserved1 */ |
| 12431 | 0, /* bios_ctrl */ |
| 12432 | 0, /* ultra_able */ |
| 12433 | 0, /* reserved2 */ |
| 12434 | 1, /* max_host_qng */ |
| 12435 | 1, /* max_dvc_qng */ |
| 12436 | 0, /* dvc_cntl */ |
| 12437 | 0, /* bug_fix */ |
| 12438 | 0, /* serial_number_word1 */ |
| 12439 | 0, /* serial_number_word2 */ |
| 12440 | 0, /* serial_number_word3 */ |
| 12441 | 0, /* check_sum */ |
| 12442 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} |
| 12443 | , /* oem_name[16] */ |
| 12444 | 0, /* dvc_err_code */ |
| 12445 | 0, /* adv_err_code */ |
| 12446 | 0, /* adv_err_addr */ |
| 12447 | 0, /* saved_dvc_err_code */ |
| 12448 | 0, /* saved_adv_err_code */ |
| 12449 | 0, /* saved_adv_err_addr */ |
| 12450 | 0 /* num_of_err */ |
| 12451 | }; |
| 12452 | |
| 12453 | static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config __devinitdata = { |
| 12454 | ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */ |
| 12455 | 0x0000, /* 01 cfg_msw */ |
| 12456 | 0xFFFF, /* 02 disc_enable */ |
| 12457 | 0xFFFF, /* 03 wdtr_able */ |
| 12458 | 0x4444, /* 04 sdtr_speed1 */ |
| 12459 | 0xFFFF, /* 05 start_motor */ |
| 12460 | 0xFFFF, /* 06 tagqng_able */ |
| 12461 | 0xFFFF, /* 07 bios_scan */ |
| 12462 | 0, /* 08 scam_tolerant */ |
| 12463 | 7, /* 09 adapter_scsi_id */ |
| 12464 | 0, /* bios_boot_delay */ |
| 12465 | 3, /* 10 scsi_reset_delay */ |
| 12466 | 0, /* bios_id_lun */ |
| 12467 | 0, /* 11 termination_se */ |
| 12468 | 0, /* termination_lvd */ |
| 12469 | 0xFFE7, /* 12 bios_ctrl */ |
| 12470 | 0x4444, /* 13 sdtr_speed2 */ |
| 12471 | 0x4444, /* 14 sdtr_speed3 */ |
| 12472 | ASC_DEF_MAX_HOST_QNG, /* 15 max_host_qng */ |
| 12473 | ASC_DEF_MAX_DVC_QNG, /* max_dvc_qng */ |
| 12474 | 0, /* 16 dvc_cntl */ |
| 12475 | 0x4444, /* 17 sdtr_speed4 */ |
| 12476 | 0, /* 18 serial_number_word1 */ |
| 12477 | 0, /* 19 serial_number_word2 */ |
| 12478 | 0, /* 20 serial_number_word3 */ |
| 12479 | 0, /* 21 check_sum */ |
| 12480 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} |
| 12481 | , /* 22-29 oem_name[16] */ |
| 12482 | 0, /* 30 dvc_err_code */ |
| 12483 | 0, /* 31 adv_err_code */ |
| 12484 | 0, /* 32 adv_err_addr */ |
| 12485 | 0, /* 33 saved_dvc_err_code */ |
| 12486 | 0, /* 34 saved_adv_err_code */ |
| 12487 | 0, /* 35 saved_adv_err_addr */ |
| 12488 | 0, /* 36 reserved */ |
| 12489 | 0, /* 37 reserved */ |
| 12490 | 0, /* 38 reserved */ |
| 12491 | 0, /* 39 reserved */ |
| 12492 | 0, /* 40 reserved */ |
| 12493 | 0, /* 41 reserved */ |
| 12494 | 0, /* 42 reserved */ |
| 12495 | 0, /* 43 reserved */ |
| 12496 | 0, /* 44 reserved */ |
| 12497 | 0, /* 45 reserved */ |
| 12498 | 0, /* 46 reserved */ |
| 12499 | 0, /* 47 reserved */ |
| 12500 | 0, /* 48 reserved */ |
| 12501 | 0, /* 49 reserved */ |
| 12502 | 0, /* 50 reserved */ |
| 12503 | 0, /* 51 reserved */ |
| 12504 | 0, /* 52 reserved */ |
| 12505 | 0, /* 53 reserved */ |
| 12506 | 0, /* 54 reserved */ |
| 12507 | 0, /* 55 reserved */ |
| 12508 | 0, /* 56 cisptr_lsw */ |
| 12509 | 0, /* 57 cisprt_msw */ |
| 12510 | PCI_VENDOR_ID_ASP, /* 58 subsysvid */ |
| 12511 | PCI_DEVICE_ID_38C0800_REV1, /* 59 subsysid */ |
| 12512 | 0, /* 60 reserved */ |
| 12513 | 0, /* 61 reserved */ |
| 12514 | 0, /* 62 reserved */ |
| 12515 | 0 /* 63 reserved */ |
| 12516 | }; |
| 12517 | |
| 12518 | static ADVEEP_38C0800_CONFIG ADVEEP_38C0800_Config_Field_IsChar __devinitdata = { |
| 12519 | 0, /* 00 cfg_lsw */ |
| 12520 | 0, /* 01 cfg_msw */ |
| 12521 | 0, /* 02 disc_enable */ |
| 12522 | 0, /* 03 wdtr_able */ |
| 12523 | 0, /* 04 sdtr_speed1 */ |
| 12524 | 0, /* 05 start_motor */ |
| 12525 | 0, /* 06 tagqng_able */ |
| 12526 | 0, /* 07 bios_scan */ |
| 12527 | 0, /* 08 scam_tolerant */ |
| 12528 | 1, /* 09 adapter_scsi_id */ |
| 12529 | 1, /* bios_boot_delay */ |
| 12530 | 1, /* 10 scsi_reset_delay */ |
| 12531 | 1, /* bios_id_lun */ |
| 12532 | 1, /* 11 termination_se */ |
| 12533 | 1, /* termination_lvd */ |
| 12534 | 0, /* 12 bios_ctrl */ |
| 12535 | 0, /* 13 sdtr_speed2 */ |
| 12536 | 0, /* 14 sdtr_speed3 */ |
| 12537 | 1, /* 15 max_host_qng */ |
| 12538 | 1, /* max_dvc_qng */ |
| 12539 | 0, /* 16 dvc_cntl */ |
| 12540 | 0, /* 17 sdtr_speed4 */ |
| 12541 | 0, /* 18 serial_number_word1 */ |
| 12542 | 0, /* 19 serial_number_word2 */ |
| 12543 | 0, /* 20 serial_number_word3 */ |
| 12544 | 0, /* 21 check_sum */ |
| 12545 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} |
| 12546 | , /* 22-29 oem_name[16] */ |
| 12547 | 0, /* 30 dvc_err_code */ |
| 12548 | 0, /* 31 adv_err_code */ |
| 12549 | 0, /* 32 adv_err_addr */ |
| 12550 | 0, /* 33 saved_dvc_err_code */ |
| 12551 | 0, /* 34 saved_adv_err_code */ |
| 12552 | 0, /* 35 saved_adv_err_addr */ |
| 12553 | 0, /* 36 reserved */ |
| 12554 | 0, /* 37 reserved */ |
| 12555 | 0, /* 38 reserved */ |
| 12556 | 0, /* 39 reserved */ |
| 12557 | 0, /* 40 reserved */ |
| 12558 | 0, /* 41 reserved */ |
| 12559 | 0, /* 42 reserved */ |
| 12560 | 0, /* 43 reserved */ |
| 12561 | 0, /* 44 reserved */ |
| 12562 | 0, /* 45 reserved */ |
| 12563 | 0, /* 46 reserved */ |
| 12564 | 0, /* 47 reserved */ |
| 12565 | 0, /* 48 reserved */ |
| 12566 | 0, /* 49 reserved */ |
| 12567 | 0, /* 50 reserved */ |
| 12568 | 0, /* 51 reserved */ |
| 12569 | 0, /* 52 reserved */ |
| 12570 | 0, /* 53 reserved */ |
| 12571 | 0, /* 54 reserved */ |
| 12572 | 0, /* 55 reserved */ |
| 12573 | 0, /* 56 cisptr_lsw */ |
| 12574 | 0, /* 57 cisprt_msw */ |
| 12575 | 0, /* 58 subsysvid */ |
| 12576 | 0, /* 59 subsysid */ |
| 12577 | 0, /* 60 reserved */ |
| 12578 | 0, /* 61 reserved */ |
| 12579 | 0, /* 62 reserved */ |
| 12580 | 0 /* 63 reserved */ |
| 12581 | }; |
| 12582 | |
| 12583 | static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config __devinitdata = { |
| 12584 | ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */ |
| 12585 | 0x0000, /* 01 cfg_msw */ |
| 12586 | 0xFFFF, /* 02 disc_enable */ |
| 12587 | 0xFFFF, /* 03 wdtr_able */ |
| 12588 | 0x5555, /* 04 sdtr_speed1 */ |
| 12589 | 0xFFFF, /* 05 start_motor */ |
| 12590 | 0xFFFF, /* 06 tagqng_able */ |
| 12591 | 0xFFFF, /* 07 bios_scan */ |
| 12592 | 0, /* 08 scam_tolerant */ |
| 12593 | 7, /* 09 adapter_scsi_id */ |
| 12594 | 0, /* bios_boot_delay */ |
| 12595 | 3, /* 10 scsi_reset_delay */ |
| 12596 | 0, /* bios_id_lun */ |
| 12597 | 0, /* 11 termination_se */ |
| 12598 | 0, /* termination_lvd */ |
| 12599 | 0xFFE7, /* 12 bios_ctrl */ |
| 12600 | 0x5555, /* 13 sdtr_speed2 */ |
| 12601 | 0x5555, /* 14 sdtr_speed3 */ |
| 12602 | ASC_DEF_MAX_HOST_QNG, /* 15 max_host_qng */ |
| 12603 | ASC_DEF_MAX_DVC_QNG, /* max_dvc_qng */ |
| 12604 | 0, /* 16 dvc_cntl */ |
| 12605 | 0x5555, /* 17 sdtr_speed4 */ |
| 12606 | 0, /* 18 serial_number_word1 */ |
| 12607 | 0, /* 19 serial_number_word2 */ |
| 12608 | 0, /* 20 serial_number_word3 */ |
| 12609 | 0, /* 21 check_sum */ |
| 12610 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} |
| 12611 | , /* 22-29 oem_name[16] */ |
| 12612 | 0, /* 30 dvc_err_code */ |
| 12613 | 0, /* 31 adv_err_code */ |
| 12614 | 0, /* 32 adv_err_addr */ |
| 12615 | 0, /* 33 saved_dvc_err_code */ |
| 12616 | 0, /* 34 saved_adv_err_code */ |
| 12617 | 0, /* 35 saved_adv_err_addr */ |
| 12618 | 0, /* 36 reserved */ |
| 12619 | 0, /* 37 reserved */ |
| 12620 | 0, /* 38 reserved */ |
| 12621 | 0, /* 39 reserved */ |
| 12622 | 0, /* 40 reserved */ |
| 12623 | 0, /* 41 reserved */ |
| 12624 | 0, /* 42 reserved */ |
| 12625 | 0, /* 43 reserved */ |
| 12626 | 0, /* 44 reserved */ |
| 12627 | 0, /* 45 reserved */ |
| 12628 | 0, /* 46 reserved */ |
| 12629 | 0, /* 47 reserved */ |
| 12630 | 0, /* 48 reserved */ |
| 12631 | 0, /* 49 reserved */ |
| 12632 | 0, /* 50 reserved */ |
| 12633 | 0, /* 51 reserved */ |
| 12634 | 0, /* 52 reserved */ |
| 12635 | 0, /* 53 reserved */ |
| 12636 | 0, /* 54 reserved */ |
| 12637 | 0, /* 55 reserved */ |
| 12638 | 0, /* 56 cisptr_lsw */ |
| 12639 | 0, /* 57 cisprt_msw */ |
| 12640 | PCI_VENDOR_ID_ASP, /* 58 subsysvid */ |
| 12641 | PCI_DEVICE_ID_38C1600_REV1, /* 59 subsysid */ |
| 12642 | 0, /* 60 reserved */ |
| 12643 | 0, /* 61 reserved */ |
| 12644 | 0, /* 62 reserved */ |
| 12645 | 0 /* 63 reserved */ |
| 12646 | }; |
| 12647 | |
| 12648 | static ADVEEP_38C1600_CONFIG ADVEEP_38C1600_Config_Field_IsChar __devinitdata = { |
| 12649 | 0, /* 00 cfg_lsw */ |
| 12650 | 0, /* 01 cfg_msw */ |
| 12651 | 0, /* 02 disc_enable */ |
| 12652 | 0, /* 03 wdtr_able */ |
| 12653 | 0, /* 04 sdtr_speed1 */ |
| 12654 | 0, /* 05 start_motor */ |
| 12655 | 0, /* 06 tagqng_able */ |
| 12656 | 0, /* 07 bios_scan */ |
| 12657 | 0, /* 08 scam_tolerant */ |
| 12658 | 1, /* 09 adapter_scsi_id */ |
| 12659 | 1, /* bios_boot_delay */ |
| 12660 | 1, /* 10 scsi_reset_delay */ |
| 12661 | 1, /* bios_id_lun */ |
| 12662 | 1, /* 11 termination_se */ |
| 12663 | 1, /* termination_lvd */ |
| 12664 | 0, /* 12 bios_ctrl */ |
| 12665 | 0, /* 13 sdtr_speed2 */ |
| 12666 | 0, /* 14 sdtr_speed3 */ |
| 12667 | 1, /* 15 max_host_qng */ |
| 12668 | 1, /* max_dvc_qng */ |
| 12669 | 0, /* 16 dvc_cntl */ |
| 12670 | 0, /* 17 sdtr_speed4 */ |
| 12671 | 0, /* 18 serial_number_word1 */ |
| 12672 | 0, /* 19 serial_number_word2 */ |
| 12673 | 0, /* 20 serial_number_word3 */ |
| 12674 | 0, /* 21 check_sum */ |
| 12675 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} |
| 12676 | , /* 22-29 oem_name[16] */ |
| 12677 | 0, /* 30 dvc_err_code */ |
| 12678 | 0, /* 31 adv_err_code */ |
| 12679 | 0, /* 32 adv_err_addr */ |
| 12680 | 0, /* 33 saved_dvc_err_code */ |
| 12681 | 0, /* 34 saved_adv_err_code */ |
| 12682 | 0, /* 35 saved_adv_err_addr */ |
| 12683 | 0, /* 36 reserved */ |
| 12684 | 0, /* 37 reserved */ |
| 12685 | 0, /* 38 reserved */ |
| 12686 | 0, /* 39 reserved */ |
| 12687 | 0, /* 40 reserved */ |
| 12688 | 0, /* 41 reserved */ |
| 12689 | 0, /* 42 reserved */ |
| 12690 | 0, /* 43 reserved */ |
| 12691 | 0, /* 44 reserved */ |
| 12692 | 0, /* 45 reserved */ |
| 12693 | 0, /* 46 reserved */ |
| 12694 | 0, /* 47 reserved */ |
| 12695 | 0, /* 48 reserved */ |
| 12696 | 0, /* 49 reserved */ |
| 12697 | 0, /* 50 reserved */ |
| 12698 | 0, /* 51 reserved */ |
| 12699 | 0, /* 52 reserved */ |
| 12700 | 0, /* 53 reserved */ |
| 12701 | 0, /* 54 reserved */ |
| 12702 | 0, /* 55 reserved */ |
| 12703 | 0, /* 56 cisptr_lsw */ |
| 12704 | 0, /* 57 cisprt_msw */ |
| 12705 | 0, /* 58 subsysvid */ |
| 12706 | 0, /* 59 subsysid */ |
| 12707 | 0, /* 60 reserved */ |
| 12708 | 0, /* 61 reserved */ |
| 12709 | 0, /* 62 reserved */ |
| 12710 | 0 /* 63 reserved */ |
| 12711 | }; |
| 12712 | |
| 12713 | #ifdef CONFIG_PCI |
| 12714 | /* |
| 12715 | * Wait for EEPROM command to complete |
| 12716 | */ |
| 12717 | static void __devinit AdvWaitEEPCmd(AdvPortAddr iop_base) |
| 12718 | { |
| 12719 | int eep_delay_ms; |
| 12720 | |
| 12721 | for (eep_delay_ms = 0; eep_delay_ms < ADV_EEP_DELAY_MS; eep_delay_ms++) { |
| 12722 | if (AdvReadWordRegister(iop_base, IOPW_EE_CMD) & |
| 12723 | ASC_EEP_CMD_DONE) { |
| 12724 | break; |
| 12725 | } |
| 12726 | mdelay(1); |
| 12727 | } |
| 12728 | if ((AdvReadWordRegister(iop_base, IOPW_EE_CMD) & ASC_EEP_CMD_DONE) == |
| 12729 | 0) |
| 12730 | BUG(); |
| 12731 | } |
| 12732 | |
| 12733 | /* |
| 12734 | * Read the EEPROM from specified location |
| 12735 | */ |
| 12736 | static ushort __devinit AdvReadEEPWord(AdvPortAddr iop_base, int eep_word_addr) |
| 12737 | { |
| 12738 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, |
| 12739 | ASC_EEP_CMD_READ | eep_word_addr); |
| 12740 | AdvWaitEEPCmd(iop_base); |
| 12741 | return AdvReadWordRegister(iop_base, IOPW_EE_DATA); |
| 12742 | } |
| 12743 | |
| 12744 | /* |
| 12745 | * Write the EEPROM from 'cfg_buf'. |
| 12746 | */ |
| 12747 | void __devinit |
| 12748 | AdvSet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) |
| 12749 | { |
| 12750 | ushort *wbuf; |
| 12751 | ushort addr, chksum; |
| 12752 | ushort *charfields; |
| 12753 | |
| 12754 | wbuf = (ushort *)cfg_buf; |
| 12755 | charfields = (ushort *)&ADVEEP_3550_Config_Field_IsChar; |
| 12756 | chksum = 0; |
| 12757 | |
| 12758 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_ABLE); |
| 12759 | AdvWaitEEPCmd(iop_base); |
| 12760 | |
| 12761 | /* |
| 12762 | * Write EEPROM from word 0 to word 20. |
| 12763 | */ |
| 12764 | for (addr = ADV_EEP_DVC_CFG_BEGIN; |
| 12765 | addr < ADV_EEP_DVC_CFG_END; addr++, wbuf++) { |
| 12766 | ushort word; |
| 12767 | |
| 12768 | if (*charfields++) { |
| 12769 | word = cpu_to_le16(*wbuf); |
| 12770 | } else { |
| 12771 | word = *wbuf; |
| 12772 | } |
| 12773 | chksum += *wbuf; /* Checksum is calculated from word values. */ |
| 12774 | AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word); |
| 12775 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, |
| 12776 | ASC_EEP_CMD_WRITE | addr); |
| 12777 | AdvWaitEEPCmd(iop_base); |
| 12778 | mdelay(ADV_EEP_DELAY_MS); |
| 12779 | } |
| 12780 | |
| 12781 | /* |
| 12782 | * Write EEPROM checksum at word 21. |
| 12783 | */ |
| 12784 | AdvWriteWordRegister(iop_base, IOPW_EE_DATA, chksum); |
| 12785 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr); |
| 12786 | AdvWaitEEPCmd(iop_base); |
| 12787 | wbuf++; |
| 12788 | charfields++; |
| 12789 | |
| 12790 | /* |
| 12791 | * Write EEPROM OEM name at words 22 to 29. |
| 12792 | */ |
| 12793 | for (addr = ADV_EEP_DVC_CTL_BEGIN; |
| 12794 | addr < ADV_EEP_MAX_WORD_ADDR; addr++, wbuf++) { |
| 12795 | ushort word; |
| 12796 | |
| 12797 | if (*charfields++) { |
| 12798 | word = cpu_to_le16(*wbuf); |
| 12799 | } else { |
| 12800 | word = *wbuf; |
| 12801 | } |
| 12802 | AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word); |
| 12803 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, |
| 12804 | ASC_EEP_CMD_WRITE | addr); |
| 12805 | AdvWaitEEPCmd(iop_base); |
| 12806 | } |
| 12807 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_DISABLE); |
| 12808 | AdvWaitEEPCmd(iop_base); |
| 12809 | } |
| 12810 | |
| 12811 | /* |
| 12812 | * Write the EEPROM from 'cfg_buf'. |
| 12813 | */ |
| 12814 | void __devinit |
| 12815 | AdvSet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf) |
| 12816 | { |
| 12817 | ushort *wbuf; |
| 12818 | ushort *charfields; |
| 12819 | ushort addr, chksum; |
| 12820 | |
| 12821 | wbuf = (ushort *)cfg_buf; |
| 12822 | charfields = (ushort *)&ADVEEP_38C0800_Config_Field_IsChar; |
| 12823 | chksum = 0; |
| 12824 | |
| 12825 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_ABLE); |
| 12826 | AdvWaitEEPCmd(iop_base); |
| 12827 | |
| 12828 | /* |
| 12829 | * Write EEPROM from word 0 to word 20. |
| 12830 | */ |
| 12831 | for (addr = ADV_EEP_DVC_CFG_BEGIN; |
| 12832 | addr < ADV_EEP_DVC_CFG_END; addr++, wbuf++) { |
| 12833 | ushort word; |
| 12834 | |
| 12835 | if (*charfields++) { |
| 12836 | word = cpu_to_le16(*wbuf); |
| 12837 | } else { |
| 12838 | word = *wbuf; |
| 12839 | } |
| 12840 | chksum += *wbuf; /* Checksum is calculated from word values. */ |
| 12841 | AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word); |
| 12842 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, |
| 12843 | ASC_EEP_CMD_WRITE | addr); |
| 12844 | AdvWaitEEPCmd(iop_base); |
| 12845 | mdelay(ADV_EEP_DELAY_MS); |
| 12846 | } |
| 12847 | |
| 12848 | /* |
| 12849 | * Write EEPROM checksum at word 21. |
| 12850 | */ |
| 12851 | AdvWriteWordRegister(iop_base, IOPW_EE_DATA, chksum); |
| 12852 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr); |
| 12853 | AdvWaitEEPCmd(iop_base); |
| 12854 | wbuf++; |
| 12855 | charfields++; |
| 12856 | |
| 12857 | /* |
| 12858 | * Write EEPROM OEM name at words 22 to 29. |
| 12859 | */ |
| 12860 | for (addr = ADV_EEP_DVC_CTL_BEGIN; |
| 12861 | addr < ADV_EEP_MAX_WORD_ADDR; addr++, wbuf++) { |
| 12862 | ushort word; |
| 12863 | |
| 12864 | if (*charfields++) { |
| 12865 | word = cpu_to_le16(*wbuf); |
| 12866 | } else { |
| 12867 | word = *wbuf; |
| 12868 | } |
| 12869 | AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word); |
| 12870 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, |
| 12871 | ASC_EEP_CMD_WRITE | addr); |
| 12872 | AdvWaitEEPCmd(iop_base); |
| 12873 | } |
| 12874 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_DISABLE); |
| 12875 | AdvWaitEEPCmd(iop_base); |
| 12876 | } |
| 12877 | |
| 12878 | /* |
| 12879 | * Write the EEPROM from 'cfg_buf'. |
| 12880 | */ |
| 12881 | void __devinit |
| 12882 | AdvSet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf) |
| 12883 | { |
| 12884 | ushort *wbuf; |
| 12885 | ushort *charfields; |
| 12886 | ushort addr, chksum; |
| 12887 | |
| 12888 | wbuf = (ushort *)cfg_buf; |
| 12889 | charfields = (ushort *)&ADVEEP_38C1600_Config_Field_IsChar; |
| 12890 | chksum = 0; |
| 12891 | |
| 12892 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_ABLE); |
| 12893 | AdvWaitEEPCmd(iop_base); |
| 12894 | |
| 12895 | /* |
| 12896 | * Write EEPROM from word 0 to word 20. |
| 12897 | */ |
| 12898 | for (addr = ADV_EEP_DVC_CFG_BEGIN; |
| 12899 | addr < ADV_EEP_DVC_CFG_END; addr++, wbuf++) { |
| 12900 | ushort word; |
| 12901 | |
| 12902 | if (*charfields++) { |
| 12903 | word = cpu_to_le16(*wbuf); |
| 12904 | } else { |
| 12905 | word = *wbuf; |
| 12906 | } |
| 12907 | chksum += *wbuf; /* Checksum is calculated from word values. */ |
| 12908 | AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word); |
| 12909 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, |
| 12910 | ASC_EEP_CMD_WRITE | addr); |
| 12911 | AdvWaitEEPCmd(iop_base); |
| 12912 | mdelay(ADV_EEP_DELAY_MS); |
| 12913 | } |
| 12914 | |
| 12915 | /* |
| 12916 | * Write EEPROM checksum at word 21. |
| 12917 | */ |
| 12918 | AdvWriteWordRegister(iop_base, IOPW_EE_DATA, chksum); |
| 12919 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr); |
| 12920 | AdvWaitEEPCmd(iop_base); |
| 12921 | wbuf++; |
| 12922 | charfields++; |
| 12923 | |
| 12924 | /* |
| 12925 | * Write EEPROM OEM name at words 22 to 29. |
| 12926 | */ |
| 12927 | for (addr = ADV_EEP_DVC_CTL_BEGIN; |
| 12928 | addr < ADV_EEP_MAX_WORD_ADDR; addr++, wbuf++) { |
| 12929 | ushort word; |
| 12930 | |
| 12931 | if (*charfields++) { |
| 12932 | word = cpu_to_le16(*wbuf); |
| 12933 | } else { |
| 12934 | word = *wbuf; |
| 12935 | } |
| 12936 | AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word); |
| 12937 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, |
| 12938 | ASC_EEP_CMD_WRITE | addr); |
| 12939 | AdvWaitEEPCmd(iop_base); |
| 12940 | } |
| 12941 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_DISABLE); |
| 12942 | AdvWaitEEPCmd(iop_base); |
| 12943 | } |
| 12944 | |
| 12945 | /* |
| 12946 | * Read EEPROM configuration into the specified buffer. |
| 12947 | * |
| 12948 | * Return a checksum based on the EEPROM configuration read. |
| 12949 | */ |
| 12950 | static ushort __devinit |
| 12951 | AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) |
| 12952 | { |
| 12953 | ushort wval, chksum; |
| 12954 | ushort *wbuf; |
| 12955 | int eep_addr; |
| 12956 | ushort *charfields; |
| 12957 | |
| 12958 | charfields = (ushort *)&ADVEEP_3550_Config_Field_IsChar; |
| 12959 | wbuf = (ushort *)cfg_buf; |
| 12960 | chksum = 0; |
| 12961 | |
| 12962 | for (eep_addr = ADV_EEP_DVC_CFG_BEGIN; |
| 12963 | eep_addr < ADV_EEP_DVC_CFG_END; eep_addr++, wbuf++) { |
| 12964 | wval = AdvReadEEPWord(iop_base, eep_addr); |
| 12965 | chksum += wval; /* Checksum is calculated from word values. */ |
| 12966 | if (*charfields++) { |
| 12967 | *wbuf = le16_to_cpu(wval); |
| 12968 | } else { |
| 12969 | *wbuf = wval; |
| 12970 | } |
| 12971 | } |
| 12972 | /* Read checksum word. */ |
| 12973 | *wbuf = AdvReadEEPWord(iop_base, eep_addr); |
| 12974 | wbuf++; |
| 12975 | charfields++; |
| 12976 | |
| 12977 | /* Read rest of EEPROM not covered by the checksum. */ |
| 12978 | for (eep_addr = ADV_EEP_DVC_CTL_BEGIN; |
| 12979 | eep_addr < ADV_EEP_MAX_WORD_ADDR; eep_addr++, wbuf++) { |
| 12980 | *wbuf = AdvReadEEPWord(iop_base, eep_addr); |
| 12981 | if (*charfields++) { |
| 12982 | *wbuf = le16_to_cpu(*wbuf); |
| 12983 | } |
| 12984 | } |
| 12985 | return chksum; |
| 12986 | } |
| 12987 | |
| 12988 | /* |
| 12989 | * Read EEPROM configuration into the specified buffer. |
| 12990 | * |
| 12991 | * Return a checksum based on the EEPROM configuration read. |
| 12992 | */ |
| 12993 | static ushort __devinit |
| 12994 | AdvGet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf) |
| 12995 | { |
| 12996 | ushort wval, chksum; |
| 12997 | ushort *wbuf; |
| 12998 | int eep_addr; |
| 12999 | ushort *charfields; |
| 13000 | |
| 13001 | charfields = (ushort *)&ADVEEP_38C0800_Config_Field_IsChar; |
| 13002 | wbuf = (ushort *)cfg_buf; |
| 13003 | chksum = 0; |
| 13004 | |
| 13005 | for (eep_addr = ADV_EEP_DVC_CFG_BEGIN; |
| 13006 | eep_addr < ADV_EEP_DVC_CFG_END; eep_addr++, wbuf++) { |
| 13007 | wval = AdvReadEEPWord(iop_base, eep_addr); |
| 13008 | chksum += wval; /* Checksum is calculated from word values. */ |
| 13009 | if (*charfields++) { |
| 13010 | *wbuf = le16_to_cpu(wval); |
| 13011 | } else { |
| 13012 | *wbuf = wval; |
| 13013 | } |
| 13014 | } |
| 13015 | /* Read checksum word. */ |
| 13016 | *wbuf = AdvReadEEPWord(iop_base, eep_addr); |
| 13017 | wbuf++; |
| 13018 | charfields++; |
| 13019 | |
| 13020 | /* Read rest of EEPROM not covered by the checksum. */ |
| 13021 | for (eep_addr = ADV_EEP_DVC_CTL_BEGIN; |
| 13022 | eep_addr < ADV_EEP_MAX_WORD_ADDR; eep_addr++, wbuf++) { |
| 13023 | *wbuf = AdvReadEEPWord(iop_base, eep_addr); |
| 13024 | if (*charfields++) { |
| 13025 | *wbuf = le16_to_cpu(*wbuf); |
| 13026 | } |
| 13027 | } |
| 13028 | return chksum; |
| 13029 | } |
| 13030 | |
| 13031 | /* |
| 13032 | * Read EEPROM configuration into the specified buffer. |
| 13033 | * |
| 13034 | * Return a checksum based on the EEPROM configuration read. |
| 13035 | */ |
| 13036 | static ushort __devinit |
| 13037 | AdvGet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf) |
| 13038 | { |
| 13039 | ushort wval, chksum; |
| 13040 | ushort *wbuf; |
| 13041 | int eep_addr; |
| 13042 | ushort *charfields; |
| 13043 | |
| 13044 | charfields = (ushort *)&ADVEEP_38C1600_Config_Field_IsChar; |
| 13045 | wbuf = (ushort *)cfg_buf; |
| 13046 | chksum = 0; |
| 13047 | |
| 13048 | for (eep_addr = ADV_EEP_DVC_CFG_BEGIN; |
| 13049 | eep_addr < ADV_EEP_DVC_CFG_END; eep_addr++, wbuf++) { |
| 13050 | wval = AdvReadEEPWord(iop_base, eep_addr); |
| 13051 | chksum += wval; /* Checksum is calculated from word values. */ |
| 13052 | if (*charfields++) { |
| 13053 | *wbuf = le16_to_cpu(wval); |
| 13054 | } else { |
| 13055 | *wbuf = wval; |
| 13056 | } |
| 13057 | } |
| 13058 | /* Read checksum word. */ |
| 13059 | *wbuf = AdvReadEEPWord(iop_base, eep_addr); |
| 13060 | wbuf++; |
| 13061 | charfields++; |
| 13062 | |
| 13063 | /* Read rest of EEPROM not covered by the checksum. */ |
| 13064 | for (eep_addr = ADV_EEP_DVC_CTL_BEGIN; |
| 13065 | eep_addr < ADV_EEP_MAX_WORD_ADDR; eep_addr++, wbuf++) { |
| 13066 | *wbuf = AdvReadEEPWord(iop_base, eep_addr); |
| 13067 | if (*charfields++) { |
| 13068 | *wbuf = le16_to_cpu(*wbuf); |
| 13069 | } |
| 13070 | } |
| 13071 | return chksum; |
| 13072 | } |
| 13073 | |
| 13074 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13075 | * Read the board's EEPROM configuration. Set fields in ADV_DVC_VAR and |
| 13076 | * ADV_DVC_CFG based on the EEPROM settings. The chip is stopped while |
| 13077 | * all of this is done. |
| 13078 | * |
| 13079 | * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR. |
| 13080 | * |
| 13081 | * For a non-fatal error return a warning code. If there are no warnings |
| 13082 | * then 0 is returned. |
| 13083 | * |
| 13084 | * Note: Chip is stopped on entry. |
| 13085 | */ |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 13086 | static int __devinit AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13087 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13088 | AdvPortAddr iop_base; |
| 13089 | ushort warn_code; |
| 13090 | ADVEEP_3550_CONFIG eep_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13091 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13092 | iop_base = asc_dvc->iop_base; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13093 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13094 | warn_code = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13095 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13096 | /* |
| 13097 | * Read the board's EEPROM configuration. |
| 13098 | * |
| 13099 | * Set default values if a bad checksum is found. |
| 13100 | */ |
| 13101 | if (AdvGet3550EEPConfig(iop_base, &eep_config) != eep_config.check_sum) { |
| 13102 | warn_code |= ASC_WARN_EEPROM_CHKSUM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13103 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13104 | /* |
| 13105 | * Set EEPROM default values. |
| 13106 | */ |
Matthew Wilcox | d68f432 | 2007-07-26 11:58:12 -0400 | [diff] [blame] | 13107 | memcpy(&eep_config, &Default_3550_EEPROM_Config, |
| 13108 | sizeof(ADVEEP_3550_CONFIG)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13109 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13110 | /* |
Matthew Wilcox | d68f432 | 2007-07-26 11:58:12 -0400 | [diff] [blame] | 13111 | * Assume the 6 byte board serial number that was read from |
| 13112 | * EEPROM is correct even if the EEPROM checksum failed. |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13113 | */ |
| 13114 | eep_config.serial_number_word3 = |
| 13115 | AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13116 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13117 | eep_config.serial_number_word2 = |
| 13118 | AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13119 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13120 | eep_config.serial_number_word1 = |
| 13121 | AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13122 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13123 | AdvSet3550EEPConfig(iop_base, &eep_config); |
| 13124 | } |
| 13125 | /* |
| 13126 | * Set ASC_DVC_VAR and ASC_DVC_CFG variables from the |
| 13127 | * EEPROM configuration that was read. |
| 13128 | * |
| 13129 | * This is the mapping of EEPROM fields to Adv Library fields. |
| 13130 | */ |
| 13131 | asc_dvc->wdtr_able = eep_config.wdtr_able; |
| 13132 | asc_dvc->sdtr_able = eep_config.sdtr_able; |
| 13133 | asc_dvc->ultra_able = eep_config.ultra_able; |
| 13134 | asc_dvc->tagqng_able = eep_config.tagqng_able; |
| 13135 | asc_dvc->cfg->disc_enable = eep_config.disc_enable; |
| 13136 | asc_dvc->max_host_qng = eep_config.max_host_qng; |
| 13137 | asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; |
| 13138 | asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID); |
| 13139 | asc_dvc->start_motor = eep_config.start_motor; |
| 13140 | asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay; |
| 13141 | asc_dvc->bios_ctrl = eep_config.bios_ctrl; |
| 13142 | asc_dvc->no_scam = eep_config.scam_tolerant; |
| 13143 | asc_dvc->cfg->serial1 = eep_config.serial_number_word1; |
| 13144 | asc_dvc->cfg->serial2 = eep_config.serial_number_word2; |
| 13145 | asc_dvc->cfg->serial3 = eep_config.serial_number_word3; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13146 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13147 | /* |
| 13148 | * Set the host maximum queuing (max. 253, min. 16) and the per device |
| 13149 | * maximum queuing (max. 63, min. 4). |
| 13150 | */ |
| 13151 | if (eep_config.max_host_qng > ASC_DEF_MAX_HOST_QNG) { |
| 13152 | eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG; |
| 13153 | } else if (eep_config.max_host_qng < ASC_DEF_MIN_HOST_QNG) { |
| 13154 | /* If the value is zero, assume it is uninitialized. */ |
| 13155 | if (eep_config.max_host_qng == 0) { |
| 13156 | eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG; |
| 13157 | } else { |
| 13158 | eep_config.max_host_qng = ASC_DEF_MIN_HOST_QNG; |
| 13159 | } |
| 13160 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13161 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13162 | if (eep_config.max_dvc_qng > ASC_DEF_MAX_DVC_QNG) { |
| 13163 | eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG; |
| 13164 | } else if (eep_config.max_dvc_qng < ASC_DEF_MIN_DVC_QNG) { |
| 13165 | /* If the value is zero, assume it is uninitialized. */ |
| 13166 | if (eep_config.max_dvc_qng == 0) { |
| 13167 | eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG; |
| 13168 | } else { |
| 13169 | eep_config.max_dvc_qng = ASC_DEF_MIN_DVC_QNG; |
| 13170 | } |
| 13171 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13172 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13173 | /* |
| 13174 | * If 'max_dvc_qng' is greater than 'max_host_qng', then |
| 13175 | * set 'max_dvc_qng' to 'max_host_qng'. |
| 13176 | */ |
| 13177 | if (eep_config.max_dvc_qng > eep_config.max_host_qng) { |
| 13178 | eep_config.max_dvc_qng = eep_config.max_host_qng; |
| 13179 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13180 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13181 | /* |
| 13182 | * Set ADV_DVC_VAR 'max_host_qng' and ADV_DVC_VAR 'max_dvc_qng' |
| 13183 | * values based on possibly adjusted EEPROM values. |
| 13184 | */ |
| 13185 | asc_dvc->max_host_qng = eep_config.max_host_qng; |
| 13186 | asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13187 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13188 | /* |
| 13189 | * If the EEPROM 'termination' field is set to automatic (0), then set |
| 13190 | * the ADV_DVC_CFG 'termination' field to automatic also. |
| 13191 | * |
| 13192 | * If the termination is specified with a non-zero 'termination' |
| 13193 | * value check that a legal value is set and set the ADV_DVC_CFG |
| 13194 | * 'termination' field appropriately. |
| 13195 | */ |
| 13196 | if (eep_config.termination == 0) { |
| 13197 | asc_dvc->cfg->termination = 0; /* auto termination */ |
| 13198 | } else { |
| 13199 | /* Enable manual control with low off / high off. */ |
| 13200 | if (eep_config.termination == 1) { |
| 13201 | asc_dvc->cfg->termination = TERM_CTL_SEL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13202 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13203 | /* Enable manual control with low off / high on. */ |
| 13204 | } else if (eep_config.termination == 2) { |
| 13205 | asc_dvc->cfg->termination = TERM_CTL_SEL | TERM_CTL_H; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13206 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13207 | /* Enable manual control with low on / high on. */ |
| 13208 | } else if (eep_config.termination == 3) { |
| 13209 | asc_dvc->cfg->termination = |
| 13210 | TERM_CTL_SEL | TERM_CTL_H | TERM_CTL_L; |
| 13211 | } else { |
| 13212 | /* |
| 13213 | * The EEPROM 'termination' field contains a bad value. Use |
| 13214 | * automatic termination instead. |
| 13215 | */ |
| 13216 | asc_dvc->cfg->termination = 0; |
| 13217 | warn_code |= ASC_WARN_EEPROM_TERMINATION; |
| 13218 | } |
| 13219 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13220 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13221 | return warn_code; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13222 | } |
| 13223 | |
| 13224 | /* |
| 13225 | * Read the board's EEPROM configuration. Set fields in ADV_DVC_VAR and |
| 13226 | * ADV_DVC_CFG based on the EEPROM settings. The chip is stopped while |
| 13227 | * all of this is done. |
| 13228 | * |
| 13229 | * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR. |
| 13230 | * |
| 13231 | * For a non-fatal error return a warning code. If there are no warnings |
| 13232 | * then 0 is returned. |
| 13233 | * |
| 13234 | * Note: Chip is stopped on entry. |
| 13235 | */ |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 13236 | static int __devinit AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13237 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13238 | AdvPortAddr iop_base; |
| 13239 | ushort warn_code; |
| 13240 | ADVEEP_38C0800_CONFIG eep_config; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13241 | uchar tid, termination; |
| 13242 | ushort sdtr_speed = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13243 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13244 | iop_base = asc_dvc->iop_base; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13245 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13246 | warn_code = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13247 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13248 | /* |
| 13249 | * Read the board's EEPROM configuration. |
| 13250 | * |
| 13251 | * Set default values if a bad checksum is found. |
| 13252 | */ |
| 13253 | if (AdvGet38C0800EEPConfig(iop_base, &eep_config) != |
| 13254 | eep_config.check_sum) { |
| 13255 | warn_code |= ASC_WARN_EEPROM_CHKSUM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13256 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13257 | /* |
| 13258 | * Set EEPROM default values. |
| 13259 | */ |
Matthew Wilcox | d68f432 | 2007-07-26 11:58:12 -0400 | [diff] [blame] | 13260 | memcpy(&eep_config, &Default_38C0800_EEPROM_Config, |
| 13261 | sizeof(ADVEEP_38C0800_CONFIG)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13262 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13263 | /* |
Matthew Wilcox | d68f432 | 2007-07-26 11:58:12 -0400 | [diff] [blame] | 13264 | * Assume the 6 byte board serial number that was read from |
| 13265 | * EEPROM is correct even if the EEPROM checksum failed. |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13266 | */ |
| 13267 | eep_config.serial_number_word3 = |
| 13268 | AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13269 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13270 | eep_config.serial_number_word2 = |
| 13271 | AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13272 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13273 | eep_config.serial_number_word1 = |
| 13274 | AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13275 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13276 | AdvSet38C0800EEPConfig(iop_base, &eep_config); |
| 13277 | } |
| 13278 | /* |
| 13279 | * Set ADV_DVC_VAR and ADV_DVC_CFG variables from the |
| 13280 | * EEPROM configuration that was read. |
| 13281 | * |
| 13282 | * This is the mapping of EEPROM fields to Adv Library fields. |
| 13283 | */ |
| 13284 | asc_dvc->wdtr_able = eep_config.wdtr_able; |
| 13285 | asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1; |
| 13286 | asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2; |
| 13287 | asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3; |
| 13288 | asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4; |
| 13289 | asc_dvc->tagqng_able = eep_config.tagqng_able; |
| 13290 | asc_dvc->cfg->disc_enable = eep_config.disc_enable; |
| 13291 | asc_dvc->max_host_qng = eep_config.max_host_qng; |
| 13292 | asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; |
| 13293 | asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID); |
| 13294 | asc_dvc->start_motor = eep_config.start_motor; |
| 13295 | asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay; |
| 13296 | asc_dvc->bios_ctrl = eep_config.bios_ctrl; |
| 13297 | asc_dvc->no_scam = eep_config.scam_tolerant; |
| 13298 | asc_dvc->cfg->serial1 = eep_config.serial_number_word1; |
| 13299 | asc_dvc->cfg->serial2 = eep_config.serial_number_word2; |
| 13300 | asc_dvc->cfg->serial3 = eep_config.serial_number_word3; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13301 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13302 | /* |
| 13303 | * For every Target ID if any of its 'sdtr_speed[1234]' bits |
| 13304 | * are set, then set an 'sdtr_able' bit for it. |
| 13305 | */ |
| 13306 | asc_dvc->sdtr_able = 0; |
| 13307 | for (tid = 0; tid <= ADV_MAX_TID; tid++) { |
| 13308 | if (tid == 0) { |
| 13309 | sdtr_speed = asc_dvc->sdtr_speed1; |
| 13310 | } else if (tid == 4) { |
| 13311 | sdtr_speed = asc_dvc->sdtr_speed2; |
| 13312 | } else if (tid == 8) { |
| 13313 | sdtr_speed = asc_dvc->sdtr_speed3; |
| 13314 | } else if (tid == 12) { |
| 13315 | sdtr_speed = asc_dvc->sdtr_speed4; |
| 13316 | } |
| 13317 | if (sdtr_speed & ADV_MAX_TID) { |
| 13318 | asc_dvc->sdtr_able |= (1 << tid); |
| 13319 | } |
| 13320 | sdtr_speed >>= 4; |
| 13321 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13322 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13323 | /* |
| 13324 | * Set the host maximum queuing (max. 253, min. 16) and the per device |
| 13325 | * maximum queuing (max. 63, min. 4). |
| 13326 | */ |
| 13327 | if (eep_config.max_host_qng > ASC_DEF_MAX_HOST_QNG) { |
| 13328 | eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG; |
| 13329 | } else if (eep_config.max_host_qng < ASC_DEF_MIN_HOST_QNG) { |
| 13330 | /* If the value is zero, assume it is uninitialized. */ |
| 13331 | if (eep_config.max_host_qng == 0) { |
| 13332 | eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG; |
| 13333 | } else { |
| 13334 | eep_config.max_host_qng = ASC_DEF_MIN_HOST_QNG; |
| 13335 | } |
| 13336 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13337 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13338 | if (eep_config.max_dvc_qng > ASC_DEF_MAX_DVC_QNG) { |
| 13339 | eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG; |
| 13340 | } else if (eep_config.max_dvc_qng < ASC_DEF_MIN_DVC_QNG) { |
| 13341 | /* If the value is zero, assume it is uninitialized. */ |
| 13342 | if (eep_config.max_dvc_qng == 0) { |
| 13343 | eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG; |
| 13344 | } else { |
| 13345 | eep_config.max_dvc_qng = ASC_DEF_MIN_DVC_QNG; |
| 13346 | } |
| 13347 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13348 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13349 | /* |
| 13350 | * If 'max_dvc_qng' is greater than 'max_host_qng', then |
| 13351 | * set 'max_dvc_qng' to 'max_host_qng'. |
| 13352 | */ |
| 13353 | if (eep_config.max_dvc_qng > eep_config.max_host_qng) { |
| 13354 | eep_config.max_dvc_qng = eep_config.max_host_qng; |
| 13355 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13356 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13357 | /* |
| 13358 | * Set ADV_DVC_VAR 'max_host_qng' and ADV_DVC_VAR 'max_dvc_qng' |
| 13359 | * values based on possibly adjusted EEPROM values. |
| 13360 | */ |
| 13361 | asc_dvc->max_host_qng = eep_config.max_host_qng; |
| 13362 | asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13363 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13364 | /* |
| 13365 | * If the EEPROM 'termination' field is set to automatic (0), then set |
| 13366 | * the ADV_DVC_CFG 'termination' field to automatic also. |
| 13367 | * |
| 13368 | * If the termination is specified with a non-zero 'termination' |
| 13369 | * value check that a legal value is set and set the ADV_DVC_CFG |
| 13370 | * 'termination' field appropriately. |
| 13371 | */ |
| 13372 | if (eep_config.termination_se == 0) { |
| 13373 | termination = 0; /* auto termination for SE */ |
| 13374 | } else { |
| 13375 | /* Enable manual control with low off / high off. */ |
| 13376 | if (eep_config.termination_se == 1) { |
| 13377 | termination = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13378 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13379 | /* Enable manual control with low off / high on. */ |
| 13380 | } else if (eep_config.termination_se == 2) { |
| 13381 | termination = TERM_SE_HI; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13382 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13383 | /* Enable manual control with low on / high on. */ |
| 13384 | } else if (eep_config.termination_se == 3) { |
| 13385 | termination = TERM_SE; |
| 13386 | } else { |
| 13387 | /* |
| 13388 | * The EEPROM 'termination_se' field contains a bad value. |
| 13389 | * Use automatic termination instead. |
| 13390 | */ |
| 13391 | termination = 0; |
| 13392 | warn_code |= ASC_WARN_EEPROM_TERMINATION; |
| 13393 | } |
| 13394 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13395 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13396 | if (eep_config.termination_lvd == 0) { |
| 13397 | asc_dvc->cfg->termination = termination; /* auto termination for LVD */ |
| 13398 | } else { |
| 13399 | /* Enable manual control with low off / high off. */ |
| 13400 | if (eep_config.termination_lvd == 1) { |
| 13401 | asc_dvc->cfg->termination = termination; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13402 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13403 | /* Enable manual control with low off / high on. */ |
| 13404 | } else if (eep_config.termination_lvd == 2) { |
| 13405 | asc_dvc->cfg->termination = termination | TERM_LVD_HI; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13406 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13407 | /* Enable manual control with low on / high on. */ |
| 13408 | } else if (eep_config.termination_lvd == 3) { |
| 13409 | asc_dvc->cfg->termination = termination | TERM_LVD; |
| 13410 | } else { |
| 13411 | /* |
| 13412 | * The EEPROM 'termination_lvd' field contains a bad value. |
| 13413 | * Use automatic termination instead. |
| 13414 | */ |
| 13415 | asc_dvc->cfg->termination = termination; |
| 13416 | warn_code |= ASC_WARN_EEPROM_TERMINATION; |
| 13417 | } |
| 13418 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13419 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13420 | return warn_code; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13421 | } |
| 13422 | |
| 13423 | /* |
| 13424 | * Read the board's EEPROM configuration. Set fields in ASC_DVC_VAR and |
| 13425 | * ASC_DVC_CFG based on the EEPROM settings. The chip is stopped while |
| 13426 | * all of this is done. |
| 13427 | * |
| 13428 | * On failure set the ASC_DVC_VAR field 'err_code' and return ADV_ERROR. |
| 13429 | * |
| 13430 | * For a non-fatal error return a warning code. If there are no warnings |
| 13431 | * then 0 is returned. |
| 13432 | * |
| 13433 | * Note: Chip is stopped on entry. |
| 13434 | */ |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 13435 | static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13436 | { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13437 | AdvPortAddr iop_base; |
| 13438 | ushort warn_code; |
| 13439 | ADVEEP_38C1600_CONFIG eep_config; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13440 | uchar tid, termination; |
| 13441 | ushort sdtr_speed = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13442 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13443 | iop_base = asc_dvc->iop_base; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13444 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13445 | warn_code = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13446 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13447 | /* |
| 13448 | * Read the board's EEPROM configuration. |
| 13449 | * |
| 13450 | * Set default values if a bad checksum is found. |
| 13451 | */ |
| 13452 | if (AdvGet38C1600EEPConfig(iop_base, &eep_config) != |
| 13453 | eep_config.check_sum) { |
Matthew Wilcox | 13ac2d9 | 2007-07-30 08:10:23 -0600 | [diff] [blame] | 13454 | struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13455 | warn_code |= ASC_WARN_EEPROM_CHKSUM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13456 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13457 | /* |
| 13458 | * Set EEPROM default values. |
| 13459 | */ |
Matthew Wilcox | d68f432 | 2007-07-26 11:58:12 -0400 | [diff] [blame] | 13460 | memcpy(&eep_config, &Default_38C1600_EEPROM_Config, |
| 13461 | sizeof(ADVEEP_38C1600_CONFIG)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13462 | |
Matthew Wilcox | d68f432 | 2007-07-26 11:58:12 -0400 | [diff] [blame] | 13463 | if (PCI_FUNC(pdev->devfn) != 0) { |
| 13464 | u8 ints; |
| 13465 | /* |
| 13466 | * Disable Bit 14 (BIOS_ENABLE) to fix SPARC Ultra 60 |
| 13467 | * and old Mac system booting problem. The Expansion |
| 13468 | * ROM must be disabled in Function 1 for these systems |
| 13469 | */ |
| 13470 | eep_config.cfg_lsw &= ~ADV_EEPROM_BIOS_ENABLE; |
| 13471 | /* |
| 13472 | * Clear the INTAB (bit 11) if the GPIO 0 input |
| 13473 | * indicates the Function 1 interrupt line is wired |
| 13474 | * to INTB. |
| 13475 | * |
| 13476 | * Set/Clear Bit 11 (INTAB) from the GPIO bit 0 input: |
| 13477 | * 1 - Function 1 interrupt line wired to INT A. |
| 13478 | * 0 - Function 1 interrupt line wired to INT B. |
| 13479 | * |
| 13480 | * Note: Function 0 is always wired to INTA. |
| 13481 | * Put all 5 GPIO bits in input mode and then read |
| 13482 | * their input values. |
| 13483 | */ |
| 13484 | AdvWriteByteRegister(iop_base, IOPB_GPIO_CNTL, 0); |
| 13485 | ints = AdvReadByteRegister(iop_base, IOPB_GPIO_DATA); |
| 13486 | if ((ints & 0x01) == 0) |
| 13487 | eep_config.cfg_lsw &= ~ADV_EEPROM_INTAB; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13488 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13489 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13490 | /* |
Matthew Wilcox | d68f432 | 2007-07-26 11:58:12 -0400 | [diff] [blame] | 13491 | * Assume the 6 byte board serial number that was read from |
| 13492 | * EEPROM is correct even if the EEPROM checksum failed. |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13493 | */ |
| 13494 | eep_config.serial_number_word3 = |
Matthew Wilcox | d68f432 | 2007-07-26 11:58:12 -0400 | [diff] [blame] | 13495 | AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13496 | eep_config.serial_number_word2 = |
Matthew Wilcox | d68f432 | 2007-07-26 11:58:12 -0400 | [diff] [blame] | 13497 | AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13498 | eep_config.serial_number_word1 = |
Matthew Wilcox | d68f432 | 2007-07-26 11:58:12 -0400 | [diff] [blame] | 13499 | AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13500 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13501 | AdvSet38C1600EEPConfig(iop_base, &eep_config); |
| 13502 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13503 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13504 | /* |
| 13505 | * Set ASC_DVC_VAR and ASC_DVC_CFG variables from the |
| 13506 | * EEPROM configuration that was read. |
| 13507 | * |
| 13508 | * This is the mapping of EEPROM fields to Adv Library fields. |
| 13509 | */ |
| 13510 | asc_dvc->wdtr_able = eep_config.wdtr_able; |
| 13511 | asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1; |
| 13512 | asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2; |
| 13513 | asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3; |
| 13514 | asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4; |
| 13515 | asc_dvc->ppr_able = 0; |
| 13516 | asc_dvc->tagqng_able = eep_config.tagqng_able; |
| 13517 | asc_dvc->cfg->disc_enable = eep_config.disc_enable; |
| 13518 | asc_dvc->max_host_qng = eep_config.max_host_qng; |
| 13519 | asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; |
| 13520 | asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ASC_MAX_TID); |
| 13521 | asc_dvc->start_motor = eep_config.start_motor; |
| 13522 | asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay; |
| 13523 | asc_dvc->bios_ctrl = eep_config.bios_ctrl; |
| 13524 | asc_dvc->no_scam = eep_config.scam_tolerant; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13525 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13526 | /* |
| 13527 | * For every Target ID if any of its 'sdtr_speed[1234]' bits |
| 13528 | * are set, then set an 'sdtr_able' bit for it. |
| 13529 | */ |
| 13530 | asc_dvc->sdtr_able = 0; |
| 13531 | for (tid = 0; tid <= ASC_MAX_TID; tid++) { |
| 13532 | if (tid == 0) { |
| 13533 | sdtr_speed = asc_dvc->sdtr_speed1; |
| 13534 | } else if (tid == 4) { |
| 13535 | sdtr_speed = asc_dvc->sdtr_speed2; |
| 13536 | } else if (tid == 8) { |
| 13537 | sdtr_speed = asc_dvc->sdtr_speed3; |
| 13538 | } else if (tid == 12) { |
| 13539 | sdtr_speed = asc_dvc->sdtr_speed4; |
| 13540 | } |
| 13541 | if (sdtr_speed & ASC_MAX_TID) { |
| 13542 | asc_dvc->sdtr_able |= (1 << tid); |
| 13543 | } |
| 13544 | sdtr_speed >>= 4; |
| 13545 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13546 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13547 | /* |
| 13548 | * Set the host maximum queuing (max. 253, min. 16) and the per device |
| 13549 | * maximum queuing (max. 63, min. 4). |
| 13550 | */ |
| 13551 | if (eep_config.max_host_qng > ASC_DEF_MAX_HOST_QNG) { |
| 13552 | eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG; |
| 13553 | } else if (eep_config.max_host_qng < ASC_DEF_MIN_HOST_QNG) { |
| 13554 | /* If the value is zero, assume it is uninitialized. */ |
| 13555 | if (eep_config.max_host_qng == 0) { |
| 13556 | eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG; |
| 13557 | } else { |
| 13558 | eep_config.max_host_qng = ASC_DEF_MIN_HOST_QNG; |
| 13559 | } |
| 13560 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13561 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13562 | if (eep_config.max_dvc_qng > ASC_DEF_MAX_DVC_QNG) { |
| 13563 | eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG; |
| 13564 | } else if (eep_config.max_dvc_qng < ASC_DEF_MIN_DVC_QNG) { |
| 13565 | /* If the value is zero, assume it is uninitialized. */ |
| 13566 | if (eep_config.max_dvc_qng == 0) { |
| 13567 | eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG; |
| 13568 | } else { |
| 13569 | eep_config.max_dvc_qng = ASC_DEF_MIN_DVC_QNG; |
| 13570 | } |
| 13571 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13572 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13573 | /* |
| 13574 | * If 'max_dvc_qng' is greater than 'max_host_qng', then |
| 13575 | * set 'max_dvc_qng' to 'max_host_qng'. |
| 13576 | */ |
| 13577 | if (eep_config.max_dvc_qng > eep_config.max_host_qng) { |
| 13578 | eep_config.max_dvc_qng = eep_config.max_host_qng; |
| 13579 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13580 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13581 | /* |
| 13582 | * Set ASC_DVC_VAR 'max_host_qng' and ASC_DVC_VAR 'max_dvc_qng' |
| 13583 | * values based on possibly adjusted EEPROM values. |
| 13584 | */ |
| 13585 | asc_dvc->max_host_qng = eep_config.max_host_qng; |
| 13586 | asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13587 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13588 | /* |
| 13589 | * If the EEPROM 'termination' field is set to automatic (0), then set |
| 13590 | * the ASC_DVC_CFG 'termination' field to automatic also. |
| 13591 | * |
| 13592 | * If the termination is specified with a non-zero 'termination' |
| 13593 | * value check that a legal value is set and set the ASC_DVC_CFG |
| 13594 | * 'termination' field appropriately. |
| 13595 | */ |
| 13596 | if (eep_config.termination_se == 0) { |
| 13597 | termination = 0; /* auto termination for SE */ |
| 13598 | } else { |
| 13599 | /* Enable manual control with low off / high off. */ |
| 13600 | if (eep_config.termination_se == 1) { |
| 13601 | termination = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13602 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13603 | /* Enable manual control with low off / high on. */ |
| 13604 | } else if (eep_config.termination_se == 2) { |
| 13605 | termination = TERM_SE_HI; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13606 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13607 | /* Enable manual control with low on / high on. */ |
| 13608 | } else if (eep_config.termination_se == 3) { |
| 13609 | termination = TERM_SE; |
| 13610 | } else { |
| 13611 | /* |
| 13612 | * The EEPROM 'termination_se' field contains a bad value. |
| 13613 | * Use automatic termination instead. |
| 13614 | */ |
| 13615 | termination = 0; |
| 13616 | warn_code |= ASC_WARN_EEPROM_TERMINATION; |
| 13617 | } |
| 13618 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13619 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13620 | if (eep_config.termination_lvd == 0) { |
| 13621 | asc_dvc->cfg->termination = termination; /* auto termination for LVD */ |
| 13622 | } else { |
| 13623 | /* Enable manual control with low off / high off. */ |
| 13624 | if (eep_config.termination_lvd == 1) { |
| 13625 | asc_dvc->cfg->termination = termination; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13626 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13627 | /* Enable manual control with low off / high on. */ |
| 13628 | } else if (eep_config.termination_lvd == 2) { |
| 13629 | asc_dvc->cfg->termination = termination | TERM_LVD_HI; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13630 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13631 | /* Enable manual control with low on / high on. */ |
| 13632 | } else if (eep_config.termination_lvd == 3) { |
| 13633 | asc_dvc->cfg->termination = termination | TERM_LVD; |
| 13634 | } else { |
| 13635 | /* |
| 13636 | * The EEPROM 'termination_lvd' field contains a bad value. |
| 13637 | * Use automatic termination instead. |
| 13638 | */ |
| 13639 | asc_dvc->cfg->termination = termination; |
| 13640 | warn_code |= ASC_WARN_EEPROM_TERMINATION; |
| 13641 | } |
| 13642 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13643 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13644 | return warn_code; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13645 | } |
| 13646 | |
| 13647 | /* |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13648 | * Initialize the ADV_DVC_VAR structure. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13649 | * |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13650 | * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13651 | * |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13652 | * For a non-fatal error return a warning code. If there are no warnings |
| 13653 | * then 0 is returned. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13654 | */ |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13655 | static int __devinit |
| 13656 | AdvInitGetConfig(struct pci_dev *pdev, asc_board_t *boardp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13657 | { |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13658 | ADV_DVC_VAR *asc_dvc = &boardp->dvc_var.adv_dvc_var; |
| 13659 | unsigned short warn_code = 0; |
| 13660 | AdvPortAddr iop_base = asc_dvc->iop_base; |
| 13661 | u16 cmd; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13662 | int status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13663 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13664 | asc_dvc->err_code = 0; |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13665 | |
| 13666 | /* |
| 13667 | * Save the state of the PCI Configuration Command Register |
| 13668 | * "Parity Error Response Control" Bit. If the bit is clear (0), |
| 13669 | * in AdvInitAsc3550/38C0800Driver() tell the microcode to ignore |
| 13670 | * DMA parity errors. |
| 13671 | */ |
| 13672 | asc_dvc->cfg->control_flag = 0; |
| 13673 | pci_read_config_word(pdev, PCI_COMMAND, &cmd); |
| 13674 | if ((cmd & PCI_COMMAND_PARITY) == 0) |
| 13675 | asc_dvc->cfg->control_flag |= CONTROL_FLAG_IGNORE_PERR; |
| 13676 | |
| 13677 | asc_dvc->cfg->lib_version = (ADV_LIB_VERSION_MAJOR << 8) | |
| 13678 | ADV_LIB_VERSION_MINOR; |
| 13679 | asc_dvc->cfg->chip_version = |
| 13680 | AdvGetChipVersion(iop_base, asc_dvc->bus_type); |
| 13681 | |
| 13682 | ASC_DBG2(1, "AdvInitGetConfig: iopb_chip_id_1: 0x%x 0x%x\n", |
| 13683 | (ushort)AdvReadByteRegister(iop_base, IOPB_CHIP_ID_1), |
| 13684 | (ushort)ADV_CHIP_ID_BYTE); |
| 13685 | |
| 13686 | ASC_DBG2(1, "AdvInitGetConfig: iopw_chip_id_0: 0x%x 0x%x\n", |
| 13687 | (ushort)AdvReadWordRegister(iop_base, IOPW_CHIP_ID_0), |
| 13688 | (ushort)ADV_CHIP_ID_WORD); |
| 13689 | |
| 13690 | /* |
| 13691 | * Reset the chip to start and allow register writes. |
| 13692 | */ |
| 13693 | if (AdvFindSignature(iop_base) == 0) { |
| 13694 | asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; |
| 13695 | return ADV_ERROR; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13696 | } else { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13697 | /* |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13698 | * The caller must set 'chip_type' to a valid setting. |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13699 | */ |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13700 | if (asc_dvc->chip_type != ADV_CHIP_ASC3550 && |
| 13701 | asc_dvc->chip_type != ADV_CHIP_ASC38C0800 && |
| 13702 | asc_dvc->chip_type != ADV_CHIP_ASC38C1600) { |
| 13703 | asc_dvc->err_code |= ASC_IERR_BAD_CHIPTYPE; |
| 13704 | return ADV_ERROR; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13705 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13706 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13707 | /* |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13708 | * Reset Chip. |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13709 | */ |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13710 | AdvWriteWordRegister(iop_base, IOPW_CTRL_REG, |
| 13711 | ADV_CTRL_REG_CMD_RESET); |
| 13712 | mdelay(100); |
| 13713 | AdvWriteWordRegister(iop_base, IOPW_CTRL_REG, |
| 13714 | ADV_CTRL_REG_CMD_WR_IO_REG); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13715 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13716 | if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { |
| 13717 | status = AdvInitFrom38C1600EEP(asc_dvc); |
| 13718 | } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { |
| 13719 | status = AdvInitFrom38C0800EEP(asc_dvc); |
| 13720 | } else { |
| 13721 | status = AdvInitFrom3550EEP(asc_dvc); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13722 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13723 | warn_code |= status; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13724 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13725 | |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13726 | if (warn_code != 0) { |
| 13727 | ASC_PRINT2("AdvInitGetConfig: board %d: warning: 0x%x\n", |
| 13728 | boardp->id, warn_code); |
| 13729 | } |
| 13730 | |
| 13731 | if (asc_dvc->err_code) { |
| 13732 | ASC_PRINT2("AdvInitGetConfig: board %d error: err_code 0x%x\n", |
| 13733 | boardp->id, asc_dvc->err_code); |
| 13734 | } |
| 13735 | |
| 13736 | return asc_dvc->err_code; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13737 | } |
Matthew Wilcox | 5121935 | 2007-10-02 21:55:22 -0400 | [diff] [blame] | 13738 | #endif |
| 13739 | |
| 13740 | static struct scsi_host_template advansys_template = { |
| 13741 | .proc_name = DRV_NAME, |
| 13742 | #ifdef CONFIG_PROC_FS |
| 13743 | .proc_info = advansys_proc_info, |
| 13744 | #endif |
| 13745 | .name = DRV_NAME, |
| 13746 | .info = advansys_info, |
| 13747 | .queuecommand = advansys_queuecommand, |
| 13748 | .eh_bus_reset_handler = advansys_reset, |
| 13749 | .bios_param = advansys_biosparam, |
| 13750 | .slave_configure = advansys_slave_configure, |
| 13751 | /* |
| 13752 | * Because the driver may control an ISA adapter 'unchecked_isa_dma' |
| 13753 | * must be set. The flag will be cleared in advansys_board_found |
| 13754 | * for non-ISA adapters. |
| 13755 | */ |
| 13756 | .unchecked_isa_dma = 1, |
| 13757 | /* |
| 13758 | * All adapters controlled by this driver are capable of large |
| 13759 | * scatter-gather lists. According to the mid-level SCSI documentation |
| 13760 | * this obviates any performance gain provided by setting |
| 13761 | * 'use_clustering'. But empirically while CPU utilization is increased |
| 13762 | * by enabling clustering, I/O throughput increases as well. |
| 13763 | */ |
| 13764 | .use_clustering = ENABLE_CLUSTERING, |
| 13765 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13766 | |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 13767 | static int __devinit |
| 13768 | advansys_wide_init_chip(asc_board_t *boardp, ADV_DVC_VAR *adv_dvc_varp) |
| 13769 | { |
| 13770 | int req_cnt = 0; |
| 13771 | adv_req_t *reqp = NULL; |
| 13772 | int sg_cnt = 0; |
| 13773 | adv_sgblk_t *sgp; |
| 13774 | int warn_code, err_code; |
| 13775 | |
| 13776 | /* |
| 13777 | * Allocate buffer carrier structures. The total size |
| 13778 | * is about 4 KB, so allocate all at once. |
| 13779 | */ |
| 13780 | boardp->carrp = kmalloc(ADV_CARRIER_BUFSIZE, GFP_KERNEL); |
| 13781 | ASC_DBG1(1, "advansys_wide_init_chip: carrp 0x%p\n", boardp->carrp); |
| 13782 | |
| 13783 | if (!boardp->carrp) |
| 13784 | goto kmalloc_failed; |
| 13785 | |
| 13786 | /* |
| 13787 | * Allocate up to 'max_host_qng' request structures for the Wide |
| 13788 | * board. The total size is about 16 KB, so allocate all at once. |
| 13789 | * If the allocation fails decrement and try again. |
| 13790 | */ |
| 13791 | for (req_cnt = adv_dvc_varp->max_host_qng; req_cnt > 0; req_cnt--) { |
| 13792 | reqp = kmalloc(sizeof(adv_req_t) * req_cnt, GFP_KERNEL); |
| 13793 | |
| 13794 | ASC_DBG3(1, "advansys_wide_init_chip: reqp 0x%p, req_cnt %d, " |
| 13795 | "bytes %lu\n", reqp, req_cnt, |
| 13796 | (ulong)sizeof(adv_req_t) * req_cnt); |
| 13797 | |
| 13798 | if (reqp) |
| 13799 | break; |
| 13800 | } |
| 13801 | |
| 13802 | if (!reqp) |
| 13803 | goto kmalloc_failed; |
| 13804 | |
| 13805 | boardp->orig_reqp = reqp; |
| 13806 | |
| 13807 | /* |
| 13808 | * Allocate up to ADV_TOT_SG_BLOCK request structures for |
| 13809 | * the Wide board. Each structure is about 136 bytes. |
| 13810 | */ |
| 13811 | boardp->adv_sgblkp = NULL; |
| 13812 | for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) { |
| 13813 | sgp = kmalloc(sizeof(adv_sgblk_t), GFP_KERNEL); |
| 13814 | |
| 13815 | if (!sgp) |
| 13816 | break; |
| 13817 | |
| 13818 | sgp->next_sgblkp = boardp->adv_sgblkp; |
| 13819 | boardp->adv_sgblkp = sgp; |
| 13820 | |
| 13821 | } |
| 13822 | |
| 13823 | ASC_DBG3(1, "advansys_wide_init_chip: sg_cnt %d * %u = %u bytes\n", |
| 13824 | sg_cnt, sizeof(adv_sgblk_t), |
| 13825 | (unsigned)(sizeof(adv_sgblk_t) * sg_cnt)); |
| 13826 | |
| 13827 | if (!boardp->adv_sgblkp) |
| 13828 | goto kmalloc_failed; |
| 13829 | |
| 13830 | adv_dvc_varp->carrier_buf = boardp->carrp; |
| 13831 | |
| 13832 | /* |
| 13833 | * Point 'adv_reqp' to the request structures and |
| 13834 | * link them together. |
| 13835 | */ |
| 13836 | req_cnt--; |
| 13837 | reqp[req_cnt].next_reqp = NULL; |
| 13838 | for (; req_cnt > 0; req_cnt--) { |
| 13839 | reqp[req_cnt - 1].next_reqp = &reqp[req_cnt]; |
| 13840 | } |
| 13841 | boardp->adv_reqp = &reqp[0]; |
| 13842 | |
| 13843 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 13844 | ASC_DBG(2, "advansys_wide_init_chip: AdvInitAsc3550Driver()\n"); |
| 13845 | warn_code = AdvInitAsc3550Driver(adv_dvc_varp); |
| 13846 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
| 13847 | ASC_DBG(2, "advansys_wide_init_chip: AdvInitAsc38C0800Driver()" |
| 13848 | "\n"); |
| 13849 | warn_code = AdvInitAsc38C0800Driver(adv_dvc_varp); |
| 13850 | } else { |
| 13851 | ASC_DBG(2, "advansys_wide_init_chip: AdvInitAsc38C1600Driver()" |
| 13852 | "\n"); |
| 13853 | warn_code = AdvInitAsc38C1600Driver(adv_dvc_varp); |
| 13854 | } |
| 13855 | err_code = adv_dvc_varp->err_code; |
| 13856 | |
| 13857 | if (warn_code || err_code) { |
| 13858 | ASC_PRINT3("advansys_wide_init_chip: board %d error: warn 0x%x," |
| 13859 | " error 0x%x\n", boardp->id, warn_code, err_code); |
| 13860 | } |
| 13861 | |
| 13862 | goto exit; |
| 13863 | |
| 13864 | kmalloc_failed: |
| 13865 | ASC_PRINT1("advansys_wide_init_chip: board %d error: kmalloc() " |
| 13866 | "failed\n", boardp->id); |
| 13867 | err_code = ADV_ERROR; |
| 13868 | exit: |
| 13869 | return err_code; |
| 13870 | } |
| 13871 | |
| 13872 | static void advansys_wide_free_mem(asc_board_t *boardp) |
| 13873 | { |
| 13874 | kfree(boardp->carrp); |
| 13875 | boardp->carrp = NULL; |
| 13876 | kfree(boardp->orig_reqp); |
| 13877 | boardp->orig_reqp = boardp->adv_reqp = NULL; |
| 13878 | while (boardp->adv_sgblkp) { |
| 13879 | adv_sgblk_t *sgp = boardp->adv_sgblkp; |
| 13880 | boardp->adv_sgblkp = sgp->next_sgblkp; |
| 13881 | kfree(sgp); |
| 13882 | } |
| 13883 | } |
| 13884 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13885 | static struct Scsi_Host *__devinit |
| 13886 | advansys_board_found(int iop, struct device *dev, int bus_type) |
| 13887 | { |
| 13888 | struct Scsi_Host *shost; |
| 13889 | struct pci_dev *pdev = bus_type == ASC_IS_PCI ? to_pci_dev(dev) : NULL; |
| 13890 | asc_board_t *boardp; |
| 13891 | ASC_DVC_VAR *asc_dvc_varp = NULL; |
| 13892 | ADV_DVC_VAR *adv_dvc_varp = NULL; |
Matthew Wilcox | 074c8fe | 2007-07-28 23:11:05 -0600 | [diff] [blame] | 13893 | int share_irq; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13894 | int warn_code, err_code; |
| 13895 | int ret; |
| 13896 | |
| 13897 | /* |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13898 | * Register the adapter, get its configuration, and |
| 13899 | * initialize it. |
| 13900 | */ |
Matthew Wilcox | 8dfb537 | 2007-07-30 09:08:34 -0600 | [diff] [blame] | 13901 | ASC_DBG(2, "advansys_board_found: scsi_host_alloc()\n"); |
| 13902 | shost = scsi_host_alloc(&advansys_template, sizeof(asc_board_t)); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13903 | if (!shost) |
| 13904 | return NULL; |
| 13905 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13906 | /* Initialize private per board data */ |
| 13907 | boardp = ASC_BOARDP(shost); |
| 13908 | memset(boardp, 0, sizeof(asc_board_t)); |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 13909 | boardp->id = asc_board_count++; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13910 | spin_lock_init(&boardp->lock); |
Matthew Wilcox | 394dbf3 | 2007-07-26 11:56:40 -0400 | [diff] [blame] | 13911 | boardp->dev = dev; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13912 | |
| 13913 | /* |
| 13914 | * Handle both narrow and wide boards. |
| 13915 | * |
| 13916 | * If a Wide board was detected, set the board structure |
| 13917 | * wide board flag. Set-up the board structure based on |
| 13918 | * the board type. |
| 13919 | */ |
| 13920 | #ifdef CONFIG_PCI |
| 13921 | if (bus_type == ASC_IS_PCI && |
| 13922 | (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW || |
| 13923 | pdev->device == PCI_DEVICE_ID_38C0800_REV1 || |
| 13924 | pdev->device == PCI_DEVICE_ID_38C1600_REV1)) { |
| 13925 | boardp->flags |= ASC_IS_WIDE_BOARD; |
| 13926 | } |
| 13927 | #endif /* CONFIG_PCI */ |
| 13928 | |
| 13929 | if (ASC_NARROW_BOARD(boardp)) { |
| 13930 | ASC_DBG(1, "advansys_board_found: narrow board\n"); |
| 13931 | asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; |
| 13932 | asc_dvc_varp->bus_type = bus_type; |
| 13933 | asc_dvc_varp->drv_ptr = boardp; |
| 13934 | asc_dvc_varp->cfg = &boardp->dvc_cfg.asc_dvc_cfg; |
| 13935 | asc_dvc_varp->cfg->overrun_buf = &overrun_buf[0]; |
| 13936 | asc_dvc_varp->iop_base = iop; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13937 | } else { |
Matthew Wilcox | 57ba5fe | 2007-07-26 11:55:07 -0400 | [diff] [blame] | 13938 | #ifdef CONFIG_PCI |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13939 | ASC_DBG(1, "advansys_board_found: wide board\n"); |
| 13940 | adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; |
| 13941 | adv_dvc_varp->drv_ptr = boardp; |
| 13942 | adv_dvc_varp->cfg = &boardp->dvc_cfg.adv_dvc_cfg; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13943 | if (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW) { |
| 13944 | ASC_DBG(1, "advansys_board_found: ASC-3550\n"); |
| 13945 | adv_dvc_varp->chip_type = ADV_CHIP_ASC3550; |
| 13946 | } else if (pdev->device == PCI_DEVICE_ID_38C0800_REV1) { |
| 13947 | ASC_DBG(1, "advansys_board_found: ASC-38C0800\n"); |
| 13948 | adv_dvc_varp->chip_type = ADV_CHIP_ASC38C0800; |
| 13949 | } else { |
| 13950 | ASC_DBG(1, "advansys_board_found: ASC-38C1600\n"); |
| 13951 | adv_dvc_varp->chip_type = ADV_CHIP_ASC38C1600; |
| 13952 | } |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13953 | |
Matthew Wilcox | 57ba5fe | 2007-07-26 11:55:07 -0400 | [diff] [blame] | 13954 | boardp->asc_n_io_port = pci_resource_len(pdev, 1); |
| 13955 | boardp->ioremap_addr = ioremap(pci_resource_start(pdev, 1), |
| 13956 | boardp->asc_n_io_port); |
| 13957 | if (!boardp->ioremap_addr) { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13958 | ASC_PRINT3 |
| 13959 | ("advansys_board_found: board %d: ioremap(%x, %d) returned NULL\n", |
Matthew Wilcox | 57ba5fe | 2007-07-26 11:55:07 -0400 | [diff] [blame] | 13960 | boardp->id, pci_resource_start(pdev, 1), |
| 13961 | boardp->asc_n_io_port); |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 13962 | goto err_shost; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13963 | } |
Matthew Wilcox | 57ba5fe | 2007-07-26 11:55:07 -0400 | [diff] [blame] | 13964 | adv_dvc_varp->iop_base = (AdvPortAddr)boardp->ioremap_addr |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 13965 | ASC_DBG1(1, "advansys_board_found: iop_base: 0x%lx\n", |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13966 | adv_dvc_varp->iop_base); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13967 | |
| 13968 | /* |
| 13969 | * Even though it isn't used to access wide boards, other |
| 13970 | * than for the debug line below, save I/O Port address so |
| 13971 | * that it can be reported. |
| 13972 | */ |
| 13973 | boardp->ioport = iop; |
| 13974 | |
Matthew Wilcox | 57ba5fe | 2007-07-26 11:55:07 -0400 | [diff] [blame] | 13975 | ASC_DBG2(1, "advansys_board_found: iopb_chip_id_1 0x%x, " |
| 13976 | "iopw_chip_id_0 0x%x\n", (ushort)inp(iop + 1), |
| 13977 | (ushort)inpw(iop)); |
| 13978 | #endif /* CONFIG_PCI */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13979 | } |
| 13980 | |
| 13981 | #ifdef CONFIG_PROC_FS |
| 13982 | /* |
| 13983 | * Allocate buffer for printing information from |
| 13984 | * /proc/scsi/advansys/[0...]. |
| 13985 | */ |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 13986 | boardp->prtbuf = kmalloc(ASC_PRTBUF_SIZE, GFP_KERNEL); |
| 13987 | if (!boardp->prtbuf) { |
| 13988 | ASC_PRINT2("advansys_board_found: board %d: kmalloc(%d) " |
| 13989 | "returned NULL\n", boardp->id, ASC_PRTBUF_SIZE); |
| 13990 | goto err_unmap; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13991 | } |
| 13992 | #endif /* CONFIG_PROC_FS */ |
| 13993 | |
| 13994 | if (ASC_NARROW_BOARD(boardp)) { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 13995 | /* |
| 13996 | * Set the board bus type and PCI IRQ before |
| 13997 | * calling AscInitGetConfig(). |
| 13998 | */ |
| 13999 | switch (asc_dvc_varp->bus_type) { |
| 14000 | #ifdef CONFIG_ISA |
| 14001 | case ASC_IS_ISA: |
| 14002 | shost->unchecked_isa_dma = TRUE; |
Matthew Wilcox | 074c8fe | 2007-07-28 23:11:05 -0600 | [diff] [blame] | 14003 | share_irq = 0; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14004 | break; |
| 14005 | case ASC_IS_VL: |
| 14006 | shost->unchecked_isa_dma = FALSE; |
Matthew Wilcox | 074c8fe | 2007-07-28 23:11:05 -0600 | [diff] [blame] | 14007 | share_irq = 0; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14008 | break; |
| 14009 | case ASC_IS_EISA: |
| 14010 | shost->unchecked_isa_dma = FALSE; |
Matthew Wilcox | 074c8fe | 2007-07-28 23:11:05 -0600 | [diff] [blame] | 14011 | share_irq = IRQF_SHARED; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14012 | break; |
| 14013 | #endif /* CONFIG_ISA */ |
| 14014 | #ifdef CONFIG_PCI |
| 14015 | case ASC_IS_PCI: |
| 14016 | shost->irq = asc_dvc_varp->irq_no = pdev->irq; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14017 | shost->unchecked_isa_dma = FALSE; |
Matthew Wilcox | 074c8fe | 2007-07-28 23:11:05 -0600 | [diff] [blame] | 14018 | share_irq = IRQF_SHARED; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14019 | break; |
| 14020 | #endif /* CONFIG_PCI */ |
| 14021 | default: |
| 14022 | ASC_PRINT2 |
| 14023 | ("advansys_board_found: board %d: unknown adapter type: %d\n", |
| 14024 | boardp->id, asc_dvc_varp->bus_type); |
| 14025 | shost->unchecked_isa_dma = TRUE; |
Matthew Wilcox | 074c8fe | 2007-07-28 23:11:05 -0600 | [diff] [blame] | 14026 | share_irq = 0; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14027 | break; |
| 14028 | } |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14029 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14030 | /* |
| 14031 | * NOTE: AscInitGetConfig() may change the board's |
| 14032 | * bus_type value. The bus_type value should no |
| 14033 | * longer be used. If the bus_type field must be |
| 14034 | * referenced only use the bit-wise AND operator "&". |
| 14035 | */ |
| 14036 | ASC_DBG(2, "advansys_board_found: AscInitGetConfig()\n"); |
Matthew Wilcox | c2dce2f | 2007-09-09 08:56:30 -0600 | [diff] [blame] | 14037 | err_code = AscInitGetConfig(boardp); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14038 | } else { |
Matthew Wilcox | c2dce2f | 2007-09-09 08:56:30 -0600 | [diff] [blame] | 14039 | #ifdef CONFIG_PCI |
| 14040 | /* |
| 14041 | * For Wide boards set PCI information before calling |
| 14042 | * AdvInitGetConfig(). |
| 14043 | */ |
| 14044 | shost->irq = adv_dvc_varp->irq_no = pdev->irq; |
| 14045 | shost->unchecked_isa_dma = FALSE; |
| 14046 | share_irq = IRQF_SHARED; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14047 | ASC_DBG(2, "advansys_board_found: AdvInitGetConfig()\n"); |
Matthew Wilcox | 394dbf3 | 2007-07-26 11:56:40 -0400 | [diff] [blame] | 14048 | |
Matthew Wilcox | c2dce2f | 2007-09-09 08:56:30 -0600 | [diff] [blame] | 14049 | err_code = AdvInitGetConfig(pdev, boardp); |
| 14050 | #endif /* CONFIG_PCI */ |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14051 | } |
| 14052 | |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 14053 | if (err_code != 0) |
| 14054 | goto err_free_proc; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14055 | |
| 14056 | /* |
| 14057 | * Save the EEPROM configuration so that it can be displayed |
| 14058 | * from /proc/scsi/advansys/[0...]. |
| 14059 | */ |
| 14060 | if (ASC_NARROW_BOARD(boardp)) { |
| 14061 | |
| 14062 | ASCEEP_CONFIG *ep; |
| 14063 | |
| 14064 | /* |
| 14065 | * Set the adapter's target id bit in the 'init_tidmask' field. |
| 14066 | */ |
| 14067 | boardp->init_tidmask |= |
| 14068 | ADV_TID_TO_TIDMASK(asc_dvc_varp->cfg->chip_scsi_id); |
| 14069 | |
| 14070 | /* |
| 14071 | * Save EEPROM settings for the board. |
| 14072 | */ |
| 14073 | ep = &boardp->eep_config.asc_eep; |
| 14074 | |
| 14075 | ep->init_sdtr = asc_dvc_varp->cfg->sdtr_enable; |
| 14076 | ep->disc_enable = asc_dvc_varp->cfg->disc_enable; |
| 14077 | ep->use_cmd_qng = asc_dvc_varp->cfg->cmd_qng_enabled; |
| 14078 | ASC_EEP_SET_DMA_SPD(ep, asc_dvc_varp->cfg->isa_dma_speed); |
| 14079 | ep->start_motor = asc_dvc_varp->start_motor; |
| 14080 | ep->cntl = asc_dvc_varp->dvc_cntl; |
| 14081 | ep->no_scam = asc_dvc_varp->no_scam; |
| 14082 | ep->max_total_qng = asc_dvc_varp->max_total_qng; |
| 14083 | ASC_EEP_SET_CHIP_ID(ep, asc_dvc_varp->cfg->chip_scsi_id); |
| 14084 | /* 'max_tag_qng' is set to the same value for every device. */ |
| 14085 | ep->max_tag_qng = asc_dvc_varp->cfg->max_tag_qng[0]; |
| 14086 | ep->adapter_info[0] = asc_dvc_varp->cfg->adapter_info[0]; |
| 14087 | ep->adapter_info[1] = asc_dvc_varp->cfg->adapter_info[1]; |
| 14088 | ep->adapter_info[2] = asc_dvc_varp->cfg->adapter_info[2]; |
| 14089 | ep->adapter_info[3] = asc_dvc_varp->cfg->adapter_info[3]; |
| 14090 | ep->adapter_info[4] = asc_dvc_varp->cfg->adapter_info[4]; |
| 14091 | ep->adapter_info[5] = asc_dvc_varp->cfg->adapter_info[5]; |
| 14092 | |
| 14093 | /* |
| 14094 | * Modify board configuration. |
| 14095 | */ |
| 14096 | ASC_DBG(2, "advansys_board_found: AscInitSetConfig()\n"); |
Matthew Wilcox | c2dce2f | 2007-09-09 08:56:30 -0600 | [diff] [blame] | 14097 | err_code = AscInitSetConfig(pdev, boardp); |
| 14098 | if (err_code) |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 14099 | goto err_free_proc; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14100 | |
| 14101 | /* |
| 14102 | * Finish initializing the 'Scsi_Host' structure. |
| 14103 | */ |
| 14104 | /* AscInitSetConfig() will set the IRQ for non-PCI boards. */ |
| 14105 | if ((asc_dvc_varp->bus_type & ASC_IS_PCI) == 0) { |
| 14106 | shost->irq = asc_dvc_varp->irq_no; |
| 14107 | } |
| 14108 | } else { |
| 14109 | ADVEEP_3550_CONFIG *ep_3550; |
| 14110 | ADVEEP_38C0800_CONFIG *ep_38C0800; |
| 14111 | ADVEEP_38C1600_CONFIG *ep_38C1600; |
| 14112 | |
| 14113 | /* |
| 14114 | * Save Wide EEP Configuration Information. |
| 14115 | */ |
| 14116 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
| 14117 | ep_3550 = &boardp->eep_config.adv_3550_eep; |
| 14118 | |
| 14119 | ep_3550->adapter_scsi_id = adv_dvc_varp->chip_scsi_id; |
| 14120 | ep_3550->max_host_qng = adv_dvc_varp->max_host_qng; |
| 14121 | ep_3550->max_dvc_qng = adv_dvc_varp->max_dvc_qng; |
| 14122 | ep_3550->termination = adv_dvc_varp->cfg->termination; |
| 14123 | ep_3550->disc_enable = adv_dvc_varp->cfg->disc_enable; |
| 14124 | ep_3550->bios_ctrl = adv_dvc_varp->bios_ctrl; |
| 14125 | ep_3550->wdtr_able = adv_dvc_varp->wdtr_able; |
| 14126 | ep_3550->sdtr_able = adv_dvc_varp->sdtr_able; |
| 14127 | ep_3550->ultra_able = adv_dvc_varp->ultra_able; |
| 14128 | ep_3550->tagqng_able = adv_dvc_varp->tagqng_able; |
| 14129 | ep_3550->start_motor = adv_dvc_varp->start_motor; |
| 14130 | ep_3550->scsi_reset_delay = |
| 14131 | adv_dvc_varp->scsi_reset_wait; |
| 14132 | ep_3550->serial_number_word1 = |
| 14133 | adv_dvc_varp->cfg->serial1; |
| 14134 | ep_3550->serial_number_word2 = |
| 14135 | adv_dvc_varp->cfg->serial2; |
| 14136 | ep_3550->serial_number_word3 = |
| 14137 | adv_dvc_varp->cfg->serial3; |
| 14138 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
| 14139 | ep_38C0800 = &boardp->eep_config.adv_38C0800_eep; |
| 14140 | |
| 14141 | ep_38C0800->adapter_scsi_id = |
| 14142 | adv_dvc_varp->chip_scsi_id; |
| 14143 | ep_38C0800->max_host_qng = adv_dvc_varp->max_host_qng; |
| 14144 | ep_38C0800->max_dvc_qng = adv_dvc_varp->max_dvc_qng; |
| 14145 | ep_38C0800->termination_lvd = |
| 14146 | adv_dvc_varp->cfg->termination; |
| 14147 | ep_38C0800->disc_enable = |
| 14148 | adv_dvc_varp->cfg->disc_enable; |
| 14149 | ep_38C0800->bios_ctrl = adv_dvc_varp->bios_ctrl; |
| 14150 | ep_38C0800->wdtr_able = adv_dvc_varp->wdtr_able; |
| 14151 | ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able; |
| 14152 | ep_38C0800->sdtr_speed1 = adv_dvc_varp->sdtr_speed1; |
| 14153 | ep_38C0800->sdtr_speed2 = adv_dvc_varp->sdtr_speed2; |
| 14154 | ep_38C0800->sdtr_speed3 = adv_dvc_varp->sdtr_speed3; |
| 14155 | ep_38C0800->sdtr_speed4 = adv_dvc_varp->sdtr_speed4; |
| 14156 | ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able; |
| 14157 | ep_38C0800->start_motor = adv_dvc_varp->start_motor; |
| 14158 | ep_38C0800->scsi_reset_delay = |
| 14159 | adv_dvc_varp->scsi_reset_wait; |
| 14160 | ep_38C0800->serial_number_word1 = |
| 14161 | adv_dvc_varp->cfg->serial1; |
| 14162 | ep_38C0800->serial_number_word2 = |
| 14163 | adv_dvc_varp->cfg->serial2; |
| 14164 | ep_38C0800->serial_number_word3 = |
| 14165 | adv_dvc_varp->cfg->serial3; |
| 14166 | } else { |
| 14167 | ep_38C1600 = &boardp->eep_config.adv_38C1600_eep; |
| 14168 | |
| 14169 | ep_38C1600->adapter_scsi_id = |
| 14170 | adv_dvc_varp->chip_scsi_id; |
| 14171 | ep_38C1600->max_host_qng = adv_dvc_varp->max_host_qng; |
| 14172 | ep_38C1600->max_dvc_qng = adv_dvc_varp->max_dvc_qng; |
| 14173 | ep_38C1600->termination_lvd = |
| 14174 | adv_dvc_varp->cfg->termination; |
| 14175 | ep_38C1600->disc_enable = |
| 14176 | adv_dvc_varp->cfg->disc_enable; |
| 14177 | ep_38C1600->bios_ctrl = adv_dvc_varp->bios_ctrl; |
| 14178 | ep_38C1600->wdtr_able = adv_dvc_varp->wdtr_able; |
| 14179 | ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able; |
| 14180 | ep_38C1600->sdtr_speed1 = adv_dvc_varp->sdtr_speed1; |
| 14181 | ep_38C1600->sdtr_speed2 = adv_dvc_varp->sdtr_speed2; |
| 14182 | ep_38C1600->sdtr_speed3 = adv_dvc_varp->sdtr_speed3; |
| 14183 | ep_38C1600->sdtr_speed4 = adv_dvc_varp->sdtr_speed4; |
| 14184 | ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able; |
| 14185 | ep_38C1600->start_motor = adv_dvc_varp->start_motor; |
| 14186 | ep_38C1600->scsi_reset_delay = |
| 14187 | adv_dvc_varp->scsi_reset_wait; |
| 14188 | ep_38C1600->serial_number_word1 = |
| 14189 | adv_dvc_varp->cfg->serial1; |
| 14190 | ep_38C1600->serial_number_word2 = |
| 14191 | adv_dvc_varp->cfg->serial2; |
| 14192 | ep_38C1600->serial_number_word3 = |
| 14193 | adv_dvc_varp->cfg->serial3; |
| 14194 | } |
| 14195 | |
| 14196 | /* |
| 14197 | * Set the adapter's target id bit in the 'init_tidmask' field. |
| 14198 | */ |
| 14199 | boardp->init_tidmask |= |
| 14200 | ADV_TID_TO_TIDMASK(adv_dvc_varp->chip_scsi_id); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14201 | } |
| 14202 | |
| 14203 | /* |
| 14204 | * Channels are numbered beginning with 0. For AdvanSys one host |
| 14205 | * structure supports one channel. Multi-channel boards have a |
| 14206 | * separate host structure for each channel. |
| 14207 | */ |
| 14208 | shost->max_channel = 0; |
| 14209 | if (ASC_NARROW_BOARD(boardp)) { |
| 14210 | shost->max_id = ASC_MAX_TID + 1; |
| 14211 | shost->max_lun = ASC_MAX_LUN + 1; |
Matthew Wilcox | f05ec59 | 2007-09-09 08:56:36 -0600 | [diff] [blame] | 14212 | shost->max_cmd_len = ASC_MAX_CDB_LEN; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14213 | |
| 14214 | shost->io_port = asc_dvc_varp->iop_base; |
| 14215 | boardp->asc_n_io_port = ASC_IOADR_GAP; |
| 14216 | shost->this_id = asc_dvc_varp->cfg->chip_scsi_id; |
| 14217 | |
| 14218 | /* Set maximum number of queues the adapter can handle. */ |
| 14219 | shost->can_queue = asc_dvc_varp->max_total_qng; |
| 14220 | } else { |
| 14221 | shost->max_id = ADV_MAX_TID + 1; |
| 14222 | shost->max_lun = ADV_MAX_LUN + 1; |
Matthew Wilcox | f05ec59 | 2007-09-09 08:56:36 -0600 | [diff] [blame] | 14223 | shost->max_cmd_len = ADV_MAX_CDB_LEN; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14224 | |
| 14225 | /* |
| 14226 | * Save the I/O Port address and length even though |
| 14227 | * I/O ports are not used to access Wide boards. |
| 14228 | * Instead the Wide boards are accessed with |
| 14229 | * PCI Memory Mapped I/O. |
| 14230 | */ |
| 14231 | shost->io_port = iop; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14232 | |
| 14233 | shost->this_id = adv_dvc_varp->chip_scsi_id; |
| 14234 | |
| 14235 | /* Set maximum number of queues the adapter can handle. */ |
| 14236 | shost->can_queue = adv_dvc_varp->max_host_qng; |
| 14237 | } |
| 14238 | |
| 14239 | /* |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14240 | * Following v1.3.89, 'cmd_per_lun' is no longer needed |
| 14241 | * and should be set to zero. |
| 14242 | * |
| 14243 | * But because of a bug introduced in v1.3.89 if the driver is |
| 14244 | * compiled as a module and 'cmd_per_lun' is zero, the Mid-Level |
| 14245 | * SCSI function 'allocate_device' will panic. To allow the driver |
| 14246 | * to work as a module in these kernels set 'cmd_per_lun' to 1. |
| 14247 | * |
| 14248 | * Note: This is wrong. cmd_per_lun should be set to the depth |
| 14249 | * you want on untagged devices always. |
| 14250 | #ifdef MODULE |
| 14251 | */ |
| 14252 | shost->cmd_per_lun = 1; |
| 14253 | /* #else |
| 14254 | shost->cmd_per_lun = 0; |
| 14255 | #endif */ |
| 14256 | |
| 14257 | /* |
| 14258 | * Set the maximum number of scatter-gather elements the |
| 14259 | * adapter can handle. |
| 14260 | */ |
| 14261 | if (ASC_NARROW_BOARD(boardp)) { |
| 14262 | /* |
| 14263 | * Allow two commands with 'sg_tablesize' scatter-gather |
| 14264 | * elements to be executed simultaneously. This value is |
| 14265 | * the theoretical hardware limit. It may be decreased |
| 14266 | * below. |
| 14267 | */ |
| 14268 | shost->sg_tablesize = |
| 14269 | (((asc_dvc_varp->max_total_qng - 2) / 2) * |
| 14270 | ASC_SG_LIST_PER_Q) + 1; |
| 14271 | } else { |
| 14272 | shost->sg_tablesize = ADV_MAX_SG_LIST; |
| 14273 | } |
| 14274 | |
| 14275 | /* |
| 14276 | * The value of 'sg_tablesize' can not exceed the SCSI |
| 14277 | * mid-level driver definition of SG_ALL. SG_ALL also |
| 14278 | * must not be exceeded, because it is used to define the |
| 14279 | * size of the scatter-gather table in 'struct asc_sg_head'. |
| 14280 | */ |
| 14281 | if (shost->sg_tablesize > SG_ALL) { |
| 14282 | shost->sg_tablesize = SG_ALL; |
| 14283 | } |
| 14284 | |
| 14285 | ASC_DBG1(1, "advansys_board_found: sg_tablesize: %d\n", shost->sg_tablesize); |
| 14286 | |
| 14287 | /* BIOS start address. */ |
| 14288 | if (ASC_NARROW_BOARD(boardp)) { |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 14289 | shost->base = AscGetChipBiosAddress(asc_dvc_varp->iop_base, |
| 14290 | asc_dvc_varp->bus_type); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14291 | } else { |
| 14292 | /* |
| 14293 | * Fill-in BIOS board variables. The Wide BIOS saves |
| 14294 | * information in LRAM that is used by the driver. |
| 14295 | */ |
| 14296 | AdvReadWordLram(adv_dvc_varp->iop_base, |
| 14297 | BIOS_SIGNATURE, boardp->bios_signature); |
| 14298 | AdvReadWordLram(adv_dvc_varp->iop_base, |
| 14299 | BIOS_VERSION, boardp->bios_version); |
| 14300 | AdvReadWordLram(adv_dvc_varp->iop_base, |
| 14301 | BIOS_CODESEG, boardp->bios_codeseg); |
| 14302 | AdvReadWordLram(adv_dvc_varp->iop_base, |
| 14303 | BIOS_CODELEN, boardp->bios_codelen); |
| 14304 | |
| 14305 | ASC_DBG2(1, |
| 14306 | "advansys_board_found: bios_signature 0x%x, bios_version 0x%x\n", |
| 14307 | boardp->bios_signature, boardp->bios_version); |
| 14308 | |
| 14309 | ASC_DBG2(1, |
| 14310 | "advansys_board_found: bios_codeseg 0x%x, bios_codelen 0x%x\n", |
| 14311 | boardp->bios_codeseg, boardp->bios_codelen); |
| 14312 | |
| 14313 | /* |
| 14314 | * If the BIOS saved a valid signature, then fill in |
| 14315 | * the BIOS code segment base address. |
| 14316 | */ |
| 14317 | if (boardp->bios_signature == 0x55AA) { |
| 14318 | /* |
| 14319 | * Convert x86 realmode code segment to a linear |
| 14320 | * address by shifting left 4. |
| 14321 | */ |
| 14322 | shost->base = ((ulong)boardp->bios_codeseg << 4); |
| 14323 | } else { |
| 14324 | shost->base = 0; |
| 14325 | } |
| 14326 | } |
| 14327 | |
| 14328 | /* |
| 14329 | * Register Board Resources - I/O Port, DMA, IRQ |
| 14330 | */ |
| 14331 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14332 | /* Register DMA Channel for Narrow boards. */ |
| 14333 | shost->dma_channel = NO_ISA_DMA; /* Default to no ISA DMA. */ |
| 14334 | #ifdef CONFIG_ISA |
| 14335 | if (ASC_NARROW_BOARD(boardp)) { |
| 14336 | /* Register DMA channel for ISA bus. */ |
| 14337 | if (asc_dvc_varp->bus_type & ASC_IS_ISA) { |
| 14338 | shost->dma_channel = asc_dvc_varp->cfg->isa_dma_channel; |
Matthew Wilcox | 01fbfe0 | 2007-09-09 08:56:40 -0600 | [diff] [blame] | 14339 | ret = request_dma(shost->dma_channel, DRV_NAME); |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 14340 | if (ret) { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14341 | ASC_PRINT3 |
| 14342 | ("advansys_board_found: board %d: request_dma() %d failed %d\n", |
| 14343 | boardp->id, shost->dma_channel, ret); |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14344 | goto err_free_proc; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14345 | } |
| 14346 | AscEnableIsaDma(shost->dma_channel); |
| 14347 | } |
| 14348 | } |
| 14349 | #endif /* CONFIG_ISA */ |
| 14350 | |
| 14351 | /* Register IRQ Number. */ |
| 14352 | ASC_DBG1(2, "advansys_board_found: request_irq() %d\n", shost->irq); |
Matthew Wilcox | 074c8fe | 2007-07-28 23:11:05 -0600 | [diff] [blame] | 14353 | |
| 14354 | ret = request_irq(shost->irq, advansys_interrupt, share_irq, |
Matthew Wilcox | 01fbfe0 | 2007-09-09 08:56:40 -0600 | [diff] [blame] | 14355 | DRV_NAME, shost); |
Matthew Wilcox | 074c8fe | 2007-07-28 23:11:05 -0600 | [diff] [blame] | 14356 | |
| 14357 | if (ret) { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14358 | if (ret == -EBUSY) { |
| 14359 | ASC_PRINT2 |
| 14360 | ("advansys_board_found: board %d: request_irq(): IRQ 0x%x already in use.\n", |
| 14361 | boardp->id, shost->irq); |
| 14362 | } else if (ret == -EINVAL) { |
| 14363 | ASC_PRINT2 |
| 14364 | ("advansys_board_found: board %d: request_irq(): IRQ 0x%x not valid.\n", |
| 14365 | boardp->id, shost->irq); |
| 14366 | } else { |
| 14367 | ASC_PRINT3 |
| 14368 | ("advansys_board_found: board %d: request_irq(): IRQ 0x%x failed with %d\n", |
| 14369 | boardp->id, shost->irq, ret); |
| 14370 | } |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 14371 | goto err_free_dma; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14372 | } |
| 14373 | |
| 14374 | /* |
| 14375 | * Initialize board RISC chip and enable interrupts. |
| 14376 | */ |
| 14377 | if (ASC_NARROW_BOARD(boardp)) { |
| 14378 | ASC_DBG(2, "advansys_board_found: AscInitAsc1000Driver()\n"); |
| 14379 | warn_code = AscInitAsc1000Driver(asc_dvc_varp); |
| 14380 | err_code = asc_dvc_varp->err_code; |
| 14381 | |
| 14382 | if (warn_code || err_code) { |
| 14383 | ASC_PRINT4 |
| 14384 | ("advansys_board_found: board %d error: init_state 0x%x, warn 0x%x, error 0x%x\n", |
| 14385 | boardp->id, |
| 14386 | asc_dvc_varp->init_state, warn_code, err_code); |
| 14387 | } |
| 14388 | } else { |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 14389 | err_code = advansys_wide_init_chip(boardp, adv_dvc_varp); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14390 | } |
| 14391 | |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 14392 | if (err_code != 0) |
| 14393 | goto err_free_wide_mem; |
| 14394 | |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14395 | ASC_DBG_PRT_SCSI_HOST(2, shost); |
| 14396 | |
Matthew Wilcox | 8dfb537 | 2007-07-30 09:08:34 -0600 | [diff] [blame] | 14397 | ret = scsi_add_host(shost, dev); |
| 14398 | if (ret) |
| 14399 | goto err_free_wide_mem; |
| 14400 | |
| 14401 | scsi_scan_host(shost); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14402 | return shost; |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 14403 | |
| 14404 | err_free_wide_mem: |
| 14405 | advansys_wide_free_mem(boardp); |
| 14406 | free_irq(shost->irq, shost); |
| 14407 | err_free_dma: |
| 14408 | if (shost->dma_channel != NO_ISA_DMA) |
| 14409 | free_dma(shost->dma_channel); |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 14410 | err_free_proc: |
| 14411 | kfree(boardp->prtbuf); |
| 14412 | err_unmap: |
| 14413 | if (boardp->ioremap_addr) |
| 14414 | iounmap(boardp->ioremap_addr); |
| 14415 | err_shost: |
Matthew Wilcox | 8dfb537 | 2007-07-30 09:08:34 -0600 | [diff] [blame] | 14416 | scsi_host_put(shost); |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 14417 | return NULL; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14418 | } |
| 14419 | |
| 14420 | /* |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14421 | * advansys_release() |
| 14422 | * |
| 14423 | * Release resources allocated for a single AdvanSys adapter. |
| 14424 | */ |
| 14425 | static int advansys_release(struct Scsi_Host *shost) |
| 14426 | { |
| 14427 | asc_board_t *boardp; |
| 14428 | |
| 14429 | ASC_DBG(1, "advansys_release: begin\n"); |
Matthew Wilcox | 8dfb537 | 2007-07-30 09:08:34 -0600 | [diff] [blame] | 14430 | scsi_remove_host(shost); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14431 | boardp = ASC_BOARDP(shost); |
Matthew Wilcox | 074c8fe | 2007-07-28 23:11:05 -0600 | [diff] [blame] | 14432 | free_irq(shost->irq, shost); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14433 | if (shost->dma_channel != NO_ISA_DMA) { |
| 14434 | ASC_DBG(1, "advansys_release: free_dma()\n"); |
| 14435 | free_dma(shost->dma_channel); |
| 14436 | } |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14437 | if (ASC_WIDE_BOARD(boardp)) { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14438 | iounmap(boardp->ioremap_addr); |
Matthew Wilcox | b2c16f5 | 2007-07-29 17:30:28 -0600 | [diff] [blame] | 14439 | advansys_wide_free_mem(boardp); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14440 | } |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14441 | kfree(boardp->prtbuf); |
Matthew Wilcox | 8dfb537 | 2007-07-30 09:08:34 -0600 | [diff] [blame] | 14442 | scsi_host_put(shost); |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14443 | ASC_DBG(1, "advansys_release: end\n"); |
| 14444 | return 0; |
| 14445 | } |
| 14446 | |
Matthew Wilcox | 95c9f16 | 2007-09-09 08:56:39 -0600 | [diff] [blame] | 14447 | #define ASC_IOADR_TABLE_MAX_IX 11 |
| 14448 | |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14449 | static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __devinitdata = { |
| 14450 | 0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190, |
| 14451 | 0x0210, 0x0230, 0x0250, 0x0330 |
| 14452 | }; |
| 14453 | |
| 14454 | static int __devinit advansys_isa_probe(struct device *dev, unsigned int id) |
| 14455 | { |
| 14456 | PortAddr iop_base = _asc_def_iop_base[id]; |
| 14457 | struct Scsi_Host *shost; |
| 14458 | |
Matthew Wilcox | 01fbfe0 | 2007-09-09 08:56:40 -0600 | [diff] [blame] | 14459 | if (!request_region(iop_base, ASC_IOADR_GAP, DRV_NAME)) { |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14460 | ASC_DBG1(1, "advansys_isa_match: I/O port 0x%x busy\n", |
| 14461 | iop_base); |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14462 | return -ENODEV; |
| 14463 | } |
| 14464 | ASC_DBG1(1, "advansys_isa_match: probing I/O port 0x%x\n", iop_base); |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14465 | if (!AscFindSignature(iop_base)) |
| 14466 | goto nodev; |
| 14467 | if (!(AscGetChipVersion(iop_base, ASC_IS_ISA) & ASC_CHIP_VER_ISA_BIT)) |
| 14468 | goto nodev; |
| 14469 | |
| 14470 | shost = advansys_board_found(iop_base, dev, ASC_IS_ISA); |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14471 | if (!shost) |
| 14472 | goto nodev; |
| 14473 | |
| 14474 | dev_set_drvdata(dev, shost); |
| 14475 | return 0; |
| 14476 | |
| 14477 | nodev: |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14478 | release_region(iop_base, ASC_IOADR_GAP); |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14479 | return -ENODEV; |
| 14480 | } |
| 14481 | |
| 14482 | static int __devexit advansys_isa_remove(struct device *dev, unsigned int id) |
| 14483 | { |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14484 | int ioport = _asc_def_iop_base[id]; |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14485 | advansys_release(dev_get_drvdata(dev)); |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14486 | release_region(ioport, ASC_IOADR_GAP); |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14487 | return 0; |
| 14488 | } |
| 14489 | |
| 14490 | static struct isa_driver advansys_isa_driver = { |
| 14491 | .probe = advansys_isa_probe, |
| 14492 | .remove = __devexit_p(advansys_isa_remove), |
| 14493 | .driver = { |
| 14494 | .owner = THIS_MODULE, |
Matthew Wilcox | 01fbfe0 | 2007-09-09 08:56:40 -0600 | [diff] [blame] | 14495 | .name = DRV_NAME, |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14496 | }, |
| 14497 | }; |
| 14498 | |
| 14499 | static int __devinit advansys_vlb_probe(struct device *dev, unsigned int id) |
| 14500 | { |
| 14501 | PortAddr iop_base = _asc_def_iop_base[id]; |
| 14502 | struct Scsi_Host *shost; |
| 14503 | |
Matthew Wilcox | 01fbfe0 | 2007-09-09 08:56:40 -0600 | [diff] [blame] | 14504 | if (!request_region(iop_base, ASC_IOADR_GAP, DRV_NAME)) { |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14505 | ASC_DBG1(1, "advansys_vlb_match: I/O port 0x%x busy\n", |
| 14506 | iop_base); |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14507 | return -ENODEV; |
| 14508 | } |
| 14509 | ASC_DBG1(1, "advansys_vlb_match: probing I/O port 0x%x\n", iop_base); |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14510 | if (!AscFindSignature(iop_base)) |
| 14511 | goto nodev; |
| 14512 | /* |
| 14513 | * I don't think this condition can actually happen, but the old |
| 14514 | * driver did it, and the chances of finding a VLB setup in 2007 |
| 14515 | * to do testing with is slight to none. |
| 14516 | */ |
| 14517 | if (AscGetChipVersion(iop_base, ASC_IS_VL) > ASC_CHIP_MAX_VER_VL) |
| 14518 | goto nodev; |
| 14519 | |
| 14520 | shost = advansys_board_found(iop_base, dev, ASC_IS_VL); |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14521 | if (!shost) |
| 14522 | goto nodev; |
| 14523 | |
| 14524 | dev_set_drvdata(dev, shost); |
| 14525 | return 0; |
| 14526 | |
| 14527 | nodev: |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14528 | release_region(iop_base, ASC_IOADR_GAP); |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14529 | return -ENODEV; |
| 14530 | } |
| 14531 | |
| 14532 | static struct isa_driver advansys_vlb_driver = { |
| 14533 | .probe = advansys_vlb_probe, |
| 14534 | .remove = __devexit_p(advansys_isa_remove), |
| 14535 | .driver = { |
| 14536 | .owner = THIS_MODULE, |
Matthew Wilcox | b8e5152b | 2007-09-09 08:56:26 -0600 | [diff] [blame] | 14537 | .name = "advansys_vlb", |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14538 | }, |
| 14539 | }; |
| 14540 | |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14541 | static struct eisa_device_id advansys_eisa_table[] __devinitdata = { |
| 14542 | { "ABP7401" }, |
| 14543 | { "ABP7501" }, |
| 14544 | { "" } |
| 14545 | }; |
| 14546 | |
| 14547 | MODULE_DEVICE_TABLE(eisa, advansys_eisa_table); |
| 14548 | |
| 14549 | /* |
| 14550 | * EISA is a little more tricky than PCI; each EISA device may have two |
| 14551 | * channels, and this driver is written to make each channel its own Scsi_Host |
| 14552 | */ |
| 14553 | struct eisa_scsi_data { |
| 14554 | struct Scsi_Host *host[2]; |
| 14555 | }; |
| 14556 | |
| 14557 | static int __devinit advansys_eisa_probe(struct device *dev) |
| 14558 | { |
| 14559 | int i, ioport; |
| 14560 | int err; |
| 14561 | struct eisa_device *edev = to_eisa_device(dev); |
| 14562 | struct eisa_scsi_data *data; |
| 14563 | |
| 14564 | err = -ENOMEM; |
| 14565 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
| 14566 | if (!data) |
| 14567 | goto fail; |
| 14568 | ioport = edev->base_addr + 0xc30; |
| 14569 | |
| 14570 | err = -ENODEV; |
| 14571 | for (i = 0; i < 2; i++, ioport += 0x20) { |
Matthew Wilcox | 01fbfe0 | 2007-09-09 08:56:40 -0600 | [diff] [blame] | 14572 | if (!request_region(ioport, ASC_IOADR_GAP, DRV_NAME)) { |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14573 | printk(KERN_WARNING "Region %x-%x busy\n", ioport, |
| 14574 | ioport + ASC_IOADR_GAP - 1); |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14575 | continue; |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14576 | } |
| 14577 | if (!AscFindSignature(ioport)) { |
| 14578 | release_region(ioport, ASC_IOADR_GAP); |
| 14579 | continue; |
| 14580 | } |
| 14581 | |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14582 | /* |
| 14583 | * I don't know why we need to do this for EISA chips, but |
| 14584 | * not for any others. It looks to be equivalent to |
| 14585 | * AscGetChipCfgMsw, but I may have overlooked something, |
| 14586 | * so I'm not converting it until I get an EISA board to |
| 14587 | * test with. |
| 14588 | */ |
| 14589 | inw(ioport + 4); |
| 14590 | data->host[i] = advansys_board_found(ioport, dev, ASC_IS_EISA); |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14591 | if (data->host[i]) { |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14592 | err = 0; |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14593 | } else { |
| 14594 | release_region(ioport, ASC_IOADR_GAP); |
| 14595 | } |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14596 | } |
| 14597 | |
| 14598 | if (err) { |
| 14599 | kfree(data); |
| 14600 | } else { |
| 14601 | dev_set_drvdata(dev, data); |
| 14602 | } |
| 14603 | |
| 14604 | fail: |
| 14605 | return err; |
| 14606 | } |
| 14607 | |
| 14608 | static __devexit int advansys_eisa_remove(struct device *dev) |
| 14609 | { |
| 14610 | int i; |
| 14611 | struct eisa_scsi_data *data = dev_get_drvdata(dev); |
| 14612 | |
| 14613 | for (i = 0; i < 2; i++) { |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14614 | int ioport; |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14615 | struct Scsi_Host *shost = data->host[i]; |
| 14616 | if (!shost) |
| 14617 | continue; |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14618 | ioport = shost->io_port; |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14619 | advansys_release(shost); |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14620 | release_region(ioport, ASC_IOADR_GAP); |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14621 | } |
| 14622 | |
| 14623 | kfree(data); |
| 14624 | return 0; |
| 14625 | } |
| 14626 | |
| 14627 | static struct eisa_driver advansys_eisa_driver = { |
| 14628 | .id_table = advansys_eisa_table, |
| 14629 | .driver = { |
Matthew Wilcox | 01fbfe0 | 2007-09-09 08:56:40 -0600 | [diff] [blame] | 14630 | .name = DRV_NAME, |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14631 | .probe = advansys_eisa_probe, |
| 14632 | .remove = __devexit_p(advansys_eisa_remove), |
| 14633 | } |
| 14634 | }; |
| 14635 | |
Dave Jones | 2672ea8 | 2006-08-02 17:11:49 -0400 | [diff] [blame] | 14636 | /* PCI Devices supported by this driver */ |
| 14637 | static struct pci_device_id advansys_pci_tbl[] __devinitdata = { |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14638 | {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A, |
| 14639 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
| 14640 | {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940, |
| 14641 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
| 14642 | {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940U, |
| 14643 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
| 14644 | {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940UW, |
| 14645 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
| 14646 | {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_38C0800_REV1, |
| 14647 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
| 14648 | {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_38C1600_REV1, |
| 14649 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
| 14650 | {} |
Dave Jones | 2672ea8 | 2006-08-02 17:11:49 -0400 | [diff] [blame] | 14651 | }; |
Matthew Wilcox | 27c868c | 2007-07-26 10:56:23 -0400 | [diff] [blame] | 14652 | |
Dave Jones | 2672ea8 | 2006-08-02 17:11:49 -0400 | [diff] [blame] | 14653 | MODULE_DEVICE_TABLE(pci, advansys_pci_tbl); |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 14654 | |
Matthew Wilcox | 9649af3 | 2007-07-26 21:51:47 -0600 | [diff] [blame] | 14655 | static void __devinit advansys_set_latency(struct pci_dev *pdev) |
| 14656 | { |
| 14657 | if ((pdev->device == PCI_DEVICE_ID_ASP_1200A) || |
| 14658 | (pdev->device == PCI_DEVICE_ID_ASP_ABP940)) { |
| 14659 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0); |
| 14660 | } else { |
| 14661 | u8 latency; |
| 14662 | pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency); |
| 14663 | if (latency < 0x20) |
| 14664 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x20); |
| 14665 | } |
| 14666 | } |
| 14667 | |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 14668 | static int __devinit |
| 14669 | advansys_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 14670 | { |
| 14671 | int err, ioport; |
| 14672 | struct Scsi_Host *shost; |
| 14673 | |
| 14674 | err = pci_enable_device(pdev); |
| 14675 | if (err) |
| 14676 | goto fail; |
Matthew Wilcox | 01fbfe0 | 2007-09-09 08:56:40 -0600 | [diff] [blame] | 14677 | err = pci_request_regions(pdev, DRV_NAME); |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14678 | if (err) |
| 14679 | goto disable_device; |
Matthew Wilcox | 9649af3 | 2007-07-26 21:51:47 -0600 | [diff] [blame] | 14680 | pci_set_master(pdev); |
| 14681 | advansys_set_latency(pdev); |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 14682 | |
| 14683 | if (pci_resource_len(pdev, 0) == 0) |
| 14684 | goto nodev; |
| 14685 | |
| 14686 | ioport = pci_resource_start(pdev, 0); |
| 14687 | shost = advansys_board_found(ioport, &pdev->dev, ASC_IS_PCI); |
| 14688 | |
| 14689 | if (!shost) |
| 14690 | goto nodev; |
| 14691 | |
| 14692 | pci_set_drvdata(pdev, shost); |
| 14693 | return 0; |
| 14694 | |
| 14695 | nodev: |
| 14696 | err = -ENODEV; |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14697 | pci_release_regions(pdev); |
| 14698 | disable_device: |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 14699 | pci_disable_device(pdev); |
| 14700 | fail: |
| 14701 | return err; |
| 14702 | } |
| 14703 | |
| 14704 | static void __devexit advansys_pci_remove(struct pci_dev *pdev) |
| 14705 | { |
| 14706 | advansys_release(pci_get_drvdata(pdev)); |
Matthew Wilcox | 71f3611 | 2007-07-30 08:04:53 -0600 | [diff] [blame] | 14707 | pci_release_regions(pdev); |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 14708 | pci_disable_device(pdev); |
| 14709 | } |
| 14710 | |
| 14711 | static struct pci_driver advansys_pci_driver = { |
Matthew Wilcox | 01fbfe0 | 2007-09-09 08:56:40 -0600 | [diff] [blame] | 14712 | .name = DRV_NAME, |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 14713 | .id_table = advansys_pci_tbl, |
| 14714 | .probe = advansys_pci_probe, |
| 14715 | .remove = __devexit_p(advansys_pci_remove), |
| 14716 | }; |
Matthew Wilcox | 8c6af9e | 2007-07-26 11:03:19 -0400 | [diff] [blame] | 14717 | |
Matthew Wilcox | 8dfb537 | 2007-07-30 09:08:34 -0600 | [diff] [blame] | 14718 | static int __init advansys_init(void) |
| 14719 | { |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14720 | int error; |
| 14721 | |
| 14722 | error = isa_register_driver(&advansys_isa_driver, |
| 14723 | ASC_IOADR_TABLE_MAX_IX); |
| 14724 | if (error) |
| 14725 | goto fail; |
| 14726 | |
| 14727 | error = isa_register_driver(&advansys_vlb_driver, |
| 14728 | ASC_IOADR_TABLE_MAX_IX); |
| 14729 | if (error) |
| 14730 | goto unregister_isa; |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14731 | |
| 14732 | error = eisa_driver_register(&advansys_eisa_driver); |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 14733 | if (error) |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14734 | goto unregister_vlb; |
Matthew Wilcox | 8dfb537 | 2007-07-30 09:08:34 -0600 | [diff] [blame] | 14735 | |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14736 | error = pci_register_driver(&advansys_pci_driver); |
| 14737 | if (error) |
| 14738 | goto unregister_eisa; |
| 14739 | |
Matthew Wilcox | 8dfb537 | 2007-07-30 09:08:34 -0600 | [diff] [blame] | 14740 | return 0; |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 14741 | |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14742 | unregister_eisa: |
| 14743 | eisa_driver_unregister(&advansys_eisa_driver); |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14744 | unregister_vlb: |
| 14745 | isa_unregister_driver(&advansys_vlb_driver); |
| 14746 | unregister_isa: |
| 14747 | isa_unregister_driver(&advansys_isa_driver); |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 14748 | fail: |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 14749 | return error; |
Matthew Wilcox | 8dfb537 | 2007-07-30 09:08:34 -0600 | [diff] [blame] | 14750 | } |
| 14751 | |
| 14752 | static void __exit advansys_exit(void) |
| 14753 | { |
Matthew Wilcox | 78e77d8 | 2007-07-29 21:46:15 -0600 | [diff] [blame] | 14754 | pci_unregister_driver(&advansys_pci_driver); |
Matthew Wilcox | b09e05a | 2007-07-30 09:14:52 -0600 | [diff] [blame] | 14755 | eisa_driver_unregister(&advansys_eisa_driver); |
Matthew Wilcox | c304ec9 | 2007-07-30 09:18:45 -0600 | [diff] [blame] | 14756 | isa_unregister_driver(&advansys_vlb_driver); |
| 14757 | isa_unregister_driver(&advansys_isa_driver); |
Matthew Wilcox | 8dfb537 | 2007-07-30 09:08:34 -0600 | [diff] [blame] | 14758 | } |
| 14759 | |
| 14760 | module_init(advansys_init); |
| 14761 | module_exit(advansys_exit); |
| 14762 | |
Matthew Wilcox | 8c6af9e | 2007-07-26 11:03:19 -0400 | [diff] [blame] | 14763 | MODULE_LICENSE("GPL"); |