Import 2.3.18pre1
[davej-history.git] / drivers / scsi / BusLogic.h
blob97c1a412f3c61a10a8fed003be4ba29acd43ba4b
1 /*
3 Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters
5 Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>
7 This program is free software; you may redistribute and/or modify it under
8 the terms of the GNU General Public License Version 2 as published by the
9 Free Software Foundation.
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for complete details.
16 The author respectfully requests that any modifications to this software be
17 sent directly to him for evaluation and testing.
19 Special thanks to Wayne Yen, Jin-Lon Hon, and Alex Win of BusLogic, whose
20 advice has been invaluable, to David Gentzel, for writing the original Linux
21 BusLogic driver, and to Paul Gortmaker, for being such a dedicated test site.
23 Finally, special thanks to Mylex/BusLogic for making the FlashPoint SCCB
24 Manager available as freely redistributable source code.
29 #include <linux/config.h>
33 Define types for some of the structures that interface with the rest
34 of the Linux Kernel and SCSI Subsystem.
37 typedef kdev_t KernelDevice_T;
38 typedefstruct proc_dir_entry PROC_DirectoryEntry_T;
39 typedefunsigned long ProcessorFlags_T;
40 typedefstruct pt_regs Registers_T;
41 typedefstruct partition PartitionTable_T;
42 typedefstruct pci_dev PCI_Device_T;
43 typedef Scsi_Host_Template SCSI_Host_Template_T;
44 typedefstruct Scsi_Host SCSI_Host_T;
45 typedefstruct scsi_device SCSI_Device_T;
46 typedefstruct scsi_disk SCSI_Disk_T;
47 typedefstruct scsi_cmnd SCSI_Command_T;
48 typedefstruct scatterlist SCSI_ScatterList_T;
52 Define prototypes for the BusLogic Driver Interface Functions.
55 extern PROC_DirectoryEntry_T BusLogic_ProcDirectoryEntry;
56 externconst char*BusLogic_DriverInfo(SCSI_Host_T *);
57 externintBusLogic_DetectHostAdapter(SCSI_Host_Template_T *);
58 externintBusLogic_ReleaseHostAdapter(SCSI_Host_T *);
59 externintBusLogic_QueueCommand(SCSI_Command_T *,
60 void(*CompletionRoutine)(SCSI_Command_T *));
61 externintBusLogic_AbortCommand(SCSI_Command_T *);
62 externintBusLogic_ResetCommand(SCSI_Command_T *,unsigned int);
63 externintBusLogic_BIOSDiskParameters(SCSI_Disk_T *, KernelDevice_T,int*);
64 externintBusLogic_ProcDirectoryInfo(char*,char**, off_t,int,int,int);
68 Define the BusLogic SCSI Host Template structure.
71 #define BUSLOGIC \
72 { proc_dir: &BusLogic_ProcDirectoryEntry,/* ProcFS Directory Entry */ \
73 proc_info: BusLogic_ProcDirectoryInfo,/* ProcFS Info Function */ \
74 name:"BusLogic",/* Driver Name */ \
75 detect: BusLogic_DetectHostAdapter,/* Detect Host Adapter */ \
76 release: BusLogic_ReleaseHostAdapter,/* Release Host Adapter */ \
77 info: BusLogic_DriverInfo,/* Driver Info Function */ \
78 queuecommand: BusLogic_QueueCommand,/* Queue Command Function */ \
79 abort: BusLogic_AbortCommand,/* Abort Command Function */ \
80 reset: BusLogic_ResetCommand,/* Reset Command Function */ \
81 bios_param: BusLogic_BIOSDiskParameters,/* BIOS Disk Parameters */ \
82 unchecked_isa_dma: 1,/* Default Initial Value */ \
83 use_clustering: ENABLE_CLUSTERING }/* Enable Clustering */
87 BusLogic_DriverVersion protects the private portion of this file.
90 #ifdef BusLogic_DriverVersion
94 FlashPoint support is only available for the Intel x86 Architecture with
95 CONFIG_PCI set.
98 #ifndef __i386__
99 #undef CONFIG_SCSI_OMIT_FLASHPOINT
100 #define CONFIG_SCSI_OMIT_FLASHPOINT
101 #endif
103 #ifndef CONFIG_PCI
104 #undef CONFIG_SCSI_OMIT_FLASHPOINT
105 #define CONFIG_SCSI_OMIT_FLASHPOINT
106 #define BusLogic_InitializeProbeInfoListISA \
107 BusLogic_InitializeProbeInfoList
108 #endif
112 Define the maximum number of BusLogic Host Adapters supported by this driver.
115 #define BusLogic_MaxHostAdapters 16
119 Define the maximum number of Target Devices supported by this driver.
122 #define BusLogic_MaxTargetDevices 16
126 Define the maximum number of Scatter/Gather Segments used by this driver.
127 For optimal performance, it is important that this limit be at least as
128 large as the largest single request generated by the I/O Subsystem.
131 #define BusLogic_ScatterGatherLimit 128
135 Define the maximum, maximum automatic, minimum automatic, and default Queue
136 Depth to allow for Target Devices depending on whether or not they support
137 Tagged Queuing and whether or not ISA Bounce Buffers are required.
140 #define BusLogic_MaxTaggedQueueDepth 64
141 #define BusLogic_MaxAutomaticTaggedQueueDepth 28
142 #define BusLogic_MinAutomaticTaggedQueueDepth 7
143 #define BusLogic_TaggedQueueDepthBB 3
144 #define BusLogic_UntaggedQueueDepth 3
145 #define BusLogic_UntaggedQueueDepthBB 2
149 Define the default amount of time in seconds to wait between a Host Adapter
150 Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI commands.
151 Some SCSI devices get confused if they receive SCSI commands too soon after
152 a SCSI Bus Reset.
155 #define BusLogic_DefaultBusSettleTime 2
159 Define the maximum number of Mailboxes that should be used for MultiMaster
160 Host Adapters. This number is chosen to be larger than the maximum Host
161 Adapter Queue Depth and small enough so that the Host Adapter structure
162 does not cross an allocation block size boundary.
165 #define BusLogic_MaxMailboxes 211
169 Define the number of CCBs that should be allocated as a group to optimize
170 Kernel memory allocation.
173 #define BusLogic_CCB_AllocationGroupSize 7
177 Define the Host Adapter Line and Message Buffer Sizes.
180 #define BusLogic_LineBufferSize 100
181 #define BusLogic_MessageBufferSize 9700
185 Define the Driver Message Levels.
188 typedefenum BusLogic_MessageLevel
190 BusLogic_AnnounceLevel =0,
191 BusLogic_InfoLevel =1,
192 BusLogic_NoticeLevel =2,
193 BusLogic_WarningLevel =3,
194 BusLogic_ErrorLevel =4
196 BusLogic_MessageLevel_T;
198 static char
199 *BusLogic_MessageLevelMap[] =
200 { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };
204 Define Driver Message macros.
207 #define BusLogic_Announce(Format, Arguments...) \
208 BusLogic_Message(BusLogic_AnnounceLevel, Format, ##Arguments)
210 #define BusLogic_Info(Format, Arguments...) \
211 BusLogic_Message(BusLogic_InfoLevel, Format, ##Arguments)
213 #define BusLogic_Notice(Format, Arguments...) \
214 BusLogic_Message(BusLogic_NoticeLevel, Format, ##Arguments)
216 #define BusLogic_Warning(Format, Arguments...) \
217 BusLogic_Message(BusLogic_WarningLevel, Format, ##Arguments)
219 #define BusLogic_Error(Format, Arguments...) \
220 BusLogic_Message(BusLogic_ErrorLevel, Format, ##Arguments)
224 Define the types of BusLogic Host Adapters that are supported and the number
225 of I/O Addresses required by each type.
228 typedefenum
230 BusLogic_MultiMaster =1,
231 BusLogic_FlashPoint =2
233 __attribute__((packed))
234 BusLogic_HostAdapterType_T;
236 #define BusLogic_MultiMasterAddressCount 4
237 #define BusLogic_FlashPointAddressCount 256
239 static int
240 BusLogic_HostAdapterAddressCount[3] =
241 {0, BusLogic_MultiMasterAddressCount, BusLogic_FlashPointAddressCount };
245 Define macros for testing the Host Adapter Type.
248 #ifndef CONFIG_SCSI_OMIT_FLASHPOINT
250 #define BusLogic_MultiMasterHostAdapterP(HostAdapter) \
251 (HostAdapter->HostAdapterType == BusLogic_MultiMaster)
253 #define BusLogic_FlashPointHostAdapterP(HostAdapter) \
254 (HostAdapter->HostAdapterType == BusLogic_FlashPoint)
256 #else
258 #define BusLogic_MultiMasterHostAdapterP(HostAdapter) \
259 (true)
261 #define BusLogic_FlashPointHostAdapterP(HostAdapter) \
262 (false)
264 #endif
268 Define the possible Host Adapter Bus Types.
271 typedefenum
273 BusLogic_Unknown_Bus =0,
274 BusLogic_ISA_Bus =1,
275 BusLogic_EISA_Bus =2,
276 BusLogic_PCI_Bus =3,
277 BusLogic_VESA_Bus =4,
278 BusLogic_MCA_Bus =5
280 __attribute__((packed))
281 BusLogic_HostAdapterBusType_T;
283 static char
284 *BusLogic_HostAdapterBusNames[] =
285 {"Unknown","ISA","EISA","PCI","VESA","MCA"};
287 static BusLogic_HostAdapterBusType_T
288 BusLogic_HostAdapterBusTypes[] =
289 { BusLogic_VESA_Bus,/* BT-4xx */
290 BusLogic_ISA_Bus,/* BT-5xx */
291 BusLogic_MCA_Bus,/* BT-6xx */
292 BusLogic_EISA_Bus,/* BT-7xx */
293 BusLogic_Unknown_Bus,/* BT-8xx */
294 BusLogic_PCI_Bus };/* BT-9xx */
298 Define the possible Host Adapter BIOS Disk Geometry Translations.
301 typedefenum BusLogic_BIOS_DiskGeometryTranslation
303 BusLogic_BIOS_Disk_Not_Installed =0,
304 BusLogic_BIOS_Disk_Installed_64x32 =1,
305 BusLogic_BIOS_Disk_Installed_128x32 =2,
306 BusLogic_BIOS_Disk_Installed_255x63 =3
308 __attribute__((packed))
309 BusLogic_BIOS_DiskGeometryTranslation_T;
313 Define a Boolean data type.
316 typedefenum{false,true}__attribute__((packed)) boolean;
320 Define a 32 bit I/O Address data type.
323 typedefunsigned int BusLogic_IO_Address_T;
327 Define a 32 bit PCI Bus Address data type.
330 typedefunsigned int BusLogic_PCI_Address_T;
334 Define a 32 bit Base Address data type.
337 typedefunsigned int BusLogic_Base_Address_T;
341 Define a 32 bit Bus Address data type.
344 typedefunsigned int BusLogic_BusAddress_T;
348 Define a 32 bit Byte Count data type.
351 typedefunsigned int BusLogic_ByteCount_T;
355 Define a 10^18 Statistics Byte Counter data type.
358 typedefstruct BusLogic_ByteCounter
360 unsigned int Units;
361 unsigned int Billions;
363 BusLogic_ByteCounter_T;
367 Define the structure for I/O Address and Bus Probing Information.
370 typedefstruct BusLogic_ProbeInfo
372 BusLogic_HostAdapterType_T HostAdapterType;
373 BusLogic_HostAdapterBusType_T HostAdapterBusType;
374 BusLogic_IO_Address_T IO_Address;
375 BusLogic_PCI_Address_T PCI_Address;
376 unsigned char Bus;
377 unsigned char Device;
378 unsigned char IRQ_Channel;
380 BusLogic_ProbeInfo_T;
384 Define the Probe Options.
387 typedefstruct BusLogic_ProbeOptions
389 boolean NoProbe:1;/* Bit 0 */
390 boolean NoProbeISA:1;/* Bit 1 */
391 boolean NoProbePCI:1;/* Bit 2 */
392 boolean NoSortPCI:1;/* Bit 3 */
393 boolean MultiMasterFirst:1;/* Bit 4 */
394 boolean FlashPointFirst:1;/* Bit 5 */
395 boolean LimitedProbeISA:1;/* Bit 6 */
396 boolean Probe330:1;/* Bit 7 */
397 boolean Probe334:1;/* Bit 8 */
398 boolean Probe230:1;/* Bit 9 */
399 boolean Probe234:1;/* Bit 10 */
400 boolean Probe130:1;/* Bit 11 */
401 boolean Probe134:1;/* Bit 12 */
403 BusLogic_ProbeOptions_T;
407 Define the Global Options.
410 typedefstruct BusLogic_GlobalOptions
412 boolean TraceProbe:1;/* Bit 0 */
413 boolean TraceHardwareReset:1;/* Bit 1 */
414 boolean TraceConfiguration:1;/* Bit 2 */
415 boolean TraceErrors:1;/* Bit 3 */
417 BusLogic_GlobalOptions_T;
421 Define the Local Options.
424 typedefstruct BusLogic_LocalOptions
426 boolean InhibitTargetInquiry:1;/* Bit 0 */
428 BusLogic_LocalOptions_T;
432 Define the Error Recovery Strategy Options.
435 typedefenum
437 BusLogic_ErrorRecovery_Default =0,
438 BusLogic_ErrorRecovery_BusDeviceReset =1,
439 BusLogic_ErrorRecovery_HardReset =2,
440 BusLogic_ErrorRecovery_None =3
442 __attribute__((packed))
443 BusLogic_ErrorRecoveryStrategy_T;
445 static char
446 *BusLogic_ErrorRecoveryStrategyNames[] =
447 {"Default","Bus Device Reset","Hard Reset","None"},
448 BusLogic_ErrorRecoveryStrategyLetters[] =
449 {'D','B','H','N'};
453 Define the BusLogic SCSI Host Adapter I/O Register Offsets.
456 #define BusLogic_ControlRegisterOffset 0/* WO register */
457 #define BusLogic_StatusRegisterOffset 0/* RO register */
458 #define BusLogic_CommandParameterRegisterOffset 1/* WO register */
459 #define BusLogic_DataInRegisterOffset 1/* RO register */
460 #define BusLogic_InterruptRegisterOffset 2/* RO register */
461 #define BusLogic_GeometryRegisterOffset 3/* RO register */
465 Define the structure of the write-only Control Register.
468 typedefunion BusLogic_ControlRegister
470 unsigned char All;
471 struct{
472 unsigned char:4;/* Bits 0-3 */
473 boolean SCSIBusReset:1;/* Bit 4 */
474 boolean InterruptReset:1;/* Bit 5 */
475 boolean SoftReset:1;/* Bit 6 */
476 boolean HardReset:1;/* Bit 7 */
477 } Bits;
479 BusLogic_ControlRegister_T;
483 Define the structure of the read-only Status Register.
486 typedefunion BusLogic_StatusRegister
488 unsigned char All;
489 struct{
490 boolean CommandInvalid:1;/* Bit 0 */
491 boolean Reserved:1;/* Bit 1 */
492 boolean DataInRegisterReady:1;/* Bit 2 */
493 boolean CommandParameterRegisterBusy:1;/* Bit 3 */
494 boolean HostAdapterReady:1;/* Bit 4 */
495 boolean InitializationRequired:1;/* Bit 5 */
496 boolean DiagnosticFailure:1;/* Bit 6 */
497 boolean DiagnosticActive:1;/* Bit 7 */
498 } Bits;
500 BusLogic_StatusRegister_T;
504 Define the structure of the read-only Interrupt Register.
507 typedefunion BusLogic_InterruptRegister
509 unsigned char All;
510 struct{
511 boolean IncomingMailboxLoaded:1;/* Bit 0 */
512 boolean OutgoingMailboxAvailable:1;/* Bit 1 */
513 boolean CommandComplete:1;/* Bit 2 */
514 boolean ExternalBusReset:1;/* Bit 3 */
515 unsigned char Reserved:3;/* Bits 4-6 */
516 boolean InterruptValid:1;/* Bit 7 */
517 } Bits;
519 BusLogic_InterruptRegister_T;
523 Define the structure of the read-only Geometry Register.
526 typedefunion BusLogic_GeometryRegister
528 unsigned char All;
529 struct{
530 BusLogic_BIOS_DiskGeometryTranslation_T Drive0Geometry:2;/* Bits 0-1 */
531 BusLogic_BIOS_DiskGeometryTranslation_T Drive1Geometry:2;/* Bits 2-3 */
532 unsigned char:3;/* Bits 4-6 */
533 boolean ExtendedTranslationEnabled:1;/* Bit 7 */
534 } Bits;
536 BusLogic_GeometryRegister_T;
540 Define the BusLogic SCSI Host Adapter Command Register Operation Codes.
543 typedefenum
545 BusLogic_TestCommandCompleteInterrupt =0x00,
546 BusLogic_InitializeMailbox =0x01,
547 BusLogic_ExecuteMailboxCommand =0x02,
548 BusLogic_ExecuteBIOSCommand =0x03,
549 BusLogic_InquireBoardID =0x04,
550 BusLogic_EnableOutgoingMailboxAvailableInt =0x05,
551 BusLogic_SetSCSISelectionTimeout =0x06,
552 BusLogic_SetPreemptTimeOnBus =0x07,
553 BusLogic_SetTimeOffBus =0x08,
554 BusLogic_SetBusTransferRate =0x09,
555 BusLogic_InquireInstalledDevicesID0to7 =0x0A,
556 BusLogic_InquireConfiguration =0x0B,
557 BusLogic_EnableTargetMode =0x0C,
558 BusLogic_InquireSetupInformation =0x0D,
559 BusLogic_WriteAdapterLocalRAM =0x1A,
560 BusLogic_ReadAdapterLocalRAM =0x1B,
561 BusLogic_WriteBusMasterChipFIFO =0x1C,
562 BusLogic_ReadBusMasterChipFIFO =0x1D,
563 BusLogic_EchoCommandData =0x1F,
564 BusLogic_HostAdapterDiagnostic =0x20,
565 BusLogic_SetAdapterOptions =0x21,
566 BusLogic_InquireInstalledDevicesID8to15 =0x23,
567 BusLogic_InquireTargetDevices =0x24,
568 BusLogic_DisableHostAdapterInterrupt =0x25,
569 BusLogic_InitializeExtendedMailbox =0x81,
570 BusLogic_ExecuteSCSICommand =0x83,
571 BusLogic_InquireFirmwareVersion3rdDigit =0x84,
572 BusLogic_InquireFirmwareVersionLetter =0x85,
573 BusLogic_InquirePCIHostAdapterInformation =0x86,
574 BusLogic_InquireHostAdapterModelNumber =0x8B,
575 BusLogic_InquireSynchronousPeriod =0x8C,
576 BusLogic_InquireExtendedSetupInformation =0x8D,
577 BusLogic_EnableStrictRoundRobinMode =0x8F,
578 BusLogic_StoreHostAdapterLocalRAM =0x90,
579 BusLogic_FetchHostAdapterLocalRAM =0x91,
580 BusLogic_StoreLocalDataInEEPROM =0x92,
581 BusLogic_UploadAutoSCSICode =0x94,
582 BusLogic_ModifyIOAddress =0x95,
583 BusLogic_SetCCBFormat =0x96,
584 BusLogic_WriteInquiryBuffer =0x9A,
585 BusLogic_ReadInquiryBuffer =0x9B,
586 BusLogic_FlashROMUploadDownload =0xA7,
587 BusLogic_ReadSCAMData =0xA8,
588 BusLogic_WriteSCAMData =0xA9
590 BusLogic_OperationCode_T;
594 Define the Inquire Board ID reply structure.
597 typedefstruct BusLogic_BoardID
599 unsigned char BoardType;/* Byte 0 */
600 unsigned char CustomFeatures;/* Byte 1 */
601 unsigned char FirmwareVersion1stDigit;/* Byte 2 */
602 unsigned char FirmwareVersion2ndDigit;/* Byte 3 */
604 BusLogic_BoardID_T;
608 Define the Inquire Installed Devices ID 0 to 7 and Inquire Installed
609 Devices ID 8 to 15 reply type. For each Target Device, a byte is returned
610 where bit 0 set indicates that Logical Unit 0 exists, bit 1 set indicates
611 that Logical Unit 1 exists, and so on.
614 typedefunsigned char BusLogic_InstalledDevices8_T[8];
618 Define the Inquire Target Devices reply type. Inquire Target Devices only
619 tests Logical Unit 0 of each Target Device unlike the Inquire Installed
620 Devices commands which test Logical Units 0 - 7. Two bytes are returned,
621 where byte 0 bit 0 set indicates that Target Device 0 exists, and so on.
624 typedefunsigned short BusLogic_InstalledDevices_T;
628 Define the Inquire Configuration reply structure.
631 typedefstruct BusLogic_Configuration
633 unsigned char:5;/* Byte 0 Bits 0-4 */
634 boolean DMA_Channel5:1;/* Byte 0 Bit 5 */
635 boolean DMA_Channel6:1;/* Byte 0 Bit 6 */
636 boolean DMA_Channel7:1;/* Byte 0 Bit 7 */
637 boolean IRQ_Channel9:1;/* Byte 1 Bit 0 */
638 boolean IRQ_Channel10:1;/* Byte 1 Bit 1 */
639 boolean IRQ_Channel11:1;/* Byte 1 Bit 2 */
640 boolean IRQ_Channel12:1;/* Byte 1 Bit 3 */
641 unsigned char:1;/* Byte 1 Bit 4 */
642 boolean IRQ_Channel14:1;/* Byte 1 Bit 5 */
643 boolean IRQ_Channel15:1;/* Byte 1 Bit 6 */
644 unsigned char:1;/* Byte 1 Bit 7 */
645 unsigned char HostAdapterID:4;/* Byte 2 Bits 0-3 */
646 unsigned char:4;/* Byte 2 Bits 4-7 */
648 BusLogic_Configuration_T;
652 Define the Inquire Setup Information reply structure.
655 typedefstruct BusLogic_SynchronousValue
657 unsigned char Offset:4;/* Bits 0-3 */
658 unsigned char TransferPeriod:3;/* Bits 4-6 */
659 boolean Synchronous:1;/* Bit 7 */
661 BusLogic_SynchronousValue_T;
663 typedef BusLogic_SynchronousValue_T
664 BusLogic_SynchronousValues8_T[8];
666 typedef BusLogic_SynchronousValue_T
667 BusLogic_SynchronousValues_T[BusLogic_MaxTargetDevices];
669 typedefstruct BusLogic_SetupInformation
671 boolean SynchronousInitiationEnabled:1;/* Byte 0 Bit 0 */
672 boolean ParityCheckingEnabled:1;/* Byte 0 Bit 1 */
673 unsigned char:6;/* Byte 0 Bits 2-7 */
674 unsigned char BusTransferRate;/* Byte 1 */
675 unsigned char PreemptTimeOnBus;/* Byte 2 */
676 unsigned char TimeOffBus;/* Byte 3 */
677 unsigned char MailboxCount;/* Byte 4 */
678 unsigned char MailboxAddress[3];/* Bytes 5-7 */
679 BusLogic_SynchronousValues8_T SynchronousValuesID0to7;/* Bytes 8-15 */
680 unsigned char DisconnectPermittedID0to7;/* Byte 16 */
681 unsigned char Signature;/* Byte 17 */
682 unsigned char CharacterD;/* Byte 18 */
683 unsigned char HostBusType;/* Byte 19 */
684 unsigned char WideTransfersPermittedID0to7;/* Byte 20 */
685 unsigned char WideTransfersActiveID0to7;/* Byte 21 */
686 BusLogic_SynchronousValues8_T SynchronousValuesID8to15;/* Bytes 22-29 */
687 unsigned char DisconnectPermittedID8to15;/* Byte 30 */
688 unsigned char:8;/* Byte 31 */
689 unsigned char WideTransfersPermittedID8to15;/* Byte 32 */
690 unsigned char WideTransfersActiveID8to15;/* Byte 33 */
692 BusLogic_SetupInformation_T;
696 Define the Initialize Extended Mailbox request structure.
699 typedefstruct BusLogic_ExtendedMailboxRequest
701 unsigned char MailboxCount;/* Byte 0 */
702 BusLogic_BusAddress_T BaseMailboxAddress;/* Bytes 1-4 */
704 __attribute__((packed))
705 BusLogic_ExtendedMailboxRequest_T;
709 Define the Inquire Firmware Version 3rd Digit reply type.
712 typedefunsigned char BusLogic_FirmwareVersion3rdDigit_T;
716 Define the Inquire Firmware Version Letter reply type.
719 typedefunsigned char BusLogic_FirmwareVersionLetter_T;
723 Define the Inquire PCI Host Adapter Information reply type. The ISA
724 Compatible I/O Port values are defined here and are also used with
725 the Modify I/O Address command.
728 typedefenum BusLogic_ISACompatibleIOPort
730 BusLogic_IO_330 =0,
731 BusLogic_IO_334 =1,
732 BusLogic_IO_230 =2,
733 BusLogic_IO_234 =3,
734 BusLogic_IO_130 =4,
735 BusLogic_IO_134 =5,
736 BusLogic_IO_Disable =6,
737 BusLogic_IO_Disable2 =7
739 __attribute__((packed))
740 BusLogic_ISACompatibleIOPort_T;
742 typedefstruct BusLogic_PCIHostAdapterInformation
744 BusLogic_ISACompatibleIOPort_T ISACompatibleIOPort;/* Byte 0 */
745 unsigned char PCIAssignedIRQChannel;/* Byte 1 */
746 boolean LowByteTerminated:1;/* Byte 2 Bit 0 */
747 boolean HighByteTerminated:1;/* Byte 2 Bit 1 */
748 unsigned char:2;/* Byte 2 Bits 2-3 */
749 boolean JP1:1;/* Byte 2 Bit 4 */
750 boolean JP2:1;/* Byte 2 Bit 5 */
751 boolean JP3:1;/* Byte 2 Bit 6 */
752 boolean GenericInfoValid:1;/* Byte 2 Bit 7 */
753 unsigned char:8;/* Byte 3 */
755 BusLogic_PCIHostAdapterInformation_T;
759 Define the Inquire Host Adapter Model Number reply type.
762 typedefunsigned char BusLogic_HostAdapterModelNumber_T[5];
766 Define the Inquire Synchronous Period reply type. For each Target Device,
767 a byte is returned which represents the Synchronous Transfer Period in units
768 of 10 nanoseconds.
771 typedefunsigned char BusLogic_SynchronousPeriod_T[BusLogic_MaxTargetDevices];
775 Define the Inquire Extended Setup Information reply structure.
778 typedefstruct BusLogic_ExtendedSetupInformation
780 unsigned char BusType;/* Byte 0 */
781 unsigned char BIOS_Address;/* Byte 1 */
782 unsigned short ScatterGatherLimit;/* Bytes 2-3 */
783 unsigned char MailboxCount;/* Byte 4 */
784 BusLogic_BusAddress_T BaseMailboxAddress;/* Bytes 5-8 */
785 struct{unsigned char:2;/* Byte 9 Bits 0-1 */
786 boolean FastOnEISA:1;/* Byte 9 Bit 2 */
787 unsigned char:3;/* Byte 9 Bits 3-5 */
788 boolean LevelSensitiveInterrupt:1;/* Byte 9 Bit 6 */
789 unsigned char:1; } Misc;/* Byte 9 Bit 7 */
790 unsigned char FirmwareRevision[3];/* Bytes 10-12 */
791 boolean HostWideSCSI:1;/* Byte 13 Bit 0 */
792 boolean HostDifferentialSCSI:1;/* Byte 13 Bit 1 */
793 boolean HostSupportsSCAM:1;/* Byte 13 Bit 2 */
794 boolean HostUltraSCSI:1;/* Byte 13 Bit 3 */
795 boolean HostSmartTermination:1;/* Byte 13 Bit 4 */
796 unsigned char:3;/* Byte 13 Bits 5-7 */
798 __attribute__((packed))
799 BusLogic_ExtendedSetupInformation_T;
803 Define the Enable Strict Round Robin Mode request type.
806 typedefenum BusLogic_RoundRobinModeRequest
808 BusLogic_AggressiveRoundRobinMode =0,
809 BusLogic_StrictRoundRobinMode =1
811 __attribute__((packed))
812 BusLogic_RoundRobinModeRequest_T;
816 Define the Fetch Host Adapter Local RAM request type.
819 #define BusLogic_BIOS_BaseOffset 0
820 #define BusLogic_AutoSCSI_BaseOffset 64
822 typedefstruct BusLogic_FetchHostAdapterLocalRAMRequest
824 unsigned char ByteOffset;/* Byte 0 */
825 unsigned char ByteCount;/* Byte 1 */
827 BusLogic_FetchHostAdapterLocalRAMRequest_T;
831 Define the Host Adapter Local RAM AutoSCSI structure.
834 typedefstruct BusLogic_AutoSCSIData
836 unsigned char InternalFactorySignature[2];/* Bytes 0-1 */
837 unsigned char InformationByteCount;/* Byte 2 */
838 unsigned char HostAdapterType[6];/* Bytes 3-8 */
839 unsigned char:8;/* Byte 9 */
840 boolean FloppyEnabled:1;/* Byte 10 Bit 0 */
841 boolean FloppySecondary:1;/* Byte 10 Bit 1 */
842 boolean LevelSensitiveInterrupt:1;/* Byte 10 Bit 2 */
843 unsigned char:2;/* Byte 10 Bits 3-4 */
844 unsigned char SystemRAMAreaForBIOS:3;/* Byte 10 Bits 5-7 */
845 unsigned char DMA_Channel:7;/* Byte 11 Bits 0-6 */
846 boolean DMA_AutoConfiguration:1;/* Byte 11 Bit 7 */
847 unsigned char IRQ_Channel:7;/* Byte 12 Bits 0-6 */
848 boolean IRQ_AutoConfiguration:1;/* Byte 12 Bit 7 */
849 unsigned char DMA_TransferRate;/* Byte 13 */
850 unsigned char SCSI_ID;/* Byte 14 */
851 boolean LowByteTerminated:1;/* Byte 15 Bit 0 */
852 boolean ParityCheckingEnabled:1;/* Byte 15 Bit 1 */
853 boolean HighByteTerminated:1;/* Byte 15 Bit 2 */
854 boolean NoisyCablingEnvironment:1;/* Byte 15 Bit 3 */
855 boolean FastSynchronousNegotiation:1;/* Byte 15 Bit 4 */
856 boolean BusResetEnabled:1;/* Byte 15 Bit 5 */
857 boolean :1;/* Byte 15 Bit 6 */
858 boolean ActiveNegationEnabled:1;/* Byte 15 Bit 7 */
859 unsigned char BusOnDelay;/* Byte 16 */
860 unsigned char BusOffDelay;/* Byte 17 */
861 boolean HostAdapterBIOSEnabled:1;/* Byte 18 Bit 0 */
862 boolean BIOSRedirectionOfINT19Enabled:1;/* Byte 18 Bit 1 */
863 boolean ExtendedTranslationEnabled:1;/* Byte 18 Bit 2 */
864 boolean MapRemovableAsFixedEnabled:1;/* Byte 18 Bit 3 */
865 boolean :1;/* Byte 18 Bit 4 */
866 boolean BIOSSupportsMoreThan2DrivesEnabled:1;/* Byte 18 Bit 5 */
867 boolean BIOSInterruptModeEnabled:1;/* Byte 18 Bit 6 */
868 boolean FlopticalSupportEnabled:1;/* Byte 19 Bit 7 */
869 unsigned short DeviceEnabled;/* Bytes 19-20 */
870 unsigned short WidePermitted;/* Bytes 21-22 */
871 unsigned short FastPermitted;/* Bytes 23-24 */
872 unsigned short SynchronousPermitted;/* Bytes 25-26 */
873 unsigned short DisconnectPermitted;/* Bytes 27-28 */
874 unsigned short SendStartUnitCommand;/* Bytes 29-30 */
875 unsigned short IgnoreInBIOSScan;/* Bytes 31-32 */
876 unsigned char PCIInterruptPin:2;/* Byte 33 Bits 0-1 */
877 unsigned char HostAdapterIOPortAddress:2;/* Byte 33 Bits 2-3 */
878 boolean StrictRoundRobinModeEnabled:1;/* Byte 33 Bit 4 */
879 boolean VESABusSpeedGreaterThan33MHz:1;/* Byte 33 Bit 5 */
880 boolean VESABurstWriteEnabled:1;/* Byte 33 Bit 6 */
881 boolean VESABurstReadEnabled:1;/* Byte 33 Bit 7 */
882 unsigned short UltraPermitted;/* Bytes 34-35 */
883 unsigned int:32;/* Bytes 36-39 */
884 unsigned char:8;/* Byte 40 */
885 unsigned char AutoSCSIMaximumLUN;/* Byte 41 */
886 boolean :1;/* Byte 42 Bit 0 */
887 boolean SCAM_Dominant:1;/* Byte 42 Bit 1 */
888 boolean SCAM_Enabled:1;/* Byte 42 Bit 2 */
889 boolean SCAM_Level2:1;/* Byte 42 Bit 3 */
890 unsigned char:4;/* Byte 42 Bits 4-7 */
891 boolean INT13ExtensionEnabled:1;/* Byte 43 Bit 0 */
892 boolean :1;/* Byte 43 Bit 1 */
893 boolean CDROMBootEnabled:1;/* Byte 43 Bit 2 */
894 unsigned char:5;/* Byte 43 Bits 3-7 */
895 unsigned char BootTargetID:4;/* Byte 44 Bits 0-3 */
896 unsigned char BootChannel:4;/* Byte 44 Bits 4-7 */
897 unsigned char ForceBusDeviceScanningOrder:1;/* Byte 45 Bit 0 */
898 unsigned char:7;/* Byte 45 Bits 1-7 */
899 unsigned short NonTaggedToAlternateLUNPermitted;/* Bytes 46-47 */
900 unsigned short RenegotiateSyncAfterCheckCondition;/* Bytes 48-49 */
901 unsigned char Reserved[10];/* Bytes 50-59 */
902 unsigned char ManufacturingDiagnostic[2];/* Bytes 60-61 */
903 unsigned short Checksum;/* Bytes 62-63 */
905 __attribute__((packed))
906 BusLogic_AutoSCSIData_T;
910 Define the Host Adapter Local RAM Auto SCSI Byte 45 structure.
913 typedefstruct BusLogic_AutoSCSIByte45
915 unsigned char ForceBusDeviceScanningOrder:1;/* Bit 0 */
916 unsigned char:7;/* Bits 1-7 */
918 BusLogic_AutoSCSIByte45_T;
922 Define the Host Adapter Local RAM BIOS Drive Map Byte structure.
925 #define BusLogic_BIOS_DriveMapOffset 17
927 typedefstruct BusLogic_BIOSDriveMapByte
929 unsigned char TargetIDBit3:1;/* Bit 0 */
930 unsigned char:2;/* Bits 1-2 */
931 BusLogic_BIOS_DiskGeometryTranslation_T DiskGeometry:2;/* Bits 3-4 */
932 unsigned char TargetID:3;/* Bits 5-7 */
934 BusLogic_BIOSDriveMapByte_T;
938 Define the Modify I/O Address request type. On PCI Host Adapters, the
939 Modify I/O Address command allows modification of the ISA compatible I/O
940 Address that the Host Adapter responds to; it does not affect the PCI
941 compliant I/O Address assigned at system initialization.
944 typedef BusLogic_ISACompatibleIOPort_T BusLogic_ModifyIOAddressRequest_T;
948 Define the Set CCB Format request type. Extended LUN Format CCBs are
949 necessary to support more than 8 Logical Units per Target Device.
952 typedefenum BusLogic_SetCCBFormatRequest
954 BusLogic_LegacyLUNFormatCCB =0,
955 BusLogic_ExtendedLUNFormatCCB =1
957 __attribute__((packed))
958 BusLogic_SetCCBFormatRequest_T;
962 Define the Requested Reply Length type used by the Inquire Setup Information,
963 Inquire Host Adapter Model Number, Inquire Synchronous Period, and Inquire
964 Extended Setup Information commands.
967 typedefunsigned char BusLogic_RequestedReplyLength_T;
971 Define the Outgoing Mailbox Action Codes.
974 typedefenum
976 BusLogic_OutgoingMailboxFree =0x00,
977 BusLogic_MailboxStartCommand =0x01,
978 BusLogic_MailboxAbortCommand =0x02
980 __attribute__((packed))
981 BusLogic_ActionCode_T;
985 Define the Incoming Mailbox Completion Codes. The MultiMaster Firmware
986 only uses codes 0 - 4. The FlashPoint SCCB Manager has no mailboxes, so
987 completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5.
990 typedefenum
992 BusLogic_IncomingMailboxFree =0x00,
993 BusLogic_CommandCompletedWithoutError =0x01,
994 BusLogic_CommandAbortedAtHostRequest =0x02,
995 BusLogic_AbortedCommandNotFound =0x03,
996 BusLogic_CommandCompletedWithError =0x04,
997 BusLogic_InvalidCCB =0x05
999 __attribute__((packed))
1000 BusLogic_CompletionCode_T;
1004 Define the Command Control Block (CCB) Opcodes.
1007 typedefenum
1009 BusLogic_InitiatorCCB =0x00,
1010 BusLogic_TargetCCB =0x01,
1011 BusLogic_InitiatorCCB_ScatterGather =0x02,
1012 BusLogic_InitiatorCCB_ResidualDataLength =0x03,
1013 BusLogic_InitiatorCCB_ScatterGatherResidual =0x04,
1014 BusLogic_BusDeviceReset =0x81
1016 __attribute__((packed))
1017 BusLogic_CCB_Opcode_T;
1021 Define the CCB Data Direction Codes.
1024 typedefenum
1026 BusLogic_UncheckedDataTransfer =0,
1027 BusLogic_DataInLengthChecked =1,
1028 BusLogic_DataOutLengthChecked =2,
1029 BusLogic_NoDataTransfer =3
1031 BusLogic_DataDirection_T;
1035 Define the Host Adapter Status Codes. The MultiMaster Firmware does not
1036 return status code 0x0C; it uses 0x12 for both overruns and underruns.
1039 typedefenum
1041 BusLogic_CommandCompletedNormally =0x00,
1042 BusLogic_LinkedCommandCompleted =0x0A,
1043 BusLogic_LinkedCommandCompletedWithFlag =0x0B,
1044 BusLogic_DataUnderRun =0x0C,
1045 BusLogic_SCSISelectionTimeout =0x11,
1046 BusLogic_DataOverRun =0x12,
1047 BusLogic_UnexpectedBusFree =0x13,
1048 BusLogic_InvalidBusPhaseRequested =0x14,
1049 BusLogic_InvalidOutgoingMailboxActionCode =0x15,
1050 BusLogic_InvalidCommandOperationCode =0x16,
1051 BusLogic_LinkedCCBhasInvalidLUN =0x17,
1052 BusLogic_InvalidCommandParameter =0x1A,
1053 BusLogic_AutoRequestSenseFailed =0x1B,
1054 BusLogic_TaggedQueuingMessageRejected =0x1C,
1055 BusLogic_UnsupportedMessageReceived =0x1D,
1056 BusLogic_HostAdapterHardwareFailed =0x20,
1057 BusLogic_TargetFailedResponseToATN =0x21,
1058 BusLogic_HostAdapterAssertedRST =0x22,
1059 BusLogic_OtherDeviceAssertedRST =0x23,
1060 BusLogic_TargetDeviceReconnectedImproperly =0x24,
1061 BusLogic_HostAdapterAssertedBusDeviceReset =0x25,
1062 BusLogic_AbortQueueGenerated =0x26,
1063 BusLogic_HostAdapterSoftwareError =0x27,
1064 BusLogic_HostAdapterHardwareTimeoutError =0x30,
1065 BusLogic_SCSIParityErrorDetected =0x34
1067 __attribute__((packed))
1068 BusLogic_HostAdapterStatus_T;
1072 Define the SCSI Target Device Status Codes.
1075 typedefenum
1077 BusLogic_OperationGood =0x00,
1078 BusLogic_CheckCondition =0x02,
1079 BusLogic_DeviceBusy =0x08
1081 __attribute__((packed))
1082 BusLogic_TargetDeviceStatus_T;
1086 Define the Queue Tag Codes.
1089 typedefenum
1091 BusLogic_SimpleQueueTag =0,
1092 BusLogic_HeadOfQueueTag =1,
1093 BusLogic_OrderedQueueTag =2,
1094 BusLogic_ReservedQT =3
1096 BusLogic_QueueTag_T;
1100 Define the SCSI Command Descriptor Block (CDB).
1103 #define BusLogic_CDB_MaxLength 12
1105 typedefunsigned char SCSI_CDB_T[BusLogic_CDB_MaxLength];
1109 Define the Scatter/Gather Segment structure required by the MultiMaster
1110 Firmware Interface and the FlashPoint SCCB Manager.
1113 typedefstruct BusLogic_ScatterGatherSegment
1115 BusLogic_ByteCount_T SegmentByteCount;/* Bytes 0-3 */
1116 BusLogic_BusAddress_T SegmentDataPointer;/* Bytes 4-7 */
1118 BusLogic_ScatterGatherSegment_T;
1122 Define the Driver CCB Status Codes.
1125 typedefenum
1127 BusLogic_CCB_Free =0,
1128 BusLogic_CCB_Active =1,
1129 BusLogic_CCB_Completed =2,
1130 BusLogic_CCB_Reset =3
1132 __attribute__((packed))
1133 BusLogic_CCB_Status_T;
1137 Define the 32 Bit Mode Command Control Block (CCB) structure. The first 40
1138 bytes are defined by and common to both the MultiMaster Firmware and the
1139 FlashPoint SCCB Manager. The next 60 bytes are defined by the FlashPoint
1140 SCCB Manager. The remaining components are defined by the Linux BusLogic
1141 Driver. Extended LUN Format CCBs differ from Legacy LUN Format 32 Bit Mode
1142 CCBs only in having the TagEnable and QueueTag fields moved from byte 17 to
1143 byte 1, and the Logical Unit field in byte 17 expanded to 6 bits. In theory,
1144 Extended LUN Format CCBs can support up to 64 Logical Units, but in practice
1145 many devices will respond improperly to Logical Units between 32 and 63, and
1146 the SCSI-2 specification defines Bit 5 as LUNTAR. Extended LUN Format CCBs
1147 are used by recent versions of the MultiMaster Firmware, as well as by the
1148 FlashPoint SCCB Manager; the FlashPoint SCCB Manager only supports 32 Logical
1149 Units. Since 64 Logical Units are unlikely to be needed in practice, and
1150 since they are problematic for the above reasons, and since limiting them to
1151 5 bits simplifies the CCB structure definition, this driver only supports
1152 32 Logical Units per Target Device.
1155 typedefstruct BusLogic_CCB
1158 MultiMaster Firmware and FlashPoint SCCB Manager Common Portion.
1160 BusLogic_CCB_Opcode_T Opcode;/* Byte 0 */
1161 unsigned char:3;/* Byte 1 Bits 0-2 */
1162 BusLogic_DataDirection_T DataDirection:2;/* Byte 1 Bits 3-4 */
1163 boolean TagEnable:1;/* Byte 1 Bit 5 */
1164 BusLogic_QueueTag_T QueueTag:2;/* Byte 1 Bits 6-7 */
1165 unsigned char CDB_Length;/* Byte 2 */
1166 unsigned char SenseDataLength;/* Byte 3 */
1167 BusLogic_ByteCount_T DataLength;/* Bytes 4-7 */
1168 BusLogic_BusAddress_T DataPointer;/* Bytes 8-11 */
1169 unsigned char:8;/* Byte 12 */
1170 unsigned char:8;/* Byte 13 */
1171 BusLogic_HostAdapterStatus_T HostAdapterStatus;/* Byte 14 */
1172 BusLogic_TargetDeviceStatus_T TargetDeviceStatus;/* Byte 15 */
1173 unsigned char TargetID;/* Byte 16 */
1174 unsigned char LogicalUnit:5;/* Byte 17 Bits 0-4 */
1175 boolean LegacyTagEnable:1;/* Byte 17 Bit 5 */
1176 BusLogic_QueueTag_T LegacyQueueTag:2;/* Byte 17 Bits 6-7 */
1177 SCSI_CDB_T CDB;/* Bytes 18-29 */
1178 unsigned char:8;/* Byte 30 */
1179 unsigned char:8;/* Byte 31 */
1180 unsigned int:32;/* Bytes 32-35 */
1181 BusLogic_BusAddress_T SenseDataPointer;/* Bytes 36-39 */
1183 FlashPoint SCCB Manager Defined Portion.
1185 void(*CallbackFunction)(struct BusLogic_CCB *);/* Bytes 40-43 */
1186 BusLogic_Base_Address_T BaseAddress;/* Bytes 44-47 */
1187 BusLogic_CompletionCode_T CompletionCode;/* Byte 48 */
1188 #ifndef CONFIG_SCSI_OMIT_FLASHPOINT
1189 unsigned char:8;/* Byte 49 */
1190 unsigned short OS_Flags;/* Bytes 50-51 */
1191 unsigned char Private[48];/* Bytes 52-99 */
1192 #endif
1194 BusLogic Linux Driver Defined Portion.
1196 boolean AllocationGroupHead;
1197 BusLogic_CCB_Status_T Status;
1198 unsigned long SerialNumber;
1199 SCSI_Command_T *Command;
1200 struct BusLogic_HostAdapter *HostAdapter;
1201 struct BusLogic_CCB *Next;
1202 struct BusLogic_CCB *NextAll;
1203 BusLogic_ScatterGatherSegment_T
1204 ScatterGatherList[BusLogic_ScatterGatherLimit];
1206 BusLogic_CCB_T;
1210 Define the 32 Bit Mode Outgoing Mailbox structure.
1213 typedefstruct BusLogic_OutgoingMailbox
1215 BusLogic_BusAddress_T CCB;/* Bytes 0-3 */
1216 unsigned int:24;/* Bytes 4-6 */
1217 BusLogic_ActionCode_T ActionCode;/* Byte 7 */
1219 BusLogic_OutgoingMailbox_T;
1223 Define the 32 Bit Mode Incoming Mailbox structure.
1226 typedefstruct BusLogic_IncomingMailbox
1228 BusLogic_BusAddress_T CCB;/* Bytes 0-3 */
1229 BusLogic_HostAdapterStatus_T HostAdapterStatus;/* Byte 4 */
1230 BusLogic_TargetDeviceStatus_T TargetDeviceStatus;/* Byte 5 */
1231 unsigned char:8;/* Byte 6 */
1232 BusLogic_CompletionCode_T CompletionCode;/* Byte 7 */
1234 BusLogic_IncomingMailbox_T;
1238 Define the BusLogic Driver Options structure.
1241 typedefstruct BusLogic_DriverOptions
1243 unsigned short TaggedQueuingPermitted;
1244 unsigned short TaggedQueuingPermittedMask;
1245 unsigned short BusSettleTime;
1246 BusLogic_LocalOptions_T LocalOptions;
1247 unsigned char CommonQueueDepth;
1248 unsigned char QueueDepth[BusLogic_MaxTargetDevices];
1249 BusLogic_ErrorRecoveryStrategy_T
1250 ErrorRecoveryStrategy[BusLogic_MaxTargetDevices];
1252 BusLogic_DriverOptions_T;
1256 Define the Host Adapter Target Flags structure.
1259 typedefstruct BusLogic_TargetFlags
1261 boolean TargetExists:1;
1262 boolean TaggedQueuingSupported:1;
1263 boolean WideTransfersSupported:1;
1264 boolean TaggedQueuingActive:1;
1265 boolean WideTransfersActive:1;
1266 boolean CommandSuccessfulFlag:1;
1267 boolean TargetInfoReported:1;
1269 BusLogic_TargetFlags_T;
1273 Define the Host Adapter Target Statistics structure.
1276 #define BusLogic_SizeBuckets 10
1278 typedefunsigned int BusLogic_CommandSizeBuckets_T[BusLogic_SizeBuckets];
1280 typedefstruct BusLogic_TargetStatistics
1282 unsigned int CommandsAttempted;
1283 unsigned int CommandsCompleted;
1284 unsigned int ReadCommands;
1285 unsigned int WriteCommands;
1286 BusLogic_ByteCounter_T TotalBytesRead;
1287 BusLogic_ByteCounter_T TotalBytesWritten;
1288 BusLogic_CommandSizeBuckets_T ReadCommandSizeBuckets;
1289 BusLogic_CommandSizeBuckets_T WriteCommandSizeBuckets;
1290 unsigned short CommandAbortsRequested;
1291 unsigned short CommandAbortsAttempted;
1292 unsigned short CommandAbortsCompleted;
1293 unsigned short BusDeviceResetsRequested;
1294 unsigned short BusDeviceResetsAttempted;
1295 unsigned short BusDeviceResetsCompleted;
1296 unsigned short HostAdapterResetsRequested;
1297 unsigned short HostAdapterResetsAttempted;
1298 unsigned short HostAdapterResetsCompleted;
1300 BusLogic_TargetStatistics_T;
1304 Define the FlashPoint Card Handle data type.
1307 #define FlashPoint_BadCardHandle 0xFFFFFFFF
1309 typedefunsigned int FlashPoint_CardHandle_T;
1313 Define the FlashPoint Information structure. This structure is defined
1314 by the FlashPoint SCCB Manager.
1317 typedefstruct FlashPoint_Info
1319 BusLogic_Base_Address_T BaseAddress;/* Bytes 0-3 */
1320 boolean Present;/* Byte 4 */
1321 unsigned char IRQ_Channel;/* Byte 5 */
1322 unsigned char SCSI_ID;/* Byte 6 */
1323 unsigned char SCSI_LUN;/* Byte 7 */
1324 unsigned short FirmwareRevision;/* Bytes 8-9 */
1325 unsigned short SynchronousPermitted;/* Bytes 10-11 */
1326 unsigned short FastPermitted;/* Bytes 12-13 */
1327 unsigned short UltraPermitted;/* Bytes 14-15 */
1328 unsigned short DisconnectPermitted;/* Bytes 16-17 */
1329 unsigned short WidePermitted;/* Bytes 18-19 */
1330 boolean ParityCheckingEnabled:1;/* Byte 20 Bit 0 */
1331 boolean HostWideSCSI:1;/* Byte 20 Bit 1 */
1332 boolean HostSoftReset:1;/* Byte 20 Bit 2 */
1333 boolean ExtendedTranslationEnabled:1;/* Byte 20 Bit 3 */
1334 boolean LowByteTerminated:1;/* Byte 20 Bit 4 */
1335 boolean HighByteTerminated:1;/* Byte 20 Bit 5 */
1336 boolean ReportDataUnderrun:1;/* Byte 20 Bit 6 */
1337 boolean SCAM_Enabled:1;/* Byte 20 Bit 7 */
1338 boolean SCAM_Level2:1;/* Byte 21 Bit 0 */
1339 unsigned char:7;/* Byte 21 Bits 1-7 */
1340 unsigned char Family;/* Byte 22 */
1341 unsigned char BusType;/* Byte 23 */
1342 unsigned char ModelNumber[3];/* Bytes 24-26 */
1343 unsigned char RelativeCardNumber;/* Byte 27 */
1344 unsigned char Reserved[4];/* Bytes 28-31 */
1345 unsigned int OS_Reserved;/* Bytes 32-35 */
1346 unsigned char TranslationInfo[4];/* Bytes 36-39 */
1347 unsigned int Reserved2[5];/* Bytes 40-59 */
1348 unsigned int SecondaryRange;/* Bytes 60-63 */
1350 FlashPoint_Info_T;
1354 Define the BusLogic Driver Host Adapter structure.
1357 typedefstruct BusLogic_HostAdapter
1359 SCSI_Host_T *SCSI_Host;
1360 BusLogic_HostAdapterType_T HostAdapterType;
1361 BusLogic_HostAdapterBusType_T HostAdapterBusType;
1362 BusLogic_IO_Address_T IO_Address;
1363 BusLogic_PCI_Address_T PCI_Address;
1364 unsigned short AddressCount;
1365 unsigned char HostNumber;
1366 unsigned char ModelName[9];
1367 unsigned char FirmwareVersion[6];
1368 unsigned char FullModelName[18];
1369 unsigned char Bus;
1370 unsigned char Device;
1371 unsigned char IRQ_Channel;
1372 unsigned char DMA_Channel;
1373 unsigned char SCSI_ID;
1374 boolean IRQ_ChannelAcquired:1;
1375 boolean DMA_ChannelAcquired:1;
1376 boolean ExtendedTranslationEnabled:1;
1377 boolean ParityCheckingEnabled:1;
1378 boolean BusResetEnabled:1;
1379 boolean LevelSensitiveInterrupt:1;
1380 boolean HostWideSCSI:1;
1381 boolean HostDifferentialSCSI:1;
1382 boolean HostSupportsSCAM:1;
1383 boolean HostUltraSCSI:1;
1384 boolean ExtendedLUNSupport:1;
1385 boolean TerminationInfoValid:1;
1386 boolean LowByteTerminated:1;
1387 boolean HighByteTerminated:1;
1388 boolean BounceBuffersRequired:1;
1389 boolean StrictRoundRobinModeSupport:1;
1390 boolean SCAM_Enabled:1;
1391 boolean SCAM_Level2:1;
1392 boolean HostAdapterInitialized:1;
1393 boolean HostAdapterExternalReset:1;
1394 boolean HostAdapterInternalError:1;
1395 boolean ProcessCompletedCCBsActive;
1396 volatile boolean HostAdapterCommandCompleted;
1397 unsigned short HostAdapterScatterGatherLimit;
1398 unsigned short DriverScatterGatherLimit;
1399 unsigned short MaxTargetDevices;
1400 unsigned short MaxLogicalUnits;
1401 unsigned short MailboxCount;
1402 unsigned short InitialCCBs;
1403 unsigned short IncrementalCCBs;
1404 unsigned short AllocatedCCBs;
1405 unsigned short DriverQueueDepth;
1406 unsigned short HostAdapterQueueDepth;
1407 unsigned short UntaggedQueueDepth;
1408 unsigned short CommonQueueDepth;
1409 unsigned short BusSettleTime;
1410 unsigned short SynchronousPermitted;
1411 unsigned short FastPermitted;
1412 unsigned short UltraPermitted;
1413 unsigned short WidePermitted;
1414 unsigned short DisconnectPermitted;
1415 unsigned short TaggedQueuingPermitted;
1416 unsigned short ExternalHostAdapterResets;
1417 unsigned short HostAdapterInternalErrors;
1418 unsigned short TargetDeviceCount;
1419 unsigned short MessageBufferLength;
1420 BusLogic_BusAddress_T BIOS_Address;
1421 BusLogic_DriverOptions_T *DriverOptions;
1422 FlashPoint_Info_T FlashPointInfo;
1423 FlashPoint_CardHandle_T CardHandle;
1424 struct BusLogic_HostAdapter *Next;
1425 BusLogic_CCB_T *All_CCBs;
1426 BusLogic_CCB_T *Free_CCBs;
1427 BusLogic_CCB_T *FirstCompletedCCB;
1428 BusLogic_CCB_T *LastCompletedCCB;
1429 BusLogic_CCB_T *BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices];
1430 BusLogic_ErrorRecoveryStrategy_T
1431 ErrorRecoveryStrategy[BusLogic_MaxTargetDevices];
1432 BusLogic_TargetFlags_T TargetFlags[BusLogic_MaxTargetDevices];
1433 unsigned char QueueDepth[BusLogic_MaxTargetDevices];
1434 unsigned char SynchronousPeriod[BusLogic_MaxTargetDevices];
1435 unsigned char SynchronousOffset[BusLogic_MaxTargetDevices];
1436 unsigned char ActiveCommands[BusLogic_MaxTargetDevices];
1437 unsigned int CommandsSinceReset[BusLogic_MaxTargetDevices];
1438 unsigned long LastSequencePoint[BusLogic_MaxTargetDevices];
1439 unsigned long LastResetAttempted[BusLogic_MaxTargetDevices];
1440 unsigned long LastResetCompleted[BusLogic_MaxTargetDevices];
1441 BusLogic_OutgoingMailbox_T *FirstOutgoingMailbox;
1442 BusLogic_OutgoingMailbox_T *LastOutgoingMailbox;
1443 BusLogic_OutgoingMailbox_T *NextOutgoingMailbox;
1444 BusLogic_IncomingMailbox_T *FirstIncomingMailbox;
1445 BusLogic_IncomingMailbox_T *LastIncomingMailbox;
1446 BusLogic_IncomingMailbox_T *NextIncomingMailbox;
1447 BusLogic_TargetStatistics_T TargetStatistics[BusLogic_MaxTargetDevices];
1448 unsigned char MailboxSpace[BusLogic_MaxMailboxes
1449 * (sizeof(BusLogic_OutgoingMailbox_T)
1450 +sizeof(BusLogic_IncomingMailbox_T))];
1451 char MessageBuffer[BusLogic_MessageBufferSize];
1453 BusLogic_HostAdapter_T;
1457 Define a structure for the BIOS Disk Parameters.
1460 typedefstruct BIOS_DiskParameters
1462 int Heads;
1463 int Sectors;
1464 int Cylinders;
1466 BIOS_DiskParameters_T;
1470 Define a structure for the SCSI Inquiry command results.
1473 typedefstruct SCSI_Inquiry
1475 unsigned char PeripheralDeviceType:5;/* Byte 0 Bits 0-4 */
1476 unsigned char PeripheralQualifier:3;/* Byte 0 Bits 5-7 */
1477 unsigned char DeviceTypeModifier:7;/* Byte 1 Bits 0-6 */
1478 boolean RMB:1;/* Byte 1 Bit 7 */
1479 unsigned char ANSI_ApprovedVersion:3;/* Byte 2 Bits 0-2 */
1480 unsigned char ECMA_Version:3;/* Byte 2 Bits 3-5 */
1481 unsigned char ISO_Version:2;/* Byte 2 Bits 6-7 */
1482 unsigned char ResponseDataFormat:4;/* Byte 3 Bits 0-3 */
1483 unsigned char:2;/* Byte 3 Bits 4-5 */
1484 boolean TrmIOP:1;/* Byte 3 Bit 6 */
1485 boolean AENC:1;/* Byte 3 Bit 7 */
1486 unsigned char AdditionalLength;/* Byte 4 */
1487 unsigned char:8;/* Byte 5 */
1488 unsigned char:8;/* Byte 6 */
1489 boolean SftRe:1;/* Byte 7 Bit 0 */
1490 boolean CmdQue:1;/* Byte 7 Bit 1 */
1491 boolean :1;/* Byte 7 Bit 2 */
1492 boolean Linked:1;/* Byte 7 Bit 3 */
1493 boolean Sync:1;/* Byte 7 Bit 4 */
1494 boolean WBus16:1;/* Byte 7 Bit 5 */
1495 boolean WBus32:1;/* Byte 7 Bit 6 */
1496 boolean RelAdr:1;/* Byte 7 Bit 7 */
1497 unsigned char VendorIdentification[8];/* Bytes 8-15 */
1498 unsigned char ProductIdentification[16];/* Bytes 16-31 */
1499 unsigned char ProductRevisionLevel[4];/* Bytes 32-35 */
1501 SCSI_Inquiry_T;
1505 BusLogic_AcquireHostAdapterLock acquires exclusive access to Host Adapter.
1508 staticinline
1509 voidBusLogic_AcquireHostAdapterLock(BusLogic_HostAdapter_T *HostAdapter,
1510 ProcessorFlags_T *ProcessorFlags)
1516 BusLogic_ReleaseHostAdapterLock releases exclusive access to Host Adapter.
1519 staticinline
1520 voidBusLogic_ReleaseHostAdapterLock(BusLogic_HostAdapter_T *HostAdapter,
1521 ProcessorFlags_T *ProcessorFlags)
1527 BusLogic_AcquireHostAdapterLockIH acquires exclusive access to Host Adapter,
1528 but is only called from the interrupt handler.
1531 staticinline
1532 voidBusLogic_AcquireHostAdapterLockIH(BusLogic_HostAdapter_T *HostAdapter,
1533 ProcessorFlags_T *ProcessorFlags)
1535 spin_lock_irqsave(&io_request_lock, *ProcessorFlags);
1540 BusLogic_ReleaseHostAdapterLockIH releases exclusive access to Host Adapter,
1541 but is only called from the interrupt handler.
1544 staticinline
1545 voidBusLogic_ReleaseHostAdapterLockIH(BusLogic_HostAdapter_T *HostAdapter,
1546 ProcessorFlags_T *ProcessorFlags)
1548 spin_unlock_irqrestore(&io_request_lock, *ProcessorFlags);
1553 Define functions to provide an abstraction for reading and writing the
1554 Host Adapter I/O Registers.
1557 staticinline
1558 voidBusLogic_SCSIBusReset(BusLogic_HostAdapter_T *HostAdapter)
1560 BusLogic_ControlRegister_T ControlRegister;
1561 ControlRegister.All =0;
1562 ControlRegister.Bits.SCSIBusReset =true;
1563 outb(ControlRegister.All,
1564 HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1567 staticinline
1568 voidBusLogic_InterruptReset(BusLogic_HostAdapter_T *HostAdapter)
1570 BusLogic_ControlRegister_T ControlRegister;
1571 ControlRegister.All =0;
1572 ControlRegister.Bits.InterruptReset =true;
1573 outb(ControlRegister.All,
1574 HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1577 staticinline
1578 voidBusLogic_SoftReset(BusLogic_HostAdapter_T *HostAdapter)
1580 BusLogic_ControlRegister_T ControlRegister;
1581 ControlRegister.All =0;
1582 ControlRegister.Bits.SoftReset =true;
1583 outb(ControlRegister.All,
1584 HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1587 staticinline
1588 voidBusLogic_HardReset(BusLogic_HostAdapter_T *HostAdapter)
1590 BusLogic_ControlRegister_T ControlRegister;
1591 ControlRegister.All =0;
1592 ControlRegister.Bits.HardReset =true;
1593 outb(ControlRegister.All,
1594 HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1597 staticinline
1598 unsigned charBusLogic_ReadStatusRegister(BusLogic_HostAdapter_T *HostAdapter)
1600 returninb(HostAdapter->IO_Address + BusLogic_StatusRegisterOffset);
1603 staticinline
1604 voidBusLogic_WriteCommandParameterRegister(BusLogic_HostAdapter_T
1605 *HostAdapter,
1606 unsigned char Value)
1608 outb(Value,
1609 HostAdapter->IO_Address + BusLogic_CommandParameterRegisterOffset);
1612 staticinline
1613 unsigned charBusLogic_ReadDataInRegister(BusLogic_HostAdapter_T *HostAdapter)
1615 returninb(HostAdapter->IO_Address + BusLogic_DataInRegisterOffset);
1618 staticinline
1619 unsigned charBusLogic_ReadInterruptRegister(BusLogic_HostAdapter_T
1620 *HostAdapter)
1622 returninb(HostAdapter->IO_Address + BusLogic_InterruptRegisterOffset);
1625 staticinline
1626 unsigned charBusLogic_ReadGeometryRegister(BusLogic_HostAdapter_T
1627 *HostAdapter)
1629 returninb(HostAdapter->IO_Address + BusLogic_GeometryRegisterOffset);
1634 BusLogic_StartMailboxCommand issues an Execute Mailbox Command, which
1635 notifies the Host Adapter that an entry has been made in an Outgoing
1636 Mailbox.
1639 staticinline
1640 voidBusLogic_StartMailboxCommand(BusLogic_HostAdapter_T *HostAdapter)
1642 BusLogic_WriteCommandParameterRegister(HostAdapter,
1643 BusLogic_ExecuteMailboxCommand);
1648 BusLogic_Delay waits for Seconds to elapse.
1651 staticinlinevoidBusLogic_Delay(int Seconds)
1653 int Milliseconds =1000* Seconds;
1654 unsigned long ProcessorFlags;
1655 save_flags(ProcessorFlags);
1656 sti();
1657 while(--Milliseconds >=0)udelay(1000);
1658 restore_flags(ProcessorFlags);
1663 Virtual_to_Bus and Bus_to_Virtual map between Kernel Virtual Addresses
1664 and PCI/VLB/EISA/ISA Bus Addresses.
1667 staticinline BusLogic_BusAddress_T Virtual_to_Bus(void*VirtualAddress)
1669 return(BusLogic_BusAddress_T)virt_to_bus(VirtualAddress);
1672 staticinlinevoid*Bus_to_Virtual(BusLogic_BusAddress_T BusAddress)
1674 return(void*)bus_to_virt(BusAddress);
1679 Virtual_to_32Bit_Virtual maps between Kernel Virtual Addresses and
1680 32 bit Kernel Virtual Addresses. This avoids compilation warnings
1681 on 64 bit architectures.
1684 staticinline
1685 BusLogic_BusAddress_T Virtual_to_32Bit_Virtual(void*VirtualAddress)
1687 return(BusLogic_BusAddress_T) (unsigned long) VirtualAddress;
1692 BusLogic_IncrementErrorCounter increments Error Counter by 1, stopping at
1693 65535 rather than wrapping around to 0.
1696 staticinlinevoidBusLogic_IncrementErrorCounter(unsigned short*ErrorCounter)
1698 if(*ErrorCounter <65535) (*ErrorCounter)++;
1703 BusLogic_IncrementByteCounter increments Byte Counter by Amount.
1706 staticinlinevoidBusLogic_IncrementByteCounter(BusLogic_ByteCounter_T
1707 *ByteCounter,
1708 unsigned int Amount)
1710 ByteCounter->Units += Amount;
1711 if(ByteCounter->Units >999999999)
1713 ByteCounter->Units -=1000000000;
1714 ByteCounter->Billions++;
1720 BusLogic_IncrementSizeBucket increments the Bucket for Amount.
1723 staticinlinevoidBusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T
1724 CommandSizeBuckets,
1725 unsigned int Amount)
1727 int Index =0;
1728 if(Amount <8*1024)
1730 if(Amount <2*1024)
1731 Index = (Amount <1*1024?0:1);
1732 else Index = (Amount <4*1024?2:3);
1734 else if(Amount <128*1024)
1736 if(Amount <32*1024)
1737 Index = (Amount <16*1024?4:5);
1738 else Index = (Amount <64*1024?6:7);
1740 else Index = (Amount <256*1024?8:9);
1741 CommandSizeBuckets[Index]++;
1746 Define the version number of the FlashPoint Firmware (SCCB Manager).
1749 #define FlashPoint_FirmwareVersion"5.02"
1753 Define the possible return values from FlashPoint_HandleInterrupt.
1756 #define FlashPoint_NormalInterrupt 0x00
1757 #define FlashPoint_InternalError 0xFE
1758 #define FlashPoint_ExternalBusReset 0xFF
1762 Define prototypes for the forward referenced BusLogic Driver
1763 Internal Functions.
1766 static voidBusLogic_QueueCompletedCCB(BusLogic_CCB_T *);
1767 static voidBusLogic_InterruptHandler(int,void*, Registers_T *);
1768 static intBusLogic_ResetHostAdapter(BusLogic_HostAdapter_T *,
1769 SCSI_Command_T *,unsigned int);
1770 static voidBusLogic_Message(BusLogic_MessageLevel_T,char*,
1771 BusLogic_HostAdapter_T *, ...);
1772 static voidBusLogic_ParseDriverOptions(char*);
1776 Declare the Initialization Functions.
1779 static voidBusLogic_AnnounceDriver(BusLogic_HostAdapter_T *) __init;
1780 static voidBusLogic_RegisterHostAdapter(BusLogic_HostAdapter_T *) __init;
1781 static voidBusLogic_UnregisterHostAdapter(BusLogic_HostAdapter_T *) __init;
1782 static boolean BusLogic_CreateInitialCCBs(BusLogic_HostAdapter_T *) __init;
1783 static voidBusLogic_DestroyCCBs(BusLogic_HostAdapter_T *) __init;
1784 static voidBusLogic_AppendProbeAddressISA(BusLogic_IO_Address_T) __init;
1785 static void
1786 BusLogic_InitializeProbeInfoListISA(BusLogic_HostAdapter_T *) __init;
1787 static voidBusLogic_SortProbeInfo(BusLogic_ProbeInfo_T *,int) __init;
1788 static int
1789 BusLogic_InitializeMultiMasterProbeInfo(BusLogic_HostAdapter_T *) __init;
1790 static int
1791 BusLogic_InitializeFlashPointProbeInfo(BusLogic_HostAdapter_T *) __init;
1792 static voidBusLogic_InitializeProbeInfoList(BusLogic_HostAdapter_T *) __init;
1793 static boolean BusLogic_Failure(BusLogic_HostAdapter_T *,char*) __init;
1794 static boolean BusLogic_ProbeHostAdapter(BusLogic_HostAdapter_T *) __init;
1795 static boolean BusLogic_CheckHostAdapter(BusLogic_HostAdapter_T *) __init;
1796 static boolean
1797 BusLogic_ReadHostAdapterConfiguration(BusLogic_HostAdapter_T *) __init;
1798 static boolean
1799 BusLogic_ReportHostAdapterConfiguration(BusLogic_HostAdapter_T *) __init;
1800 static boolean BusLogic_AcquireResources(BusLogic_HostAdapter_T *) __init;
1801 static voidBusLogic_ReleaseResources(BusLogic_HostAdapter_T *) __init;
1802 static boolean BusLogic_TargetDeviceInquiry(BusLogic_HostAdapter_T *) __init;
1803 static voidBusLogic_InitializeHostStructure(BusLogic_HostAdapter_T *,
1804 SCSI_Host_T *) __init;
1805 intBusLogic_DetectHostAdapter(SCSI_Host_Template_T *) __init;
1806 intBusLogic_ReleaseHostAdapter(SCSI_Host_T *) __init;
1807 static boolean BusLogic_ParseKeyword(char**,char*) __init;
1808 static voidBusLogic_ParseDriverOptions(char*) __init;
1809 voidBusLogic_Setup(char*,int*) __init;
1812 #endif/* BusLogic_DriverVersion */
close