![]() |
|
|||
0001 /* 0002 * Initio A100 device driver for Linux. 0003 * 0004 * Copyright (c) 1994-1998 Initio Corporation 0005 * All rights reserved. 0006 * 0007 * This program is free software; you can redistribute it and/or modify 0008 * it under the terms of the GNU General Public License as published by 0009 * the Free Software Foundation; either version 2, or (at your option) 0010 * any later version. 0011 * 0012 * This program is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 * GNU General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU General Public License 0018 * along with this program; see the file COPYING. If not, write to 0019 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 0020 * 0021 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 0022 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0023 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 0024 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 0025 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 0026 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 0027 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 0028 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 0029 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 0030 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 0031 * SUCH DAMAGE. 0032 * 0033 * Revision History: 0034 * 06/18/98 HL, Initial production Version 1.02 0035 * 12/19/98 bv, Use spinlocks for 2.1.95 and up 0036 * 06/25/02 Doug Ledford <dledford@redhat.com> 0037 * - This and the i60uscsi.h file are almost identical, 0038 * merged them into a single header used by both .c files. 0039 * 14/06/07 Alan Cox <alan@redhat.com> 0040 * - Grand cleanup and Linuxisation 0041 */ 0042 0043 #define inia100_REVID "Initio INI-A100U2W SCSI device driver; Revision: 1.02d" 0044 0045 #if 1 0046 #define ORC_MAXQUEUE 245 0047 #define ORC_MAXTAGS 64 0048 #else 0049 #define ORC_MAXQUEUE 25 0050 #define ORC_MAXTAGS 8 0051 #endif 0052 0053 #define TOTAL_SG_ENTRY 32 0054 #define MAX_TARGETS 16 0055 #define IMAX_CDB 15 0056 #define SENSE_SIZE 14 0057 0058 /************************************************************************/ 0059 /* Scatter-Gather Element Structure */ 0060 /************************************************************************/ 0061 struct orc_sgent { 0062 u32 base; /* Data Pointer */ 0063 u32 length; /* Data Length */ 0064 }; 0065 0066 /* SCSI related definition */ 0067 #define DISC_NOT_ALLOW 0x80 /* Disconnect is not allowed */ 0068 #define DISC_ALLOW 0xC0 /* Disconnect is allowed */ 0069 0070 0071 #define ORC_OFFSET_SCB 16 0072 #define ORC_MAX_SCBS 250 0073 #define MAX_CHANNELS 2 0074 #define MAX_ESCB_ELE 64 0075 #define TCF_DRV_255_63 0x0400 0076 0077 /********************************************************/ 0078 /* Orchid Host Command Set */ 0079 /********************************************************/ 0080 #define ORC_CMD_NOP 0x00 /* Host command - NOP */ 0081 #define ORC_CMD_VERSION 0x01 /* Host command - Get F/W version */ 0082 #define ORC_CMD_ECHO 0x02 /* Host command - ECHO */ 0083 #define ORC_CMD_SET_NVM 0x03 /* Host command - Set NVRAM */ 0084 #define ORC_CMD_GET_NVM 0x04 /* Host command - Get NVRAM */ 0085 #define ORC_CMD_GET_BUS_STATUS 0x05 /* Host command - Get SCSI bus status */ 0086 #define ORC_CMD_ABORT_SCB 0x06 /* Host command - Abort SCB */ 0087 #define ORC_CMD_ISSUE_SCB 0x07 /* Host command - Issue SCB */ 0088 0089 /********************************************************/ 0090 /* Orchid Register Set */ 0091 /********************************************************/ 0092 #define ORC_GINTS 0xA0 /* Global Interrupt Status */ 0093 #define QINT 0x04 /* Reply Queue Interrupt */ 0094 #define ORC_GIMSK 0xA1 /* Global Interrupt MASK */ 0095 #define MQINT 0x04 /* Mask Reply Queue Interrupt */ 0096 #define ORC_GCFG 0xA2 /* Global Configure */ 0097 #define EEPRG 0x01 /* Enable EEPROM programming */ 0098 #define ORC_GSTAT 0xA3 /* Global status */ 0099 #define WIDEBUS 0x10 /* Wide SCSI Devices connected */ 0100 #define ORC_HDATA 0xA4 /* Host Data */ 0101 #define ORC_HCTRL 0xA5 /* Host Control */ 0102 #define SCSIRST 0x80 /* SCSI bus reset */ 0103 #define HDO 0x40 /* Host data out */ 0104 #define HOSTSTOP 0x02 /* Host stop RISC engine */ 0105 #define DEVRST 0x01 /* Device reset */ 0106 #define ORC_HSTUS 0xA6 /* Host Status */ 0107 #define HDI 0x02 /* Host data in */ 0108 #define RREADY 0x01 /* RISC engine is ready to receive */ 0109 #define ORC_NVRAM 0xA7 /* Nvram port address */ 0110 #define SE2CS 0x008 0111 #define SE2CLK 0x004 0112 #define SE2DO 0x002 0113 #define SE2DI 0x001 0114 #define ORC_PQUEUE 0xA8 /* Posting queue FIFO */ 0115 #define ORC_PQCNT 0xA9 /* Posting queue FIFO Cnt */ 0116 #define ORC_RQUEUE 0xAA /* Reply queue FIFO */ 0117 #define ORC_RQUEUECNT 0xAB /* Reply queue FIFO Cnt */ 0118 #define ORC_FWBASEADR 0xAC /* Firmware base address */ 0119 0120 #define ORC_EBIOSADR0 0xB0 /* External Bios address */ 0121 #define ORC_EBIOSADR1 0xB1 /* External Bios address */ 0122 #define ORC_EBIOSADR2 0xB2 /* External Bios address */ 0123 #define ORC_EBIOSDATA 0xB3 /* External Bios address */ 0124 0125 #define ORC_SCBSIZE 0xB7 /* SCB size register */ 0126 #define ORC_SCBBASE0 0xB8 /* SCB base address 0 */ 0127 #define ORC_SCBBASE1 0xBC /* SCB base address 1 */ 0128 0129 #define ORC_RISCCTL 0xE0 /* RISC Control */ 0130 #define PRGMRST 0x002 0131 #define DOWNLOAD 0x001 0132 #define ORC_PRGMCTR0 0xE2 /* RISC program counter */ 0133 #define ORC_PRGMCTR1 0xE3 /* RISC program counter */ 0134 #define ORC_RISCRAM 0xEC /* RISC RAM data port 4 bytes */ 0135 0136 struct orc_extended_scb { /* Extended SCB */ 0137 struct orc_sgent sglist[TOTAL_SG_ENTRY]; /*0 Start of SG list */ 0138 struct scsi_cmnd *srb; /*50 SRB Pointer */ 0139 }; 0140 0141 /*********************************************************************** 0142 SCSI Control Block 0143 0144 0x40 bytes long, the last 8 are user bytes 0145 ************************************************************************/ 0146 struct orc_scb { /* Scsi_Ctrl_Blk */ 0147 u8 opcode; /*00 SCB command code&residual */ 0148 u8 flags; /*01 SCB Flags */ 0149 u8 target; /*02 Target Id */ 0150 u8 lun; /*03 Lun */ 0151 u32 reserved0; /*04 Reserved for ORCHID must 0 */ 0152 u32 xferlen; /*08 Data Transfer Length */ 0153 u32 reserved1; /*0C Reserved for ORCHID must 0 */ 0154 u32 sg_len; /*10 SG list # * 8 */ 0155 u32 sg_addr; /*14 SG List Buf physical Addr */ 0156 u32 sg_addrhigh; /*18 SG Buffer high physical Addr */ 0157 u8 hastat; /*1C Host Status */ 0158 u8 tastat; /*1D Target Status */ 0159 u8 status; /*1E SCB status */ 0160 u8 link; /*1F Link pointer, default 0xFF */ 0161 u8 sense_len; /*20 Sense Allocation Length */ 0162 u8 cdb_len; /*21 CDB Length */ 0163 u8 ident; /*22 Identify */ 0164 u8 tag_msg; /*23 Tag Message */ 0165 u8 cdb[IMAX_CDB]; /*24 SCSI CDBs */ 0166 u8 scbidx; /*3C Index for this ORCSCB */ 0167 u32 sense_addr; /*34 Sense Buffer physical Addr */ 0168 0169 struct orc_extended_scb *escb; /*38 Extended SCB Pointer */ 0170 /* 64bit pointer or 32bit pointer + reserved ? */ 0171 #ifndef CONFIG_64BIT 0172 u8 reserved2[4]; /*3E Reserved for Driver use */ 0173 #endif 0174 }; 0175 0176 /* Opcodes of ORCSCB_Opcode */ 0177 #define ORC_EXECSCSI 0x00 /* SCSI initiator command with residual */ 0178 #define ORC_BUSDEVRST 0x01 /* SCSI Bus Device Reset */ 0179 0180 /* Status of ORCSCB_Status */ 0181 #define ORCSCB_COMPLETE 0x00 /* SCB request completed */ 0182 #define ORCSCB_POST 0x01 /* SCB is posted by the HOST */ 0183 0184 /* Bit Definition for ORCSCB_Flags */ 0185 #define SCF_DISINT 0x01 /* Disable HOST interrupt */ 0186 #define SCF_DIR 0x18 /* Direction bits */ 0187 #define SCF_NO_DCHK 0x00 /* Direction determined by SCSI */ 0188 #define SCF_DIN 0x08 /* From Target to Initiator */ 0189 #define SCF_DOUT 0x10 /* From Initiator to Target */ 0190 #define SCF_NO_XF 0x18 /* No data transfer */ 0191 #define SCF_POLL 0x40 0192 0193 /* Error Codes for ORCSCB_HaStat */ 0194 #define HOST_SEL_TOUT 0x11 0195 #define HOST_DO_DU 0x12 0196 #define HOST_BUS_FREE 0x13 0197 #define HOST_BAD_PHAS 0x14 0198 #define HOST_INV_CMD 0x16 0199 #define HOST_SCSI_RST 0x1B 0200 #define HOST_DEV_RST 0x1C 0201 0202 0203 /* Error Codes for ORCSCB_TaStat */ 0204 #define TARGET_CHK_COND 0x02 0205 #define TARGET_BUSY 0x08 0206 #define TARGET_TAG_FULL 0x28 0207 0208 0209 /*********************************************************************** 0210 Target Device Control Structure 0211 **********************************************************************/ 0212 0213 struct orc_target { 0214 u8 TCS_DrvDASD; /* 6 */ 0215 u8 TCS_DrvSCSI; /* 7 */ 0216 u8 TCS_DrvHead; /* 8 */ 0217 u16 TCS_DrvFlags; /* 4 */ 0218 u8 TCS_DrvSector; /* 7 */ 0219 }; 0220 0221 /* Bit Definition for TCF_DrvFlags */ 0222 #define TCS_DF_NODASD_SUPT 0x20 /* Suppress OS/2 DASD Mgr support */ 0223 #define TCS_DF_NOSCSI_SUPT 0x40 /* Suppress OS/2 SCSI Mgr support */ 0224 0225 0226 /*********************************************************************** 0227 Host Adapter Control Structure 0228 ************************************************************************/ 0229 struct orc_host { 0230 unsigned long base; /* Base address */ 0231 u8 index; /* Index (Channel)*/ 0232 u8 scsi_id; /* H/A SCSI ID */ 0233 u8 BIOScfg; /*BIOS configuration */ 0234 u8 flags; 0235 u8 max_targets; /* SCSI0MAXTags */ 0236 struct orc_scb *scb_virt; /* Virtual Pointer to SCB array */ 0237 dma_addr_t scb_phys; /* Scb Physical address */ 0238 struct orc_extended_scb *escb_virt; /* Virtual pointer to ESCB Scatter list */ 0239 dma_addr_t escb_phys; /* scatter list Physical address */ 0240 u8 target_flag[16]; /* target configuration, TCF_EN_TAG */ 0241 u8 max_tags[16]; /* ORC_MAX_SCBS */ 0242 u32 allocation_map[MAX_CHANNELS][8]; /* Max STB is 256, So 256/32 */ 0243 spinlock_t allocation_lock; 0244 struct pci_dev *pdev; 0245 }; 0246 0247 /* Bit Definition for HCS_Flags */ 0248 0249 #define HCF_SCSI_RESET 0x01 /* SCSI BUS RESET */ 0250 #define HCF_PARITY 0x02 /* parity card */ 0251 #define HCF_LVDS 0x10 /* parity card */ 0252 0253 /* Bit Definition for TargetFlag */ 0254 0255 #define TCF_EN_255 0x08 0256 #define TCF_EN_TAG 0x10 0257 #define TCF_BUSY 0x20 0258 #define TCF_DISCONNECT 0x40 0259 #define TCF_SPIN_UP 0x80 0260 0261 /* Bit Definition for HCS_AFlags */ 0262 #define HCS_AF_IGNORE 0x01 /* Adapter ignore */ 0263 #define HCS_AF_DISABLE_RESET 0x10 /* Adapter disable reset */ 0264 #define HCS_AF_DISABLE_ADPT 0x80 /* Adapter disable */ 0265 0266 struct orc_nvram { 0267 /*----------header ---------------*/ 0268 u8 SubVendorID0; /* 00 - Sub Vendor ID */ 0269 u8 SubVendorID1; /* 00 - Sub Vendor ID */ 0270 u8 SubSysID0; /* 02 - Sub System ID */ 0271 u8 SubSysID1; /* 02 - Sub System ID */ 0272 u8 SubClass; /* 04 - Sub Class */ 0273 u8 VendorID0; /* 05 - Vendor ID */ 0274 u8 VendorID1; /* 05 - Vendor ID */ 0275 u8 DeviceID0; /* 07 - Device ID */ 0276 u8 DeviceID1; /* 07 - Device ID */ 0277 u8 Reserved0[2]; /* 09 - Reserved */ 0278 u8 revision; /* 0B - revision of data structure */ 0279 /* ----Host Adapter Structure ---- */ 0280 u8 NumOfCh; /* 0C - Number of SCSI channel */ 0281 u8 BIOSConfig1; /* 0D - BIOS configuration 1 */ 0282 u8 BIOSConfig2; /* 0E - BIOS boot channel&target ID */ 0283 u8 BIOSConfig3; /* 0F - BIOS configuration 3 */ 0284 /* ----SCSI channel Structure ---- */ 0285 /* from "CTRL-I SCSI Host Adapter SetUp menu " */ 0286 u8 scsi_id; /* 10 - Channel 0 SCSI ID */ 0287 u8 SCSI0Config; /* 11 - Channel 0 SCSI configuration */ 0288 u8 SCSI0MaxTags; /* 12 - Channel 0 Maximum tags */ 0289 u8 SCSI0ResetTime; /* 13 - Channel 0 Reset recovering time */ 0290 u8 ReservedforChannel0[2]; /* 14 - Reserved */ 0291 0292 /* ----SCSI target Structure ---- */ 0293 /* from "CTRL-I SCSI device SetUp menu " */ 0294 u8 Target00Config; /* 16 - Channel 0 Target 0 config */ 0295 u8 Target01Config; /* 17 - Channel 0 Target 1 config */ 0296 u8 Target02Config; /* 18 - Channel 0 Target 2 config */ 0297 u8 Target03Config; /* 19 - Channel 0 Target 3 config */ 0298 u8 Target04Config; /* 1A - Channel 0 Target 4 config */ 0299 u8 Target05Config; /* 1B - Channel 0 Target 5 config */ 0300 u8 Target06Config; /* 1C - Channel 0 Target 6 config */ 0301 u8 Target07Config; /* 1D - Channel 0 Target 7 config */ 0302 u8 Target08Config; /* 1E - Channel 0 Target 8 config */ 0303 u8 Target09Config; /* 1F - Channel 0 Target 9 config */ 0304 u8 Target0AConfig; /* 20 - Channel 0 Target A config */ 0305 u8 Target0BConfig; /* 21 - Channel 0 Target B config */ 0306 u8 Target0CConfig; /* 22 - Channel 0 Target C config */ 0307 u8 Target0DConfig; /* 23 - Channel 0 Target D config */ 0308 u8 Target0EConfig; /* 24 - Channel 0 Target E config */ 0309 u8 Target0FConfig; /* 25 - Channel 0 Target F config */ 0310 0311 u8 SCSI1Id; /* 26 - Channel 1 SCSI ID */ 0312 u8 SCSI1Config; /* 27 - Channel 1 SCSI configuration */ 0313 u8 SCSI1MaxTags; /* 28 - Channel 1 Maximum tags */ 0314 u8 SCSI1ResetTime; /* 29 - Channel 1 Reset recovering time */ 0315 u8 ReservedforChannel1[2]; /* 2A - Reserved */ 0316 0317 /* ----SCSI target Structure ---- */ 0318 /* from "CTRL-I SCSI device SetUp menu " */ 0319 u8 Target10Config; /* 2C - Channel 1 Target 0 config */ 0320 u8 Target11Config; /* 2D - Channel 1 Target 1 config */ 0321 u8 Target12Config; /* 2E - Channel 1 Target 2 config */ 0322 u8 Target13Config; /* 2F - Channel 1 Target 3 config */ 0323 u8 Target14Config; /* 30 - Channel 1 Target 4 config */ 0324 u8 Target15Config; /* 31 - Channel 1 Target 5 config */ 0325 u8 Target16Config; /* 32 - Channel 1 Target 6 config */ 0326 u8 Target17Config; /* 33 - Channel 1 Target 7 config */ 0327 u8 Target18Config; /* 34 - Channel 1 Target 8 config */ 0328 u8 Target19Config; /* 35 - Channel 1 Target 9 config */ 0329 u8 Target1AConfig; /* 36 - Channel 1 Target A config */ 0330 u8 Target1BConfig; /* 37 - Channel 1 Target B config */ 0331 u8 Target1CConfig; /* 38 - Channel 1 Target C config */ 0332 u8 Target1DConfig; /* 39 - Channel 1 Target D config */ 0333 u8 Target1EConfig; /* 3A - Channel 1 Target E config */ 0334 u8 Target1FConfig; /* 3B - Channel 1 Target F config */ 0335 u8 reserved[3]; /* 3C - Reserved */ 0336 /* ---------- CheckSum ---------- */ 0337 u8 CheckSum; /* 3F - Checksum of NVRam */ 0338 }; 0339 0340 /* Bios Configuration for nvram->BIOSConfig1 */ 0341 #define NBC_BIOSENABLE 0x01 /* BIOS enable */ 0342 #define NBC_CDROM 0x02 /* Support bootable CDROM */ 0343 #define NBC_REMOVABLE 0x04 /* Support removable drive */ 0344 0345 /* Bios Configuration for nvram->BIOSConfig2 */ 0346 #define NBB_TARGET_MASK 0x0F /* Boot SCSI target ID number */ 0347 #define NBB_CHANL_MASK 0xF0 /* Boot SCSI channel number */ 0348 0349 /* Bit definition for nvram->SCSIConfig */ 0350 #define NCC_BUSRESET 0x01 /* Reset SCSI bus at power up */ 0351 #define NCC_PARITYCHK 0x02 /* SCSI parity enable */ 0352 #define NCC_LVDS 0x10 /* Enable LVDS */ 0353 #define NCC_ACTTERM1 0x20 /* Enable active terminator 1 */ 0354 #define NCC_ACTTERM2 0x40 /* Enable active terminator 2 */ 0355 #define NCC_AUTOTERM 0x80 /* Enable auto termination */ 0356 0357 /* Bit definition for nvram->TargetxConfig */ 0358 #define NTC_PERIOD 0x07 /* Maximum Sync. Speed */ 0359 #define NTC_1GIGA 0x08 /* 255 head / 63 sectors (64/32) */ 0360 #define NTC_NO_SYNC 0x10 /* NO SYNC. NEGO */ 0361 #define NTC_NO_WIDESYNC 0x20 /* NO WIDE SYNC. NEGO */ 0362 #define NTC_DISC_ENABLE 0x40 /* Enable SCSI disconnect */ 0363 #define NTC_SPINUP 0x80 /* Start disk drive */ 0364 0365 /* Default NVRam values */ 0366 #define NBC_DEFAULT (NBC_ENABLE) 0367 #define NCC_DEFAULT (NCC_BUSRESET | NCC_AUTOTERM | NCC_PARITYCHK) 0368 #define NCC_MAX_TAGS 0x20 /* Maximum tags per target */ 0369 #define NCC_RESET_TIME 0x0A /* SCSI RESET recovering time */ 0370 #define NTC_DEFAULT (NTC_1GIGA | NTC_NO_WIDESYNC | NTC_DISC_ENABLE) 0371
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |