aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/initio.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/initio.h')
-rw-r--r--drivers/scsi/initio.h313
1 files changed, 130 insertions, 183 deletions
diff --git a/drivers/scsi/initio.h b/drivers/scsi/initio.h
index acb67a4af2c..cb48efa81fe 100644
--- a/drivers/scsi/initio.h
+++ b/drivers/scsi/initio.h
@@ -4,6 +4,8 @@
4 * Copyright (c) 1994-1998 Initio Corporation 4 * Copyright (c) 1994-1998 Initio Corporation
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Cleanups (c) Copyright 2007 Red Hat <alan@redhat.com>
8 *
7 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option) 11 * the Free Software Foundation; either version 2, or (at your option)
@@ -18,27 +20,6 @@
18 * along with this program; see the file COPYING. If not, write to 20 * along with this program; see the file COPYING. If not, write to
19 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 * 22 *
21 * --------------------------------------------------------------------------
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the above copyright
27 * notice, this list of conditions, and the following disclaimer,
28 * without modification, immediately at the beginning of the file.
29 * 2. Redistributions in binary form must reproduce the above copyright
30 * notice, this list of conditions and the following disclaimer in the
31 * documentation and/or other materials provided with the distribution.
32 * 3. The name of the author may not be used to endorse or promote products
33 * derived from this software without specific prior written permission.
34 *
35 * Where this Software is combined with software released under the terms of
36 * the GNU General Public License ("GPL") and the terms of the GPL would require the
37 * combined work to also be released under the terms of the GPL, the terms
38 * and conditions of this License will apply in addition to those of the
39 * GPL with the exception of any terms or conditions of this License that
40 * conflict with, or are expressly prohibited by, the GPL.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
43 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -56,17 +37,6 @@
56 37
57#include <linux/types.h> 38#include <linux/types.h>
58 39
59#define ULONG unsigned long
60#define USHORT unsigned short
61#define UCHAR unsigned char
62#define BYTE unsigned char
63#define WORD unsigned short
64#define DWORD unsigned long
65#define UBYTE unsigned char
66#define UWORD unsigned short
67#define UDWORD unsigned long
68#define U32 u32
69
70#define TOTAL_SG_ENTRY 32 40#define TOTAL_SG_ENTRY 32
71#define MAX_SUPPORTED_ADAPTERS 8 41#define MAX_SUPPORTED_ADAPTERS 8
72#define MAX_OFFSET 15 42#define MAX_OFFSET 15
@@ -368,55 +338,55 @@ typedef struct {
368/************************************************************************/ 338/************************************************************************/
369/* Scatter-Gather Element Structure */ 339/* Scatter-Gather Element Structure */
370/************************************************************************/ 340/************************************************************************/
371typedef struct SG_Struc { 341struct sg_entry {
372 U32 SG_Ptr; /* Data Pointer */ 342 u32 data; /* Data Pointer */
373 U32 SG_Len; /* Data Length */ 343 u32 len; /* Data Length */
374} SG; 344};
375 345
376/*********************************************************************** 346/***********************************************************************
377 SCSI Control Block 347 SCSI Control Block
378************************************************************************/ 348************************************************************************/
379typedef struct Scsi_Ctrl_Blk { 349struct scsi_ctrl_blk {
380 struct Scsi_Ctrl_Blk *SCB_NxtScb; 350 struct scsi_ctrl_blk *next;
381 UBYTE SCB_Status; /*4 */ 351 u8 status; /*4 */
382 UBYTE SCB_NxtStat; /*5 */ 352 u8 next_state; /*5 */
383 UBYTE SCB_Mode; /*6 */ 353 u8 mode; /*6 */
384 UBYTE SCB_Msgin; /*7 SCB_Res0 */ 354 u8 msgin; /*7 SCB_Res0 */
385 UWORD SCB_SGIdx; /*8 */ 355 u16 sgidx; /*8 */
386 UWORD SCB_SGMax; /*A */ 356 u16 sgmax; /*A */
387#ifdef ALPHA 357#ifdef ALPHA
388 U32 SCB_Reserved[2]; /*C */ 358 u32 reserved[2]; /*C */
389#else 359#else
390 U32 SCB_Reserved[3]; /*C */ 360 u32 reserved[3]; /*C */
391#endif 361#endif
392 362
393 U32 SCB_XferLen; /*18 Current xfer len */ 363 u32 xferlen; /*18 Current xfer len */
394 U32 SCB_TotXLen; /*1C Total xfer len */ 364 u32 totxlen; /*1C Total xfer len */
395 U32 SCB_PAddr; /*20 SCB phy. Addr. */ 365 u32 paddr; /*20 SCB phy. Addr. */
396 366
397 UBYTE SCB_Opcode; /*24 SCB command code */ 367 u8 opcode; /*24 SCB command code */
398 UBYTE SCB_Flags; /*25 SCB Flags */ 368 u8 flags; /*25 SCB Flags */
399 UBYTE SCB_Target; /*26 Target Id */ 369 u8 target; /*26 Target Id */
400 UBYTE SCB_Lun; /*27 Lun */ 370 u8 lun; /*27 Lun */
401 U32 SCB_BufPtr; /*28 Data Buffer Pointer */ 371 u32 bufptr; /*28 Data Buffer Pointer */
402 U32 SCB_BufLen; /*2C Data Allocation Length */ 372 u32 buflen; /*2C Data Allocation Length */
403 UBYTE SCB_SGLen; /*30 SG list # */ 373 u8 sglen; /*30 SG list # */
404 UBYTE SCB_SenseLen; /*31 Sense Allocation Length */ 374 u8 senselen; /*31 Sense Allocation Length */
405 UBYTE SCB_HaStat; /*32 */ 375 u8 hastat; /*32 */
406 UBYTE SCB_TaStat; /*33 */ 376 u8 tastat; /*33 */
407 UBYTE SCB_CDBLen; /*34 CDB Length */ 377 u8 cdblen; /*34 CDB Length */
408 UBYTE SCB_Ident; /*35 Identify */ 378 u8 ident; /*35 Identify */
409 UBYTE SCB_TagMsg; /*36 Tag Message */ 379 u8 tagmsg; /*36 Tag Message */
410 UBYTE SCB_TagId; /*37 Queue Tag */ 380 u8 tagid; /*37 Queue Tag */
411 UBYTE SCB_CDB[12]; /*38 */ 381 u8 cdb[12]; /*38 */
412 U32 SCB_SGPAddr; /*44 SG List/Sense Buf phy. Addr. */ 382 u32 sgpaddr; /*44 SG List/Sense Buf phy. Addr. */
413 U32 SCB_SensePtr; /*48 Sense data pointer */ 383 u32 senseptr; /*48 Sense data pointer */
414 void (*SCB_Post) (BYTE *, BYTE *); /*4C POST routine */ 384 void (*post) (u8 *, u8 *); /*4C POST routine */
415 struct scsi_cmnd *SCB_Srb; /*50 SRB Pointer */ 385 struct scsi_cmnd *srb; /*50 SRB Pointer */
416 SG SCB_SGList[TOTAL_SG_ENTRY]; /*54 Start of SG list */ 386 struct sg_entry sglist[TOTAL_SG_ENTRY]; /*54 Start of SG list */
417} SCB; 387};
418 388
419/* Bit Definition for SCB_Status */ 389/* Bit Definition for status */
420#define SCB_RENT 0x01 390#define SCB_RENT 0x01
421#define SCB_PEND 0x02 391#define SCB_PEND 0x02
422#define SCB_CONTIG 0x04 /* Contigent Allegiance */ 392#define SCB_CONTIG 0x04 /* Contigent Allegiance */
@@ -425,17 +395,17 @@ typedef struct Scsi_Ctrl_Blk {
425#define SCB_DONE 0x20 395#define SCB_DONE 0x20
426 396
427 397
428/* Opcodes of SCB_Opcode */ 398/* Opcodes for opcode */
429#define ExecSCSI 0x1 399#define ExecSCSI 0x1
430#define BusDevRst 0x2 400#define BusDevRst 0x2
431#define AbortCmd 0x3 401#define AbortCmd 0x3
432 402
433 403
434/* Bit Definition for SCB_Mode */ 404/* Bit Definition for mode */
435#define SCM_RSENS 0x01 /* request sense mode */ 405#define SCM_RSENS 0x01 /* request sense mode */
436 406
437 407
438/* Bit Definition for SCB_Flags */ 408/* Bit Definition for flags */
439#define SCF_DONE 0x01 409#define SCF_DONE 0x01
440#define SCF_POST 0x02 410#define SCF_POST 0x02
441#define SCF_SENSE 0x04 411#define SCF_SENSE 0x04
@@ -492,15 +462,14 @@ typedef struct Scsi_Ctrl_Blk {
492 Target Device Control Structure 462 Target Device Control Structure
493**********************************************************************/ 463**********************************************************************/
494 464
495typedef struct Tar_Ctrl_Struc { 465struct target_control {
496 UWORD TCS_Flags; /* 0 */ 466 u16 flags;
497 UBYTE TCS_JS_Period; /* 2 */ 467 u8 js_period;
498 UBYTE TCS_SConfig0; /* 3 */ 468 u8 sconfig0;
499 469 u16 drv_flags;
500 UWORD TCS_DrvFlags; /* 4 */ 470 u8 heads;
501 UBYTE TCS_DrvHead; /* 6 */ 471 u8 sectors;
502 UBYTE TCS_DrvSector; /* 7 */ 472};
503} TCS;
504 473
505/*********************************************************************** 474/***********************************************************************
506 Target Device Control Structure 475 Target Device Control Structure
@@ -523,62 +492,53 @@ typedef struct Tar_Ctrl_Struc {
523#define TCF_DRV_EN_TAG 0x0800 492#define TCF_DRV_EN_TAG 0x0800
524#define TCF_DRV_255_63 0x0400 493#define TCF_DRV_255_63 0x0400
525 494
526typedef struct I91u_Adpt_Struc {
527 UWORD ADPT_BIOS; /* 0 */
528 UWORD ADPT_BASE; /* 1 */
529 UBYTE ADPT_Bus; /* 2 */
530 UBYTE ADPT_Device; /* 3 */
531 UBYTE ADPT_INTR; /* 4 */
532} INI_ADPT_STRUCT;
533
534
535/*********************************************************************** 495/***********************************************************************
536 Host Adapter Control Structure 496 Host Adapter Control Structure
537************************************************************************/ 497************************************************************************/
538typedef struct Ha_Ctrl_Struc { 498struct initio_host {
539 UWORD HCS_Base; /* 00 */ 499 u16 addr; /* 00 */
540 UWORD HCS_BIOS; /* 02 */ 500 u16 bios_addr; /* 02 */
541 UBYTE HCS_Intr; /* 04 */ 501 u8 irq; /* 04 */
542 UBYTE HCS_SCSI_ID; /* 05 */ 502 u8 scsi_id; /* 05 */
543 UBYTE HCS_MaxTar; /* 06 */ 503 u8 max_tar; /* 06 */
544 UBYTE HCS_NumScbs; /* 07 */ 504 u8 num_scbs; /* 07 */
545 505
546 UBYTE HCS_Flags; /* 08 */ 506 u8 flags; /* 08 */
547 UBYTE HCS_Index; /* 09 */ 507 u8 index; /* 09 */
548 UBYTE HCS_HaId; /* 0A */ 508 u8 ha_id; /* 0A */
549 UBYTE HCS_Config; /* 0B */ 509 u8 config; /* 0B */
550 UWORD HCS_IdMask; /* 0C */ 510 u16 idmask; /* 0C */
551 UBYTE HCS_Semaph; /* 0E */ 511 u8 semaph; /* 0E */
552 UBYTE HCS_Phase; /* 0F */ 512 u8 phase; /* 0F */
553 UBYTE HCS_JSStatus0; /* 10 */ 513 u8 jsstatus0; /* 10 */
554 UBYTE HCS_JSInt; /* 11 */ 514 u8 jsint; /* 11 */
555 UBYTE HCS_JSStatus1; /* 12 */ 515 u8 jsstatus1; /* 12 */
556 UBYTE HCS_SConf1; /* 13 */ 516 u8 sconf1; /* 13 */
557 517
558 UBYTE HCS_Msg[8]; /* 14 */ 518 u8 msg[8]; /* 14 */
559 SCB *HCS_NxtAvail; /* 1C */ 519 struct scsi_ctrl_blk *next_avail; /* 1C */
560 SCB *HCS_Scb; /* 20 */ 520 struct scsi_ctrl_blk *scb; /* 20 */
561 SCB *HCS_ScbEnd; /* 24 */ 521 struct scsi_ctrl_blk *scb_end; /* 24 */ /*UNUSED*/
562 SCB *HCS_NxtPend; /* 28 */ 522 struct scsi_ctrl_blk *next_pending; /* 28 */
563 SCB *HCS_NxtContig; /* 2C */ 523 struct scsi_ctrl_blk *next_contig; /* 2C */ /*UNUSED*/
564 SCB *HCS_ActScb; /* 30 */ 524 struct scsi_ctrl_blk *active; /* 30 */
565 TCS *HCS_ActTcs; /* 34 */ 525 struct target_control *active_tc; /* 34 */
566 526
567 SCB *HCS_FirstAvail; /* 38 */ 527 struct scsi_ctrl_blk *first_avail; /* 38 */
568 SCB *HCS_LastAvail; /* 3C */ 528 struct scsi_ctrl_blk *last_avail; /* 3C */
569 SCB *HCS_FirstPend; /* 40 */ 529 struct scsi_ctrl_blk *first_pending; /* 40 */
570 SCB *HCS_LastPend; /* 44 */ 530 struct scsi_ctrl_blk *last_pending; /* 44 */
571 SCB *HCS_FirstBusy; /* 48 */ 531 struct scsi_ctrl_blk *first_busy; /* 48 */
572 SCB *HCS_LastBusy; /* 4C */ 532 struct scsi_ctrl_blk *last_busy; /* 4C */
573 SCB *HCS_FirstDone; /* 50 */ 533 struct scsi_ctrl_blk *first_done; /* 50 */
574 SCB *HCS_LastDone; /* 54 */ 534 struct scsi_ctrl_blk *last_done; /* 54 */
575 UBYTE HCS_MaxTags[16]; /* 58 */ 535 u8 max_tags[16]; /* 58 */
576 UBYTE HCS_ActTags[16]; /* 68 */ 536 u8 act_tags[16]; /* 68 */
577 TCS HCS_Tcs[MAX_TARGETS]; /* 78 */ 537 struct target_control targets[MAX_TARGETS]; /* 78 */
578 spinlock_t HCS_AvailLock; 538 spinlock_t avail_lock;
579 spinlock_t HCS_SemaphLock; 539 spinlock_t semaph_lock;
580 struct pci_dev *pci_dev; 540 struct pci_dev *pci_dev;
581} HCS; 541};
582 542
583/* Bit Definition for HCB_Config */ 543/* Bit Definition for HCB_Config */
584#define HCC_SCSI_RESET 0x01 544#define HCC_SCSI_RESET 0x01
@@ -599,47 +559,47 @@ typedef struct Ha_Ctrl_Struc {
599*******************************************************************/ 559*******************************************************************/
600 560
601typedef struct _NVRAM_SCSI { /* SCSI channel configuration */ 561typedef struct _NVRAM_SCSI { /* SCSI channel configuration */
602 UCHAR NVM_ChSCSIID; /* 0Ch -> Channel SCSI ID */ 562 u8 NVM_ChSCSIID; /* 0Ch -> Channel SCSI ID */
603 UCHAR NVM_ChConfig1; /* 0Dh -> Channel config 1 */ 563 u8 NVM_ChConfig1; /* 0Dh -> Channel config 1 */
604 UCHAR NVM_ChConfig2; /* 0Eh -> Channel config 2 */ 564 u8 NVM_ChConfig2; /* 0Eh -> Channel config 2 */
605 UCHAR NVM_NumOfTarg; /* 0Fh -> Number of SCSI target */ 565 u8 NVM_NumOfTarg; /* 0Fh -> Number of SCSI target */
606 /* SCSI target configuration */ 566 /* SCSI target configuration */
607 UCHAR NVM_Targ0Config; /* 10h -> Target 0 configuration */ 567 u8 NVM_Targ0Config; /* 10h -> Target 0 configuration */
608 UCHAR NVM_Targ1Config; /* 11h -> Target 1 configuration */ 568 u8 NVM_Targ1Config; /* 11h -> Target 1 configuration */
609 UCHAR NVM_Targ2Config; /* 12h -> Target 2 configuration */ 569 u8 NVM_Targ2Config; /* 12h -> Target 2 configuration */
610 UCHAR NVM_Targ3Config; /* 13h -> Target 3 configuration */ 570 u8 NVM_Targ3Config; /* 13h -> Target 3 configuration */
611 UCHAR NVM_Targ4Config; /* 14h -> Target 4 configuration */ 571 u8 NVM_Targ4Config; /* 14h -> Target 4 configuration */
612 UCHAR NVM_Targ5Config; /* 15h -> Target 5 configuration */ 572 u8 NVM_Targ5Config; /* 15h -> Target 5 configuration */
613 UCHAR NVM_Targ6Config; /* 16h -> Target 6 configuration */ 573 u8 NVM_Targ6Config; /* 16h -> Target 6 configuration */
614 UCHAR NVM_Targ7Config; /* 17h -> Target 7 configuration */ 574 u8 NVM_Targ7Config; /* 17h -> Target 7 configuration */
615 UCHAR NVM_Targ8Config; /* 18h -> Target 8 configuration */ 575 u8 NVM_Targ8Config; /* 18h -> Target 8 configuration */
616 UCHAR NVM_Targ9Config; /* 19h -> Target 9 configuration */ 576 u8 NVM_Targ9Config; /* 19h -> Target 9 configuration */
617 UCHAR NVM_TargAConfig; /* 1Ah -> Target A configuration */ 577 u8 NVM_TargAConfig; /* 1Ah -> Target A configuration */
618 UCHAR NVM_TargBConfig; /* 1Bh -> Target B configuration */ 578 u8 NVM_TargBConfig; /* 1Bh -> Target B configuration */
619 UCHAR NVM_TargCConfig; /* 1Ch -> Target C configuration */ 579 u8 NVM_TargCConfig; /* 1Ch -> Target C configuration */
620 UCHAR NVM_TargDConfig; /* 1Dh -> Target D configuration */ 580 u8 NVM_TargDConfig; /* 1Dh -> Target D configuration */
621 UCHAR NVM_TargEConfig; /* 1Eh -> Target E configuration */ 581 u8 NVM_TargEConfig; /* 1Eh -> Target E configuration */
622 UCHAR NVM_TargFConfig; /* 1Fh -> Target F configuration */ 582 u8 NVM_TargFConfig; /* 1Fh -> Target F configuration */
623} NVRAM_SCSI; 583} NVRAM_SCSI;
624 584
625typedef struct _NVRAM { 585typedef struct _NVRAM {
626/*----------header ---------------*/ 586/*----------header ---------------*/
627 USHORT NVM_Signature; /* 0,1: Signature */ 587 u16 NVM_Signature; /* 0,1: Signature */
628 UCHAR NVM_Size; /* 2: Size of data structure */ 588 u8 NVM_Size; /* 2: Size of data structure */
629 UCHAR NVM_Revision; /* 3: Revision of data structure */ 589 u8 NVM_Revision; /* 3: Revision of data structure */
630 /* ----Host Adapter Structure ---- */ 590 /* ----Host Adapter Structure ---- */
631 UCHAR NVM_ModelByte0; /* 4: Model number (byte 0) */ 591 u8 NVM_ModelByte0; /* 4: Model number (byte 0) */
632 UCHAR NVM_ModelByte1; /* 5: Model number (byte 1) */ 592 u8 NVM_ModelByte1; /* 5: Model number (byte 1) */
633 UCHAR NVM_ModelInfo; /* 6: Model information */ 593 u8 NVM_ModelInfo; /* 6: Model information */
634 UCHAR NVM_NumOfCh; /* 7: Number of SCSI channel */ 594 u8 NVM_NumOfCh; /* 7: Number of SCSI channel */
635 UCHAR NVM_BIOSConfig1; /* 8: BIOS configuration 1 */ 595 u8 NVM_BIOSConfig1; /* 8: BIOS configuration 1 */
636 UCHAR NVM_BIOSConfig2; /* 9: BIOS configuration 2 */ 596 u8 NVM_BIOSConfig2; /* 9: BIOS configuration 2 */
637 UCHAR NVM_HAConfig1; /* A: Hoat adapter configuration 1 */ 597 u8 NVM_HAConfig1; /* A: Hoat adapter configuration 1 */
638 UCHAR NVM_HAConfig2; /* B: Hoat adapter configuration 2 */ 598 u8 NVM_HAConfig2; /* B: Hoat adapter configuration 2 */
639 NVRAM_SCSI NVM_SCSIInfo[2]; 599 NVRAM_SCSI NVM_SCSIInfo[2];
640 UCHAR NVM_reserved[10]; 600 u8 NVM_reserved[10];
641 /* ---------- CheckSum ---------- */ 601 /* ---------- CheckSum ---------- */
642 USHORT NVM_CheckSum; /* 0x3E, 0x3F: Checksum of NVRam */ 602 u16 NVM_CheckSum; /* 0x3E, 0x3F: Checksum of NVRam */
643} NVRAM, *PNVRAM; 603} NVRAM, *PNVRAM;
644 604
645/* Bios Configuration for nvram->BIOSConfig1 */ 605/* Bios Configuration for nvram->BIOSConfig1 */
@@ -681,19 +641,6 @@ typedef struct _NVRAM {
681#define DISC_ALLOW 0xC0 /* Disconnect is allowed */ 641#define DISC_ALLOW 0xC0 /* Disconnect is allowed */
682#define SCSICMD_RequestSense 0x03 642#define SCSICMD_RequestSense 0x03
683 643
684typedef struct _HCSinfo {
685 ULONG base;
686 UCHAR vec;
687 UCHAR bios; /* High byte of BIOS address */
688 USHORT BaseAndBios; /* high byte: pHcsInfo->bios,low byte:pHcsInfo->base */
689} HCSINFO;
690
691#define TUL_RD(x,y) (UCHAR)(inb( (int)((ULONG)(x+y)) ))
692#define TUL_RDLONG(x,y) (ULONG)(inl((int)((ULONG)(x+y)) ))
693#define TUL_WR( adr,data) outb( (UCHAR)(data), (int)(adr))
694#define TUL_WRSHORT(adr,data) outw( (UWORD)(data), (int)(adr))
695#define TUL_WRLONG( adr,data) outl( (ULONG)(data), (int)(adr))
696
697#define SCSI_ABORT_SNOOZE 0 644#define SCSI_ABORT_SNOOZE 0
698#define SCSI_ABORT_SUCCESS 1 645#define SCSI_ABORT_SUCCESS 1
699#define SCSI_ABORT_PENDING 2 646#define SCSI_ABORT_PENDING 2