Annotation of Gnu-Mach/i386/i386at/gpl/linux/scsi/BusLogic.h, revision 1.1

1.1     ! root        1: /*
        !             2: 
        !             3:   Linux Driver for BusLogic MultiMaster SCSI Host Adapters
        !             4: 
        !             5:   Copyright 1995 by Leonard N. Zubkoff <[email protected]>
        !             6: 
        !             7:   See BusLogic.c for licensing information.
        !             8: 
        !             9: */
        !            10: 
        !            11: 
        !            12: /*
        !            13:   Define types for some of the structures that interface with the rest
        !            14:   of the Linux Kernel and SCSI Subsystem.
        !            15: */
        !            16: 
        !            17: typedef struct pt_regs Registers_T;
        !            18: typedef Scsi_Host_Template SCSI_Host_Template_T;
        !            19: typedef struct Scsi_Host SCSI_Host_T;
        !            20: typedef struct scsi_disk SCSI_Disk_T;
        !            21: typedef struct scsi_cmnd SCSI_Command_T;
        !            22: typedef struct scatterlist SCSI_ScatterList_T;
        !            23: typedef kdev_t KernelDevice_T;
        !            24: 
        !            25: 
        !            26: /*
        !            27:   Define prototypes for the BusLogic Driver Interface Functions.
        !            28: */
        !            29: 
        !            30: const char *BusLogic_DriverInfo(SCSI_Host_T *);
        !            31: int BusLogic_DetectHostAdapter(SCSI_Host_Template_T *);
        !            32: int BusLogic_ReleaseHostAdapter(SCSI_Host_T *);
        !            33: int BusLogic_QueueCommand(SCSI_Command_T *,
        !            34:                          void (*CompletionRoutine)(SCSI_Command_T *));
        !            35: int BusLogic_AbortCommand(SCSI_Command_T *);
        !            36: int BusLogic_ResetCommand(SCSI_Command_T *);
        !            37: int BusLogic_BIOSDiskParameters(SCSI_Disk_T *, KernelDevice_T, int *);
        !            38: 
        !            39: 
        !            40: /*
        !            41:   Define the BusLogic SCSI Host Template structure.
        !            42: */
        !            43: 
        !            44: #define BUSLOGIC                                                        \
        !            45:   { NULL,                              /* Next                      */  \
        !            46:     NULL,                              /* Usage Count Pointer       */  \
        !            47:     NULL,                              /* /proc Directory Entry     */  \
        !            48:     NULL,                              /* /proc Info Function       */  \
        !            49:     "BusLogic",                                /* Driver Name               */  \
        !            50:     BusLogic_DetectHostAdapter,                /* Detect Host Adapter       */  \
        !            51:     BusLogic_ReleaseHostAdapter,       /* Release Host Adapter      */  \
        !            52:     BusLogic_DriverInfo,               /* Driver Info Function      */  \
        !            53:     NULL,                              /* Command Function          */  \
        !            54:     BusLogic_QueueCommand,             /* Queue Command Function    */  \
        !            55:     BusLogic_AbortCommand,             /* Abort Command Function    */  \
        !            56:     BusLogic_ResetCommand,             /* Reset Command Function    */  \
        !            57:     NULL,                              /* Slave Attach Function     */  \
        !            58:     BusLogic_BIOSDiskParameters,       /* Disk BIOS Parameters      */  \
        !            59:     0,                                 /* Can Queue                 */  \
        !            60:     0,                                 /* This ID                   */  \
        !            61:     0,                                 /* Scatter/Gather Table Size */  \
        !            62:     0,                                 /* SCSI Commands per LUN     */  \
        !            63:     0,                                 /* Present                   */  \
        !            64:     1,                                 /* Default Unchecked ISA DMA */  \
        !            65:     ENABLE_CLUSTERING }                        /* Enable Clustering         */
        !            66: 
        !            67: 
        !            68: /*
        !            69:   BusLogic_DriverVersion protects the private portion of this file.
        !            70: */
        !            71: 
        !            72: #ifdef BusLogic_DriverVersion
        !            73: 
        !            74: 
        !            75: /*
        !            76:   Define the maximum number of BusLogic Host Adapters that are supported.
        !            77: */
        !            78: 
        !            79: #define BusLogic_MaxHostAdapters               10
        !            80: 
        !            81: 
        !            82: /*
        !            83:   Define the maximum number of I/O Addresses that may be probed.
        !            84: */
        !            85: 
        !            86: #define BusLogic_IO_MaxProbeAddresses          16
        !            87: 
        !            88: 
        !            89: /*
        !            90:   Define the maximum number of Target IDs supported by this driver.
        !            91: */
        !            92: 
        !            93: #define BusLogic_MaxTargetIDs                  16
        !            94: 
        !            95: 
        !            96: /*
        !            97:   Define the number of Incoming and Outgoing Mailboxes used by this driver.
        !            98:   The maximum possible value is 255, since the MailboxCount parameter to the
        !            99:   Initialize Extended Mailbox command is limited to a single byte.
        !           100: */
        !           101: 
        !           102: #define BusLogic_MailboxCount                  64
        !           103: 
        !           104: 
        !           105: /*
        !           106:   Define the number of Command Control Blocks (CCBs) to create during
        !           107:   initialization for each Host Adapter.  Additional CCBs will be allocated
        !           108:   if necessary as commands are queued.
        !           109: */
        !           110: 
        !           111: #define BusLogic_InitialCCBs                   32
        !           112: 
        !           113: 
        !           114: /*
        !           115:   Define the maximum number of Scatter/Gather Segments used by this driver.
        !           116:   For maximum performance, it is important that this limit be at least as
        !           117:   large as the maximum single request generated by the routine make_request.
        !           118: */
        !           119: 
        !           120: #define BusLogic_ScatterGatherLimit            128
        !           121: 
        !           122: 
        !           123: /*
        !           124:   Define the default number of Concurrent Commands per Logical Unit to allow
        !           125:   for Target Devices depending on whether or not ISA bounce buffers are
        !           126:   required.
        !           127: */
        !           128: 
        !           129: #define BusLogic_Concurrency                   7
        !           130: #define BusLogic_Concurrency_BB                        1
        !           131: 
        !           132: 
        !           133: /*
        !           134:   Define the default amount of time in seconds to wait between a Host Adapter
        !           135:   Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI commands.
        !           136:   Some SCSI devices get confused if they receive SCSI commands too soon after
        !           137:   a SCSI Bus Reset.
        !           138: */
        !           139: 
        !           140: #define BusLogic_DefaultBusSettleTime          2
        !           141: 
        !           142: 
        !           143: /*
        !           144:   Define the possible Local Options.
        !           145: */
        !           146: 
        !           147: #define BusLogic_InhibitTargetInquiry          1
        !           148: 
        !           149: 
        !           150: /*
        !           151:   Define the possible Global Options.
        !           152: */
        !           153: 
        !           154: #define BusLogic_TraceProbe                    1
        !           155: #define BusLogic_TraceHardReset                        2
        !           156: #define BusLogic_TraceConfiguration            4
        !           157: #define BusLogic_TraceErrors                   8
        !           158: 
        !           159: 
        !           160: /*
        !           161:   Define the possible Error Recovery Options.
        !           162: */
        !           163: 
        !           164: #define BusLogic_ErrorRecoveryDefault          0
        !           165: #define BusLogic_ErrorRecoveryHardReset                1
        !           166: #define BusLogic_ErrorRecoveryBusDeviceReset   2
        !           167: #define BusLogic_ErrorRecoveryNone             3
        !           168: 
        !           169: static char
        !           170:   *BusLogic_ErrorRecoveryOptions[] =
        !           171:     { "Default", "Hard Reset", "Bus Device Reset", "None" },
        !           172:   *BusLogic_ErrorRecoveryOptions2[] =
        !           173:     { "D", "H", "B", "N" };
        !           174: 
        !           175: 
        !           176: /*
        !           177:   Define a boolean data type.
        !           178: */
        !           179: 
        !           180: #define false 0
        !           181: #define true  1
        !           182: typedef unsigned char boolean;
        !           183: 
        !           184: 
        !           185: /*
        !           186:   Define the BusLogic SCSI Host Adapter I/O Register Offsets.
        !           187: */
        !           188: 
        !           189: #define BusLogic_IO_PortCount                  4       /* I/O Registers */
        !           190: #define BusLogic_ControlRegister               0       /* WO register */
        !           191: #define BusLogic_StatusRegister                        0       /* RO register */
        !           192: #define BusLogic_CommandParameterRegister      1       /* WO register */
        !           193: #define BusLogic_DataInRegister                        1       /* RO register */
        !           194: #define BusLogic_InterruptRegister             2       /* RO register */
        !           195: #define BusLogic_GeometryRegister              3       /* RO, undocumented */
        !           196: 
        !           197: 
        !           198: /*
        !           199:   Define the bits in the write-only Control Register.
        !           200: */
        !           201: 
        !           202: #define BusLogic_ReservedCR                    0x0F
        !           203: #define BusLogic_SCSIBusReset                  0x10
        !           204: #define BusLogic_InterruptReset                        0x20
        !           205: #define BusLogic_SoftReset                     0x40
        !           206: #define BusLogic_HardReset                     0x80
        !           207: 
        !           208: 
        !           209: /*
        !           210:   Define the bits in the read-only Status Register.
        !           211: */
        !           212: 
        !           213: #define BusLogic_CommandInvalid                        0x01
        !           214: #define BusLogic_ReservedSR                    0x02
        !           215: #define BusLogic_DataInRegisterReady           0x04
        !           216: #define BusLogic_CommandParameterRegisterBusy  0x08
        !           217: #define BusLogic_HostAdapterReady              0x10
        !           218: #define BusLogic_InitializationRequired                0x20
        !           219: #define BusLogic_DiagnosticFailure             0x40
        !           220: #define BusLogic_DiagnosticActive              0x80
        !           221: 
        !           222: 
        !           223: /*
        !           224:   Define the bits in the read-only Interrupt Register.
        !           225: */
        !           226: 
        !           227: #define BusLogic_IncomingMailboxLoaded         0x01
        !           228: #define BusLogic_OutgoingMailboxAvailable      0x02
        !           229: #define BusLogic_CommandComplete               0x04
        !           230: #define BusLogic_SCSIResetState                        0x08
        !           231: #define BusLogic_ReservedIR                    0x70
        !           232: #define BusLogic_InterruptValid                        0x80
        !           233: 
        !           234: 
        !           235: /*
        !           236:   Define the bits in the undocumented read-only Geometry Register.
        !           237: */
        !           238: 
        !           239: #define BusLogic_Drive0Geometry                        0x03
        !           240: #define BusLogic_Drive1Geometry                        0x0C
        !           241: #define BusLogic_ReservedGR                    0x70
        !           242: #define BusLogic_ExtendedTranslationEnabled    0x80
        !           243: 
        !           244: 
        !           245: /*
        !           246:   Define the BusLogic SCSI Host Adapter Command Register Operation Codes.
        !           247: */
        !           248: 
        !           249: typedef enum
        !           250: {
        !           251:   BusLogic_TestCommandCompleteInterrupt =      0x00,   /* documented */
        !           252:   BusLogic_InitializeMailbox =                 0x01,   /* documented */
        !           253:   BusLogic_StartMailboxCommand =               0x02,   /* documented */
        !           254:   BusLogic_StartBIOSCommand =                  0x03,   /* documented */
        !           255:   BusLogic_InquireBoardID =                    0x04,   /* documented */
        !           256:   BusLogic_EnableOutgoingMailboxAvailableIRQ = 0x05,   /* documented */
        !           257:   BusLogic_SetSCSISelectionTimeout =           0x06,   /* documented */
        !           258:   BusLogic_SetPreemptTimeOnBus =               0x07,   /* documented */
        !           259:   BusLogic_SetTimeOffBus =                     0x08,   /* ISA Bus only */
        !           260:   BusLogic_SetBusTransferRate =                        0x09,   /* ISA Bus only */
        !           261:   BusLogic_InquireInstalledDevicesID0to7 =     0x0A,   /* documented */
        !           262:   BusLogic_InquireConfiguration =              0x0B,   /* documented */
        !           263:   BusLogic_SetTargetMode =                     0x0C,   /* now undocumented */
        !           264:   BusLogic_InquireSetupInformation =           0x0D,   /* documented */
        !           265:   BusLogic_WriteAdapterLocalRAM =              0x1A,   /* documented */
        !           266:   BusLogic_ReadAdapterLocalRAM =               0x1B,   /* documented */
        !           267:   BusLogic_WriteBusMasterChipFIFO =            0x1C,   /* documented */
        !           268:   BusLogic_ReadBusMasterChipFIFO =             0x1D,   /* documented */
        !           269:   BusLogic_EchoCommandData =                   0x1F,   /* documented */
        !           270:   BusLogic_HostAdapterDiagnostic =             0x20,   /* documented */
        !           271:   BusLogic_SetAdapterOptions =                 0x21,   /* documented */
        !           272:   BusLogic_InquireInstalledDevicesID8to15 =    0x23,   /* Wide only */
        !           273:   BusLogic_InitializeExtendedMailbox =         0x81,   /* documented */
        !           274:   BusLogic_InquireFirmwareVersion3rdDigit =    0x84,   /* undocumented */
        !           275:   BusLogic_InquireFirmwareVersionLetter =      0x85,   /* undocumented */
        !           276:   BusLogic_InquireBoardModelNumber      =      0x8B,   /* undocumented */
        !           277:   BusLogic_InquireSynchronousPeriod =          0x8C,   /* undocumented */
        !           278:   BusLogic_InquireExtendedSetupInformation =   0x8D,   /* documented */
        !           279:   BusLogic_EnableStrictRoundRobinMode =                0x8F,   /* documented */
        !           280:   BusLogic_ModifyIOAddress =                   0x95,   /* PCI only */
        !           281:   BusLogic_EnableWideModeCCB =                 0x96    /* Wide only */
        !           282: }
        !           283: BusLogic_OperationCode_T;
        !           284: 
        !           285: 
        !           286: /*
        !           287:   Define the Inquire Board ID reply structure.
        !           288: */
        !           289: 
        !           290: typedef struct BusLogic_BoardID
        !           291: {
        !           292:   unsigned char BoardType;
        !           293:   unsigned char CustomFeatures;
        !           294:   unsigned char FirmwareVersion1stDigit;
        !           295:   unsigned char FirmwareVersion2ndDigit;
        !           296: }
        !           297: BusLogic_BoardID_T;
        !           298: 
        !           299: 
        !           300: /*
        !           301:   Define the Inquire Installed Devices ID 0 to 7 and Inquire Installed
        !           302:   Devices ID 8 to 15 reply type.  For each Target ID, a byte is returned
        !           303:   where bit 0 set indicates that Logical Unit 0 exists, bit 1 set indicates
        !           304:   that Logical Unit 1 exists, and so on.
        !           305: */
        !           306: 
        !           307: typedef unsigned char BusLogic_InstalledDevices8_T[8];
        !           308: 
        !           309: typedef unsigned char BusLogic_InstalledDevices_T[BusLogic_MaxTargetIDs];
        !           310: 
        !           311: 
        !           312: /*
        !           313:   Define the Inquire Configuration reply structure.
        !           314: */
        !           315: 
        !           316: typedef struct BusLogic_Configuration
        !           317: {
        !           318:   unsigned char :5;                            /* Byte 0: DMA Channel */
        !           319:   boolean DMA_Channel5:1;
        !           320:   boolean DMA_Channel6:1;
        !           321:   boolean DMA_Channel7:1;
        !           322:   boolean IRQ_Channel9:1;                      /* Byte 1: IRQ Channel */
        !           323:   boolean IRQ_Channel10:1;
        !           324:   boolean IRQ_Channel11:1;
        !           325:   boolean IRQ_Channel12:1;
        !           326:   unsigned char :1;
        !           327:   boolean IRQ_Channel14:1;
        !           328:   boolean IRQ_Channel15:1;
        !           329:   unsigned char :1;
        !           330:   unsigned char HostAdapterID:4;               /* Byte 2: Host Adapter ID */
        !           331:   unsigned char :4;
        !           332: }
        !           333: BusLogic_Configuration_T;
        !           334: 
        !           335: 
        !           336: /*
        !           337:   Define the Inquire Setup Information reply structure.
        !           338: */
        !           339: 
        !           340: typedef struct BusLogic_SynchronousValue
        !           341: {
        !           342:   unsigned char Offset:4;
        !           343:   unsigned char TransferPeriod:3;
        !           344:   boolean Synchronous:1;
        !           345: }
        !           346: BusLogic_SynchronousValue_T;
        !           347: 
        !           348: typedef BusLogic_SynchronousValue_T
        !           349:   BusLogic_SynchronousValues8_T[8];
        !           350: 
        !           351: typedef BusLogic_SynchronousValue_T
        !           352:   BusLogic_SynchronousValues_T[BusLogic_MaxTargetIDs];
        !           353: 
        !           354: typedef struct BusLogic_SetupInformation
        !           355: {
        !           356:   boolean SynchronousInitiationEnabled:1;      /* Byte 0 */
        !           357:   boolean ParityCheckEnabled:1;
        !           358:   unsigned char :6;
        !           359:   unsigned char BusTransferRate;               /* Byte 1 */
        !           360:   unsigned char PreemptTimeOnBus;              /* Byte 2 */
        !           361:   unsigned char TimeOffBus;                    /* Byte 3 */
        !           362:   unsigned char MailboxCount;                  /* Byte 4 */
        !           363:   unsigned char MailboxAddress[3];             /* Bytes 5-7 */
        !           364:   BusLogic_SynchronousValues8_T SynchronousValuesID0to7; /* Bytes 8-15 */
        !           365:   unsigned char DisconnectPermittedID0to7;     /* Byte 16 */
        !           366:   unsigned char Signature;                     /* Byte 17 */
        !           367:   unsigned char CharacterD;                    /* Byte 18 */
        !           368:   unsigned char BusLetter;                     /* Byte 19 */
        !           369:   unsigned char :8;                            /* Byte 20 */
        !           370:   unsigned char :8;                            /* Byte 21 */
        !           371:   BusLogic_SynchronousValues8_T SynchronousValuesID8to15; /* Bytes 22-29 */
        !           372:   unsigned char DisconnectPermittedID8to15;    /* Byte 30 */
        !           373: }
        !           374: BusLogic_SetupInformation_T;
        !           375: 
        !           376: 
        !           377: /*
        !           378:   Define the Initialize Extended Mailbox request structure.
        !           379: */
        !           380: 
        !           381: typedef struct BusLogic_ExtendedMailboxRequest
        !           382: {
        !           383:   unsigned char MailboxCount;
        !           384:   void *BaseMailboxAddress __attribute__ ((packed));
        !           385: }
        !           386: BusLogic_ExtendedMailboxRequest_T;
        !           387: 
        !           388: 
        !           389: /*
        !           390:   Define the Inquire Firmware Version 3rd Digit reply type.
        !           391: */
        !           392: 
        !           393: typedef unsigned char BusLogic_FirmwareVersion3rdDigit_T;
        !           394: 
        !           395: 
        !           396: /*
        !           397:   Define the Inquire Firmware Version Letter reply type.
        !           398: */
        !           399: 
        !           400: typedef unsigned char BusLogic_FirmwareVersionLetter_T;
        !           401: 
        !           402: 
        !           403: /*
        !           404:   Define the Inquire Board Model Number reply type.
        !           405: */
        !           406: 
        !           407: typedef unsigned char BusLogic_BoardModelNumber_T[5];
        !           408: 
        !           409: 
        !           410: /*
        !           411:   Define the Inquire Synchronous Period reply type.  For each Target ID, a byte
        !           412:   is returned which represents the Synchronous Transfer Period in units of 10
        !           413:   nanoseconds.
        !           414: */
        !           415: 
        !           416: typedef unsigned char BusLogic_SynchronousPeriod_T[BusLogic_MaxTargetIDs];
        !           417: 
        !           418: 
        !           419: /*
        !           420:   Define the Inquire Extended Setup Information reply structure.
        !           421: */
        !           422: 
        !           423: typedef struct BusLogic_ExtendedSetupInformation
        !           424: {
        !           425:   unsigned char BusType;                               /* Byte 0 */
        !           426:   unsigned char BIOS_Address;                          /* Byte 1 */
        !           427:   unsigned short ScatterGatherLimit;                   /* Bytes 2-3 */
        !           428:   unsigned char MailboxCount;                          /* Byte 4 */
        !           429:   void *BaseMailboxAddress __attribute__ ((packed));   /* Bytes 5-8 */
        !           430:   struct { unsigned char :6;                           /* Byte 9 */
        !           431:           boolean LevelSensitiveInterrupts:1;
        !           432:           unsigned char :1; } Misc;
        !           433:   unsigned char FirmwareRevision[3];                   /* Bytes 10-12 */
        !           434:   boolean HostWideSCSI:1;                              /* Byte 13 Bit 0 */
        !           435:   boolean HostDifferentialSCSI:1;                      /* Byte 13 Bit 1 */
        !           436:   unsigned char :6;
        !           437: }
        !           438: BusLogic_ExtendedSetupInformation_T;
        !           439: 
        !           440: 
        !           441: /*
        !           442:   Define the Enable Strict Round Robin Mode request type.
        !           443: */
        !           444: 
        !           445: #define BusLogic_AggressiveRoundRobinMode      0x00
        !           446: #define BusLogic_StrictRoundRobinMode          0x01
        !           447: 
        !           448: typedef unsigned char BusLogic_RoundRobinModeRequest_T;
        !           449: 
        !           450: 
        !           451: /*
        !           452:   Define the Modify I/O Address request type.  On PCI Host Adapters, the
        !           453:   Modify I/O Address command allows modification of the ISA compatible I/O
        !           454:   Address that the Host Adapter responds to; it does not affect the PCI
        !           455:   compliant I/O Address assigned at system initialization.
        !           456: */
        !           457: 
        !           458: #define BusLogic_ModifyIO_330                  0x00
        !           459: #define BusLogic_ModifyIO_334                  0x01
        !           460: #define BusLogic_ModifyIO_230                  0x02
        !           461: #define BusLogic_ModifyIO_234                  0x03
        !           462: #define BusLogic_ModifyIO_130                  0x04
        !           463: #define BusLogic_ModifyIO_134                  0x05
        !           464: #define BusLogic_ModifyIO_Disable              0x06
        !           465: #define BusLogic_ModifyIO_Disable2             0x07
        !           466: 
        !           467: typedef unsigned char BusLogic_ModifyIOAddressRequest_T;
        !           468: 
        !           469: 
        !           470: /*
        !           471:   Define the Enable Wide Mode SCSI CCB request type.  Wide Mode CCBs are
        !           472:   necessary to support more than 8 Logical Units per Target.
        !           473: */
        !           474: 
        !           475: #define BusLogic_NormalModeCCB                 0x00
        !           476: #define BusLogic_WideModeCCB                   0x01
        !           477: 
        !           478: typedef unsigned char BusLogic_WideModeCCBRequest_T;
        !           479: 
        !           480: 
        !           481: /*
        !           482:   Define the Requested Reply Length type used by the Inquire Setup Information,
        !           483:   Inquire Board Model Number, Inquire Synchronous Period, and Inquire Extended
        !           484:   Setup Information commands.
        !           485: */
        !           486: 
        !           487: typedef unsigned char BusLogic_RequestedReplyLength_T;
        !           488: 
        !           489: 
        !           490: /*
        !           491:   Define a Lock data structure.  Until a true symmetric multiprocessing kernel
        !           492:   is available, locking is implemented as saving the processor flags and
        !           493:   disabling interrupts, and unlocking restores the saved processor flags.
        !           494: */
        !           495: 
        !           496: typedef unsigned long BusLogic_Lock_T;
        !           497: 
        !           498: 
        !           499: /*
        !           500:   Define the Outgoing Mailbox Action Codes.
        !           501: */
        !           502: 
        !           503: typedef enum
        !           504: {
        !           505:   BusLogic_OutgoingMailboxFree =               0,
        !           506:   BusLogic_MailboxStartCommand =               1,
        !           507:   BusLogic_MailboxAbortCommand =               2
        !           508: }
        !           509: BusLogic_ActionCode_T;
        !           510: 
        !           511: 
        !           512: /*
        !           513:   Define the Incoming Mailbox Completion Codes.
        !           514: */
        !           515: 
        !           516: typedef enum
        !           517: {
        !           518:   BusLogic_IncomingMailboxFree =               0,
        !           519:   BusLogic_CommandCompletedWithoutError =      1,
        !           520:   BusLogic_CommandAbortedAtHostRequest =       2,
        !           521:   BusLogic_AbortedCommandNotFound =            3,
        !           522:   BusLogic_CommandCompletedWithError =         4
        !           523: }
        !           524: BusLogic_CompletionCode_T;
        !           525: 
        !           526: 
        !           527: /*
        !           528:   Define the Command Control Block (CCB) Opcodes.
        !           529: */
        !           530: 
        !           531: typedef enum
        !           532: {
        !           533:   BusLogic_InitiatorCCB =                      0x00,
        !           534:   BusLogic_TargetCCB =                         0x01,
        !           535:   BusLogic_InitiatorCCB_ScatterGather =                0x02,
        !           536:   BusLogic_InitiatorCCB_ResidualDataLength =   0x03,
        !           537:   BusLogic_InitiatorCCB_ScatterGatherResidual =        0x04,
        !           538:   BusLogic_SCSIBusDeviceReset =                        0x81
        !           539: }
        !           540: BusLogic_CCB_Opcode_T;
        !           541: 
        !           542: 
        !           543: /*
        !           544:   Define the CCB Data Direction Codes.
        !           545: */
        !           546: 
        !           547: typedef enum
        !           548: {
        !           549:   BusLogic_UncheckedDataTransfer =             0x00,
        !           550:   BusLogic_DataInLengthChecked =               0x01,
        !           551:   BusLogic_DataOutLengthChecked =              0x02,
        !           552:   BusLogic_NoDataTransfer =                    0x03
        !           553: }
        !           554: BusLogic_DataDirection_T;
        !           555: 
        !           556: 
        !           557: /*
        !           558:   Define the Host Adapter Status Codes.
        !           559: */
        !           560: 
        !           561: typedef enum
        !           562: {
        !           563:   BusLogic_CommandCompletedNormally =          0x00,
        !           564:   BusLogic_LinkedCommandCompleted =            0x0A,
        !           565:   BusLogic_LinkedCommandCompletedWithFlag =    0x0B,
        !           566:   BusLogic_SCSISelectionTimeout =              0x11,
        !           567:   BusLogic_DataOverUnderRun =                  0x12,
        !           568:   BusLogic_UnexpectedBusFree =                 0x13,
        !           569:   BusLogic_InvalidBusPhaseRequested =          0x14,
        !           570:   BusLogic_InvalidOutgoingMailboxActionCode =  0x15,
        !           571:   BusLogic_InvalidCommandOperationCode =       0x16,
        !           572:   BusLogic_LinkedCCBhasInvalidLUN =            0x17,
        !           573:   BusLogic_InvalidCommandParameter =           0x1A,
        !           574:   BusLogic_AutoRequestSenseFailed =            0x1B,
        !           575:   BusLogic_TaggedQueuingMessageRejected =      0x1C,
        !           576:   BusLogic_UnsupportedMessageReceived =                0x1D,
        !           577:   BusLogic_HostAdapterHardwareFailed =         0x20,
        !           578:   BusLogic_TargetFailedResponseToATN =         0x21,
        !           579:   BusLogic_HostAdapterAssertedRST =            0x22,
        !           580:   BusLogic_OtherDeviceAssertedRST =            0x23,
        !           581:   BusLogic_TargetDeviceReconnectedImproperly = 0x24,
        !           582:   BusLogic_HostAdapterAssertedBusDeviceReset = 0x25,
        !           583:   BusLogic_AbortQueueGenerated =               0x26,
        !           584:   BusLogic_HostAdapterSoftwareError =          0x27,
        !           585:   BusLogic_HostAdapterHardwareTimeoutError =   0x30,
        !           586:   BusLogic_SCSIParityErrorDetected =           0x34
        !           587: }
        !           588: BusLogic_HostAdapterStatus_T;
        !           589: 
        !           590: 
        !           591: /*
        !           592:   Define the SCSI Target Device Status Codes.
        !           593: */
        !           594: 
        !           595: typedef enum
        !           596: {
        !           597:   BusLogic_OperationGood =                     0x00,
        !           598:   BusLogic_CheckCondition =                    0x02,
        !           599:   BusLogic_DeviceBusy =                                0x08
        !           600: }
        !           601: BusLogic_TargetDeviceStatus_T;
        !           602: 
        !           603: 
        !           604: /*
        !           605:   Define the Queue Tag Codes.
        !           606: */
        !           607: 
        !           608: typedef enum
        !           609: {
        !           610:   BusLogic_SimpleQueueTag =                    0x00,
        !           611:   BusLogic_HeadOfQueueTag =                    0x01,
        !           612:   BusLogic_OrderedQueueTag =                   0x02,
        !           613:   BusLogic_ReservedQT =                                0x03
        !           614: }
        !           615: BusLogic_QueueTag_T;
        !           616: 
        !           617: 
        !           618: /*
        !           619:   Define the SCSI Command Descriptor Block (CDB).
        !           620: */
        !           621: 
        !           622: #define BusLogic_CDB_MaxLength                 12
        !           623: 
        !           624: typedef unsigned char SCSI_CDB_T[BusLogic_CDB_MaxLength];
        !           625: 
        !           626: 
        !           627: /*
        !           628:   Define the SCSI Sense Data.
        !           629: */
        !           630: 
        !           631: #define BusLogic_SenseDataMaxLength            255
        !           632: 
        !           633: typedef unsigned char SCSI_SenseData_T[BusLogic_SenseDataMaxLength];
        !           634: 
        !           635: 
        !           636: /*
        !           637:   Define the Scatter/Gather Segment structure required by the Host Adapter
        !           638:   Firmware Interface.
        !           639: */
        !           640: 
        !           641: typedef struct BusLogic_ScatterGatherSegment
        !           642: {
        !           643:   unsigned long SegmentByteCount;
        !           644:   void *SegmentDataPointer;
        !           645: }
        !           646: BusLogic_ScatterGatherSegment_T;
        !           647: 
        !           648: 
        !           649: /*
        !           650:   Define the 32 Bit Mode Command Control Block (CCB) structure.  The first 40
        !           651:   bytes are defined by the Host Adapter Firmware Interface.  The remaining
        !           652:   components are defined by the Linux BusLogic Driver.  Wide Mode CCBs differ
        !           653:   from standard 32 Bit Mode CCBs only in having the TagEnable and QueueTag
        !           654:   fields moved from byte 17 to byte 1, and the Logical Unit field in byte 17
        !           655:   expanded to 6 bits; unfortunately, using a union of structs containing
        !           656:   enumeration type bitfields to provide both definitions leads to packing
        !           657:   problems, so the following definition is used which requires setting
        !           658:   TagEnable to Logical Unit bit 5 in Wide Mode CCBs.
        !           659: */
        !           660: 
        !           661: typedef struct BusLogic_CCB
        !           662: {
        !           663:   /*
        !           664:     BusLogic Host Adapter Firmware Portion.
        !           665:   */
        !           666:   BusLogic_CCB_Opcode_T Opcode:8;                      /* Byte 0 */
        !           667:   unsigned char :3;                                    /* Byte 1 Bits 0-2 */
        !           668:   BusLogic_DataDirection_T DataDirection:2;            /* Byte 1 Bits 3-4 */
        !           669:   boolean WideModeTagEnable:1;                         /* Byte 1 Bit 5 */
        !           670:   BusLogic_QueueTag_T WideModeQueueTag:2;              /* Byte 1 Bits 6-7 */
        !           671:   unsigned char CDB_Length;                            /* Byte 2 */
        !           672:   unsigned char SenseDataLength;                       /* Byte 3 */
        !           673:   unsigned long DataLength;                            /* Bytes 4-7 */
        !           674:   void *DataPointer;                                   /* Bytes 8-11 */
        !           675:   unsigned char :8;                                    /* Byte 12 */
        !           676:   unsigned char :8;                                    /* Byte 13 */
        !           677:   BusLogic_HostAdapterStatus_T HostAdapterStatus:8;    /* Byte 14 */
        !           678:   BusLogic_TargetDeviceStatus_T TargetDeviceStatus:8;  /* Byte 15 */
        !           679:   unsigned char TargetID;                              /* Byte 16 */
        !           680:   unsigned char LogicalUnit:5;                         /* Byte 17 Bits 0-4 */
        !           681:   boolean TagEnable:1;                                 /* Byte 17 Bit 5 */
        !           682:   BusLogic_QueueTag_T QueueTag:2;                      /* Byte 17 Bits 6-7 */
        !           683:   SCSI_CDB_T CDB;                                      /* Bytes 18-29 */
        !           684:   unsigned char :8;                                    /* Byte 30 */
        !           685:   unsigned char :8;                                    /* Byte 31 */
        !           686:   unsigned long :32;                                   /* Bytes 32-35 */
        !           687:   SCSI_SenseData_T *SenseDataPointer;                  /* Bytes 36-39 */
        !           688:   /*
        !           689:     BusLogic Linux Driver Portion.
        !           690:   */
        !           691:   struct BusLogic_HostAdapter *HostAdapter;
        !           692:   SCSI_Command_T *Command;
        !           693:   enum { BusLogic_CCB_Free =       0,
        !           694:         BusLogic_CCB_Active =      1,
        !           695:         BusLogic_CCB_Completed =   2,
        !           696:         BusLogic_CCB_Reset =       3 } Status;
        !           697:   BusLogic_CompletionCode_T MailboxCompletionCode;
        !           698:   unsigned int SerialNumber;
        !           699:   struct BusLogic_CCB *Next;
        !           700:   struct BusLogic_CCB *NextAll;
        !           701:   BusLogic_ScatterGatherSegment_T
        !           702:     ScatterGatherList[BusLogic_ScatterGatherLimit];
        !           703: }
        !           704: BusLogic_CCB_T;
        !           705: 
        !           706: 
        !           707: /*
        !           708:   Define the 32 Bit Mode Outgoing Mailbox structure.
        !           709: */
        !           710: 
        !           711: typedef struct BusLogic_OutgoingMailbox
        !           712: {
        !           713:   BusLogic_CCB_T *CCB;
        !           714:   unsigned long :24;
        !           715:   BusLogic_ActionCode_T ActionCode:8;
        !           716: }
        !           717: BusLogic_OutgoingMailbox_T;
        !           718: 
        !           719: 
        !           720: /*
        !           721:   Define the 32 Bit Mode Incoming Mailbox structure.
        !           722: */
        !           723: 
        !           724: typedef struct BusLogic_IncomingMailbox
        !           725: {
        !           726:   BusLogic_CCB_T *CCB;
        !           727:   BusLogic_HostAdapterStatus_T HostAdapterStatus:8;
        !           728:   BusLogic_TargetDeviceStatus_T TargetDeviceStatus:8;
        !           729:   unsigned char :8;
        !           730:   BusLogic_CompletionCode_T CompletionCode:8;
        !           731: }
        !           732: BusLogic_IncomingMailbox_T;
        !           733: 
        !           734: 
        !           735: /*
        !           736:   Define the possible Bus Types.
        !           737: */
        !           738: 
        !           739: typedef enum
        !           740: {
        !           741:   BusLogic_Unknown_Bus =                       0,
        !           742:   BusLogic_ISA_Bus =                           1,
        !           743:   BusLogic_MCA_Bus =                           2,
        !           744:   BusLogic_EISA_Bus =                          3,
        !           745:   BusLogic_VESA_Bus =                          4,
        !           746:   BusLogic_PCI_Bus =                           5
        !           747: }
        !           748: BusLogic_BusType_T;
        !           749: 
        !           750: static char
        !           751:   *BusLogic_BusNames[] =
        !           752:     { "Unknown", "ISA", "MCA", "EISA", "VESA", "PCI" };
        !           753: 
        !           754: 
        !           755: /*
        !           756:   Define the Linux BusLogic Driver Command Line Entry structure.
        !           757: */
        !           758: 
        !           759: typedef struct BusLogic_CommandLineEntry
        !           760: {
        !           761:   unsigned short IO_Address;
        !           762:   unsigned short Concurrency;
        !           763:   unsigned short BusSettleTime;
        !           764:   unsigned short LocalOptions;
        !           765:   unsigned short TaggedQueuingPermitted;
        !           766:   unsigned short TaggedQueuingPermittedMask;
        !           767:   unsigned char ErrorRecoveryOption[BusLogic_MaxTargetIDs];
        !           768: }
        !           769: BusLogic_CommandLineEntry_T;
        !           770: 
        !           771: 
        !           772: /*
        !           773:   Define the Linux BusLogic Driver Host Adapter structure.
        !           774: */
        !           775: 
        !           776: typedef struct BusLogic_HostAdapter
        !           777: {
        !           778:   SCSI_Host_T *SCSI_Host;
        !           779:   unsigned char HostNumber;
        !           780:   unsigned char ModelName[9];
        !           781:   unsigned char FirmwareVersion[6];
        !           782:   unsigned char BoardName[18];
        !           783:   unsigned char InterruptLabel[62];
        !           784:   unsigned short IO_Address;
        !           785:   unsigned char IRQ_Channel;
        !           786:   unsigned char DMA_Channel;
        !           787:   unsigned char SCSI_ID;
        !           788:   BusLogic_BusType_T BusType:3;
        !           789:   boolean IRQ_ChannelAcquired:1;
        !           790:   boolean DMA_ChannelAcquired:1;
        !           791:   boolean SynchronousInitiation:1;
        !           792:   boolean ParityChecking:1;
        !           793:   boolean ExtendedTranslation:1;
        !           794:   boolean LevelSensitiveInterrupts:1;
        !           795:   boolean HostWideSCSI:1;
        !           796:   boolean HostDifferentialSCSI:1;
        !           797:   boolean HostAdapterResetPending:1;
        !           798:   boolean BounceBuffersRequired:1;
        !           799:   volatile boolean HostAdapterCommandCompleted:1;
        !           800:   unsigned short HostAdapterScatterGatherLimit;
        !           801:   unsigned short DriverScatterGatherLimit;
        !           802:   unsigned short MaxTargetIDs;
        !           803:   unsigned short MaxLogicalUnits;
        !           804:   unsigned short Concurrency;
        !           805:   unsigned short BusSettleTime;
        !           806:   unsigned short LocalOptions;
        !           807:   unsigned short DisconnectPermitted;
        !           808:   unsigned short TaggedQueuingPermitted;
        !           809:   unsigned long BIOS_Address;
        !           810:   BusLogic_InstalledDevices_T InstalledDevices;
        !           811:   BusLogic_SynchronousValues_T SynchronousValues;
        !           812:   BusLogic_SynchronousPeriod_T SynchronousPeriod;
        !           813:   BusLogic_Lock_T Lock;
        !           814:   struct BusLogic_HostAdapter *Next;
        !           815:   BusLogic_CommandLineEntry_T *CommandLineEntry;
        !           816:   BusLogic_CCB_T *All_CCBs;
        !           817:   BusLogic_CCB_T *Free_CCBs;
        !           818:   unsigned char ErrorRecoveryOption[BusLogic_MaxTargetIDs];
        !           819:   unsigned char CommandSuccessfulFlag[BusLogic_MaxTargetIDs];
        !           820:   unsigned long ReadWriteOperationCount[BusLogic_MaxTargetIDs];
        !           821:   unsigned char QueuedOperationCount[BusLogic_MaxTargetIDs];
        !           822:   unsigned long LastSequencePoint[BusLogic_MaxTargetIDs];
        !           823:   BusLogic_OutgoingMailbox_T *FirstOutgoingMailbox;
        !           824:   BusLogic_OutgoingMailbox_T *LastOutgoingMailbox;
        !           825:   BusLogic_OutgoingMailbox_T *NextOutgoingMailbox;
        !           826:   BusLogic_IncomingMailbox_T *FirstIncomingMailbox;
        !           827:   BusLogic_IncomingMailbox_T *LastIncomingMailbox;
        !           828:   BusLogic_IncomingMailbox_T *NextIncomingMailbox;
        !           829:   BusLogic_OutgoingMailbox_T OutgoingMailboxes[BusLogic_MailboxCount];
        !           830:   BusLogic_IncomingMailbox_T IncomingMailboxes[BusLogic_MailboxCount];
        !           831: }
        !           832: BusLogic_HostAdapter_T;
        !           833: 
        !           834: 
        !           835: /*
        !           836:   Define a symbolic structure for the BIOS Disk Parameters.
        !           837: */
        !           838: 
        !           839: typedef struct BIOS_DiskParameters
        !           840: {
        !           841:   int Heads;
        !           842:   int Sectors;
        !           843:   int Cylinders;
        !           844: }
        !           845: BIOS_DiskParameters_T;
        !           846: 
        !           847: 
        !           848: /*
        !           849:   BusLogic_LockHostAdapter acquires exclusive access to Host Adapter.
        !           850: */
        !           851: 
        !           852: static inline
        !           853: void BusLogic_LockHostAdapter(BusLogic_HostAdapter_T *HostAdapter)
        !           854: {
        !           855:   save_flags(HostAdapter->Lock);
        !           856:   cli();
        !           857: }
        !           858: 
        !           859: 
        !           860: /*
        !           861:   BusLogic_UnlockHostAdapter releases exclusive access to Host Adapter.
        !           862: */
        !           863: 
        !           864: static inline
        !           865: void BusLogic_UnlockHostAdapter(BusLogic_HostAdapter_T *HostAdapter)
        !           866: {
        !           867:   restore_flags(HostAdapter->Lock);
        !           868: }
        !           869: 
        !           870: 
        !           871: /*
        !           872:   BusLogic_LockHostAdapterID acquires exclusive access to Host Adapter,
        !           873:   but is only called when interrupts are disabled.
        !           874: */
        !           875: 
        !           876: static inline
        !           877: void BusLogic_LockHostAdapterID(BusLogic_HostAdapter_T *HostAdapter)
        !           878: {
        !           879: }
        !           880: 
        !           881: 
        !           882: /*
        !           883:   BusLogic_UnlockHostAdapterID releases exclusive access to Host Adapter,
        !           884:   but is only called when interrupts are disabled.
        !           885: */
        !           886: 
        !           887: static inline
        !           888: void BusLogic_UnlockHostAdapterID(BusLogic_HostAdapter_T *HostAdapter)
        !           889: {
        !           890: }
        !           891: 
        !           892: 
        !           893: /*
        !           894:   Define functions to provide an abstraction for reading and writing the
        !           895:   Host Adapter I/O Registers.
        !           896: */
        !           897: 
        !           898: static inline
        !           899: void BusLogic_WriteControlRegister(BusLogic_HostAdapter_T *HostAdapter,
        !           900:                                   unsigned char Value)
        !           901: {
        !           902:   outb(Value, HostAdapter->IO_Address + BusLogic_ControlRegister);
        !           903: }
        !           904: 
        !           905: static inline
        !           906: unsigned char BusLogic_ReadStatusRegister(BusLogic_HostAdapter_T *HostAdapter)
        !           907: {
        !           908:   return inb(HostAdapter->IO_Address + BusLogic_StatusRegister);
        !           909: }
        !           910: 
        !           911: static inline
        !           912: void BusLogic_WriteCommandParameterRegister(BusLogic_HostAdapter_T *HostAdapter,
        !           913:                                            unsigned char Value)
        !           914: {
        !           915:   outb(Value, HostAdapter->IO_Address + BusLogic_CommandParameterRegister);
        !           916: }
        !           917: 
        !           918: static inline
        !           919: unsigned char BusLogic_ReadDataInRegister(BusLogic_HostAdapter_T *HostAdapter)
        !           920: {
        !           921:   return inb(HostAdapter->IO_Address + BusLogic_DataInRegister);
        !           922: }
        !           923: 
        !           924: static inline
        !           925: unsigned char BusLogic_ReadInterruptRegister(BusLogic_HostAdapter_T
        !           926:                                             *HostAdapter)
        !           927: {
        !           928:   return inb(HostAdapter->IO_Address + BusLogic_InterruptRegister);
        !           929: }
        !           930: 
        !           931: static inline
        !           932: unsigned char BusLogic_ReadGeometryRegister(BusLogic_HostAdapter_T *HostAdapter)
        !           933: {
        !           934:   return inb(HostAdapter->IO_Address + BusLogic_GeometryRegister);
        !           935: }
        !           936: 
        !           937: 
        !           938: /*
        !           939:   BusLogic_StartMailboxScan issues a Start Mailbox Scan command, which
        !           940:   notifies the Host Adapter that an entry has been made in an Outgoing
        !           941:   Mailbox.
        !           942: */
        !           943: 
        !           944: static inline
        !           945: void BusLogic_StartMailboxScan(BusLogic_HostAdapter_T *HostAdapter)
        !           946: {
        !           947:   BusLogic_WriteCommandParameterRegister(HostAdapter,
        !           948:                                         BusLogic_StartMailboxCommand);
        !           949: }
        !           950: 
        !           951: 
        !           952: /*
        !           953:   BusLogic_Delay waits for Seconds to elapse.
        !           954: */
        !           955: 
        !           956: static inline void BusLogic_Delay(int Seconds)
        !           957: {
        !           958:   unsigned long TimeoutJiffies = jiffies + Seconds * HZ;
        !           959:   unsigned long ProcessorFlags;
        !           960:   save_flags(ProcessorFlags);
        !           961:   sti();
        !           962:   while (jiffies < TimeoutJiffies) ;
        !           963:   restore_flags(ProcessorFlags);
        !           964: }
        !           965: 
        !           966: 
        !           967: /*
        !           968:   Define prototypes for the forward referenced BusLogic Driver
        !           969:   Internal Functions.
        !           970: */
        !           971: 
        !           972: static void BusLogic_InterruptHandler(int, Registers_T *);
        !           973: static int BusLogic_ResetHostAdapter(BusLogic_HostAdapter_T *,
        !           974:                                     SCSI_Command_T *);
        !           975: 
        !           976: 
        !           977: #endif /* BusLogic_DriverVersion */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.