1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28#ifndef _BUSLOGIC_H
29#define _BUSLOGIC_H
30
31
32#ifndef PACKED
33#define PACKED __attribute__((packed))
34#endif
35
36
37
38
39
40#define BusLogic_MaxHostAdapters 16
41
42
43
44
45
46
47#define BusLogic_MaxTargetDevices 16
48
49
50
51
52
53
54
55
56#define BusLogic_ScatterGatherLimit 128
57
58
59
60
61
62
63
64
65#define BusLogic_MaxTaggedQueueDepth 64
66#define BusLogic_MaxAutomaticTaggedQueueDepth 28
67#define BusLogic_MinAutomaticTaggedQueueDepth 7
68#define BusLogic_TaggedQueueDepthBB 3
69#define BusLogic_UntaggedQueueDepth 3
70#define BusLogic_UntaggedQueueDepthBB 2
71
72
73
74
75
76
77
78
79
80#define BusLogic_DefaultBusSettleTime 2
81
82
83
84
85
86
87
88
89
90#define BusLogic_MaxMailboxes 211
91
92
93
94
95
96
97
98#define BusLogic_CCB_AllocationGroupSize 7
99
100
101
102
103
104
105#define BusLogic_LineBufferSize 100
106#define BusLogic_MessageBufferSize 9700
107
108
109
110
111
112
113enum BusLogic_MessageLevel {
114 BusLogic_AnnounceLevel = 0,
115 BusLogic_InfoLevel = 1,
116 BusLogic_NoticeLevel = 2,
117 BusLogic_WarningLevel = 3,
118 BusLogic_ErrorLevel = 4
119};
120
121static char *BusLogic_MessageLevelMap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };
122
123
124
125
126
127
128#define BusLogic_Announce(Format, Arguments...) \
129 BusLogic_Message(BusLogic_AnnounceLevel, Format, ##Arguments)
130
131#define BusLogic_Info(Format, Arguments...) \
132 BusLogic_Message(BusLogic_InfoLevel, Format, ##Arguments)
133
134#define BusLogic_Notice(Format, Arguments...) \
135 BusLogic_Message(BusLogic_NoticeLevel, Format, ##Arguments)
136
137#define BusLogic_Warning(Format, Arguments...) \
138 BusLogic_Message(BusLogic_WarningLevel, Format, ##Arguments)
139
140#define BusLogic_Error(Format, Arguments...) \
141 BusLogic_Message(BusLogic_ErrorLevel, Format, ##Arguments)
142
143
144
145
146
147
148
149enum BusLogic_HostAdapterType {
150 BusLogic_MultiMaster = 1,
151 BusLogic_FlashPoint = 2
152} PACKED;
153
154#define BusLogic_MultiMasterAddressCount 4
155#define BusLogic_FlashPointAddressCount 256
156
157static int BusLogic_HostAdapterAddressCount[3] = { 0, BusLogic_MultiMasterAddressCount, BusLogic_FlashPointAddressCount };
158
159
160
161
162
163
164#ifdef CONFIG_SCSI_FLASHPOINT
165
166#define BusLogic_MultiMasterHostAdapterP(HostAdapter) \
167 (HostAdapter->HostAdapterType == BusLogic_MultiMaster)
168
169#define BusLogic_FlashPointHostAdapterP(HostAdapter) \
170 (HostAdapter->HostAdapterType == BusLogic_FlashPoint)
171
172#else
173
174#define BusLogic_MultiMasterHostAdapterP(HostAdapter) \
175 (true)
176
177#define BusLogic_FlashPointHostAdapterP(HostAdapter) \
178 (false)
179
180#endif
181
182
183
184
185
186
187enum BusLogic_HostAdapterBusType {
188 BusLogic_Unknown_Bus = 0,
189 BusLogic_ISA_Bus = 1,
190 BusLogic_EISA_Bus = 2,
191 BusLogic_PCI_Bus = 3,
192 BusLogic_VESA_Bus = 4,
193 BusLogic_MCA_Bus = 5
194} PACKED;
195
196static char *BusLogic_HostAdapterBusNames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };
197
198static enum BusLogic_HostAdapterBusType BusLogic_HostAdapterBusTypes[] = {
199 BusLogic_VESA_Bus,
200 BusLogic_ISA_Bus,
201 BusLogic_MCA_Bus,
202 BusLogic_EISA_Bus,
203 BusLogic_Unknown_Bus,
204 BusLogic_PCI_Bus
205};
206
207
208
209
210
211enum BusLogic_BIOS_DiskGeometryTranslation {
212 BusLogic_BIOS_Disk_Not_Installed = 0,
213 BusLogic_BIOS_Disk_Installed_64x32 = 1,
214 BusLogic_BIOS_Disk_Installed_128x32 = 2,
215 BusLogic_BIOS_Disk_Installed_255x63 = 3
216} PACKED;
217
218
219
220
221
222
223struct BusLogic_ByteCounter {
224 unsigned int Units;
225 unsigned int Billions;
226};
227
228
229
230
231
232
233struct BusLogic_ProbeInfo {
234 enum BusLogic_HostAdapterType HostAdapterType;
235 enum BusLogic_HostAdapterBusType HostAdapterBusType;
236 unsigned long IO_Address;
237 unsigned long PCI_Address;
238 struct pci_dev *PCI_Device;
239 unsigned char Bus;
240 unsigned char Device;
241 unsigned char IRQ_Channel;
242};
243
244
245
246
247
248struct BusLogic_ProbeOptions {
249 bool NoProbe:1;
250 bool NoProbeISA:1;
251 bool NoProbePCI:1;
252 bool NoSortPCI:1;
253 bool MultiMasterFirst:1;
254 bool FlashPointFirst:1;
255 bool LimitedProbeISA:1;
256 bool Probe330:1;
257 bool Probe334:1;
258 bool Probe230:1;
259 bool Probe234:1;
260 bool Probe130:1;
261 bool Probe134:1;
262};
263
264
265
266
267
268struct BusLogic_GlobalOptions {
269 bool TraceProbe:1;
270 bool TraceHardwareReset:1;
271 bool TraceConfiguration:1;
272 bool TraceErrors:1;
273};
274
275
276
277
278
279struct BusLogic_LocalOptions {
280 bool InhibitTargetInquiry:1;
281};
282
283
284
285
286
287#define BusLogic_ControlRegisterOffset 0
288#define BusLogic_StatusRegisterOffset 0
289#define BusLogic_CommandParameterRegisterOffset 1
290#define BusLogic_DataInRegisterOffset 1
291#define BusLogic_InterruptRegisterOffset 2
292#define BusLogic_GeometryRegisterOffset 3
293
294
295
296
297
298union BusLogic_ControlRegister {
299 unsigned char All;
300 struct {
301 unsigned char:4;
302 bool SCSIBusReset:1;
303 bool InterruptReset:1;
304 bool SoftReset:1;
305 bool HardReset:1;
306 } cr;
307};
308
309
310
311
312
313union BusLogic_StatusRegister {
314 unsigned char All;
315 struct {
316 bool CommandInvalid:1;
317 bool Reserved:1;
318 bool DataInRegisterReady:1;
319 bool CommandParameterRegisterBusy:1;
320 bool HostAdapterReady:1;
321 bool InitializationRequired:1;
322 bool DiagnosticFailure:1;
323 bool DiagnosticActive:1;
324 } sr;
325};
326
327
328
329
330
331union BusLogic_InterruptRegister {
332 unsigned char All;
333 struct {
334 bool IncomingMailboxLoaded:1;
335 bool OutgoingMailboxAvailable:1;
336 bool CommandComplete:1;
337 bool ExternalBusReset:1;
338 unsigned char Reserved:3;
339 bool InterruptValid:1;
340 } ir;
341};
342
343
344
345
346
347union BusLogic_GeometryRegister {
348 unsigned char All;
349 struct {
350 enum BusLogic_BIOS_DiskGeometryTranslation Drive0Geometry:2;
351 enum BusLogic_BIOS_DiskGeometryTranslation Drive1Geometry:2;
352 unsigned char:3;
353 bool ExtendedTranslationEnabled:1;
354 } gr;
355};
356
357
358
359
360
361enum BusLogic_OperationCode {
362 BusLogic_TestCommandCompleteInterrupt = 0x00,
363 BusLogic_InitializeMailbox = 0x01,
364 BusLogic_ExecuteMailboxCommand = 0x02,
365 BusLogic_ExecuteBIOSCommand = 0x03,
366 BusLogic_InquireBoardID = 0x04,
367 BusLogic_EnableOutgoingMailboxAvailableInt = 0x05,
368 BusLogic_SetSCSISelectionTimeout = 0x06,
369 BusLogic_SetPreemptTimeOnBus = 0x07,
370 BusLogic_SetTimeOffBus = 0x08,
371 BusLogic_SetBusTransferRate = 0x09,
372 BusLogic_InquireInstalledDevicesID0to7 = 0x0A,
373 BusLogic_InquireConfiguration = 0x0B,
374 BusLogic_EnableTargetMode = 0x0C,
375 BusLogic_InquireSetupInformation = 0x0D,
376 BusLogic_WriteAdapterLocalRAM = 0x1A,
377 BusLogic_ReadAdapterLocalRAM = 0x1B,
378 BusLogic_WriteBusMasterChipFIFO = 0x1C,
379 BusLogic_ReadBusMasterChipFIFO = 0x1D,
380 BusLogic_EchoCommandData = 0x1F,
381 BusLogic_HostAdapterDiagnostic = 0x20,
382 BusLogic_SetAdapterOptions = 0x21,
383 BusLogic_InquireInstalledDevicesID8to15 = 0x23,
384 BusLogic_InquireTargetDevices = 0x24,
385 BusLogic_DisableHostAdapterInterrupt = 0x25,
386 BusLogic_InitializeExtendedMailbox = 0x81,
387 BusLogic_ExecuteSCSICommand = 0x83,
388 BusLogic_InquireFirmwareVersion3rdDigit = 0x84,
389 BusLogic_InquireFirmwareVersionLetter = 0x85,
390 BusLogic_InquirePCIHostAdapterInformation = 0x86,
391 BusLogic_InquireHostAdapterModelNumber = 0x8B,
392 BusLogic_InquireSynchronousPeriod = 0x8C,
393 BusLogic_InquireExtendedSetupInformation = 0x8D,
394 BusLogic_EnableStrictRoundRobinMode = 0x8F,
395 BusLogic_StoreHostAdapterLocalRAM = 0x90,
396 BusLogic_FetchHostAdapterLocalRAM = 0x91,
397 BusLogic_StoreLocalDataInEEPROM = 0x92,
398 BusLogic_UploadAutoSCSICode = 0x94,
399 BusLogic_ModifyIOAddress = 0x95,
400 BusLogic_SetCCBFormat = 0x96,
401 BusLogic_WriteInquiryBuffer = 0x9A,
402 BusLogic_ReadInquiryBuffer = 0x9B,
403 BusLogic_FlashROMUploadDownload = 0xA7,
404 BusLogic_ReadSCAMData = 0xA8,
405 BusLogic_WriteSCAMData = 0xA9
406};
407
408
409
410
411
412struct BusLogic_BoardID {
413 unsigned char BoardType;
414 unsigned char CustomFeatures;
415 unsigned char FirmwareVersion1stDigit;
416 unsigned char FirmwareVersion2ndDigit;
417};
418
419
420
421
422
423struct BusLogic_Configuration {
424 unsigned char:5;
425 bool DMA_Channel5:1;
426 bool DMA_Channel6:1;
427 bool DMA_Channel7:1;
428 bool IRQ_Channel9:1;
429 bool IRQ_Channel10:1;
430 bool IRQ_Channel11:1;
431 bool IRQ_Channel12:1;
432 unsigned char:1;
433 bool IRQ_Channel14:1;
434 bool IRQ_Channel15:1;
435 unsigned char:1;
436 unsigned char HostAdapterID:4;
437 unsigned char:4;
438};
439
440
441
442
443
444struct BusLogic_SynchronousValue {
445 unsigned char Offset:4;
446 unsigned char TransferPeriod:3;
447 bool Synchronous:1;
448};
449
450struct BusLogic_SetupInformation {
451 bool SynchronousInitiationEnabled:1;
452 bool ParityCheckingEnabled:1;
453 unsigned char:6;
454 unsigned char BusTransferRate;
455 unsigned char PreemptTimeOnBus;
456 unsigned char TimeOffBus;
457 unsigned char MailboxCount;
458 unsigned char MailboxAddress[3];
459 struct BusLogic_SynchronousValue SynchronousValuesID0to7[8];
460 unsigned char DisconnectPermittedID0to7;
461 unsigned char Signature;
462 unsigned char CharacterD;
463 unsigned char HostBusType;
464 unsigned char WideTransfersPermittedID0to7;
465 unsigned char WideTransfersActiveID0to7;
466 struct BusLogic_SynchronousValue SynchronousValuesID8to15[8];
467 unsigned char DisconnectPermittedID8to15;
468 unsigned char:8;
469 unsigned char WideTransfersPermittedID8to15;
470 unsigned char WideTransfersActiveID8to15;
471};
472
473
474
475
476
477struct BusLogic_ExtendedMailboxRequest {
478 unsigned char MailboxCount;
479 u32 BaseMailboxAddress;
480} PACKED;
481
482
483
484
485
486
487
488
489enum BusLogic_ISACompatibleIOPort {
490 BusLogic_IO_330 = 0,
491 BusLogic_IO_334 = 1,
492 BusLogic_IO_230 = 2,
493 BusLogic_IO_234 = 3,
494 BusLogic_IO_130 = 4,
495 BusLogic_IO_134 = 5,
496 BusLogic_IO_Disable = 6,
497 BusLogic_IO_Disable2 = 7
498} PACKED;
499
500struct BusLogic_PCIHostAdapterInformation {
501 enum BusLogic_ISACompatibleIOPort ISACompatibleIOPort;
502 unsigned char PCIAssignedIRQChannel;
503 bool LowByteTerminated:1;
504 bool HighByteTerminated:1;
505 unsigned char:2;
506 bool JP1:1;
507 bool JP2:1;
508 bool JP3:1;
509 bool GenericInfoValid:1;
510 unsigned char:8;
511};
512
513
514
515
516
517struct BusLogic_ExtendedSetupInformation {
518 unsigned char BusType;
519 unsigned char BIOS_Address;
520 unsigned short ScatterGatherLimit;
521 unsigned char MailboxCount;
522 u32 BaseMailboxAddress;
523 struct {
524 unsigned char:2;
525 bool FastOnEISA:1;
526 unsigned char:3;
527 bool LevelSensitiveInterrupt:1;
528 unsigned char:1;
529 } Misc;
530 unsigned char FirmwareRevision[3];
531 bool HostWideSCSI:1;
532 bool HostDifferentialSCSI:1;
533 bool HostSupportsSCAM:1;
534 bool HostUltraSCSI:1;
535 bool HostSmartTermination:1;
536 unsigned char:3;
537} PACKED;
538
539
540
541
542
543enum BusLogic_RoundRobinModeRequest {
544 BusLogic_AggressiveRoundRobinMode = 0,
545 BusLogic_StrictRoundRobinMode = 1
546} PACKED;
547
548
549
550
551
552
553#define BusLogic_BIOS_BaseOffset 0
554#define BusLogic_AutoSCSI_BaseOffset 64
555
556struct BusLogic_FetchHostAdapterLocalRAMRequest {
557 unsigned char ByteOffset;
558 unsigned char ByteCount;
559};
560
561
562
563
564
565struct BusLogic_AutoSCSIData {
566 unsigned char InternalFactorySignature[2];
567 unsigned char InformationByteCount;
568 unsigned char HostAdapterType[6];
569 unsigned char:8;
570 bool FloppyEnabled:1;
571 bool FloppySecondary:1;
572 bool LevelSensitiveInterrupt:1;
573 unsigned char:2;
574 unsigned char SystemRAMAreaForBIOS:3;
575 unsigned char DMA_Channel:7;
576 bool DMA_AutoConfiguration:1;
577 unsigned char IRQ_Channel:7;
578 bool IRQ_AutoConfiguration:1;
579 unsigned char DMA_TransferRate;
580 unsigned char SCSI_ID;
581 bool LowByteTerminated:1;
582 bool ParityCheckingEnabled:1;
583 bool HighByteTerminated:1;
584 bool NoisyCablingEnvironment:1;
585 bool FastSynchronousNegotiation:1;
586 bool BusResetEnabled:1;
587 bool:1;
588 bool ActiveNegationEnabled:1;
589 unsigned char BusOnDelay;
590 unsigned char BusOffDelay;
591 bool HostAdapterBIOSEnabled:1;
592 bool BIOSRedirectionOfINT19Enabled:1;
593 bool ExtendedTranslationEnabled:1;
594 bool MapRemovableAsFixedEnabled:1;
595 bool:1;
596 bool BIOSSupportsMoreThan2DrivesEnabled:1;
597 bool BIOSInterruptModeEnabled:1;
598 bool FlopticalSupportEnabled:1;
599 unsigned short DeviceEnabled;
600 unsigned short WidePermitted;
601 unsigned short FastPermitted;
602 unsigned short SynchronousPermitted;
603 unsigned short DisconnectPermitted;
604 unsigned short SendStartUnitCommand;
605 unsigned short IgnoreInBIOSScan;
606 unsigned char PCIInterruptPin:2;
607 unsigned char HostAdapterIOPortAddress:2;
608 bool StrictRoundRobinModeEnabled:1;
609 bool VESABusSpeedGreaterThan33MHz:1;
610 bool VESABurstWriteEnabled:1;
611 bool VESABurstReadEnabled:1;
612 unsigned short UltraPermitted;
613 unsigned int:32;
614 unsigned char:8;
615 unsigned char AutoSCSIMaximumLUN;
616 bool:1;
617 bool SCAM_Dominant:1;
618 bool SCAM_Enabled:1;
619 bool SCAM_Level2:1;
620 unsigned char:4;
621 bool INT13ExtensionEnabled:1;
622 bool:1;
623 bool CDROMBootEnabled:1;
624 unsigned char:5;
625 unsigned char BootTargetID:4;
626 unsigned char BootChannel:4;
627 unsigned char ForceBusDeviceScanningOrder:1;
628 unsigned char:7;
629 unsigned short NonTaggedToAlternateLUNPermitted;
630 unsigned short RenegotiateSyncAfterCheckCondition;
631 unsigned char Reserved[10];
632 unsigned char ManufacturingDiagnostic[2];
633 unsigned short Checksum;
634} PACKED;
635
636
637
638
639
640struct BusLogic_AutoSCSIByte45 {
641 unsigned char ForceBusDeviceScanningOrder:1;
642 unsigned char:7;
643};
644
645
646
647
648
649#define BusLogic_BIOS_DriveMapOffset 17
650
651struct BusLogic_BIOSDriveMapByte {
652 unsigned char TargetIDBit3:1;
653 unsigned char:2;
654 enum BusLogic_BIOS_DiskGeometryTranslation DiskGeometry:2;
655 unsigned char TargetID:3;
656};
657
658
659
660
661
662
663enum BusLogic_SetCCBFormatRequest {
664 BusLogic_LegacyLUNFormatCCB = 0,
665 BusLogic_ExtendedLUNFormatCCB = 1
666} PACKED;
667
668
669
670
671
672enum BusLogic_ActionCode {
673 BusLogic_OutgoingMailboxFree = 0x00,
674 BusLogic_MailboxStartCommand = 0x01,
675 BusLogic_MailboxAbortCommand = 0x02
676} PACKED;
677
678
679
680
681
682
683
684
685enum BusLogic_CompletionCode {
686 BusLogic_IncomingMailboxFree = 0x00,
687 BusLogic_CommandCompletedWithoutError = 0x01,
688 BusLogic_CommandAbortedAtHostRequest = 0x02,
689 BusLogic_AbortedCommandNotFound = 0x03,
690 BusLogic_CommandCompletedWithError = 0x04,
691 BusLogic_InvalidCCB = 0x05
692} PACKED;
693
694
695
696
697
698enum BusLogic_CCB_Opcode {
699 BusLogic_InitiatorCCB = 0x00,
700 BusLogic_TargetCCB = 0x01,
701 BusLogic_InitiatorCCB_ScatterGather = 0x02,
702 BusLogic_InitiatorCCB_ResidualDataLength = 0x03,
703 BusLogic_InitiatorCCB_ScatterGatherResidual = 0x04,
704 BusLogic_BusDeviceReset = 0x81
705} PACKED;
706
707
708
709
710
711
712enum BusLogic_DataDirection {
713 BusLogic_UncheckedDataTransfer = 0,
714 BusLogic_DataInLengthChecked = 1,
715 BusLogic_DataOutLengthChecked = 2,
716 BusLogic_NoDataTransfer = 3
717};
718
719
720
721
722
723
724
725enum BusLogic_HostAdapterStatus {
726 BusLogic_CommandCompletedNormally = 0x00,
727 BusLogic_LinkedCommandCompleted = 0x0A,
728 BusLogic_LinkedCommandCompletedWithFlag = 0x0B,
729 BusLogic_DataUnderRun = 0x0C,
730 BusLogic_SCSISelectionTimeout = 0x11,
731 BusLogic_DataOverRun = 0x12,
732 BusLogic_UnexpectedBusFree = 0x13,
733 BusLogic_InvalidBusPhaseRequested = 0x14,
734 BusLogic_InvalidOutgoingMailboxActionCode = 0x15,
735 BusLogic_InvalidCommandOperationCode = 0x16,
736 BusLogic_LinkedCCBhasInvalidLUN = 0x17,
737 BusLogic_InvalidCommandParameter = 0x1A,
738 BusLogic_AutoRequestSenseFailed = 0x1B,
739 BusLogic_TaggedQueuingMessageRejected = 0x1C,
740 BusLogic_UnsupportedMessageReceived = 0x1D,
741 BusLogic_HostAdapterHardwareFailed = 0x20,
742 BusLogic_TargetFailedResponseToATN = 0x21,
743 BusLogic_HostAdapterAssertedRST = 0x22,
744 BusLogic_OtherDeviceAssertedRST = 0x23,
745 BusLogic_TargetDeviceReconnectedImproperly = 0x24,
746 BusLogic_HostAdapterAssertedBusDeviceReset = 0x25,
747 BusLogic_AbortQueueGenerated = 0x26,
748 BusLogic_HostAdapterSoftwareError = 0x27,
749 BusLogic_HostAdapterHardwareTimeoutError = 0x30,
750 BusLogic_SCSIParityErrorDetected = 0x34
751} PACKED;
752
753
754
755
756
757
758enum BusLogic_TargetDeviceStatus {
759 BusLogic_OperationGood = 0x00,
760 BusLogic_CheckCondition = 0x02,
761 BusLogic_DeviceBusy = 0x08
762} PACKED;
763
764
765
766
767
768enum BusLogic_QueueTag {
769 BusLogic_SimpleQueueTag = 0,
770 BusLogic_HeadOfQueueTag = 1,
771 BusLogic_OrderedQueueTag = 2,
772 BusLogic_ReservedQT = 3
773};
774
775
776
777
778
779#define BusLogic_CDB_MaxLength 12
780
781typedef unsigned char SCSI_CDB_T[BusLogic_CDB_MaxLength];
782
783
784
785
786
787
788
789struct BusLogic_ScatterGatherSegment {
790 u32 SegmentByteCount;
791 u32 SegmentDataPointer;
792};
793
794
795
796
797
798enum BusLogic_CCB_Status {
799 BusLogic_CCB_Free = 0,
800 BusLogic_CCB_Active = 1,
801 BusLogic_CCB_Completed = 2,
802 BusLogic_CCB_Reset = 3
803} PACKED;
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825struct BusLogic_CCB {
826
827
828
829 enum BusLogic_CCB_Opcode Opcode;
830 unsigned char:3;
831 enum BusLogic_DataDirection DataDirection:2;
832 bool TagEnable:1;
833 enum BusLogic_QueueTag QueueTag:2;
834 unsigned char CDB_Length;
835 unsigned char SenseDataLength;
836 u32 DataLength;
837 u32 DataPointer;
838 unsigned char:8;
839 unsigned char:8;
840 enum BusLogic_HostAdapterStatus HostAdapterStatus;
841 enum BusLogic_TargetDeviceStatus TargetDeviceStatus;
842 unsigned char TargetID;
843 unsigned char LogicalUnit:5;
844 bool LegacyTagEnable:1;
845 enum BusLogic_QueueTag LegacyQueueTag:2;
846 SCSI_CDB_T CDB;
847 unsigned char:8;
848 unsigned char:8;
849 unsigned int:32;
850 u32 SenseDataPointer;
851
852
853
854 void (*CallbackFunction) (struct BusLogic_CCB *);
855 u32 BaseAddress;
856 enum BusLogic_CompletionCode CompletionCode;
857#ifdef CONFIG_SCSI_FLASHPOINT
858 unsigned char:8;
859 unsigned short OS_Flags;
860 unsigned char Private[48];
861#endif
862
863
864
865 dma_addr_t AllocationGroupHead;
866 unsigned int AllocationGroupSize;
867 u32 DMA_Handle;
868 enum BusLogic_CCB_Status Status;
869 unsigned long SerialNumber;
870 struct scsi_cmnd *Command;
871 struct BusLogic_HostAdapter *HostAdapter;
872 struct BusLogic_CCB *Next;
873 struct BusLogic_CCB *NextAll;
874 struct BusLogic_ScatterGatherSegment
875 ScatterGatherList[BusLogic_ScatterGatherLimit];
876};
877
878
879
880
881
882struct BusLogic_OutgoingMailbox {
883 u32 CCB;
884 unsigned int:24;
885 enum BusLogic_ActionCode ActionCode;
886};
887
888
889
890
891
892struct BusLogic_IncomingMailbox {
893 u32 CCB;
894 enum BusLogic_HostAdapterStatus HostAdapterStatus;
895 enum BusLogic_TargetDeviceStatus TargetDeviceStatus;
896 unsigned char:8;
897 enum BusLogic_CompletionCode CompletionCode;
898};
899
900
901
902
903
904
905struct BusLogic_DriverOptions {
906 unsigned short TaggedQueuingPermitted;
907 unsigned short TaggedQueuingPermittedMask;
908 unsigned short BusSettleTime;
909 struct BusLogic_LocalOptions LocalOptions;
910 unsigned char CommonQueueDepth;
911 unsigned char QueueDepth[BusLogic_MaxTargetDevices];
912};
913
914
915
916
917
918struct BusLogic_TargetFlags {
919 bool TargetExists:1;
920 bool TaggedQueuingSupported:1;
921 bool WideTransfersSupported:1;
922 bool TaggedQueuingActive:1;
923 bool WideTransfersActive:1;
924 bool CommandSuccessfulFlag:1;
925 bool TargetInfoReported:1;
926};
927
928
929
930
931
932#define BusLogic_SizeBuckets 10
933
934typedef unsigned int BusLogic_CommandSizeBuckets_T[BusLogic_SizeBuckets];
935
936struct BusLogic_TargetStatistics {
937 unsigned int CommandsAttempted;
938 unsigned int CommandsCompleted;
939 unsigned int ReadCommands;
940 unsigned int WriteCommands;
941 struct BusLogic_ByteCounter TotalBytesRead;
942 struct BusLogic_ByteCounter TotalBytesWritten;
943 BusLogic_CommandSizeBuckets_T ReadCommandSizeBuckets;
944 BusLogic_CommandSizeBuckets_T WriteCommandSizeBuckets;
945 unsigned short CommandAbortsRequested;
946 unsigned short CommandAbortsAttempted;
947 unsigned short CommandAbortsCompleted;
948 unsigned short BusDeviceResetsRequested;
949 unsigned short BusDeviceResetsAttempted;
950 unsigned short BusDeviceResetsCompleted;
951 unsigned short HostAdapterResetsRequested;
952 unsigned short HostAdapterResetsAttempted;
953 unsigned short HostAdapterResetsCompleted;
954};
955
956
957
958
959
960#define FlashPoint_BadCardHandle 0xFFFFFFFF
961
962typedef unsigned int FlashPoint_CardHandle_T;
963
964
965
966
967
968
969
970struct FlashPoint_Info {
971 u32 BaseAddress;
972 bool Present;
973 unsigned char IRQ_Channel;
974 unsigned char SCSI_ID;
975 unsigned char SCSI_LUN;
976 unsigned short FirmwareRevision;
977 unsigned short SynchronousPermitted;
978 unsigned short FastPermitted;
979 unsigned short UltraPermitted;
980 unsigned short DisconnectPermitted;
981 unsigned short WidePermitted;
982 bool ParityCheckingEnabled:1;
983 bool HostWideSCSI:1;
984 bool HostSoftReset:1;
985 bool ExtendedTranslationEnabled:1;
986 bool LowByteTerminated:1;
987 bool HighByteTerminated:1;
988 bool ReportDataUnderrun:1;
989 bool SCAM_Enabled:1;
990 bool SCAM_Level2:1;
991 unsigned char:7;
992 unsigned char Family;
993 unsigned char BusType;
994 unsigned char ModelNumber[3];
995 unsigned char RelativeCardNumber;
996 unsigned char Reserved[4];
997 unsigned int OS_Reserved;
998 unsigned char TranslationInfo[4];
999 unsigned int Reserved2[5];
1000 unsigned int SecondaryRange;
1001};
1002
1003
1004
1005
1006
1007struct BusLogic_HostAdapter {
1008 struct Scsi_Host *SCSI_Host;
1009 struct pci_dev *PCI_Device;
1010 enum BusLogic_HostAdapterType HostAdapterType;
1011 enum BusLogic_HostAdapterBusType HostAdapterBusType;
1012 unsigned long IO_Address;
1013 unsigned long PCI_Address;
1014 unsigned short AddressCount;
1015 unsigned char HostNumber;
1016 unsigned char ModelName[9];
1017 unsigned char FirmwareVersion[6];
1018 unsigned char FullModelName[18];
1019 unsigned char Bus;
1020 unsigned char Device;
1021 unsigned char IRQ_Channel;
1022 unsigned char DMA_Channel;
1023 unsigned char SCSI_ID;
1024 bool IRQ_ChannelAcquired:1;
1025 bool DMA_ChannelAcquired:1;
1026 bool ExtendedTranslationEnabled:1;
1027 bool ParityCheckingEnabled:1;
1028 bool BusResetEnabled:1;
1029 bool LevelSensitiveInterrupt:1;
1030 bool HostWideSCSI:1;
1031 bool HostDifferentialSCSI:1;
1032 bool HostSupportsSCAM:1;
1033 bool HostUltraSCSI:1;
1034 bool ExtendedLUNSupport:1;
1035 bool TerminationInfoValid:1;
1036 bool LowByteTerminated:1;
1037 bool HighByteTerminated:1;
1038 bool BounceBuffersRequired:1;
1039 bool StrictRoundRobinModeSupport:1;
1040 bool SCAM_Enabled:1;
1041 bool SCAM_Level2:1;
1042 bool HostAdapterInitialized:1;
1043 bool HostAdapterExternalReset:1;
1044 bool HostAdapterInternalError:1;
1045 bool ProcessCompletedCCBsActive;
1046 volatile bool HostAdapterCommandCompleted;
1047 unsigned short HostAdapterScatterGatherLimit;
1048 unsigned short DriverScatterGatherLimit;
1049 unsigned short MaxTargetDevices;
1050 unsigned short MaxLogicalUnits;
1051 unsigned short MailboxCount;
1052 unsigned short InitialCCBs;
1053 unsigned short IncrementalCCBs;
1054 unsigned short AllocatedCCBs;
1055 unsigned short DriverQueueDepth;
1056 unsigned short HostAdapterQueueDepth;
1057 unsigned short UntaggedQueueDepth;
1058 unsigned short CommonQueueDepth;
1059 unsigned short BusSettleTime;
1060 unsigned short SynchronousPermitted;
1061 unsigned short FastPermitted;
1062 unsigned short UltraPermitted;
1063 unsigned short WidePermitted;
1064 unsigned short DisconnectPermitted;
1065 unsigned short TaggedQueuingPermitted;
1066 unsigned short ExternalHostAdapterResets;
1067 unsigned short HostAdapterInternalErrors;
1068 unsigned short TargetDeviceCount;
1069 unsigned short MessageBufferLength;
1070 u32 BIOS_Address;
1071 struct BusLogic_DriverOptions *DriverOptions;
1072 struct FlashPoint_Info FlashPointInfo;
1073 FlashPoint_CardHandle_T CardHandle;
1074 struct list_head host_list;
1075 struct BusLogic_CCB *All_CCBs;
1076 struct BusLogic_CCB *Free_CCBs;
1077 struct BusLogic_CCB *FirstCompletedCCB;
1078 struct BusLogic_CCB *LastCompletedCCB;
1079 struct BusLogic_CCB *BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices];
1080 struct BusLogic_TargetFlags TargetFlags[BusLogic_MaxTargetDevices];
1081 unsigned char QueueDepth[BusLogic_MaxTargetDevices];
1082 unsigned char SynchronousPeriod[BusLogic_MaxTargetDevices];
1083 unsigned char SynchronousOffset[BusLogic_MaxTargetDevices];
1084 unsigned char ActiveCommands[BusLogic_MaxTargetDevices];
1085 unsigned int CommandsSinceReset[BusLogic_MaxTargetDevices];
1086 unsigned long LastSequencePoint[BusLogic_MaxTargetDevices];
1087 unsigned long LastResetAttempted[BusLogic_MaxTargetDevices];
1088 unsigned long LastResetCompleted[BusLogic_MaxTargetDevices];
1089 struct BusLogic_OutgoingMailbox *FirstOutgoingMailbox;
1090 struct BusLogic_OutgoingMailbox *LastOutgoingMailbox;
1091 struct BusLogic_OutgoingMailbox *NextOutgoingMailbox;
1092 struct BusLogic_IncomingMailbox *FirstIncomingMailbox;
1093 struct BusLogic_IncomingMailbox *LastIncomingMailbox;
1094 struct BusLogic_IncomingMailbox *NextIncomingMailbox;
1095 struct BusLogic_TargetStatistics TargetStatistics[BusLogic_MaxTargetDevices];
1096 unsigned char *MailboxSpace;
1097 dma_addr_t MailboxSpaceHandle;
1098 unsigned int MailboxSize;
1099 unsigned long CCB_Offset;
1100 char MessageBuffer[BusLogic_MessageBufferSize];
1101};
1102
1103
1104
1105
1106
1107struct BIOS_DiskParameters {
1108 int Heads;
1109 int Sectors;
1110 int Cylinders;
1111};
1112
1113
1114
1115
1116
1117struct SCSI_Inquiry {
1118 unsigned char PeripheralDeviceType:5;
1119 unsigned char PeripheralQualifier:3;
1120 unsigned char DeviceTypeModifier:7;
1121 bool RMB:1;
1122 unsigned char ANSI_ApprovedVersion:3;
1123 unsigned char ECMA_Version:3;
1124 unsigned char ISO_Version:2;
1125 unsigned char ResponseDataFormat:4;
1126 unsigned char:2;
1127 bool TrmIOP:1;
1128 bool AENC:1;
1129 unsigned char AdditionalLength;
1130 unsigned char:8;
1131 unsigned char:8;
1132 bool SftRe:1;
1133 bool CmdQue:1;
1134 bool:1;
1135 bool Linked:1;
1136 bool Sync:1;
1137 bool WBus16:1;
1138 bool WBus32:1;
1139 bool RelAdr:1;
1140 unsigned char VendorIdentification[8];
1141 unsigned char ProductIdentification[16];
1142 unsigned char ProductRevisionLevel[4];
1143};
1144
1145
1146
1147
1148
1149
1150
1151static inline void BusLogic_SCSIBusReset(struct BusLogic_HostAdapter *HostAdapter)
1152{
1153 union BusLogic_ControlRegister ControlRegister;
1154 ControlRegister.All = 0;
1155 ControlRegister.cr.SCSIBusReset = true;
1156 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1157}
1158
1159static inline void BusLogic_InterruptReset(struct BusLogic_HostAdapter *HostAdapter)
1160{
1161 union BusLogic_ControlRegister ControlRegister;
1162 ControlRegister.All = 0;
1163 ControlRegister.cr.InterruptReset = true;
1164 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1165}
1166
1167static inline void BusLogic_SoftReset(struct BusLogic_HostAdapter *HostAdapter)
1168{
1169 union BusLogic_ControlRegister ControlRegister;
1170 ControlRegister.All = 0;
1171 ControlRegister.cr.SoftReset = true;
1172 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1173}
1174
1175static inline void BusLogic_HardReset(struct BusLogic_HostAdapter *HostAdapter)
1176{
1177 union BusLogic_ControlRegister ControlRegister;
1178 ControlRegister.All = 0;
1179 ControlRegister.cr.HardReset = true;
1180 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1181}
1182
1183static inline unsigned char BusLogic_ReadStatusRegister(struct BusLogic_HostAdapter *HostAdapter)
1184{
1185 return inb(HostAdapter->IO_Address + BusLogic_StatusRegisterOffset);
1186}
1187
1188static inline void BusLogic_WriteCommandParameterRegister(struct BusLogic_HostAdapter
1189 *HostAdapter, unsigned char Value)
1190{
1191 outb(Value, HostAdapter->IO_Address + BusLogic_CommandParameterRegisterOffset);
1192}
1193
1194static inline unsigned char BusLogic_ReadDataInRegister(struct BusLogic_HostAdapter *HostAdapter)
1195{
1196 return inb(HostAdapter->IO_Address + BusLogic_DataInRegisterOffset);
1197}
1198
1199static inline unsigned char BusLogic_ReadInterruptRegister(struct BusLogic_HostAdapter *HostAdapter)
1200{
1201 return inb(HostAdapter->IO_Address + BusLogic_InterruptRegisterOffset);
1202}
1203
1204static inline unsigned char BusLogic_ReadGeometryRegister(struct BusLogic_HostAdapter *HostAdapter)
1205{
1206 return inb(HostAdapter->IO_Address + BusLogic_GeometryRegisterOffset);
1207}
1208
1209
1210
1211
1212
1213
1214
1215static inline void BusLogic_StartMailboxCommand(struct BusLogic_HostAdapter *HostAdapter)
1216{
1217 BusLogic_WriteCommandParameterRegister(HostAdapter, BusLogic_ExecuteMailboxCommand);
1218}
1219
1220
1221
1222
1223
1224static inline void BusLogic_Delay(int Seconds)
1225{
1226 mdelay(1000 * Seconds);
1227}
1228
1229
1230
1231
1232
1233
1234static inline u32 Virtual_to_Bus(void *VirtualAddress)
1235{
1236 return (u32) virt_to_bus(VirtualAddress);
1237}
1238
1239static inline void *Bus_to_Virtual(u32 BusAddress)
1240{
1241 return (void *) bus_to_virt(BusAddress);
1242}
1243
1244
1245
1246
1247
1248
1249
1250static inline u32 Virtual_to_32Bit_Virtual(void *VirtualAddress)
1251{
1252 return (u32) (unsigned long) VirtualAddress;
1253}
1254
1255
1256
1257
1258
1259
1260static inline void BusLogic_IncrementErrorCounter(unsigned short *ErrorCounter)
1261{
1262 if (*ErrorCounter < 65535)
1263 (*ErrorCounter)++;
1264}
1265
1266
1267
1268
1269
1270static inline void BusLogic_IncrementByteCounter(struct BusLogic_ByteCounter
1271 *ByteCounter, unsigned int Amount)
1272{
1273 ByteCounter->Units += Amount;
1274 if (ByteCounter->Units > 999999999) {
1275 ByteCounter->Units -= 1000000000;
1276 ByteCounter->Billions++;
1277 }
1278}
1279
1280
1281
1282
1283
1284static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T CommandSizeBuckets, unsigned int Amount)
1285{
1286 int Index = 0;
1287 if (Amount < 8 * 1024) {
1288 if (Amount < 2 * 1024)
1289 Index = (Amount < 1 * 1024 ? 0 : 1);
1290 else
1291 Index = (Amount < 4 * 1024 ? 2 : 3);
1292 } else if (Amount < 128 * 1024) {
1293 if (Amount < 32 * 1024)
1294 Index = (Amount < 16 * 1024 ? 4 : 5);
1295 else
1296 Index = (Amount < 64 * 1024 ? 6 : 7);
1297 } else
1298 Index = (Amount < 256 * 1024 ? 8 : 9);
1299 CommandSizeBuckets[Index]++;
1300}
1301
1302
1303
1304
1305
1306#define FlashPoint_FirmwareVersion "5.02"
1307
1308
1309
1310
1311
1312#define FlashPoint_NormalInterrupt 0x00
1313#define FlashPoint_InternalError 0xFE
1314#define FlashPoint_ExternalBusReset 0xFF
1315
1316
1317
1318
1319
1320
1321static const char *BusLogic_DriverInfo(struct Scsi_Host *);
1322static int BusLogic_QueueCommand(struct scsi_cmnd *, void (*CompletionRoutine) (struct scsi_cmnd *));
1323static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *);
1324static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *, char **, off_t, int, int);
1325static int BusLogic_SlaveConfigure(struct scsi_device *);
1326static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *);
1327static irqreturn_t BusLogic_InterruptHandler(int, void *);
1328static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *, bool HardReset);
1329static void BusLogic_Message(enum BusLogic_MessageLevel, char *, struct BusLogic_HostAdapter *, ...);
1330static int __init BusLogic_Setup(char *);
1331
1332#endif
1333