[PATCH] ARM: Fixup missing includes in arch/arm/mm/proc-<cputype>.S
[linux-2.6/kvm.git] / drivers / scsi / BusLogic.h
blob9792e5af5252c4a6378490667fe64f5318c64dac
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.
28 #ifndef _BUSLOGIC_H
29 #define _BUSLOGIC_H
32 #ifndef PACKED
33 #define PACKED __attribute__((packed))
34 #endif
37 FlashPoint support is only available for the Intel x86 Architecture with
38 CONFIG_PCI set.
41 #ifndef __i386__
42 #undef CONFIG_SCSI_OMIT_FLASHPOINT
43 #define CONFIG_SCSI_OMIT_FLASHPOINT
44 #endif
46 #ifndef CONFIG_PCI
47 #undef CONFIG_SCSI_OMIT_FLASHPOINT
48 #define CONFIG_SCSI_OMIT_FLASHPOINT
49 #define BusLogic_InitializeProbeInfoListISA BusLogic_InitializeProbeInfoList
50 #endif
54 Define the maximum number of BusLogic Host Adapters supported by this driver.
57 #define BusLogic_MaxHostAdapters 16
61 Define the maximum number of Target Devices supported by this driver.
64 #define BusLogic_MaxTargetDevices 16
68 Define the maximum number of Scatter/Gather Segments used by this driver.
69 For optimal performance, it is important that this limit be at least as
70 large as the largest single request generated by the I/O Subsystem.
73 #define BusLogic_ScatterGatherLimit 128
77 Define the maximum, maximum automatic, minimum automatic, and default Queue
78 Depth to allow for Target Devices depending on whether or not they support
79 Tagged Queuing and whether or not ISA Bounce Buffers are required.
82 #define BusLogic_MaxTaggedQueueDepth 64
83 #define BusLogic_MaxAutomaticTaggedQueueDepth 28
84 #define BusLogic_MinAutomaticTaggedQueueDepth 7
85 #define BusLogic_TaggedQueueDepthBB 3
86 #define BusLogic_UntaggedQueueDepth 3
87 #define BusLogic_UntaggedQueueDepthBB 2
91 Define the default amount of time in seconds to wait between a Host Adapter
92 Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI commands.
93 Some SCSI devices get confused if they receive SCSI commands too soon after
94 a SCSI Bus Reset.
97 #define BusLogic_DefaultBusSettleTime 2
101 Define the maximum number of Mailboxes that should be used for MultiMaster
102 Host Adapters. This number is chosen to be larger than the maximum Host
103 Adapter Queue Depth and small enough so that the Host Adapter structure
104 does not cross an allocation block size boundary.
107 #define BusLogic_MaxMailboxes 211
111 Define the number of CCBs that should be allocated as a group to optimize
112 Kernel memory allocation.
115 #define BusLogic_CCB_AllocationGroupSize 7
119 Define the Host Adapter Line and Message Buffer Sizes.
122 #define BusLogic_LineBufferSize 100
123 #define BusLogic_MessageBufferSize 9700
127 Define the Driver Message Levels.
130 enum BusLogic_MessageLevel {
131 BusLogic_AnnounceLevel = 0,
132 BusLogic_InfoLevel = 1,
133 BusLogic_NoticeLevel = 2,
134 BusLogic_WarningLevel = 3,
135 BusLogic_ErrorLevel = 4
138 static char *BusLogic_MessageLevelMap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };
142 Define Driver Message macros.
145 #define BusLogic_Announce(Format, Arguments...) \
146 BusLogic_Message(BusLogic_AnnounceLevel, Format, ##Arguments)
148 #define BusLogic_Info(Format, Arguments...) \
149 BusLogic_Message(BusLogic_InfoLevel, Format, ##Arguments)
151 #define BusLogic_Notice(Format, Arguments...) \
152 BusLogic_Message(BusLogic_NoticeLevel, Format, ##Arguments)
154 #define BusLogic_Warning(Format, Arguments...) \
155 BusLogic_Message(BusLogic_WarningLevel, Format, ##Arguments)
157 #define BusLogic_Error(Format, Arguments...) \
158 BusLogic_Message(BusLogic_ErrorLevel, Format, ##Arguments)
162 Define the types of BusLogic Host Adapters that are supported and the number
163 of I/O Addresses required by each type.
166 enum BusLogic_HostAdapterType {
167 BusLogic_MultiMaster = 1,
168 BusLogic_FlashPoint = 2
169 } PACKED;
171 #define BusLogic_MultiMasterAddressCount 4
172 #define BusLogic_FlashPointAddressCount 256
174 static int BusLogic_HostAdapterAddressCount[3] = { 0, BusLogic_MultiMasterAddressCount, BusLogic_FlashPointAddressCount };
178 Define macros for testing the Host Adapter Type.
181 #ifndef CONFIG_SCSI_OMIT_FLASHPOINT
183 #define BusLogic_MultiMasterHostAdapterP(HostAdapter) \
184 (HostAdapter->HostAdapterType == BusLogic_MultiMaster)
186 #define BusLogic_FlashPointHostAdapterP(HostAdapter) \
187 (HostAdapter->HostAdapterType == BusLogic_FlashPoint)
189 #else
191 #define BusLogic_MultiMasterHostAdapterP(HostAdapter) \
192 (true)
194 #define BusLogic_FlashPointHostAdapterP(HostAdapter) \
195 (false)
197 #endif
201 Define the possible Host Adapter Bus Types.
204 enum BusLogic_HostAdapterBusType {
205 BusLogic_Unknown_Bus = 0,
206 BusLogic_ISA_Bus = 1,
207 BusLogic_EISA_Bus = 2,
208 BusLogic_PCI_Bus = 3,
209 BusLogic_VESA_Bus = 4,
210 BusLogic_MCA_Bus = 5
211 } PACKED;
213 static char *BusLogic_HostAdapterBusNames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };
215 static enum BusLogic_HostAdapterBusType BusLogic_HostAdapterBusTypes[] = {
216 BusLogic_VESA_Bus, /* BT-4xx */
217 BusLogic_ISA_Bus, /* BT-5xx */
218 BusLogic_MCA_Bus, /* BT-6xx */
219 BusLogic_EISA_Bus, /* BT-7xx */
220 BusLogic_Unknown_Bus, /* BT-8xx */
221 BusLogic_PCI_Bus /* BT-9xx */
225 Define the possible Host Adapter BIOS Disk Geometry Translations.
228 enum BusLogic_BIOS_DiskGeometryTranslation {
229 BusLogic_BIOS_Disk_Not_Installed = 0,
230 BusLogic_BIOS_Disk_Installed_64x32 = 1,
231 BusLogic_BIOS_Disk_Installed_128x32 = 2,
232 BusLogic_BIOS_Disk_Installed_255x63 = 3
233 } PACKED;
237 Define a Boolean data type.
240 typedef enum {
241 false,
242 true
243 } PACKED boolean;
246 Define a 10^18 Statistics Byte Counter data type.
249 struct BusLogic_ByteCounter {
250 unsigned int Units;
251 unsigned int Billions;
256 Define the structure for I/O Address and Bus Probing Information.
259 struct BusLogic_ProbeInfo {
260 enum BusLogic_HostAdapterType HostAdapterType;
261 enum BusLogic_HostAdapterBusType HostAdapterBusType;
262 unsigned long IO_Address;
263 unsigned long PCI_Address;
264 struct pci_dev *PCI_Device;
265 unsigned char Bus;
266 unsigned char Device;
267 unsigned char IRQ_Channel;
271 Define the Probe Options.
274 struct BusLogic_ProbeOptions {
275 boolean NoProbe:1; /* Bit 0 */
276 boolean NoProbeISA:1; /* Bit 1 */
277 boolean NoProbePCI:1; /* Bit 2 */
278 boolean NoSortPCI:1; /* Bit 3 */
279 boolean MultiMasterFirst:1; /* Bit 4 */
280 boolean FlashPointFirst:1; /* Bit 5 */
281 boolean LimitedProbeISA:1; /* Bit 6 */
282 boolean Probe330:1; /* Bit 7 */
283 boolean Probe334:1; /* Bit 8 */
284 boolean Probe230:1; /* Bit 9 */
285 boolean Probe234:1; /* Bit 10 */
286 boolean Probe130:1; /* Bit 11 */
287 boolean Probe134:1; /* Bit 12 */
291 Define the Global Options.
294 struct BusLogic_GlobalOptions {
295 boolean TraceProbe:1; /* Bit 0 */
296 boolean TraceHardwareReset:1; /* Bit 1 */
297 boolean TraceConfiguration:1; /* Bit 2 */
298 boolean TraceErrors:1; /* Bit 3 */
302 Define the Local Options.
305 struct BusLogic_LocalOptions {
306 boolean InhibitTargetInquiry:1; /* Bit 0 */
310 Define the BusLogic SCSI Host Adapter I/O Register Offsets.
313 #define BusLogic_ControlRegisterOffset 0 /* WO register */
314 #define BusLogic_StatusRegisterOffset 0 /* RO register */
315 #define BusLogic_CommandParameterRegisterOffset 1 /* WO register */
316 #define BusLogic_DataInRegisterOffset 1 /* RO register */
317 #define BusLogic_InterruptRegisterOffset 2 /* RO register */
318 #define BusLogic_GeometryRegisterOffset 3 /* RO register */
321 Define the structure of the write-only Control Register.
324 union BusLogic_ControlRegister {
325 unsigned char All;
326 struct {
327 unsigned char:4; /* Bits 0-3 */
328 boolean SCSIBusReset:1; /* Bit 4 */
329 boolean InterruptReset:1; /* Bit 5 */
330 boolean SoftReset:1; /* Bit 6 */
331 boolean HardReset:1; /* Bit 7 */
332 } cr;
336 Define the structure of the read-only Status Register.
339 union BusLogic_StatusRegister {
340 unsigned char All;
341 struct {
342 boolean CommandInvalid:1; /* Bit 0 */
343 boolean Reserved:1; /* Bit 1 */
344 boolean DataInRegisterReady:1; /* Bit 2 */
345 boolean CommandParameterRegisterBusy:1; /* Bit 3 */
346 boolean HostAdapterReady:1; /* Bit 4 */
347 boolean InitializationRequired:1; /* Bit 5 */
348 boolean DiagnosticFailure:1; /* Bit 6 */
349 boolean DiagnosticActive:1; /* Bit 7 */
350 } sr;
354 Define the structure of the read-only Interrupt Register.
357 union BusLogic_InterruptRegister {
358 unsigned char All;
359 struct {
360 boolean IncomingMailboxLoaded:1; /* Bit 0 */
361 boolean OutgoingMailboxAvailable:1; /* Bit 1 */
362 boolean CommandComplete:1; /* Bit 2 */
363 boolean ExternalBusReset:1; /* Bit 3 */
364 unsigned char Reserved:3; /* Bits 4-6 */
365 boolean InterruptValid:1; /* Bit 7 */
366 } ir;
370 Define the structure of the read-only Geometry Register.
373 union BusLogic_GeometryRegister {
374 unsigned char All;
375 struct {
376 enum BusLogic_BIOS_DiskGeometryTranslation Drive0Geometry:2; /* Bits 0-1 */
377 enum BusLogic_BIOS_DiskGeometryTranslation Drive1Geometry:2; /* Bits 2-3 */
378 unsigned char:3; /* Bits 4-6 */
379 boolean ExtendedTranslationEnabled:1; /* Bit 7 */
380 } gr;
384 Define the BusLogic SCSI Host Adapter Command Register Operation Codes.
387 enum BusLogic_OperationCode {
388 BusLogic_TestCommandCompleteInterrupt = 0x00,
389 BusLogic_InitializeMailbox = 0x01,
390 BusLogic_ExecuteMailboxCommand = 0x02,
391 BusLogic_ExecuteBIOSCommand = 0x03,
392 BusLogic_InquireBoardID = 0x04,
393 BusLogic_EnableOutgoingMailboxAvailableInt = 0x05,
394 BusLogic_SetSCSISelectionTimeout = 0x06,
395 BusLogic_SetPreemptTimeOnBus = 0x07,
396 BusLogic_SetTimeOffBus = 0x08,
397 BusLogic_SetBusTransferRate = 0x09,
398 BusLogic_InquireInstalledDevicesID0to7 = 0x0A,
399 BusLogic_InquireConfiguration = 0x0B,
400 BusLogic_EnableTargetMode = 0x0C,
401 BusLogic_InquireSetupInformation = 0x0D,
402 BusLogic_WriteAdapterLocalRAM = 0x1A,
403 BusLogic_ReadAdapterLocalRAM = 0x1B,
404 BusLogic_WriteBusMasterChipFIFO = 0x1C,
405 BusLogic_ReadBusMasterChipFIFO = 0x1D,
406 BusLogic_EchoCommandData = 0x1F,
407 BusLogic_HostAdapterDiagnostic = 0x20,
408 BusLogic_SetAdapterOptions = 0x21,
409 BusLogic_InquireInstalledDevicesID8to15 = 0x23,
410 BusLogic_InquireTargetDevices = 0x24,
411 BusLogic_DisableHostAdapterInterrupt = 0x25,
412 BusLogic_InitializeExtendedMailbox = 0x81,
413 BusLogic_ExecuteSCSICommand = 0x83,
414 BusLogic_InquireFirmwareVersion3rdDigit = 0x84,
415 BusLogic_InquireFirmwareVersionLetter = 0x85,
416 BusLogic_InquirePCIHostAdapterInformation = 0x86,
417 BusLogic_InquireHostAdapterModelNumber = 0x8B,
418 BusLogic_InquireSynchronousPeriod = 0x8C,
419 BusLogic_InquireExtendedSetupInformation = 0x8D,
420 BusLogic_EnableStrictRoundRobinMode = 0x8F,
421 BusLogic_StoreHostAdapterLocalRAM = 0x90,
422 BusLogic_FetchHostAdapterLocalRAM = 0x91,
423 BusLogic_StoreLocalDataInEEPROM = 0x92,
424 BusLogic_UploadAutoSCSICode = 0x94,
425 BusLogic_ModifyIOAddress = 0x95,
426 BusLogic_SetCCBFormat = 0x96,
427 BusLogic_WriteInquiryBuffer = 0x9A,
428 BusLogic_ReadInquiryBuffer = 0x9B,
429 BusLogic_FlashROMUploadDownload = 0xA7,
430 BusLogic_ReadSCAMData = 0xA8,
431 BusLogic_WriteSCAMData = 0xA9
435 Define the Inquire Board ID reply structure.
438 struct BusLogic_BoardID {
439 unsigned char BoardType; /* Byte 0 */
440 unsigned char CustomFeatures; /* Byte 1 */
441 unsigned char FirmwareVersion1stDigit; /* Byte 2 */
442 unsigned char FirmwareVersion2ndDigit; /* Byte 3 */
446 Define the Inquire Configuration reply structure.
449 struct BusLogic_Configuration {
450 unsigned char:5; /* Byte 0 Bits 0-4 */
451 boolean DMA_Channel5:1; /* Byte 0 Bit 5 */
452 boolean DMA_Channel6:1; /* Byte 0 Bit 6 */
453 boolean DMA_Channel7:1; /* Byte 0 Bit 7 */
454 boolean IRQ_Channel9:1; /* Byte 1 Bit 0 */
455 boolean IRQ_Channel10:1; /* Byte 1 Bit 1 */
456 boolean IRQ_Channel11:1; /* Byte 1 Bit 2 */
457 boolean IRQ_Channel12:1; /* Byte 1 Bit 3 */
458 unsigned char:1; /* Byte 1 Bit 4 */
459 boolean IRQ_Channel14:1; /* Byte 1 Bit 5 */
460 boolean IRQ_Channel15:1; /* Byte 1 Bit 6 */
461 unsigned char:1; /* Byte 1 Bit 7 */
462 unsigned char HostAdapterID:4; /* Byte 2 Bits 0-3 */
463 unsigned char:4; /* Byte 2 Bits 4-7 */
467 Define the Inquire Setup Information reply structure.
470 struct BusLogic_SynchronousValue {
471 unsigned char Offset:4; /* Bits 0-3 */
472 unsigned char TransferPeriod:3; /* Bits 4-6 */
473 boolean Synchronous:1; /* Bit 7 */
476 struct BusLogic_SetupInformation {
477 boolean SynchronousInitiationEnabled:1; /* Byte 0 Bit 0 */
478 boolean ParityCheckingEnabled:1; /* Byte 0 Bit 1 */
479 unsigned char:6; /* Byte 0 Bits 2-7 */
480 unsigned char BusTransferRate; /* Byte 1 */
481 unsigned char PreemptTimeOnBus; /* Byte 2 */
482 unsigned char TimeOffBus; /* Byte 3 */
483 unsigned char MailboxCount; /* Byte 4 */
484 unsigned char MailboxAddress[3]; /* Bytes 5-7 */
485 struct BusLogic_SynchronousValue SynchronousValuesID0to7[8]; /* Bytes 8-15 */
486 unsigned char DisconnectPermittedID0to7; /* Byte 16 */
487 unsigned char Signature; /* Byte 17 */
488 unsigned char CharacterD; /* Byte 18 */
489 unsigned char HostBusType; /* Byte 19 */
490 unsigned char WideTransfersPermittedID0to7; /* Byte 20 */
491 unsigned char WideTransfersActiveID0to7; /* Byte 21 */
492 struct BusLogic_SynchronousValue SynchronousValuesID8to15[8]; /* Bytes 22-29 */
493 unsigned char DisconnectPermittedID8to15; /* Byte 30 */
494 unsigned char:8; /* Byte 31 */
495 unsigned char WideTransfersPermittedID8to15; /* Byte 32 */
496 unsigned char WideTransfersActiveID8to15; /* Byte 33 */
500 Define the Initialize Extended Mailbox request structure.
503 struct BusLogic_ExtendedMailboxRequest {
504 unsigned char MailboxCount; /* Byte 0 */
505 u32 BaseMailboxAddress; /* Bytes 1-4 */
506 } PACKED;
510 Define the Inquire PCI Host Adapter Information reply type. The ISA
511 Compatible I/O Port values are defined here and are also used with
512 the Modify I/O Address command.
515 enum BusLogic_ISACompatibleIOPort {
516 BusLogic_IO_330 = 0,
517 BusLogic_IO_334 = 1,
518 BusLogic_IO_230 = 2,
519 BusLogic_IO_234 = 3,
520 BusLogic_IO_130 = 4,
521 BusLogic_IO_134 = 5,
522 BusLogic_IO_Disable = 6,
523 BusLogic_IO_Disable2 = 7
524 } PACKED;
526 struct BusLogic_PCIHostAdapterInformation {
527 enum BusLogic_ISACompatibleIOPort ISACompatibleIOPort; /* Byte 0 */
528 unsigned char PCIAssignedIRQChannel; /* Byte 1 */
529 boolean LowByteTerminated:1; /* Byte 2 Bit 0 */
530 boolean HighByteTerminated:1; /* Byte 2 Bit 1 */
531 unsigned char:2; /* Byte 2 Bits 2-3 */
532 boolean JP1:1; /* Byte 2 Bit 4 */
533 boolean JP2:1; /* Byte 2 Bit 5 */
534 boolean JP3:1; /* Byte 2 Bit 6 */
535 boolean GenericInfoValid:1; /* Byte 2 Bit 7 */
536 unsigned char:8; /* Byte 3 */
540 Define the Inquire Extended Setup Information reply structure.
543 struct BusLogic_ExtendedSetupInformation {
544 unsigned char BusType; /* Byte 0 */
545 unsigned char BIOS_Address; /* Byte 1 */
546 unsigned short ScatterGatherLimit; /* Bytes 2-3 */
547 unsigned char MailboxCount; /* Byte 4 */
548 u32 BaseMailboxAddress; /* Bytes 5-8 */
549 struct {
550 unsigned char:2; /* Byte 9 Bits 0-1 */
551 boolean FastOnEISA:1; /* Byte 9 Bit 2 */
552 unsigned char:3; /* Byte 9 Bits 3-5 */
553 boolean LevelSensitiveInterrupt:1; /* Byte 9 Bit 6 */
554 unsigned char:1; /* Byte 9 Bit 7 */
555 } Misc;
556 unsigned char FirmwareRevision[3]; /* Bytes 10-12 */
557 boolean HostWideSCSI:1; /* Byte 13 Bit 0 */
558 boolean HostDifferentialSCSI:1; /* Byte 13 Bit 1 */
559 boolean HostSupportsSCAM:1; /* Byte 13 Bit 2 */
560 boolean HostUltraSCSI:1; /* Byte 13 Bit 3 */
561 boolean HostSmartTermination:1; /* Byte 13 Bit 4 */
562 unsigned char:3; /* Byte 13 Bits 5-7 */
563 } PACKED;
566 Define the Enable Strict Round Robin Mode request type.
569 enum BusLogic_RoundRobinModeRequest {
570 BusLogic_AggressiveRoundRobinMode = 0,
571 BusLogic_StrictRoundRobinMode = 1
572 } PACKED;
576 Define the Fetch Host Adapter Local RAM request type.
579 #define BusLogic_BIOS_BaseOffset 0
580 #define BusLogic_AutoSCSI_BaseOffset 64
582 struct BusLogic_FetchHostAdapterLocalRAMRequest {
583 unsigned char ByteOffset; /* Byte 0 */
584 unsigned char ByteCount; /* Byte 1 */
588 Define the Host Adapter Local RAM AutoSCSI structure.
591 struct BusLogic_AutoSCSIData {
592 unsigned char InternalFactorySignature[2]; /* Bytes 0-1 */
593 unsigned char InformationByteCount; /* Byte 2 */
594 unsigned char HostAdapterType[6]; /* Bytes 3-8 */
595 unsigned char:8; /* Byte 9 */
596 boolean FloppyEnabled:1; /* Byte 10 Bit 0 */
597 boolean FloppySecondary:1; /* Byte 10 Bit 1 */
598 boolean LevelSensitiveInterrupt:1; /* Byte 10 Bit 2 */
599 unsigned char:2; /* Byte 10 Bits 3-4 */
600 unsigned char SystemRAMAreaForBIOS:3; /* Byte 10 Bits 5-7 */
601 unsigned char DMA_Channel:7; /* Byte 11 Bits 0-6 */
602 boolean DMA_AutoConfiguration:1; /* Byte 11 Bit 7 */
603 unsigned char IRQ_Channel:7; /* Byte 12 Bits 0-6 */
604 boolean IRQ_AutoConfiguration:1; /* Byte 12 Bit 7 */
605 unsigned char DMA_TransferRate; /* Byte 13 */
606 unsigned char SCSI_ID; /* Byte 14 */
607 boolean LowByteTerminated:1; /* Byte 15 Bit 0 */
608 boolean ParityCheckingEnabled:1; /* Byte 15 Bit 1 */
609 boolean HighByteTerminated:1; /* Byte 15 Bit 2 */
610 boolean NoisyCablingEnvironment:1; /* Byte 15 Bit 3 */
611 boolean FastSynchronousNegotiation:1; /* Byte 15 Bit 4 */
612 boolean BusResetEnabled:1; /* Byte 15 Bit 5 */
613 boolean:1; /* Byte 15 Bit 6 */
614 boolean ActiveNegationEnabled:1; /* Byte 15 Bit 7 */
615 unsigned char BusOnDelay; /* Byte 16 */
616 unsigned char BusOffDelay; /* Byte 17 */
617 boolean HostAdapterBIOSEnabled:1; /* Byte 18 Bit 0 */
618 boolean BIOSRedirectionOfINT19Enabled:1; /* Byte 18 Bit 1 */
619 boolean ExtendedTranslationEnabled:1; /* Byte 18 Bit 2 */
620 boolean MapRemovableAsFixedEnabled:1; /* Byte 18 Bit 3 */
621 boolean:1; /* Byte 18 Bit 4 */
622 boolean BIOSSupportsMoreThan2DrivesEnabled:1; /* Byte 18 Bit 5 */
623 boolean BIOSInterruptModeEnabled:1; /* Byte 18 Bit 6 */
624 boolean FlopticalSupportEnabled:1; /* Byte 19 Bit 7 */
625 unsigned short DeviceEnabled; /* Bytes 19-20 */
626 unsigned short WidePermitted; /* Bytes 21-22 */
627 unsigned short FastPermitted; /* Bytes 23-24 */
628 unsigned short SynchronousPermitted; /* Bytes 25-26 */
629 unsigned short DisconnectPermitted; /* Bytes 27-28 */
630 unsigned short SendStartUnitCommand; /* Bytes 29-30 */
631 unsigned short IgnoreInBIOSScan; /* Bytes 31-32 */
632 unsigned char PCIInterruptPin:2; /* Byte 33 Bits 0-1 */
633 unsigned char HostAdapterIOPortAddress:2; /* Byte 33 Bits 2-3 */
634 boolean StrictRoundRobinModeEnabled:1; /* Byte 33 Bit 4 */
635 boolean VESABusSpeedGreaterThan33MHz:1; /* Byte 33 Bit 5 */
636 boolean VESABurstWriteEnabled:1; /* Byte 33 Bit 6 */
637 boolean VESABurstReadEnabled:1; /* Byte 33 Bit 7 */
638 unsigned short UltraPermitted; /* Bytes 34-35 */
639 unsigned int:32; /* Bytes 36-39 */
640 unsigned char:8; /* Byte 40 */
641 unsigned char AutoSCSIMaximumLUN; /* Byte 41 */
642 boolean:1; /* Byte 42 Bit 0 */
643 boolean SCAM_Dominant:1; /* Byte 42 Bit 1 */
644 boolean SCAM_Enabled:1; /* Byte 42 Bit 2 */
645 boolean SCAM_Level2:1; /* Byte 42 Bit 3 */
646 unsigned char:4; /* Byte 42 Bits 4-7 */
647 boolean INT13ExtensionEnabled:1; /* Byte 43 Bit 0 */
648 boolean:1; /* Byte 43 Bit 1 */
649 boolean CDROMBootEnabled:1; /* Byte 43 Bit 2 */
650 unsigned char:5; /* Byte 43 Bits 3-7 */
651 unsigned char BootTargetID:4; /* Byte 44 Bits 0-3 */
652 unsigned char BootChannel:4; /* Byte 44 Bits 4-7 */
653 unsigned char ForceBusDeviceScanningOrder:1; /* Byte 45 Bit 0 */
654 unsigned char:7; /* Byte 45 Bits 1-7 */
655 unsigned short NonTaggedToAlternateLUNPermitted; /* Bytes 46-47 */
656 unsigned short RenegotiateSyncAfterCheckCondition; /* Bytes 48-49 */
657 unsigned char Reserved[10]; /* Bytes 50-59 */
658 unsigned char ManufacturingDiagnostic[2]; /* Bytes 60-61 */
659 unsigned short Checksum; /* Bytes 62-63 */
660 } PACKED;
663 Define the Host Adapter Local RAM Auto SCSI Byte 45 structure.
666 struct BusLogic_AutoSCSIByte45 {
667 unsigned char ForceBusDeviceScanningOrder:1; /* Bit 0 */
668 unsigned char:7; /* Bits 1-7 */
672 Define the Host Adapter Local RAM BIOS Drive Map Byte structure.
675 #define BusLogic_BIOS_DriveMapOffset 17
677 struct BusLogic_BIOSDriveMapByte {
678 unsigned char TargetIDBit3:1; /* Bit 0 */
679 unsigned char:2; /* Bits 1-2 */
680 enum BusLogic_BIOS_DiskGeometryTranslation DiskGeometry:2; /* Bits 3-4 */
681 unsigned char TargetID:3; /* Bits 5-7 */
685 Define the Set CCB Format request type. Extended LUN Format CCBs are
686 necessary to support more than 8 Logical Units per Target Device.
689 enum BusLogic_SetCCBFormatRequest {
690 BusLogic_LegacyLUNFormatCCB = 0,
691 BusLogic_ExtendedLUNFormatCCB = 1
692 } PACKED;
695 Define the Outgoing Mailbox Action Codes.
698 enum BusLogic_ActionCode {
699 BusLogic_OutgoingMailboxFree = 0x00,
700 BusLogic_MailboxStartCommand = 0x01,
701 BusLogic_MailboxAbortCommand = 0x02
702 } PACKED;
706 Define the Incoming Mailbox Completion Codes. The MultiMaster Firmware
707 only uses codes 0 - 4. The FlashPoint SCCB Manager has no mailboxes, so
708 completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5.
711 enum BusLogic_CompletionCode {
712 BusLogic_IncomingMailboxFree = 0x00,
713 BusLogic_CommandCompletedWithoutError = 0x01,
714 BusLogic_CommandAbortedAtHostRequest = 0x02,
715 BusLogic_AbortedCommandNotFound = 0x03,
716 BusLogic_CommandCompletedWithError = 0x04,
717 BusLogic_InvalidCCB = 0x05
718 } PACKED;
721 Define the Command Control Block (CCB) Opcodes.
724 enum BusLogic_CCB_Opcode {
725 BusLogic_InitiatorCCB = 0x00,
726 BusLogic_TargetCCB = 0x01,
727 BusLogic_InitiatorCCB_ScatterGather = 0x02,
728 BusLogic_InitiatorCCB_ResidualDataLength = 0x03,
729 BusLogic_InitiatorCCB_ScatterGatherResidual = 0x04,
730 BusLogic_BusDeviceReset = 0x81
731 } PACKED;
735 Define the CCB Data Direction Codes.
738 enum BusLogic_DataDirection {
739 BusLogic_UncheckedDataTransfer = 0,
740 BusLogic_DataInLengthChecked = 1,
741 BusLogic_DataOutLengthChecked = 2,
742 BusLogic_NoDataTransfer = 3
747 Define the Host Adapter Status Codes. The MultiMaster Firmware does not
748 return status code 0x0C; it uses 0x12 for both overruns and underruns.
751 enum BusLogic_HostAdapterStatus {
752 BusLogic_CommandCompletedNormally = 0x00,
753 BusLogic_LinkedCommandCompleted = 0x0A,
754 BusLogic_LinkedCommandCompletedWithFlag = 0x0B,
755 BusLogic_DataUnderRun = 0x0C,
756 BusLogic_SCSISelectionTimeout = 0x11,
757 BusLogic_DataOverRun = 0x12,
758 BusLogic_UnexpectedBusFree = 0x13,
759 BusLogic_InvalidBusPhaseRequested = 0x14,
760 BusLogic_InvalidOutgoingMailboxActionCode = 0x15,
761 BusLogic_InvalidCommandOperationCode = 0x16,
762 BusLogic_LinkedCCBhasInvalidLUN = 0x17,
763 BusLogic_InvalidCommandParameter = 0x1A,
764 BusLogic_AutoRequestSenseFailed = 0x1B,
765 BusLogic_TaggedQueuingMessageRejected = 0x1C,
766 BusLogic_UnsupportedMessageReceived = 0x1D,
767 BusLogic_HostAdapterHardwareFailed = 0x20,
768 BusLogic_TargetFailedResponseToATN = 0x21,
769 BusLogic_HostAdapterAssertedRST = 0x22,
770 BusLogic_OtherDeviceAssertedRST = 0x23,
771 BusLogic_TargetDeviceReconnectedImproperly = 0x24,
772 BusLogic_HostAdapterAssertedBusDeviceReset = 0x25,
773 BusLogic_AbortQueueGenerated = 0x26,
774 BusLogic_HostAdapterSoftwareError = 0x27,
775 BusLogic_HostAdapterHardwareTimeoutError = 0x30,
776 BusLogic_SCSIParityErrorDetected = 0x34
777 } PACKED;
781 Define the SCSI Target Device Status Codes.
784 enum BusLogic_TargetDeviceStatus {
785 BusLogic_OperationGood = 0x00,
786 BusLogic_CheckCondition = 0x02,
787 BusLogic_DeviceBusy = 0x08
788 } PACKED;
791 Define the Queue Tag Codes.
794 enum BusLogic_QueueTag {
795 BusLogic_SimpleQueueTag = 0,
796 BusLogic_HeadOfQueueTag = 1,
797 BusLogic_OrderedQueueTag = 2,
798 BusLogic_ReservedQT = 3
802 Define the SCSI Command Descriptor Block (CDB).
805 #define BusLogic_CDB_MaxLength 12
807 typedef unsigned char SCSI_CDB_T[BusLogic_CDB_MaxLength];
811 Define the Scatter/Gather Segment structure required by the MultiMaster
812 Firmware Interface and the FlashPoint SCCB Manager.
815 struct BusLogic_ScatterGatherSegment {
816 u32 SegmentByteCount; /* Bytes 0-3 */
817 u32 SegmentDataPointer; /* Bytes 4-7 */
821 Define the Driver CCB Status Codes.
824 enum BusLogic_CCB_Status {
825 BusLogic_CCB_Free = 0,
826 BusLogic_CCB_Active = 1,
827 BusLogic_CCB_Completed = 2,
828 BusLogic_CCB_Reset = 3
829 } PACKED;
833 Define the 32 Bit Mode Command Control Block (CCB) structure. The first 40
834 bytes are defined by and common to both the MultiMaster Firmware and the
835 FlashPoint SCCB Manager. The next 60 bytes are defined by the FlashPoint
836 SCCB Manager. The remaining components are defined by the Linux BusLogic
837 Driver. Extended LUN Format CCBs differ from Legacy LUN Format 32 Bit Mode
838 CCBs only in having the TagEnable and QueueTag fields moved from byte 17 to
839 byte 1, and the Logical Unit field in byte 17 expanded to 6 bits. In theory,
840 Extended LUN Format CCBs can support up to 64 Logical Units, but in practice
841 many devices will respond improperly to Logical Units between 32 and 63, and
842 the SCSI-2 specification defines Bit 5 as LUNTAR. Extended LUN Format CCBs
843 are used by recent versions of the MultiMaster Firmware, as well as by the
844 FlashPoint SCCB Manager; the FlashPoint SCCB Manager only supports 32 Logical
845 Units. Since 64 Logical Units are unlikely to be needed in practice, and
846 since they are problematic for the above reasons, and since limiting them to
847 5 bits simplifies the CCB structure definition, this driver only supports
848 32 Logical Units per Target Device.
851 struct BusLogic_CCB {
853 MultiMaster Firmware and FlashPoint SCCB Manager Common Portion.
855 enum BusLogic_CCB_Opcode Opcode; /* Byte 0 */
856 unsigned char:3; /* Byte 1 Bits 0-2 */
857 enum BusLogic_DataDirection DataDirection:2; /* Byte 1 Bits 3-4 */
858 boolean TagEnable:1; /* Byte 1 Bit 5 */
859 enum BusLogic_QueueTag QueueTag:2; /* Byte 1 Bits 6-7 */
860 unsigned char CDB_Length; /* Byte 2 */
861 unsigned char SenseDataLength; /* Byte 3 */
862 u32 DataLength; /* Bytes 4-7 */
863 u32 DataPointer; /* Bytes 8-11 */
864 unsigned char:8; /* Byte 12 */
865 unsigned char:8; /* Byte 13 */
866 enum BusLogic_HostAdapterStatus HostAdapterStatus; /* Byte 14 */
867 enum BusLogic_TargetDeviceStatus TargetDeviceStatus; /* Byte 15 */
868 unsigned char TargetID; /* Byte 16 */
869 unsigned char LogicalUnit:5; /* Byte 17 Bits 0-4 */
870 boolean LegacyTagEnable:1; /* Byte 17 Bit 5 */
871 enum BusLogic_QueueTag LegacyQueueTag:2; /* Byte 17 Bits 6-7 */
872 SCSI_CDB_T CDB; /* Bytes 18-29 */
873 unsigned char:8; /* Byte 30 */
874 unsigned char:8; /* Byte 31 */
875 unsigned int:32; /* Bytes 32-35 */
876 u32 SenseDataPointer; /* Bytes 36-39 */
878 FlashPoint SCCB Manager Defined Portion.
880 void (*CallbackFunction) (struct BusLogic_CCB *); /* Bytes 40-43 */
881 u32 BaseAddress; /* Bytes 44-47 */
882 enum BusLogic_CompletionCode CompletionCode; /* Byte 48 */
883 #ifndef CONFIG_SCSI_OMIT_FLASHPOINT
884 unsigned char:8; /* Byte 49 */
885 unsigned short OS_Flags; /* Bytes 50-51 */
886 unsigned char Private[48]; /* Bytes 52-99 */
887 #endif
889 BusLogic Linux Driver Defined Portion.
891 dma_addr_t AllocationGroupHead;
892 unsigned int AllocationGroupSize;
893 u32 DMA_Handle;
894 enum BusLogic_CCB_Status Status;
895 unsigned long SerialNumber;
896 struct scsi_cmnd *Command;
897 struct BusLogic_HostAdapter *HostAdapter;
898 struct BusLogic_CCB *Next;
899 struct BusLogic_CCB *NextAll;
900 struct BusLogic_ScatterGatherSegment
901 ScatterGatherList[BusLogic_ScatterGatherLimit];
905 Define the 32 Bit Mode Outgoing Mailbox structure.
908 struct BusLogic_OutgoingMailbox {
909 u32 CCB; /* Bytes 0-3 */
910 unsigned int:24; /* Bytes 4-6 */
911 enum BusLogic_ActionCode ActionCode; /* Byte 7 */
915 Define the 32 Bit Mode Incoming Mailbox structure.
918 struct BusLogic_IncomingMailbox {
919 u32 CCB; /* Bytes 0-3 */
920 enum BusLogic_HostAdapterStatus HostAdapterStatus; /* Byte 4 */
921 enum BusLogic_TargetDeviceStatus TargetDeviceStatus; /* Byte 5 */
922 unsigned char:8; /* Byte 6 */
923 enum BusLogic_CompletionCode CompletionCode; /* Byte 7 */
928 Define the BusLogic Driver Options structure.
931 struct BusLogic_DriverOptions {
932 unsigned short TaggedQueuingPermitted;
933 unsigned short TaggedQueuingPermittedMask;
934 unsigned short BusSettleTime;
935 struct BusLogic_LocalOptions LocalOptions;
936 unsigned char CommonQueueDepth;
937 unsigned char QueueDepth[BusLogic_MaxTargetDevices];
941 Define the Host Adapter Target Flags structure.
944 struct BusLogic_TargetFlags {
945 boolean TargetExists:1;
946 boolean TaggedQueuingSupported:1;
947 boolean WideTransfersSupported:1;
948 boolean TaggedQueuingActive:1;
949 boolean WideTransfersActive:1;
950 boolean CommandSuccessfulFlag:1;
951 boolean TargetInfoReported:1;
955 Define the Host Adapter Target Statistics structure.
958 #define BusLogic_SizeBuckets 10
960 typedef unsigned int BusLogic_CommandSizeBuckets_T[BusLogic_SizeBuckets];
962 struct BusLogic_TargetStatistics {
963 unsigned int CommandsAttempted;
964 unsigned int CommandsCompleted;
965 unsigned int ReadCommands;
966 unsigned int WriteCommands;
967 struct BusLogic_ByteCounter TotalBytesRead;
968 struct BusLogic_ByteCounter TotalBytesWritten;
969 BusLogic_CommandSizeBuckets_T ReadCommandSizeBuckets;
970 BusLogic_CommandSizeBuckets_T WriteCommandSizeBuckets;
971 unsigned short CommandAbortsRequested;
972 unsigned short CommandAbortsAttempted;
973 unsigned short CommandAbortsCompleted;
974 unsigned short BusDeviceResetsRequested;
975 unsigned short BusDeviceResetsAttempted;
976 unsigned short BusDeviceResetsCompleted;
977 unsigned short HostAdapterResetsRequested;
978 unsigned short HostAdapterResetsAttempted;
979 unsigned short HostAdapterResetsCompleted;
983 Define the FlashPoint Card Handle data type.
986 #define FlashPoint_BadCardHandle 0xFFFFFFFF
988 typedef unsigned int FlashPoint_CardHandle_T;
992 Define the FlashPoint Information structure. This structure is defined
993 by the FlashPoint SCCB Manager.
996 struct FlashPoint_Info {
997 u32 BaseAddress; /* Bytes 0-3 */
998 boolean Present; /* Byte 4 */
999 unsigned char IRQ_Channel; /* Byte 5 */
1000 unsigned char SCSI_ID; /* Byte 6 */
1001 unsigned char SCSI_LUN; /* Byte 7 */
1002 unsigned short FirmwareRevision; /* Bytes 8-9 */
1003 unsigned short SynchronousPermitted; /* Bytes 10-11 */
1004 unsigned short FastPermitted; /* Bytes 12-13 */
1005 unsigned short UltraPermitted; /* Bytes 14-15 */
1006 unsigned short DisconnectPermitted; /* Bytes 16-17 */
1007 unsigned short WidePermitted; /* Bytes 18-19 */
1008 boolean ParityCheckingEnabled:1; /* Byte 20 Bit 0 */
1009 boolean HostWideSCSI:1; /* Byte 20 Bit 1 */
1010 boolean HostSoftReset:1; /* Byte 20 Bit 2 */
1011 boolean ExtendedTranslationEnabled:1; /* Byte 20 Bit 3 */
1012 boolean LowByteTerminated:1; /* Byte 20 Bit 4 */
1013 boolean HighByteTerminated:1; /* Byte 20 Bit 5 */
1014 boolean ReportDataUnderrun:1; /* Byte 20 Bit 6 */
1015 boolean SCAM_Enabled:1; /* Byte 20 Bit 7 */
1016 boolean SCAM_Level2:1; /* Byte 21 Bit 0 */
1017 unsigned char:7; /* Byte 21 Bits 1-7 */
1018 unsigned char Family; /* Byte 22 */
1019 unsigned char BusType; /* Byte 23 */
1020 unsigned char ModelNumber[3]; /* Bytes 24-26 */
1021 unsigned char RelativeCardNumber; /* Byte 27 */
1022 unsigned char Reserved[4]; /* Bytes 28-31 */
1023 unsigned int OS_Reserved; /* Bytes 32-35 */
1024 unsigned char TranslationInfo[4]; /* Bytes 36-39 */
1025 unsigned int Reserved2[5]; /* Bytes 40-59 */
1026 unsigned int SecondaryRange; /* Bytes 60-63 */
1030 Define the BusLogic Driver Host Adapter structure.
1033 struct BusLogic_HostAdapter {
1034 struct Scsi_Host *SCSI_Host;
1035 struct pci_dev *PCI_Device;
1036 enum BusLogic_HostAdapterType HostAdapterType;
1037 enum BusLogic_HostAdapterBusType HostAdapterBusType;
1038 unsigned long IO_Address;
1039 unsigned long PCI_Address;
1040 unsigned short AddressCount;
1041 unsigned char HostNumber;
1042 unsigned char ModelName[9];
1043 unsigned char FirmwareVersion[6];
1044 unsigned char FullModelName[18];
1045 unsigned char Bus;
1046 unsigned char Device;
1047 unsigned char IRQ_Channel;
1048 unsigned char DMA_Channel;
1049 unsigned char SCSI_ID;
1050 boolean IRQ_ChannelAcquired:1;
1051 boolean DMA_ChannelAcquired:1;
1052 boolean ExtendedTranslationEnabled:1;
1053 boolean ParityCheckingEnabled:1;
1054 boolean BusResetEnabled:1;
1055 boolean LevelSensitiveInterrupt:1;
1056 boolean HostWideSCSI:1;
1057 boolean HostDifferentialSCSI:1;
1058 boolean HostSupportsSCAM:1;
1059 boolean HostUltraSCSI:1;
1060 boolean ExtendedLUNSupport:1;
1061 boolean TerminationInfoValid:1;
1062 boolean LowByteTerminated:1;
1063 boolean HighByteTerminated:1;
1064 boolean BounceBuffersRequired:1;
1065 boolean StrictRoundRobinModeSupport:1;
1066 boolean SCAM_Enabled:1;
1067 boolean SCAM_Level2:1;
1068 boolean HostAdapterInitialized:1;
1069 boolean HostAdapterExternalReset:1;
1070 boolean HostAdapterInternalError:1;
1071 boolean ProcessCompletedCCBsActive;
1072 volatile boolean HostAdapterCommandCompleted;
1073 unsigned short HostAdapterScatterGatherLimit;
1074 unsigned short DriverScatterGatherLimit;
1075 unsigned short MaxTargetDevices;
1076 unsigned short MaxLogicalUnits;
1077 unsigned short MailboxCount;
1078 unsigned short InitialCCBs;
1079 unsigned short IncrementalCCBs;
1080 unsigned short AllocatedCCBs;
1081 unsigned short DriverQueueDepth;
1082 unsigned short HostAdapterQueueDepth;
1083 unsigned short UntaggedQueueDepth;
1084 unsigned short CommonQueueDepth;
1085 unsigned short BusSettleTime;
1086 unsigned short SynchronousPermitted;
1087 unsigned short FastPermitted;
1088 unsigned short UltraPermitted;
1089 unsigned short WidePermitted;
1090 unsigned short DisconnectPermitted;
1091 unsigned short TaggedQueuingPermitted;
1092 unsigned short ExternalHostAdapterResets;
1093 unsigned short HostAdapterInternalErrors;
1094 unsigned short TargetDeviceCount;
1095 unsigned short MessageBufferLength;
1096 u32 BIOS_Address;
1097 struct BusLogic_DriverOptions *DriverOptions;
1098 struct FlashPoint_Info FlashPointInfo;
1099 FlashPoint_CardHandle_T CardHandle;
1100 struct list_head host_list;
1101 struct BusLogic_CCB *All_CCBs;
1102 struct BusLogic_CCB *Free_CCBs;
1103 struct BusLogic_CCB *FirstCompletedCCB;
1104 struct BusLogic_CCB *LastCompletedCCB;
1105 struct BusLogic_CCB *BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices];
1106 struct BusLogic_TargetFlags TargetFlags[BusLogic_MaxTargetDevices];
1107 unsigned char QueueDepth[BusLogic_MaxTargetDevices];
1108 unsigned char SynchronousPeriod[BusLogic_MaxTargetDevices];
1109 unsigned char SynchronousOffset[BusLogic_MaxTargetDevices];
1110 unsigned char ActiveCommands[BusLogic_MaxTargetDevices];
1111 unsigned int CommandsSinceReset[BusLogic_MaxTargetDevices];
1112 unsigned long LastSequencePoint[BusLogic_MaxTargetDevices];
1113 unsigned long LastResetAttempted[BusLogic_MaxTargetDevices];
1114 unsigned long LastResetCompleted[BusLogic_MaxTargetDevices];
1115 struct BusLogic_OutgoingMailbox *FirstOutgoingMailbox;
1116 struct BusLogic_OutgoingMailbox *LastOutgoingMailbox;
1117 struct BusLogic_OutgoingMailbox *NextOutgoingMailbox;
1118 struct BusLogic_IncomingMailbox *FirstIncomingMailbox;
1119 struct BusLogic_IncomingMailbox *LastIncomingMailbox;
1120 struct BusLogic_IncomingMailbox *NextIncomingMailbox;
1121 struct BusLogic_TargetStatistics TargetStatistics[BusLogic_MaxTargetDevices];
1122 unsigned char *MailboxSpace;
1123 dma_addr_t MailboxSpaceHandle;
1124 unsigned int MailboxSize;
1125 unsigned long CCB_Offset;
1126 char MessageBuffer[BusLogic_MessageBufferSize];
1130 Define a structure for the BIOS Disk Parameters.
1133 struct BIOS_DiskParameters {
1134 int Heads;
1135 int Sectors;
1136 int Cylinders;
1140 Define a structure for the SCSI Inquiry command results.
1143 struct SCSI_Inquiry {
1144 unsigned char PeripheralDeviceType:5; /* Byte 0 Bits 0-4 */
1145 unsigned char PeripheralQualifier:3; /* Byte 0 Bits 5-7 */
1146 unsigned char DeviceTypeModifier:7; /* Byte 1 Bits 0-6 */
1147 boolean RMB:1; /* Byte 1 Bit 7 */
1148 unsigned char ANSI_ApprovedVersion:3; /* Byte 2 Bits 0-2 */
1149 unsigned char ECMA_Version:3; /* Byte 2 Bits 3-5 */
1150 unsigned char ISO_Version:2; /* Byte 2 Bits 6-7 */
1151 unsigned char ResponseDataFormat:4; /* Byte 3 Bits 0-3 */
1152 unsigned char:2; /* Byte 3 Bits 4-5 */
1153 boolean TrmIOP:1; /* Byte 3 Bit 6 */
1154 boolean AENC:1; /* Byte 3 Bit 7 */
1155 unsigned char AdditionalLength; /* Byte 4 */
1156 unsigned char:8; /* Byte 5 */
1157 unsigned char:8; /* Byte 6 */
1158 boolean SftRe:1; /* Byte 7 Bit 0 */
1159 boolean CmdQue:1; /* Byte 7 Bit 1 */
1160 boolean:1; /* Byte 7 Bit 2 */
1161 boolean Linked:1; /* Byte 7 Bit 3 */
1162 boolean Sync:1; /* Byte 7 Bit 4 */
1163 boolean WBus16:1; /* Byte 7 Bit 5 */
1164 boolean WBus32:1; /* Byte 7 Bit 6 */
1165 boolean RelAdr:1; /* Byte 7 Bit 7 */
1166 unsigned char VendorIdentification[8]; /* Bytes 8-15 */
1167 unsigned char ProductIdentification[16]; /* Bytes 16-31 */
1168 unsigned char ProductRevisionLevel[4]; /* Bytes 32-35 */
1173 Define functions to provide an abstraction for reading and writing the
1174 Host Adapter I/O Registers.
1177 static inline void BusLogic_SCSIBusReset(struct BusLogic_HostAdapter *HostAdapter)
1179 union BusLogic_ControlRegister ControlRegister;
1180 ControlRegister.All = 0;
1181 ControlRegister.cr.SCSIBusReset = true;
1182 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1185 static inline void BusLogic_InterruptReset(struct BusLogic_HostAdapter *HostAdapter)
1187 union BusLogic_ControlRegister ControlRegister;
1188 ControlRegister.All = 0;
1189 ControlRegister.cr.InterruptReset = true;
1190 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1193 static inline void BusLogic_SoftReset(struct BusLogic_HostAdapter *HostAdapter)
1195 union BusLogic_ControlRegister ControlRegister;
1196 ControlRegister.All = 0;
1197 ControlRegister.cr.SoftReset = true;
1198 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1201 static inline void BusLogic_HardReset(struct BusLogic_HostAdapter *HostAdapter)
1203 union BusLogic_ControlRegister ControlRegister;
1204 ControlRegister.All = 0;
1205 ControlRegister.cr.HardReset = true;
1206 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1209 static inline unsigned char BusLogic_ReadStatusRegister(struct BusLogic_HostAdapter *HostAdapter)
1211 return inb(HostAdapter->IO_Address + BusLogic_StatusRegisterOffset);
1214 static inline void BusLogic_WriteCommandParameterRegister(struct BusLogic_HostAdapter
1215 *HostAdapter, unsigned char Value)
1217 outb(Value, HostAdapter->IO_Address + BusLogic_CommandParameterRegisterOffset);
1220 static inline unsigned char BusLogic_ReadDataInRegister(struct BusLogic_HostAdapter *HostAdapter)
1222 return inb(HostAdapter->IO_Address + BusLogic_DataInRegisterOffset);
1225 static inline unsigned char BusLogic_ReadInterruptRegister(struct BusLogic_HostAdapter *HostAdapter)
1227 return inb(HostAdapter->IO_Address + BusLogic_InterruptRegisterOffset);
1230 static inline unsigned char BusLogic_ReadGeometryRegister(struct BusLogic_HostAdapter *HostAdapter)
1232 return inb(HostAdapter->IO_Address + BusLogic_GeometryRegisterOffset);
1236 BusLogic_StartMailboxCommand issues an Execute Mailbox Command, which
1237 notifies the Host Adapter that an entry has been made in an Outgoing
1238 Mailbox.
1241 static inline void BusLogic_StartMailboxCommand(struct BusLogic_HostAdapter *HostAdapter)
1243 BusLogic_WriteCommandParameterRegister(HostAdapter, BusLogic_ExecuteMailboxCommand);
1247 BusLogic_Delay waits for Seconds to elapse.
1250 static inline void BusLogic_Delay(int Seconds)
1252 mdelay(1000 * Seconds);
1256 Virtual_to_Bus and Bus_to_Virtual map between Kernel Virtual Addresses
1257 and PCI/VLB/EISA/ISA Bus Addresses.
1260 static inline u32 Virtual_to_Bus(void *VirtualAddress)
1262 return (u32) virt_to_bus(VirtualAddress);
1265 static inline void *Bus_to_Virtual(u32 BusAddress)
1267 return (void *) bus_to_virt(BusAddress);
1271 Virtual_to_32Bit_Virtual maps between Kernel Virtual Addresses and
1272 32 bit Kernel Virtual Addresses. This avoids compilation warnings
1273 on 64 bit architectures.
1276 static inline u32 Virtual_to_32Bit_Virtual(void *VirtualAddress)
1278 return (u32) (unsigned long) VirtualAddress;
1282 BusLogic_IncrementErrorCounter increments Error Counter by 1, stopping at
1283 65535 rather than wrapping around to 0.
1286 static inline void BusLogic_IncrementErrorCounter(unsigned short *ErrorCounter)
1288 if (*ErrorCounter < 65535)
1289 (*ErrorCounter)++;
1293 BusLogic_IncrementByteCounter increments Byte Counter by Amount.
1296 static inline void BusLogic_IncrementByteCounter(struct BusLogic_ByteCounter
1297 *ByteCounter, unsigned int Amount)
1299 ByteCounter->Units += Amount;
1300 if (ByteCounter->Units > 999999999) {
1301 ByteCounter->Units -= 1000000000;
1302 ByteCounter->Billions++;
1307 BusLogic_IncrementSizeBucket increments the Bucket for Amount.
1310 static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T CommandSizeBuckets, unsigned int Amount)
1312 int Index = 0;
1313 if (Amount < 8 * 1024) {
1314 if (Amount < 2 * 1024)
1315 Index = (Amount < 1 * 1024 ? 0 : 1);
1316 else
1317 Index = (Amount < 4 * 1024 ? 2 : 3);
1318 } else if (Amount < 128 * 1024) {
1319 if (Amount < 32 * 1024)
1320 Index = (Amount < 16 * 1024 ? 4 : 5);
1321 else
1322 Index = (Amount < 64 * 1024 ? 6 : 7);
1323 } else
1324 Index = (Amount < 256 * 1024 ? 8 : 9);
1325 CommandSizeBuckets[Index]++;
1329 Define the version number of the FlashPoint Firmware (SCCB Manager).
1332 #define FlashPoint_FirmwareVersion "5.02"
1335 Define the possible return values from FlashPoint_HandleInterrupt.
1338 #define FlashPoint_NormalInterrupt 0x00
1339 #define FlashPoint_InternalError 0xFE
1340 #define FlashPoint_ExternalBusReset 0xFF
1343 Define prototypes for the forward referenced BusLogic Driver
1344 Internal Functions.
1347 static const char *BusLogic_DriverInfo(struct Scsi_Host *);
1348 static int BusLogic_QueueCommand(struct scsi_cmnd *, void (*CompletionRoutine) (struct scsi_cmnd *));
1349 static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *);
1350 static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *, char **, off_t, int, int);
1351 static int BusLogic_SlaveConfigure(struct scsi_device *);
1352 static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *);
1353 static irqreturn_t BusLogic_InterruptHandler(int, void *, struct pt_regs *);
1354 static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *, boolean HardReset);
1355 static void BusLogic_Message(enum BusLogic_MessageLevel, char *, struct BusLogic_HostAdapter *, ...);
1356 static int __init BusLogic_Setup(char *);
1358 #endif /* _BUSLOGIC_H */