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
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.
31 #include <linux/config.h>
34 #define PACKED __attribute__((packed))
38 FlashPoint support is only available for the Intel x86 Architecture with
43 #undef CONFIG_SCSI_OMIT_FLASHPOINT
44 #define CONFIG_SCSI_OMIT_FLASHPOINT
48 #undef CONFIG_SCSI_OMIT_FLASHPOINT
49 #define CONFIG_SCSI_OMIT_FLASHPOINT
50 #define BusLogic_InitializeProbeInfoListISA BusLogic_InitializeProbeInfoList
55 Define the maximum number of BusLogic Host Adapters supported by this driver.
58 #define BusLogic_MaxHostAdapters 16
62 Define the maximum number of Target Devices supported by this driver.
65 #define BusLogic_MaxTargetDevices 16
69 Define the maximum number of Scatter/Gather Segments used by this driver.
70 For optimal performance, it is important that this limit be at least as
71 large as the largest single request generated by the I/O Subsystem.
74 #define BusLogic_ScatterGatherLimit 128
78 Define the maximum, maximum automatic, minimum automatic, and default Queue
79 Depth to allow for Target Devices depending on whether or not they support
80 Tagged Queuing and whether or not ISA Bounce Buffers are required.
83 #define BusLogic_MaxTaggedQueueDepth 64
84 #define BusLogic_MaxAutomaticTaggedQueueDepth 28
85 #define BusLogic_MinAutomaticTaggedQueueDepth 7
86 #define BusLogic_TaggedQueueDepthBB 3
87 #define BusLogic_UntaggedQueueDepth 3
88 #define BusLogic_UntaggedQueueDepthBB 2
92 Define the default amount of time in seconds to wait between a Host Adapter
93 Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI commands.
94 Some SCSI devices get confused if they receive SCSI commands too soon after
98 #define BusLogic_DefaultBusSettleTime 2
102 Define the maximum number of Mailboxes that should be used for MultiMaster
103 Host Adapters. This number is chosen to be larger than the maximum Host
104 Adapter Queue Depth and small enough so that the Host Adapter structure
105 does not cross an allocation block size boundary.
108 #define BusLogic_MaxMailboxes 211
112 Define the number of CCBs that should be allocated as a group to optimize
113 Kernel memory allocation.
116 #define BusLogic_CCB_AllocationGroupSize 7
120 Define the Host Adapter Line and Message Buffer Sizes.
123 #define BusLogic_LineBufferSize 100
124 #define BusLogic_MessageBufferSize 9700
128 Define the Driver Message Levels.
131 enum BusLogic_MessageLevel
133 BusLogic_AnnounceLevel = 0,
134 BusLogic_InfoLevel = 1,
135 BusLogic_NoticeLevel = 2,
136 BusLogic_WarningLevel = 3,
137 BusLogic_ErrorLevel = 4
140 static char *BusLogic_MessageLevelMap[] =
141 { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };
145 Define Driver Message macros.
148 #define BusLogic_Announce(Format, Arguments...) \
149 BusLogic_Message(BusLogic_AnnounceLevel, Format, ##Arguments)
151 #define BusLogic_Info(Format, Arguments...) \
152 BusLogic_Message(BusLogic_InfoLevel, Format, ##Arguments)
154 #define BusLogic_Notice(Format, Arguments...) \
155 BusLogic_Message(BusLogic_NoticeLevel, Format, ##Arguments)
157 #define BusLogic_Warning(Format, Arguments...) \
158 BusLogic_Message(BusLogic_WarningLevel, Format, ##Arguments)
160 #define BusLogic_Error(Format, Arguments...) \
161 BusLogic_Message(BusLogic_ErrorLevel, Format, ##Arguments)
165 Define the types of BusLogic Host Adapters that are supported and the number
166 of I/O Addresses required by each type.
169 enum BusLogic_HostAdapterType
171 BusLogic_MultiMaster = 1,
172 BusLogic_FlashPoint = 2
175 #define BusLogic_MultiMasterAddressCount 4
176 #define BusLogic_FlashPointAddressCount 256
178 static int BusLogic_HostAdapterAddressCount[3] =
179 { 0, BusLogic_MultiMasterAddressCount, BusLogic_FlashPointAddressCount };
183 Define macros for testing the Host Adapter Type.
186 #ifndef CONFIG_SCSI_OMIT_FLASHPOINT
188 #define BusLogic_MultiMasterHostAdapterP(HostAdapter) \
189 (HostAdapter->HostAdapterType == BusLogic_MultiMaster)
191 #define BusLogic_FlashPointHostAdapterP(HostAdapter) \
192 (HostAdapter->HostAdapterType == BusLogic_FlashPoint)
196 #define BusLogic_MultiMasterHostAdapterP(HostAdapter) \
199 #define BusLogic_FlashPointHostAdapterP(HostAdapter) \
206 Define the possible Host Adapter Bus Types.
209 enum BusLogic_HostAdapterBusType
211 BusLogic_Unknown_Bus = 0,
212 BusLogic_ISA_Bus = 1,
213 BusLogic_EISA_Bus = 2,
214 BusLogic_PCI_Bus = 3,
215 BusLogic_VESA_Bus = 4,
219 static char *BusLogic_HostAdapterBusNames[] =
220 { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };
222 static enum BusLogic_HostAdapterBusType BusLogic_HostAdapterBusTypes[] =
224 BusLogic_VESA_Bus, /* BT-4xx */
225 BusLogic_ISA_Bus, /* BT-5xx */
226 BusLogic_MCA_Bus, /* BT-6xx */
227 BusLogic_EISA_Bus, /* BT-7xx */
228 BusLogic_Unknown_Bus, /* BT-8xx */
229 BusLogic_PCI_Bus /* BT-9xx */
233 Define the possible Host Adapter BIOS Disk Geometry Translations.
236 enum BusLogic_BIOS_DiskGeometryTranslation
238 BusLogic_BIOS_Disk_Not_Installed = 0,
239 BusLogic_BIOS_Disk_Installed_64x32 = 1,
240 BusLogic_BIOS_Disk_Installed_128x32 = 2,
241 BusLogic_BIOS_Disk_Installed_255x63 = 3
246 Define a Boolean data type.
255 Define a 10^18 Statistics Byte Counter data type.
258 struct BusLogic_ByteCounter
261 unsigned int Billions;
266 Define the structure for I/O Address and Bus Probing Information.
269 struct BusLogic_ProbeInfo
271 enum BusLogic_HostAdapterType HostAdapterType;
272 enum BusLogic_HostAdapterBusType HostAdapterBusType;
273 unsigned long IO_Address;
274 unsigned long PCI_Address;
275 struct pci_dev *PCI_Device;
277 unsigned char Device;
278 unsigned char IRQ_Channel;
282 Define the Probe Options.
285 struct BusLogic_ProbeOptions
287 boolean NoProbe:1; /* Bit 0 */
288 boolean NoProbeISA:1; /* Bit 1 */
289 boolean NoProbePCI:1; /* Bit 2 */
290 boolean NoSortPCI:1; /* Bit 3 */
291 boolean MultiMasterFirst:1; /* Bit 4 */
292 boolean FlashPointFirst:1; /* Bit 5 */
293 boolean LimitedProbeISA:1; /* Bit 6 */
294 boolean Probe330:1; /* Bit 7 */
295 boolean Probe334:1; /* Bit 8 */
296 boolean Probe230:1; /* Bit 9 */
297 boolean Probe234:1; /* Bit 10 */
298 boolean Probe130:1; /* Bit 11 */
299 boolean Probe134:1; /* Bit 12 */
303 Define the Global Options.
306 struct BusLogic_GlobalOptions
308 boolean TraceProbe:1; /* Bit 0 */
309 boolean TraceHardwareReset:1; /* Bit 1 */
310 boolean TraceConfiguration:1; /* Bit 2 */
311 boolean TraceErrors:1; /* Bit 3 */
315 Define the Local Options.
318 struct BusLogic_LocalOptions
320 boolean InhibitTargetInquiry:1; /* Bit 0 */
324 Define the BusLogic SCSI Host Adapter I/O Register Offsets.
327 #define BusLogic_ControlRegisterOffset 0 /* WO register */
328 #define BusLogic_StatusRegisterOffset 0 /* RO register */
329 #define BusLogic_CommandParameterRegisterOffset 1 /* WO register */
330 #define BusLogic_DataInRegisterOffset 1 /* RO register */
331 #define BusLogic_InterruptRegisterOffset 2 /* RO register */
332 #define BusLogic_GeometryRegisterOffset 3 /* RO register */
335 Define the structure of the write-only Control Register.
338 union BusLogic_ControlRegister
342 unsigned char :4; /* Bits 0-3 */
343 boolean SCSIBusReset:1; /* Bit 4 */
344 boolean InterruptReset:1; /* Bit 5 */
345 boolean SoftReset:1; /* Bit 6 */
346 boolean HardReset:1; /* Bit 7 */
351 Define the structure of the read-only Status Register.
354 union BusLogic_StatusRegister
358 boolean CommandInvalid:1; /* Bit 0 */
359 boolean Reserved:1; /* Bit 1 */
360 boolean DataInRegisterReady:1; /* Bit 2 */
361 boolean CommandParameterRegisterBusy:1; /* Bit 3 */
362 boolean HostAdapterReady:1; /* Bit 4 */
363 boolean InitializationRequired:1; /* Bit 5 */
364 boolean DiagnosticFailure:1; /* Bit 6 */
365 boolean DiagnosticActive:1; /* Bit 7 */
370 Define the structure of the read-only Interrupt Register.
373 union BusLogic_InterruptRegister
377 boolean IncomingMailboxLoaded:1; /* Bit 0 */
378 boolean OutgoingMailboxAvailable:1; /* Bit 1 */
379 boolean CommandComplete:1; /* Bit 2 */
380 boolean ExternalBusReset:1; /* Bit 3 */
381 unsigned char Reserved:3; /* Bits 4-6 */
382 boolean InterruptValid:1; /* Bit 7 */
387 Define the structure of the read-only Geometry Register.
390 union BusLogic_GeometryRegister
394 enum BusLogic_BIOS_DiskGeometryTranslation Drive0Geometry:2;/* Bits 0-1 */
395 enum BusLogic_BIOS_DiskGeometryTranslation Drive1Geometry:2;/* Bits 2-3 */
396 unsigned char :3; /* Bits 4-6 */
397 boolean ExtendedTranslationEnabled:1; /* Bit 7 */
402 Define the BusLogic SCSI Host Adapter Command Register Operation Codes.
405 enum BusLogic_OperationCode
407 BusLogic_TestCommandCompleteInterrupt = 0x00,
408 BusLogic_InitializeMailbox = 0x01,
409 BusLogic_ExecuteMailboxCommand = 0x02,
410 BusLogic_ExecuteBIOSCommand = 0x03,
411 BusLogic_InquireBoardID = 0x04,
412 BusLogic_EnableOutgoingMailboxAvailableInt = 0x05,
413 BusLogic_SetSCSISelectionTimeout = 0x06,
414 BusLogic_SetPreemptTimeOnBus = 0x07,
415 BusLogic_SetTimeOffBus = 0x08,
416 BusLogic_SetBusTransferRate = 0x09,
417 BusLogic_InquireInstalledDevicesID0to7 = 0x0A,
418 BusLogic_InquireConfiguration = 0x0B,
419 BusLogic_EnableTargetMode = 0x0C,
420 BusLogic_InquireSetupInformation = 0x0D,
421 BusLogic_WriteAdapterLocalRAM = 0x1A,
422 BusLogic_ReadAdapterLocalRAM = 0x1B,
423 BusLogic_WriteBusMasterChipFIFO = 0x1C,
424 BusLogic_ReadBusMasterChipFIFO = 0x1D,
425 BusLogic_EchoCommandData = 0x1F,
426 BusLogic_HostAdapterDiagnostic = 0x20,
427 BusLogic_SetAdapterOptions = 0x21,
428 BusLogic_InquireInstalledDevicesID8to15 = 0x23,
429 BusLogic_InquireTargetDevices = 0x24,
430 BusLogic_DisableHostAdapterInterrupt = 0x25,
431 BusLogic_InitializeExtendedMailbox = 0x81,
432 BusLogic_ExecuteSCSICommand = 0x83,
433 BusLogic_InquireFirmwareVersion3rdDigit = 0x84,
434 BusLogic_InquireFirmwareVersionLetter = 0x85,
435 BusLogic_InquirePCIHostAdapterInformation = 0x86,
436 BusLogic_InquireHostAdapterModelNumber = 0x8B,
437 BusLogic_InquireSynchronousPeriod = 0x8C,
438 BusLogic_InquireExtendedSetupInformation = 0x8D,
439 BusLogic_EnableStrictRoundRobinMode = 0x8F,
440 BusLogic_StoreHostAdapterLocalRAM = 0x90,
441 BusLogic_FetchHostAdapterLocalRAM = 0x91,
442 BusLogic_StoreLocalDataInEEPROM = 0x92,
443 BusLogic_UploadAutoSCSICode = 0x94,
444 BusLogic_ModifyIOAddress = 0x95,
445 BusLogic_SetCCBFormat = 0x96,
446 BusLogic_WriteInquiryBuffer = 0x9A,
447 BusLogic_ReadInquiryBuffer = 0x9B,
448 BusLogic_FlashROMUploadDownload = 0xA7,
449 BusLogic_ReadSCAMData = 0xA8,
450 BusLogic_WriteSCAMData = 0xA9
454 Define the Inquire Board ID reply structure.
457 struct BusLogic_BoardID
459 unsigned char BoardType; /* Byte 0 */
460 unsigned char CustomFeatures; /* Byte 1 */
461 unsigned char FirmwareVersion1stDigit; /* Byte 2 */
462 unsigned char FirmwareVersion2ndDigit; /* Byte 3 */
466 Define the Inquire Configuration reply structure.
469 struct BusLogic_Configuration
471 unsigned char :5; /* Byte 0 Bits 0-4 */
472 boolean DMA_Channel5:1; /* Byte 0 Bit 5 */
473 boolean DMA_Channel6:1; /* Byte 0 Bit 6 */
474 boolean DMA_Channel7:1; /* Byte 0 Bit 7 */
475 boolean IRQ_Channel9:1; /* Byte 1 Bit 0 */
476 boolean IRQ_Channel10:1; /* Byte 1 Bit 1 */
477 boolean IRQ_Channel11:1; /* Byte 1 Bit 2 */
478 boolean IRQ_Channel12:1; /* Byte 1 Bit 3 */
479 unsigned char :1; /* Byte 1 Bit 4 */
480 boolean IRQ_Channel14:1; /* Byte 1 Bit 5 */
481 boolean IRQ_Channel15:1; /* Byte 1 Bit 6 */
482 unsigned char :1; /* Byte 1 Bit 7 */
483 unsigned char HostAdapterID:4; /* Byte 2 Bits 0-3 */
484 unsigned char :4; /* Byte 2 Bits 4-7 */
488 Define the Inquire Setup Information reply structure.
491 struct BusLogic_SynchronousValue
493 unsigned char Offset:4; /* Bits 0-3 */
494 unsigned char TransferPeriod:3; /* Bits 4-6 */
495 boolean Synchronous:1; /* Bit 7 */
498 struct BusLogic_SetupInformation
500 boolean SynchronousInitiationEnabled:1; /* Byte 0 Bit 0 */
501 boolean ParityCheckingEnabled:1; /* Byte 0 Bit 1 */
502 unsigned char :6; /* Byte 0 Bits 2-7 */
503 unsigned char BusTransferRate; /* Byte 1 */
504 unsigned char PreemptTimeOnBus; /* Byte 2 */
505 unsigned char TimeOffBus; /* Byte 3 */
506 unsigned char MailboxCount; /* Byte 4 */
507 unsigned char MailboxAddress[3]; /* Bytes 5-7 */
508 struct BusLogic_SynchronousValue SynchronousValuesID0to7[8];/* Bytes 8-15 */
509 unsigned char DisconnectPermittedID0to7; /* Byte 16 */
510 unsigned char Signature; /* Byte 17 */
511 unsigned char CharacterD; /* Byte 18 */
512 unsigned char HostBusType; /* Byte 19 */
513 unsigned char WideTransfersPermittedID0to7; /* Byte 20 */
514 unsigned char WideTransfersActiveID0to7; /* Byte 21 */
515 struct BusLogic_SynchronousValue SynchronousValuesID8to15[8]; /* Bytes 22-29 */
516 unsigned char DisconnectPermittedID8to15; /* Byte 30 */
517 unsigned char :8; /* Byte 31 */
518 unsigned char WideTransfersPermittedID8to15; /* Byte 32 */
519 unsigned char WideTransfersActiveID8to15; /* Byte 33 */
523 Define the Initialize Extended Mailbox request structure.
526 struct BusLogic_ExtendedMailboxRequest
528 unsigned char MailboxCount; /* Byte 0 */
529 u32 BaseMailboxAddress; /* Bytes 1-4 */
534 Define the Inquire PCI Host Adapter Information reply type. The ISA
535 Compatible I/O Port values are defined here and are also used with
536 the Modify I/O Address command.
539 enum BusLogic_ISACompatibleIOPort
547 BusLogic_IO_Disable = 6,
548 BusLogic_IO_Disable2 = 7
551 struct BusLogic_PCIHostAdapterInformation
553 enum BusLogic_ISACompatibleIOPort ISACompatibleIOPort;/* Byte 0 */
554 unsigned char PCIAssignedIRQChannel; /* Byte 1 */
555 boolean LowByteTerminated:1; /* Byte 2 Bit 0 */
556 boolean HighByteTerminated:1; /* Byte 2 Bit 1 */
557 unsigned char :2; /* Byte 2 Bits 2-3 */
558 boolean JP1:1; /* Byte 2 Bit 4 */
559 boolean JP2:1; /* Byte 2 Bit 5 */
560 boolean JP3:1; /* Byte 2 Bit 6 */
561 boolean GenericInfoValid:1; /* Byte 2 Bit 7 */
562 unsigned char :8; /* Byte 3 */
566 Define the Inquire Extended Setup Information reply structure.
569 struct BusLogic_ExtendedSetupInformation
571 unsigned char BusType; /* Byte 0 */
572 unsigned char BIOS_Address; /* Byte 1 */
573 unsigned short ScatterGatherLimit; /* Bytes 2-3 */
574 unsigned char MailboxCount; /* Byte 4 */
575 u32 BaseMailboxAddress; /* Bytes 5-8 */
577 unsigned char :2; /* Byte 9 Bits 0-1 */
578 boolean FastOnEISA:1; /* Byte 9 Bit 2 */
579 unsigned char :3; /* Byte 9 Bits 3-5 */
580 boolean LevelSensitiveInterrupt:1; /* Byte 9 Bit 6 */
581 unsigned char :1; /* Byte 9 Bit 7 */
583 unsigned char FirmwareRevision[3]; /* Bytes 10-12 */
584 boolean HostWideSCSI:1; /* Byte 13 Bit 0 */
585 boolean HostDifferentialSCSI:1; /* Byte 13 Bit 1 */
586 boolean HostSupportsSCAM:1; /* Byte 13 Bit 2 */
587 boolean HostUltraSCSI:1; /* Byte 13 Bit 3 */
588 boolean HostSmartTermination:1; /* Byte 13 Bit 4 */
589 unsigned char :3; /* Byte 13 Bits 5-7 */
593 Define the Enable Strict Round Robin Mode request type.
596 enum BusLogic_RoundRobinModeRequest
598 BusLogic_AggressiveRoundRobinMode = 0,
599 BusLogic_StrictRoundRobinMode = 1
604 Define the Fetch Host Adapter Local RAM request type.
607 #define BusLogic_BIOS_BaseOffset 0
608 #define BusLogic_AutoSCSI_BaseOffset 64
610 struct BusLogic_FetchHostAdapterLocalRAMRequest
612 unsigned char ByteOffset; /* Byte 0 */
613 unsigned char ByteCount; /* Byte 1 */
617 Define the Host Adapter Local RAM AutoSCSI structure.
620 struct BusLogic_AutoSCSIData
622 unsigned char InternalFactorySignature[2]; /* Bytes 0-1 */
623 unsigned char InformationByteCount; /* Byte 2 */
624 unsigned char HostAdapterType[6]; /* Bytes 3-8 */
625 unsigned char :8; /* Byte 9 */
626 boolean FloppyEnabled:1; /* Byte 10 Bit 0 */
627 boolean FloppySecondary:1; /* Byte 10 Bit 1 */
628 boolean LevelSensitiveInterrupt:1; /* Byte 10 Bit 2 */
629 unsigned char :2; /* Byte 10 Bits 3-4 */
630 unsigned char SystemRAMAreaForBIOS:3; /* Byte 10 Bits 5-7 */
631 unsigned char DMA_Channel:7; /* Byte 11 Bits 0-6 */
632 boolean DMA_AutoConfiguration:1; /* Byte 11 Bit 7 */
633 unsigned char IRQ_Channel:7; /* Byte 12 Bits 0-6 */
634 boolean IRQ_AutoConfiguration:1; /* Byte 12 Bit 7 */
635 unsigned char DMA_TransferRate; /* Byte 13 */
636 unsigned char SCSI_ID; /* Byte 14 */
637 boolean LowByteTerminated:1; /* Byte 15 Bit 0 */
638 boolean ParityCheckingEnabled:1; /* Byte 15 Bit 1 */
639 boolean HighByteTerminated:1; /* Byte 15 Bit 2 */
640 boolean NoisyCablingEnvironment:1; /* Byte 15 Bit 3 */
641 boolean FastSynchronousNegotiation:1; /* Byte 15 Bit 4 */
642 boolean BusResetEnabled:1; /* Byte 15 Bit 5 */
643 boolean :1; /* Byte 15 Bit 6 */
644 boolean ActiveNegationEnabled:1; /* Byte 15 Bit 7 */
645 unsigned char BusOnDelay; /* Byte 16 */
646 unsigned char BusOffDelay; /* Byte 17 */
647 boolean HostAdapterBIOSEnabled:1; /* Byte 18 Bit 0 */
648 boolean BIOSRedirectionOfINT19Enabled:1; /* Byte 18 Bit 1 */
649 boolean ExtendedTranslationEnabled:1; /* Byte 18 Bit 2 */
650 boolean MapRemovableAsFixedEnabled:1; /* Byte 18 Bit 3 */
651 boolean :1; /* Byte 18 Bit 4 */
652 boolean BIOSSupportsMoreThan2DrivesEnabled:1; /* Byte 18 Bit 5 */
653 boolean BIOSInterruptModeEnabled:1; /* Byte 18 Bit 6 */
654 boolean FlopticalSupportEnabled:1; /* Byte 19 Bit 7 */
655 unsigned short DeviceEnabled; /* Bytes 19-20 */
656 unsigned short WidePermitted; /* Bytes 21-22 */
657 unsigned short FastPermitted; /* Bytes 23-24 */
658 unsigned short SynchronousPermitted; /* Bytes 25-26 */
659 unsigned short DisconnectPermitted; /* Bytes 27-28 */
660 unsigned short SendStartUnitCommand; /* Bytes 29-30 */
661 unsigned short IgnoreInBIOSScan; /* Bytes 31-32 */
662 unsigned char PCIInterruptPin:2; /* Byte 33 Bits 0-1 */
663 unsigned char HostAdapterIOPortAddress:2; /* Byte 33 Bits 2-3 */
664 boolean StrictRoundRobinModeEnabled:1; /* Byte 33 Bit 4 */
665 boolean VESABusSpeedGreaterThan33MHz:1; /* Byte 33 Bit 5 */
666 boolean VESABurstWriteEnabled:1; /* Byte 33 Bit 6 */
667 boolean VESABurstReadEnabled:1; /* Byte 33 Bit 7 */
668 unsigned short UltraPermitted; /* Bytes 34-35 */
669 unsigned int :32; /* Bytes 36-39 */
670 unsigned char :8; /* Byte 40 */
671 unsigned char AutoSCSIMaximumLUN; /* Byte 41 */
672 boolean :1; /* Byte 42 Bit 0 */
673 boolean SCAM_Dominant:1; /* Byte 42 Bit 1 */
674 boolean SCAM_Enabled:1; /* Byte 42 Bit 2 */
675 boolean SCAM_Level2:1; /* Byte 42 Bit 3 */
676 unsigned char :4; /* Byte 42 Bits 4-7 */
677 boolean INT13ExtensionEnabled:1; /* Byte 43 Bit 0 */
678 boolean :1; /* Byte 43 Bit 1 */
679 boolean CDROMBootEnabled:1; /* Byte 43 Bit 2 */
680 unsigned char :5; /* Byte 43 Bits 3-7 */
681 unsigned char BootTargetID:4; /* Byte 44 Bits 0-3 */
682 unsigned char BootChannel:4; /* Byte 44 Bits 4-7 */
683 unsigned char ForceBusDeviceScanningOrder:1; /* Byte 45 Bit 0 */
684 unsigned char :7; /* Byte 45 Bits 1-7 */
685 unsigned short NonTaggedToAlternateLUNPermitted; /* Bytes 46-47 */
686 unsigned short RenegotiateSyncAfterCheckCondition; /* Bytes 48-49 */
687 unsigned char Reserved[10]; /* Bytes 50-59 */
688 unsigned char ManufacturingDiagnostic[2]; /* Bytes 60-61 */
689 unsigned short Checksum; /* Bytes 62-63 */
693 Define the Host Adapter Local RAM Auto SCSI Byte 45 structure.
696 struct BusLogic_AutoSCSIByte45
698 unsigned char ForceBusDeviceScanningOrder:1; /* Bit 0 */
699 unsigned char :7; /* Bits 1-7 */
703 Define the Host Adapter Local RAM BIOS Drive Map Byte structure.
706 #define BusLogic_BIOS_DriveMapOffset 17
708 struct BusLogic_BIOSDriveMapByte
710 unsigned char TargetIDBit3:1; /* Bit 0 */
711 unsigned char :2; /* Bits 1-2 */
712 enum BusLogic_BIOS_DiskGeometryTranslation DiskGeometry:2; /* Bits 3-4 */
713 unsigned char TargetID:3; /* Bits 5-7 */
717 Define the Set CCB Format request type. Extended LUN Format CCBs are
718 necessary to support more than 8 Logical Units per Target Device.
721 enum BusLogic_SetCCBFormatRequest
723 BusLogic_LegacyLUNFormatCCB = 0,
724 BusLogic_ExtendedLUNFormatCCB = 1
728 Define the Outgoing Mailbox Action Codes.
731 enum BusLogic_ActionCode
733 BusLogic_OutgoingMailboxFree = 0x00,
734 BusLogic_MailboxStartCommand = 0x01,
735 BusLogic_MailboxAbortCommand = 0x02
740 Define the Incoming Mailbox Completion Codes. The MultiMaster Firmware
741 only uses codes 0 - 4. The FlashPoint SCCB Manager has no mailboxes, so
742 completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5.
745 enum BusLogic_CompletionCode
747 BusLogic_IncomingMailboxFree = 0x00,
748 BusLogic_CommandCompletedWithoutError = 0x01,
749 BusLogic_CommandAbortedAtHostRequest = 0x02,
750 BusLogic_AbortedCommandNotFound = 0x03,
751 BusLogic_CommandCompletedWithError = 0x04,
752 BusLogic_InvalidCCB = 0x05
756 Define the Command Control Block (CCB) Opcodes.
759 enum BusLogic_CCB_Opcode
761 BusLogic_InitiatorCCB = 0x00,
762 BusLogic_TargetCCB = 0x01,
763 BusLogic_InitiatorCCB_ScatterGather = 0x02,
764 BusLogic_InitiatorCCB_ResidualDataLength = 0x03,
765 BusLogic_InitiatorCCB_ScatterGatherResidual = 0x04,
766 BusLogic_BusDeviceReset = 0x81
771 Define the CCB Data Direction Codes.
774 enum BusLogic_DataDirection
776 BusLogic_UncheckedDataTransfer = 0,
777 BusLogic_DataInLengthChecked = 1,
778 BusLogic_DataOutLengthChecked = 2,
779 BusLogic_NoDataTransfer = 3
784 Define the Host Adapter Status Codes. The MultiMaster Firmware does not
785 return status code 0x0C; it uses 0x12 for both overruns and underruns.
788 enum BusLogic_HostAdapterStatus
790 BusLogic_CommandCompletedNormally = 0x00,
791 BusLogic_LinkedCommandCompleted = 0x0A,
792 BusLogic_LinkedCommandCompletedWithFlag = 0x0B,
793 BusLogic_DataUnderRun = 0x0C,
794 BusLogic_SCSISelectionTimeout = 0x11,
795 BusLogic_DataOverRun = 0x12,
796 BusLogic_UnexpectedBusFree = 0x13,
797 BusLogic_InvalidBusPhaseRequested = 0x14,
798 BusLogic_InvalidOutgoingMailboxActionCode = 0x15,
799 BusLogic_InvalidCommandOperationCode = 0x16,
800 BusLogic_LinkedCCBhasInvalidLUN = 0x17,
801 BusLogic_InvalidCommandParameter = 0x1A,
802 BusLogic_AutoRequestSenseFailed = 0x1B,
803 BusLogic_TaggedQueuingMessageRejected = 0x1C,
804 BusLogic_UnsupportedMessageReceived = 0x1D,
805 BusLogic_HostAdapterHardwareFailed = 0x20,
806 BusLogic_TargetFailedResponseToATN = 0x21,
807 BusLogic_HostAdapterAssertedRST = 0x22,
808 BusLogic_OtherDeviceAssertedRST = 0x23,
809 BusLogic_TargetDeviceReconnectedImproperly = 0x24,
810 BusLogic_HostAdapterAssertedBusDeviceReset = 0x25,
811 BusLogic_AbortQueueGenerated = 0x26,
812 BusLogic_HostAdapterSoftwareError = 0x27,
813 BusLogic_HostAdapterHardwareTimeoutError = 0x30,
814 BusLogic_SCSIParityErrorDetected = 0x34
819 Define the SCSI Target Device Status Codes.
822 enum BusLogic_TargetDeviceStatus
824 BusLogic_OperationGood = 0x00,
825 BusLogic_CheckCondition = 0x02,
826 BusLogic_DeviceBusy = 0x08
830 Define the Queue Tag Codes.
833 enum BusLogic_QueueTag
835 BusLogic_SimpleQueueTag = 0,
836 BusLogic_HeadOfQueueTag = 1,
837 BusLogic_OrderedQueueTag = 2,
838 BusLogic_ReservedQT = 3
842 Define the SCSI Command Descriptor Block (CDB).
845 #define BusLogic_CDB_MaxLength 12
847 typedef unsigned char SCSI_CDB_T[BusLogic_CDB_MaxLength];
851 Define the Scatter/Gather Segment structure required by the MultiMaster
852 Firmware Interface and the FlashPoint SCCB Manager.
855 struct BusLogic_ScatterGatherSegment
857 u32 SegmentByteCount; /* Bytes 0-3 */
858 u32 SegmentDataPointer; /* Bytes 4-7 */
862 Define the Driver CCB Status Codes.
865 enum BusLogic_CCB_Status
867 BusLogic_CCB_Free = 0,
868 BusLogic_CCB_Active = 1,
869 BusLogic_CCB_Completed = 2,
870 BusLogic_CCB_Reset = 3
875 Define the 32 Bit Mode Command Control Block (CCB) structure. The first 40
876 bytes are defined by and common to both the MultiMaster Firmware and the
877 FlashPoint SCCB Manager. The next 60 bytes are defined by the FlashPoint
878 SCCB Manager. The remaining components are defined by the Linux BusLogic
879 Driver. Extended LUN Format CCBs differ from Legacy LUN Format 32 Bit Mode
880 CCBs only in having the TagEnable and QueueTag fields moved from byte 17 to
881 byte 1, and the Logical Unit field in byte 17 expanded to 6 bits. In theory,
882 Extended LUN Format CCBs can support up to 64 Logical Units, but in practice
883 many devices will respond improperly to Logical Units between 32 and 63, and
884 the SCSI-2 specification defines Bit 5 as LUNTAR. Extended LUN Format CCBs
885 are used by recent versions of the MultiMaster Firmware, as well as by the
886 FlashPoint SCCB Manager; the FlashPoint SCCB Manager only supports 32 Logical
887 Units. Since 64 Logical Units are unlikely to be needed in practice, and
888 since they are problematic for the above reasons, and since limiting them to
889 5 bits simplifies the CCB structure definition, this driver only supports
890 32 Logical Units per Target Device.
896 MultiMaster Firmware and FlashPoint SCCB Manager Common Portion.
898 enum BusLogic_CCB_Opcode Opcode; /* Byte 0 */
899 unsigned char :3; /* Byte 1 Bits 0-2 */
900 enum BusLogic_DataDirection DataDirection:2; /* Byte 1 Bits 3-4 */
901 boolean TagEnable:1; /* Byte 1 Bit 5 */
902 enum BusLogic_QueueTag QueueTag:2; /* Byte 1 Bits 6-7 */
903 unsigned char CDB_Length; /* Byte 2 */
904 unsigned char SenseDataLength; /* Byte 3 */
905 u32 DataLength; /* Bytes 4-7 */
906 u32 DataPointer; /* Bytes 8-11 */
907 unsigned char :8; /* Byte 12 */
908 unsigned char :8; /* Byte 13 */
909 enum BusLogic_HostAdapterStatus HostAdapterStatus; /* Byte 14 */
910 enum BusLogic_TargetDeviceStatus TargetDeviceStatus; /* Byte 15 */
911 unsigned char TargetID; /* Byte 16 */
912 unsigned char LogicalUnit:5; /* Byte 17 Bits 0-4 */
913 boolean LegacyTagEnable:1; /* Byte 17 Bit 5 */
914 enum BusLogic_QueueTag LegacyQueueTag:2; /* Byte 17 Bits 6-7 */
915 SCSI_CDB_T CDB; /* Bytes 18-29 */
916 unsigned char :8; /* Byte 30 */
917 unsigned char :8; /* Byte 31 */
918 unsigned int :32; /* Bytes 32-35 */
919 u32 SenseDataPointer; /* Bytes 36-39 */
921 FlashPoint SCCB Manager Defined Portion.
923 void (*CallbackFunction)(struct BusLogic_CCB *); /* Bytes 40-43 */
924 u32 BaseAddress; /* Bytes 44-47 */
925 enum BusLogic_CompletionCode CompletionCode; /* Byte 48 */
926 #ifndef CONFIG_SCSI_OMIT_FLASHPOINT
927 unsigned char :8; /* Byte 49 */
928 unsigned short OS_Flags; /* Bytes 50-51 */
929 unsigned char Private[48]; /* Bytes 52-99 */
932 BusLogic Linux Driver Defined Portion.
934 dma_addr_t AllocationGroupHead;
935 unsigned int AllocationGroupSize;
937 enum BusLogic_CCB_Status Status;
938 unsigned long SerialNumber;
939 struct scsi_cmnd *Command;
940 struct BusLogic_HostAdapter *HostAdapter;
941 struct BusLogic_CCB *Next;
942 struct BusLogic_CCB *NextAll;
943 struct BusLogic_ScatterGatherSegment
944 ScatterGatherList[BusLogic_ScatterGatherLimit];
948 Define the 32 Bit Mode Outgoing Mailbox structure.
951 struct BusLogic_OutgoingMailbox
953 u32 CCB; /* Bytes 0-3 */
954 unsigned int :24; /* Bytes 4-6 */
955 enum BusLogic_ActionCode ActionCode; /* Byte 7 */
959 Define the 32 Bit Mode Incoming Mailbox structure.
962 struct BusLogic_IncomingMailbox
964 u32 CCB; /* Bytes 0-3 */
965 enum BusLogic_HostAdapterStatus HostAdapterStatus; /* Byte 4 */
966 enum BusLogic_TargetDeviceStatus TargetDeviceStatus; /* Byte 5 */
967 unsigned char :8; /* Byte 6 */
968 enum BusLogic_CompletionCode CompletionCode; /* Byte 7 */
973 Define the BusLogic Driver Options structure.
976 struct BusLogic_DriverOptions
978 unsigned short TaggedQueuingPermitted;
979 unsigned short TaggedQueuingPermittedMask;
980 unsigned short BusSettleTime;
981 struct BusLogic_LocalOptions LocalOptions;
982 unsigned char CommonQueueDepth;
983 unsigned char QueueDepth[BusLogic_MaxTargetDevices];
987 Define the Host Adapter Target Flags structure.
990 struct BusLogic_TargetFlags
992 boolean TargetExists:1;
993 boolean TaggedQueuingSupported:1;
994 boolean WideTransfersSupported:1;
995 boolean TaggedQueuingActive:1;
996 boolean WideTransfersActive:1;
997 boolean CommandSuccessfulFlag:1;
998 boolean TargetInfoReported:1;
1002 Define the Host Adapter Target Statistics structure.
1005 #define BusLogic_SizeBuckets 10
1007 typedef unsigned int BusLogic_CommandSizeBuckets_T[BusLogic_SizeBuckets];
1009 struct BusLogic_TargetStatistics
1011 unsigned int CommandsAttempted;
1012 unsigned int CommandsCompleted;
1013 unsigned int ReadCommands;
1014 unsigned int WriteCommands;
1015 struct BusLogic_ByteCounter TotalBytesRead;
1016 struct BusLogic_ByteCounter TotalBytesWritten;
1017 BusLogic_CommandSizeBuckets_T ReadCommandSizeBuckets;
1018 BusLogic_CommandSizeBuckets_T WriteCommandSizeBuckets;
1019 unsigned short CommandAbortsRequested;
1020 unsigned short CommandAbortsAttempted;
1021 unsigned short CommandAbortsCompleted;
1022 unsigned short BusDeviceResetsRequested;
1023 unsigned short BusDeviceResetsAttempted;
1024 unsigned short BusDeviceResetsCompleted;
1025 unsigned short HostAdapterResetsRequested;
1026 unsigned short HostAdapterResetsAttempted;
1027 unsigned short HostAdapterResetsCompleted;
1031 Define the FlashPoint Card Handle data type.
1034 #define FlashPoint_BadCardHandle 0xFFFFFFFF
1036 typedef unsigned int FlashPoint_CardHandle_T;
1040 Define the FlashPoint Information structure. This structure is defined
1041 by the FlashPoint SCCB Manager.
1044 struct FlashPoint_Info
1046 u32 BaseAddress; /* Bytes 0-3 */
1047 boolean Present; /* Byte 4 */
1048 unsigned char IRQ_Channel; /* Byte 5 */
1049 unsigned char SCSI_ID; /* Byte 6 */
1050 unsigned char SCSI_LUN; /* Byte 7 */
1051 unsigned short FirmwareRevision; /* Bytes 8-9 */
1052 unsigned short SynchronousPermitted; /* Bytes 10-11 */
1053 unsigned short FastPermitted; /* Bytes 12-13 */
1054 unsigned short UltraPermitted; /* Bytes 14-15 */
1055 unsigned short DisconnectPermitted; /* Bytes 16-17 */
1056 unsigned short WidePermitted; /* Bytes 18-19 */
1057 boolean ParityCheckingEnabled:1; /* Byte 20 Bit 0 */
1058 boolean HostWideSCSI:1; /* Byte 20 Bit 1 */
1059 boolean HostSoftReset:1; /* Byte 20 Bit 2 */
1060 boolean ExtendedTranslationEnabled:1; /* Byte 20 Bit 3 */
1061 boolean LowByteTerminated:1; /* Byte 20 Bit 4 */
1062 boolean HighByteTerminated:1; /* Byte 20 Bit 5 */
1063 boolean ReportDataUnderrun:1; /* Byte 20 Bit 6 */
1064 boolean SCAM_Enabled:1; /* Byte 20 Bit 7 */
1065 boolean SCAM_Level2:1; /* Byte 21 Bit 0 */
1066 unsigned char :7; /* Byte 21 Bits 1-7 */
1067 unsigned char Family; /* Byte 22 */
1068 unsigned char BusType; /* Byte 23 */
1069 unsigned char ModelNumber[3]; /* Bytes 24-26 */
1070 unsigned char RelativeCardNumber; /* Byte 27 */
1071 unsigned char Reserved[4]; /* Bytes 28-31 */
1072 unsigned int OS_Reserved; /* Bytes 32-35 */
1073 unsigned char TranslationInfo[4]; /* Bytes 36-39 */
1074 unsigned int Reserved2[5]; /* Bytes 40-59 */
1075 unsigned int SecondaryRange; /* Bytes 60-63 */
1079 Define the BusLogic Driver Host Adapter structure.
1082 struct BusLogic_HostAdapter
1084 struct Scsi_Host *SCSI_Host;
1085 struct pci_dev *PCI_Device;
1086 enum BusLogic_HostAdapterType HostAdapterType;
1087 enum BusLogic_HostAdapterBusType HostAdapterBusType;
1088 unsigned long IO_Address;
1089 unsigned long PCI_Address;
1090 unsigned short AddressCount;
1091 unsigned char HostNumber;
1092 unsigned char ModelName[9];
1093 unsigned char FirmwareVersion[6];
1094 unsigned char FullModelName[18];
1096 unsigned char Device;
1097 unsigned char IRQ_Channel;
1098 unsigned char DMA_Channel;
1099 unsigned char SCSI_ID;
1100 boolean IRQ_ChannelAcquired:1;
1101 boolean DMA_ChannelAcquired:1;
1102 boolean ExtendedTranslationEnabled:1;
1103 boolean ParityCheckingEnabled:1;
1104 boolean BusResetEnabled:1;
1105 boolean LevelSensitiveInterrupt:1;
1106 boolean HostWideSCSI:1;
1107 boolean HostDifferentialSCSI:1;
1108 boolean HostSupportsSCAM:1;
1109 boolean HostUltraSCSI:1;
1110 boolean ExtendedLUNSupport:1;
1111 boolean TerminationInfoValid:1;
1112 boolean LowByteTerminated:1;
1113 boolean HighByteTerminated:1;
1114 boolean BounceBuffersRequired:1;
1115 boolean StrictRoundRobinModeSupport:1;
1116 boolean SCAM_Enabled:1;
1117 boolean SCAM_Level2:1;
1118 boolean HostAdapterInitialized:1;
1119 boolean HostAdapterExternalReset:1;
1120 boolean HostAdapterInternalError:1;
1121 boolean ProcessCompletedCCBsActive;
1122 volatile boolean HostAdapterCommandCompleted;
1123 unsigned short HostAdapterScatterGatherLimit;
1124 unsigned short DriverScatterGatherLimit;
1125 unsigned short MaxTargetDevices;
1126 unsigned short MaxLogicalUnits;
1127 unsigned short MailboxCount;
1128 unsigned short InitialCCBs;
1129 unsigned short IncrementalCCBs;
1130 unsigned short AllocatedCCBs;
1131 unsigned short DriverQueueDepth;
1132 unsigned short HostAdapterQueueDepth;
1133 unsigned short UntaggedQueueDepth;
1134 unsigned short CommonQueueDepth;
1135 unsigned short BusSettleTime;
1136 unsigned short SynchronousPermitted;
1137 unsigned short FastPermitted;
1138 unsigned short UltraPermitted;
1139 unsigned short WidePermitted;
1140 unsigned short DisconnectPermitted;
1141 unsigned short TaggedQueuingPermitted;
1142 unsigned short ExternalHostAdapterResets;
1143 unsigned short HostAdapterInternalErrors;
1144 unsigned short TargetDeviceCount;
1145 unsigned short MessageBufferLength;
1147 struct BusLogic_DriverOptions *DriverOptions;
1148 struct FlashPoint_Info FlashPointInfo;
1149 FlashPoint_CardHandle_T CardHandle;
1150 struct BusLogic_HostAdapter *Next;
1151 struct BusLogic_CCB *All_CCBs;
1152 struct BusLogic_CCB *Free_CCBs;
1153 struct BusLogic_CCB *FirstCompletedCCB;
1154 struct BusLogic_CCB *LastCompletedCCB;
1155 struct BusLogic_CCB *BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices];
1156 struct BusLogic_TargetFlags TargetFlags[BusLogic_MaxTargetDevices];
1157 unsigned char QueueDepth[BusLogic_MaxTargetDevices];
1158 unsigned char SynchronousPeriod[BusLogic_MaxTargetDevices];
1159 unsigned char SynchronousOffset[BusLogic_MaxTargetDevices];
1160 unsigned char ActiveCommands[BusLogic_MaxTargetDevices];
1161 unsigned int CommandsSinceReset[BusLogic_MaxTargetDevices];
1162 unsigned long LastSequencePoint[BusLogic_MaxTargetDevices];
1163 unsigned long LastResetAttempted[BusLogic_MaxTargetDevices];
1164 unsigned long LastResetCompleted[BusLogic_MaxTargetDevices];
1165 struct BusLogic_OutgoingMailbox *FirstOutgoingMailbox;
1166 struct BusLogic_OutgoingMailbox *LastOutgoingMailbox;
1167 struct BusLogic_OutgoingMailbox *NextOutgoingMailbox;
1168 struct BusLogic_IncomingMailbox *FirstIncomingMailbox;
1169 struct BusLogic_IncomingMailbox *LastIncomingMailbox;
1170 struct BusLogic_IncomingMailbox *NextIncomingMailbox;
1171 struct BusLogic_TargetStatistics TargetStatistics[BusLogic_MaxTargetDevices];
1172 unsigned char *MailboxSpace;
1173 dma_addr_t MailboxSpaceHandle;
1174 unsigned int MailboxSize;
1175 unsigned long CCB_Offset;
1176 char MessageBuffer[BusLogic_MessageBufferSize];
1180 Define a structure for the BIOS Disk Parameters.
1183 struct BIOS_DiskParameters
1191 Define a structure for the SCSI Inquiry command results.
1196 unsigned char PeripheralDeviceType:5; /* Byte 0 Bits 0-4 */
1197 unsigned char PeripheralQualifier:3; /* Byte 0 Bits 5-7 */
1198 unsigned char DeviceTypeModifier:7; /* Byte 1 Bits 0-6 */
1199 boolean RMB:1; /* Byte 1 Bit 7 */
1200 unsigned char ANSI_ApprovedVersion:3; /* Byte 2 Bits 0-2 */
1201 unsigned char ECMA_Version:3; /* Byte 2 Bits 3-5 */
1202 unsigned char ISO_Version:2; /* Byte 2 Bits 6-7 */
1203 unsigned char ResponseDataFormat:4; /* Byte 3 Bits 0-3 */
1204 unsigned char :2; /* Byte 3 Bits 4-5 */
1205 boolean TrmIOP:1; /* Byte 3 Bit 6 */
1206 boolean AENC:1; /* Byte 3 Bit 7 */
1207 unsigned char AdditionalLength; /* Byte 4 */
1208 unsigned char :8; /* Byte 5 */
1209 unsigned char :8; /* Byte 6 */
1210 boolean SftRe:1; /* Byte 7 Bit 0 */
1211 boolean CmdQue:1; /* Byte 7 Bit 1 */
1212 boolean :1; /* Byte 7 Bit 2 */
1213 boolean Linked:1; /* Byte 7 Bit 3 */
1214 boolean Sync:1; /* Byte 7 Bit 4 */
1215 boolean WBus16:1; /* Byte 7 Bit 5 */
1216 boolean WBus32:1; /* Byte 7 Bit 6 */
1217 boolean RelAdr:1; /* Byte 7 Bit 7 */
1218 unsigned char VendorIdentification[8]; /* Bytes 8-15 */
1219 unsigned char ProductIdentification[16]; /* Bytes 16-31 */
1220 unsigned char ProductRevisionLevel[4]; /* Bytes 32-35 */
1224 BusLogic_AcquireHostAdapterLock acquires exclusive access to Host Adapter.
1227 static inline void BusLogic_AcquireHostAdapterLock(struct BusLogic_HostAdapter *HostAdapter)
1229 spin_lock_irq(HostAdapter->SCSI_Host->host_lock);
1233 BusLogic_ReleaseHostAdapterLock releases exclusive access to Host Adapter.
1236 static inline void BusLogic_ReleaseHostAdapterLock(struct BusLogic_HostAdapter *HostAdapter)
1238 spin_unlock_irq(HostAdapter->SCSI_Host->host_lock);
1243 BusLogic_AcquireHostAdapterLockIH acquires exclusive access to Host Adapter,
1244 but is only called from the interrupt handler.
1247 static inline void BusLogic_AcquireHostAdapterLockIH(struct BusLogic_HostAdapter *HostAdapter,
1248 unsigned long *ProcessorFlags)
1250 spin_lock_irqsave(HostAdapter->SCSI_Host->host_lock, *ProcessorFlags);
1255 BusLogic_ReleaseHostAdapterLockIH releases exclusive access to Host Adapter,
1256 but is only called from the interrupt handler.
1259 static inline void BusLogic_ReleaseHostAdapterLockIH(struct BusLogic_HostAdapter *HostAdapter,
1260 unsigned long *ProcessorFlags)
1262 spin_unlock_irqrestore(HostAdapter->SCSI_Host->host_lock, *ProcessorFlags);
1267 Define functions to provide an abstraction for reading and writing the
1268 Host Adapter I/O Registers.
1271 static inline void BusLogic_SCSIBusReset(struct BusLogic_HostAdapter *HostAdapter)
1273 union BusLogic_ControlRegister ControlRegister;
1274 ControlRegister.All = 0;
1275 ControlRegister.cr.SCSIBusReset = true;
1276 outb(ControlRegister.All,
1277 HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1280 static inline void BusLogic_InterruptReset(struct BusLogic_HostAdapter *HostAdapter)
1282 union BusLogic_ControlRegister ControlRegister;
1283 ControlRegister.All = 0;
1284 ControlRegister.cr.InterruptReset = true;
1285 outb(ControlRegister.All,
1286 HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1289 static inline void BusLogic_SoftReset(struct BusLogic_HostAdapter *HostAdapter)
1291 union BusLogic_ControlRegister ControlRegister;
1292 ControlRegister.All = 0;
1293 ControlRegister.cr.SoftReset = true;
1294 outb(ControlRegister.All,
1295 HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1298 static inline void BusLogic_HardReset(struct BusLogic_HostAdapter *HostAdapter)
1300 union BusLogic_ControlRegister ControlRegister;
1301 ControlRegister.All = 0;
1302 ControlRegister.cr.HardReset = true;
1303 outb(ControlRegister.All,
1304 HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1307 static inline unsigned char BusLogic_ReadStatusRegister(struct BusLogic_HostAdapter *HostAdapter)
1309 return inb(HostAdapter->IO_Address + BusLogic_StatusRegisterOffset);
1312 static inline void BusLogic_WriteCommandParameterRegister(struct BusLogic_HostAdapter
1314 unsigned char Value)
1316 outb(Value, HostAdapter->IO_Address + BusLogic_CommandParameterRegisterOffset);
1319 static inline unsigned char BusLogic_ReadDataInRegister(struct BusLogic_HostAdapter *HostAdapter)
1321 return inb(HostAdapter->IO_Address + BusLogic_DataInRegisterOffset);
1324 static inline unsigned char BusLogic_ReadInterruptRegister(struct BusLogic_HostAdapter *HostAdapter)
1326 return inb(HostAdapter->IO_Address + BusLogic_InterruptRegisterOffset);
1329 static inline unsigned char BusLogic_ReadGeometryRegister(struct BusLogic_HostAdapter *HostAdapter)
1331 return inb(HostAdapter->IO_Address + BusLogic_GeometryRegisterOffset);
1335 BusLogic_StartMailboxCommand issues an Execute Mailbox Command, which
1336 notifies the Host Adapter that an entry has been made in an Outgoing
1340 static inline void BusLogic_StartMailboxCommand(struct BusLogic_HostAdapter *HostAdapter)
1342 BusLogic_WriteCommandParameterRegister(HostAdapter, BusLogic_ExecuteMailboxCommand);
1346 BusLogic_Delay waits for Seconds to elapse.
1349 static inline void BusLogic_Delay(int Seconds)
1351 mdelay(1000 * Seconds);
1355 Virtual_to_Bus and Bus_to_Virtual map between Kernel Virtual Addresses
1356 and PCI/VLB/EISA/ISA Bus Addresses.
1359 static inline u32 Virtual_to_Bus(void *VirtualAddress)
1361 return (u32) virt_to_bus(VirtualAddress);
1364 static inline void *Bus_to_Virtual(u32 BusAddress)
1366 return (void *) bus_to_virt(BusAddress);
1370 Virtual_to_32Bit_Virtual maps between Kernel Virtual Addresses and
1371 32 bit Kernel Virtual Addresses. This avoids compilation warnings
1372 on 64 bit architectures.
1375 static inline u32 Virtual_to_32Bit_Virtual(void *VirtualAddress)
1377 return (u32) (unsigned long) VirtualAddress;
1381 BusLogic_IncrementErrorCounter increments Error Counter by 1, stopping at
1382 65535 rather than wrapping around to 0.
1385 static inline void BusLogic_IncrementErrorCounter(unsigned short *ErrorCounter)
1387 if (*ErrorCounter < 65535) (*ErrorCounter)++;
1391 BusLogic_IncrementByteCounter increments Byte Counter by Amount.
1394 static inline void BusLogic_IncrementByteCounter(struct BusLogic_ByteCounter
1396 unsigned int Amount)
1398 ByteCounter->Units += Amount;
1399 if (ByteCounter->Units > 999999999)
1401 ByteCounter->Units -= 1000000000;
1402 ByteCounter->Billions++;
1407 BusLogic_IncrementSizeBucket increments the Bucket for Amount.
1410 static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T
1412 unsigned int Amount)
1415 if (Amount < 8*1024)
1417 if (Amount < 2*1024)
1418 Index = (Amount < 1*1024 ? 0 : 1);
1419 else Index = (Amount < 4*1024 ? 2 : 3);
1421 else if (Amount < 128*1024)
1423 if (Amount < 32*1024)
1424 Index = (Amount < 16*1024 ? 4 : 5);
1425 else Index = (Amount < 64*1024 ? 6 : 7);
1427 else Index = (Amount < 256*1024 ? 8 : 9);
1428 CommandSizeBuckets[Index]++;
1432 Define the version number of the FlashPoint Firmware (SCCB Manager).
1435 #define FlashPoint_FirmwareVersion "5.02"
1438 Define the possible return values from FlashPoint_HandleInterrupt.
1441 #define FlashPoint_NormalInterrupt 0x00
1442 #define FlashPoint_InternalError 0xFE
1443 #define FlashPoint_ExternalBusReset 0xFF
1446 Define prototypes for the forward referenced BusLogic Driver
1450 static const char *BusLogic_DriverInfo(struct Scsi_Host *);
1451 static int BusLogic_DetectHostAdapter(struct scsi_host_template *);
1452 static int BusLogic_ReleaseHostAdapter(struct Scsi_Host *);
1453 static int BusLogic_QueueCommand(struct scsi_cmnd *,
1454 void (*CompletionRoutine)(struct scsi_cmnd *));
1455 static int BusLogic_BIOSDiskParameters(struct scsi_device *,
1456 struct block_device *,
1458 static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *,
1459 char **, off_t, int, int);
1460 static int BusLogic_SlaveConfigure(struct scsi_device *);
1461 static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *);
1462 static irqreturn_t BusLogic_InterruptHandler(int, void *, struct pt_regs *);
1463 static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *,
1465 static void BusLogic_Message(enum BusLogic_MessageLevel, char *,
1466 struct BusLogic_HostAdapter *, ...);
1467 static int __init BusLogic_Setup(char *);
1469 #endif /* _BUSLOGIC_H */