OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [scsi/] [BusLogic.h] - Blame information for rev 1626

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
/*
2
 
3
  Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters
4
 
5
  Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>
6
 
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.
10
 
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.
15
 
16
  The author respectfully requests that any modifications to this software be
17
  sent directly to him for evaluation and testing.
18
 
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.
22
 
23
  Finally, special thanks to Mylex/BusLogic for making the FlashPoint SCCB
24
  Manager available as freely redistributable source code.
25
 
26
*/
27
 
28
 
29
#include <linux/config.h>
30
 
31
 
32
/*
33
  Define types for some of the structures that interface with the rest
34
  of the Linux Kernel and SCSI Subsystem.
35
*/
36
 
37
typedef kdev_t KernelDevice_T;
38
typedef struct proc_dir_entry PROC_DirectoryEntry_T;
39
typedef unsigned long ProcessorFlags_T;
40
typedef struct pt_regs Registers_T;
41
typedef struct partition PartitionTable_T;
42
typedef Scsi_Host_Template SCSI_Host_Template_T;
43
typedef struct Scsi_Host SCSI_Host_T;
44
typedef struct scsi_device SCSI_Device_T;
45
typedef struct scsi_disk SCSI_Disk_T;
46
typedef struct scsi_cmnd SCSI_Command_T;
47
typedef struct scatterlist SCSI_ScatterList_T;
48
 
49
 
50
/*
51
  Define prototypes for the BusLogic Driver Interface Functions.
52
*/
53
 
54
extern PROC_DirectoryEntry_T BusLogic_ProcDirectoryEntry;
55
extern const char *BusLogic_DriverInfo(SCSI_Host_T *);
56
extern int BusLogic_DetectHostAdapter(SCSI_Host_Template_T *);
57
extern int BusLogic_ReleaseHostAdapter(SCSI_Host_T *);
58
extern int BusLogic_QueueCommand(SCSI_Command_T *,
59
                                 void (*CompletionRoutine)(SCSI_Command_T *));
60
extern int BusLogic_AbortCommand(SCSI_Command_T *);
61
extern int BusLogic_ResetCommand(SCSI_Command_T *, unsigned int);
62
extern int BusLogic_BIOSDiskParameters(SCSI_Disk_T *, KernelDevice_T, int *);
63
extern int BusLogic_ProcDirectoryInfo(char *, char **, off_t, int, int, int);
64
 
65
 
66
/*
67
  Define the BusLogic SCSI Host Template structure.
68
*/
69
 
70
#define BUSLOGIC                                                               \
71
  { proc_dir:       &BusLogic_ProcDirectoryEntry, /* ProcFS Directory Entry */ \
72
    proc_info:      BusLogic_ProcDirectoryInfo,   /* ProcFS Info Function   */ \
73
    name:           "BusLogic",                   /* Driver Name            */ \
74
    detect:         BusLogic_DetectHostAdapter,   /* Detect Host Adapter    */ \
75
    release:        BusLogic_ReleaseHostAdapter,  /* Release Host Adapter   */ \
76
    info:           BusLogic_DriverInfo,          /* Driver Info Function   */ \
77
    queuecommand:   BusLogic_QueueCommand,        /* Queue Command Function */ \
78
    abort:          BusLogic_AbortCommand,        /* Abort Command Function */ \
79
    reset:          BusLogic_ResetCommand,        /* Reset Command Function */ \
80
    bios_param:     BusLogic_BIOSDiskParameters,  /* BIOS Disk Parameters   */ \
81
    unchecked_isa_dma: 1,                         /* Default Initial Value  */ \
82
    use_clustering: ENABLE_CLUSTERING }           /* Enable Clustering      */
83
 
84
 
85
/*
86
  BusLogic_DriverVersion protects the private portion of this file.
87
*/
88
 
89
#ifdef BusLogic_DriverVersion
90
 
91
 
92
/*
93
  FlashPoint support is only available for the Intel x86 Architecture with
94
  CONFIG_PCI set.
95
*/
96
 
97
#ifndef __i386__
98
#undef CONFIG_SCSI_OMIT_FLASHPOINT
99
#define CONFIG_SCSI_OMIT_FLASHPOINT
100
#endif
101
 
102
#ifndef CONFIG_PCI
103
#undef CONFIG_SCSI_OMIT_FLASHPOINT
104
#define CONFIG_SCSI_OMIT_FLASHPOINT
105
#define BusLogic_InitializeProbeInfoListISA \
106
  BusLogic_InitializeProbeInfoList
107
#endif
108
 
109
 
110
/*
111
  Define the maximum number of BusLogic Host Adapters supported by this driver.
112
*/
113
 
114
#define BusLogic_MaxHostAdapters                16
115
 
116
 
117
/*
118
  Define the maximum number of Target Devices supported by this driver.
119
*/
120
 
121
#define BusLogic_MaxTargetDevices               16
122
 
123
 
124
/*
125
  Define the maximum number of Scatter/Gather Segments used by this driver.
126
  For optimal performance, it is important that this limit be at least as
127
  large as the largest single request generated by the I/O Subsystem.
128
*/
129
 
130
#define BusLogic_ScatterGatherLimit             128
131
 
132
 
133
/*
134
  Define the maximum, maximum automatic, minimum automatic, and default Queue
135
  Depth to allow for Target Devices depending on whether or not they support
136
  Tagged Queuing and whether or not ISA Bounce Buffers are required.
137
*/
138
 
139
#define BusLogic_MaxTaggedQueueDepth            64
140
#define BusLogic_MaxAutomaticTaggedQueueDepth   28
141
#define BusLogic_MinAutomaticTaggedQueueDepth   7
142
#define BusLogic_TaggedQueueDepthBB             3
143
#define BusLogic_UntaggedQueueDepth             3
144
#define BusLogic_UntaggedQueueDepthBB           2
145
 
146
 
147
/*
148
  Define the default amount of time in seconds to wait between a Host Adapter
149
  Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI commands.
150
  Some SCSI devices get confused if they receive SCSI commands too soon after
151
  a SCSI Bus Reset.
152
*/
153
 
154
#define BusLogic_DefaultBusSettleTime           2
155
 
156
 
157
/*
158
  Define the maximum number of Mailboxes that should be used for MultiMaster
159
  Host Adapters.  This number is chosen to be larger than the maximum Host
160
  Adapter Queue Depth and small enough so that the Host Adapter structure
161
  does not cross an allocation block size boundary.
162
*/
163
 
164
#define BusLogic_MaxMailboxes                   211
165
 
166
 
167
/*
168
  Define the number of CCBs that should be allocated as a group to optimize
169
  Kernel memory allocation.
170
*/
171
 
172
#define BusLogic_CCB_AllocationGroupSize        7
173
 
174
 
175
/*
176
  Define the Host Adapter Line and Message Buffer Sizes.
177
*/
178
 
179
#define BusLogic_LineBufferSize                 100
180
#define BusLogic_MessageBufferSize              9700
181
 
182
 
183
/*
184
  Define the Driver Message Levels.
185
*/
186
 
187
typedef enum BusLogic_MessageLevel
188
{
189
  BusLogic_AnnounceLevel =                      0,
190
  BusLogic_InfoLevel =                          1,
191
  BusLogic_NoticeLevel =                        2,
192
  BusLogic_WarningLevel =                       3,
193
  BusLogic_ErrorLevel =                         4
194
}
195
BusLogic_MessageLevel_T;
196
 
197
static char
198
  *BusLogic_MessageLevelMap[] =
199
    { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };
200
 
201
 
202
/*
203
  Define Driver Message macros.
204
*/
205
 
206
#define BusLogic_Announce(Format, Arguments...) \
207
  BusLogic_Message(BusLogic_AnnounceLevel, Format, ##Arguments)
208
 
209
#define BusLogic_Info(Format, Arguments...) \
210
  BusLogic_Message(BusLogic_InfoLevel, Format, ##Arguments)
211
 
212
#define BusLogic_Notice(Format, Arguments...) \
213
  BusLogic_Message(BusLogic_NoticeLevel, Format, ##Arguments)
214
 
215
#define BusLogic_Warning(Format, Arguments...) \
216
  BusLogic_Message(BusLogic_WarningLevel, Format, ##Arguments)
217
 
218
#define BusLogic_Error(Format, Arguments...) \
219
  BusLogic_Message(BusLogic_ErrorLevel, Format, ##Arguments)
220
 
221
 
222
/*
223
  Define the types of BusLogic Host Adapters that are supported and the number
224
  of I/O Addresses required by each type.
225
*/
226
 
227
typedef enum
228
{
229
  BusLogic_MultiMaster =                        1,
230
  BusLogic_FlashPoint =                         2
231
}
232
__attribute__ ((packed))
233
BusLogic_HostAdapterType_T;
234
 
235
#define BusLogic_MultiMasterAddressCount        4
236
#define BusLogic_FlashPointAddressCount         256
237
 
238
static int
239
  BusLogic_HostAdapterAddressCount[3] =
240
    { 0, BusLogic_MultiMasterAddressCount, BusLogic_FlashPointAddressCount };
241
 
242
 
243
/*
244
  Define macros for testing the Host Adapter Type.
245
*/
246
 
247
#ifndef CONFIG_SCSI_OMIT_FLASHPOINT
248
 
249
#define BusLogic_MultiMasterHostAdapterP(HostAdapter) \
250
  (HostAdapter->HostAdapterType == BusLogic_MultiMaster)
251
 
252
#define BusLogic_FlashPointHostAdapterP(HostAdapter) \
253
  (HostAdapter->HostAdapterType == BusLogic_FlashPoint)
254
 
255
#else
256
 
257
#define BusLogic_MultiMasterHostAdapterP(HostAdapter) \
258
  (true)
259
 
260
#define BusLogic_FlashPointHostAdapterP(HostAdapter) \
261
  (false)
262
 
263
#endif
264
 
265
 
266
/*
267
  Define the possible Host Adapter Bus Types.
268
*/
269
 
270
typedef enum
271
{
272
  BusLogic_Unknown_Bus =                        0,
273
  BusLogic_ISA_Bus =                            1,
274
  BusLogic_EISA_Bus =                           2,
275
  BusLogic_PCI_Bus =                            3,
276
  BusLogic_VESA_Bus =                           4,
277
  BusLogic_MCA_Bus =                            5
278
}
279
__attribute__ ((packed))
280
BusLogic_HostAdapterBusType_T;
281
 
282
static char
283
  *BusLogic_HostAdapterBusNames[] =
284
    { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };
285
 
286
static BusLogic_HostAdapterBusType_T
287
  BusLogic_HostAdapterBusTypes[] =
288
    { BusLogic_VESA_Bus,                                /* BT-4xx */
289
      BusLogic_ISA_Bus,                                 /* BT-5xx */
290
      BusLogic_MCA_Bus,                                 /* BT-6xx */
291
      BusLogic_EISA_Bus,                                /* BT-7xx */
292
      BusLogic_Unknown_Bus,                             /* BT-8xx */
293
      BusLogic_PCI_Bus };                               /* BT-9xx */
294
 
295
 
296
/*
297
  Define the possible Host Adapter BIOS Disk Geometry Translations.
298
*/
299
 
300
typedef enum BusLogic_BIOS_DiskGeometryTranslation
301
{
302
  BusLogic_BIOS_Disk_Not_Installed =            0,
303
  BusLogic_BIOS_Disk_Installed_64x32 =          1,
304
  BusLogic_BIOS_Disk_Installed_128x32 =         2,
305
  BusLogic_BIOS_Disk_Installed_255x63 =         3
306
}
307
__attribute__ ((packed))
308
BusLogic_BIOS_DiskGeometryTranslation_T;
309
 
310
 
311
/*
312
  Define a Boolean data type.
313
*/
314
 
315
typedef enum { false, true } __attribute__ ((packed)) boolean;
316
 
317
 
318
/*
319
  Define a 32 bit I/O Address data type.
320
*/
321
 
322
typedef unsigned int BusLogic_IO_Address_T;
323
 
324
 
325
/*
326
  Define a 32 bit PCI Bus Address data type.
327
*/
328
 
329
typedef unsigned int BusLogic_PCI_Address_T;
330
 
331
 
332
/*
333
  Define a 32 bit Base Address data type.
334
*/
335
 
336
typedef unsigned int BusLogic_Base_Address_T;
337
 
338
 
339
/*
340
  Define a 32 bit Bus Address data type.
341
*/
342
 
343
typedef unsigned int BusLogic_BusAddress_T;
344
 
345
 
346
/*
347
  Define a 32 bit Byte Count data type.
348
*/
349
 
350
typedef unsigned int BusLogic_ByteCount_T;
351
 
352
 
353
/*
354
  Define a 10^18 Statistics Byte Counter data type.
355
*/
356
 
357
typedef struct BusLogic_ByteCounter
358
{
359
  unsigned int Units;
360
  unsigned int Billions;
361
}
362
BusLogic_ByteCounter_T;
363
 
364
 
365
/*
366
  Define the structure for I/O Address and Bus Probing Information.
367
*/
368
 
369
typedef struct BusLogic_ProbeInfo
370
{
371
  BusLogic_HostAdapterType_T HostAdapterType;
372
  BusLogic_HostAdapterBusType_T HostAdapterBusType;
373
  BusLogic_IO_Address_T IO_Address;
374
  BusLogic_PCI_Address_T PCI_Address;
375
  unsigned char Bus;
376
  unsigned char Device;
377
  unsigned char IRQ_Channel;
378
}
379
BusLogic_ProbeInfo_T;
380
 
381
 
382
/*
383
  Define the Probe Options.
384
*/
385
 
386
typedef struct BusLogic_ProbeOptions
387
{
388
  boolean NoProbe:1;                                    /* Bit 0 */
389
  boolean NoProbeISA:1;                                 /* Bit 1 */
390
  boolean NoProbePCI:1;                                 /* Bit 2 */
391
  boolean NoSortPCI:1;                                  /* Bit 3 */
392
  boolean MultiMasterFirst:1;                           /* Bit 4 */
393
  boolean FlashPointFirst:1;                            /* Bit 5 */
394
  boolean LimitedProbeISA:1;                            /* Bit 6 */
395
  boolean Probe330:1;                                   /* Bit 7 */
396
  boolean Probe334:1;                                   /* Bit 8 */
397
  boolean Probe230:1;                                   /* Bit 9 */
398
  boolean Probe234:1;                                   /* Bit 10 */
399
  boolean Probe130:1;                                   /* Bit 11 */
400
  boolean Probe134:1;                                   /* Bit 12 */
401
}
402
BusLogic_ProbeOptions_T;
403
 
404
 
405
/*
406
  Define the Global Options.
407
*/
408
 
409
typedef struct BusLogic_GlobalOptions
410
{
411
  boolean TraceProbe:1;                                 /* Bit 0 */
412
  boolean TraceHardwareReset:1;                         /* Bit 1 */
413
  boolean TraceConfiguration:1;                         /* Bit 2 */
414
  boolean TraceErrors:1;                                /* Bit 3 */
415
}
416
BusLogic_GlobalOptions_T;
417
 
418
 
419
/*
420
  Define the Local Options.
421
*/
422
 
423
typedef struct BusLogic_LocalOptions
424
{
425
  boolean InhibitTargetInquiry:1;                       /* Bit 0 */
426
}
427
BusLogic_LocalOptions_T;
428
 
429
 
430
/*
431
  Define the Error Recovery Strategy Options.
432
*/
433
 
434
typedef enum
435
{
436
  BusLogic_ErrorRecovery_Default =              0,
437
  BusLogic_ErrorRecovery_BusDeviceReset =       1,
438
  BusLogic_ErrorRecovery_HardReset =            2,
439
  BusLogic_ErrorRecovery_None =                 3
440
}
441
__attribute__ ((packed))
442
BusLogic_ErrorRecoveryStrategy_T;
443
 
444
static char
445
  *BusLogic_ErrorRecoveryStrategyNames[] =
446
    { "Default", "Bus Device Reset", "Hard Reset", "None" },
447
  BusLogic_ErrorRecoveryStrategyLetters[] =
448
    { 'D', 'B', 'H', 'N' };
449
 
450
 
451
/*
452
  Define the BusLogic SCSI Host Adapter I/O Register Offsets.
453
*/
454
 
455
#define BusLogic_ControlRegisterOffset          0        /* WO register */
456
#define BusLogic_StatusRegisterOffset           0        /* RO register */
457
#define BusLogic_CommandParameterRegisterOffset 1       /* WO register */
458
#define BusLogic_DataInRegisterOffset           1       /* RO register */
459
#define BusLogic_InterruptRegisterOffset        2       /* RO register */
460
#define BusLogic_GeometryRegisterOffset         3       /* RO register */
461
 
462
 
463
/*
464
  Define the structure of the write-only Control Register.
465
*/
466
 
467
typedef union BusLogic_ControlRegister
468
{
469
  unsigned char All;
470
  struct {
471
    unsigned char :4;                                   /* Bits 0-3 */
472
    boolean SCSIBusReset:1;                             /* Bit 4 */
473
    boolean InterruptReset:1;                           /* Bit 5 */
474
    boolean SoftReset:1;                                /* Bit 6 */
475
    boolean HardReset:1;                                /* Bit 7 */
476
  } Bits;
477
}
478
BusLogic_ControlRegister_T;
479
 
480
 
481
/*
482
  Define the structure of the read-only Status Register.
483
*/
484
 
485
typedef union BusLogic_StatusRegister
486
{
487
  unsigned char All;
488
  struct {
489
    boolean CommandInvalid:1;                           /* Bit 0 */
490
    boolean Reserved:1;                                 /* Bit 1 */
491
    boolean DataInRegisterReady:1;                      /* Bit 2 */
492
    boolean CommandParameterRegisterBusy:1;             /* Bit 3 */
493
    boolean HostAdapterReady:1;                         /* Bit 4 */
494
    boolean InitializationRequired:1;                   /* Bit 5 */
495
    boolean DiagnosticFailure:1;                        /* Bit 6 */
496
    boolean DiagnosticActive:1;                         /* Bit 7 */
497
  } Bits;
498
}
499
BusLogic_StatusRegister_T;
500
 
501
 
502
/*
503
  Define the structure of the read-only Interrupt Register.
504
*/
505
 
506
typedef union BusLogic_InterruptRegister
507
{
508
  unsigned char All;
509
  struct {
510
    boolean IncomingMailboxLoaded:1;                    /* Bit 0 */
511
    boolean OutgoingMailboxAvailable:1;                 /* Bit 1 */
512
    boolean CommandComplete:1;                          /* Bit 2 */
513
    boolean ExternalBusReset:1;                         /* Bit 3 */
514
    unsigned char Reserved:3;                           /* Bits 4-6 */
515
    boolean InterruptValid:1;                           /* Bit 7 */
516
  } Bits;
517
}
518
BusLogic_InterruptRegister_T;
519
 
520
 
521
/*
522
  Define the structure of the read-only Geometry Register.
523
*/
524
 
525
typedef union BusLogic_GeometryRegister
526
{
527
  unsigned char All;
528
  struct {
529
    BusLogic_BIOS_DiskGeometryTranslation_T Drive0Geometry:2; /* Bits 0-1 */
530
    BusLogic_BIOS_DiskGeometryTranslation_T Drive1Geometry:2; /* Bits 2-3 */
531
    unsigned char :3;                                   /* Bits 4-6 */
532
    boolean ExtendedTranslationEnabled:1;               /* Bit 7 */
533
  } Bits;
534
}
535
BusLogic_GeometryRegister_T;
536
 
537
 
538
/*
539
  Define the BusLogic SCSI Host Adapter Command Register Operation Codes.
540
*/
541
 
542
typedef enum
543
{
544
  BusLogic_TestCommandCompleteInterrupt =       0x00,
545
  BusLogic_InitializeMailbox =                  0x01,
546
  BusLogic_ExecuteMailboxCommand =              0x02,
547
  BusLogic_ExecuteBIOSCommand =                 0x03,
548
  BusLogic_InquireBoardID =                     0x04,
549
  BusLogic_EnableOutgoingMailboxAvailableInt =  0x05,
550
  BusLogic_SetSCSISelectionTimeout =            0x06,
551
  BusLogic_SetPreemptTimeOnBus =                0x07,
552
  BusLogic_SetTimeOffBus =                      0x08,
553
  BusLogic_SetBusTransferRate =                 0x09,
554
  BusLogic_InquireInstalledDevicesID0to7 =      0x0A,
555
  BusLogic_InquireConfiguration =               0x0B,
556
  BusLogic_EnableTargetMode =                   0x0C,
557
  BusLogic_InquireSetupInformation =            0x0D,
558
  BusLogic_WriteAdapterLocalRAM =               0x1A,
559
  BusLogic_ReadAdapterLocalRAM =                0x1B,
560
  BusLogic_WriteBusMasterChipFIFO =             0x1C,
561
  BusLogic_ReadBusMasterChipFIFO =              0x1D,
562
  BusLogic_EchoCommandData =                    0x1F,
563
  BusLogic_HostAdapterDiagnostic =              0x20,
564
  BusLogic_SetAdapterOptions =                  0x21,
565
  BusLogic_InquireInstalledDevicesID8to15 =     0x23,
566
  BusLogic_InquireTargetDevices =               0x24,
567
  BusLogic_DisableHostAdapterInterrupt =        0x25,
568
  BusLogic_InitializeExtendedMailbox =          0x81,
569
  BusLogic_ExecuteSCSICommand =                 0x83,
570
  BusLogic_InquireFirmwareVersion3rdDigit =     0x84,
571
  BusLogic_InquireFirmwareVersionLetter =       0x85,
572
  BusLogic_InquirePCIHostAdapterInformation =   0x86,
573
  BusLogic_InquireHostAdapterModelNumber =      0x8B,
574
  BusLogic_InquireSynchronousPeriod =           0x8C,
575
  BusLogic_InquireExtendedSetupInformation =    0x8D,
576
  BusLogic_EnableStrictRoundRobinMode =         0x8F,
577
  BusLogic_StoreHostAdapterLocalRAM =           0x90,
578
  BusLogic_FetchHostAdapterLocalRAM =           0x91,
579
  BusLogic_StoreLocalDataInEEPROM =             0x92,
580
  BusLogic_UploadAutoSCSICode =                 0x94,
581
  BusLogic_ModifyIOAddress =                    0x95,
582
  BusLogic_SetCCBFormat =                       0x96,
583
  BusLogic_WriteInquiryBuffer =                 0x9A,
584
  BusLogic_ReadInquiryBuffer =                  0x9B,
585
  BusLogic_FlashROMUploadDownload =             0xA7,
586
  BusLogic_ReadSCAMData =                       0xA8,
587
  BusLogic_WriteSCAMData =                      0xA9
588
}
589
BusLogic_OperationCode_T;
590
 
591
 
592
/*
593
  Define the Inquire Board ID reply structure.
594
*/
595
 
596
typedef struct BusLogic_BoardID
597
{
598
  unsigned char BoardType;                              /* Byte 0 */
599
  unsigned char CustomFeatures;                         /* Byte 1 */
600
  unsigned char FirmwareVersion1stDigit;                /* Byte 2 */
601
  unsigned char FirmwareVersion2ndDigit;                /* Byte 3 */
602
}
603
BusLogic_BoardID_T;
604
 
605
 
606
/*
607
  Define the Inquire Installed Devices ID 0 to 7 and Inquire Installed
608
  Devices ID 8 to 15 reply type.  For each Target Device, a byte is returned
609
  where bit 0 set indicates that Logical Unit 0 exists, bit 1 set indicates
610
  that Logical Unit 1 exists, and so on.
611
*/
612
 
613
typedef unsigned char BusLogic_InstalledDevices8_T[8];
614
 
615
 
616
/*
617
  Define the Inquire Target Devices reply type.  Inquire Target Devices only
618
  tests Logical Unit 0 of each Target Device unlike the Inquire Installed
619
  Devices commands which test Logical Units 0 - 7.  Two bytes are returned,
620
  where byte 0 bit 0 set indicates that Target Device 0 exists, and so on.
621
*/
622
 
623
typedef unsigned short BusLogic_InstalledDevices_T;
624
 
625
 
626
/*
627
  Define the Inquire Configuration reply structure.
628
*/
629
 
630
typedef struct BusLogic_Configuration
631
{
632
  unsigned char :5;                                     /* Byte 0 Bits 0-4 */
633
  boolean DMA_Channel5:1;                               /* Byte 0 Bit 5 */
634
  boolean DMA_Channel6:1;                               /* Byte 0 Bit 6 */
635
  boolean DMA_Channel7:1;                               /* Byte 0 Bit 7 */
636
  boolean IRQ_Channel9:1;                               /* Byte 1 Bit 0 */
637
  boolean IRQ_Channel10:1;                              /* Byte 1 Bit 1 */
638
  boolean IRQ_Channel11:1;                              /* Byte 1 Bit 2 */
639
  boolean IRQ_Channel12:1;                              /* Byte 1 Bit 3 */
640
  unsigned char :1;                                     /* Byte 1 Bit 4 */
641
  boolean IRQ_Channel14:1;                              /* Byte 1 Bit 5 */
642
  boolean IRQ_Channel15:1;                              /* Byte 1 Bit 6 */
643
  unsigned char :1;                                     /* Byte 1 Bit 7 */
644
  unsigned char HostAdapterID:4;                        /* Byte 2 Bits 0-3 */
645
  unsigned char :4;                                     /* Byte 2 Bits 4-7 */
646
}
647
BusLogic_Configuration_T;
648
 
649
 
650
/*
651
  Define the Inquire Setup Information reply structure.
652
*/
653
 
654
typedef struct BusLogic_SynchronousValue
655
{
656
  unsigned char Offset:4;                               /* Bits 0-3 */
657
  unsigned char TransferPeriod:3;                       /* Bits 4-6 */
658
  boolean Synchronous:1;                                /* Bit 7 */
659
}
660
BusLogic_SynchronousValue_T;
661
 
662
typedef BusLogic_SynchronousValue_T
663
  BusLogic_SynchronousValues8_T[8];
664
 
665
typedef BusLogic_SynchronousValue_T
666
  BusLogic_SynchronousValues_T[BusLogic_MaxTargetDevices];
667
 
668
typedef struct BusLogic_SetupInformation
669
{
670
  boolean SynchronousInitiationEnabled:1;               /* Byte 0 Bit 0 */
671
  boolean ParityCheckingEnabled:1;                      /* Byte 0 Bit 1 */
672
  unsigned char :6;                                     /* Byte 0 Bits 2-7 */
673
  unsigned char BusTransferRate;                        /* Byte 1 */
674
  unsigned char PreemptTimeOnBus;                       /* Byte 2 */
675
  unsigned char TimeOffBus;                             /* Byte 3 */
676
  unsigned char MailboxCount;                           /* Byte 4 */
677
  unsigned char MailboxAddress[3];                      /* Bytes 5-7 */
678
  BusLogic_SynchronousValues8_T SynchronousValuesID0to7; /* Bytes 8-15 */
679
  unsigned char DisconnectPermittedID0to7;              /* Byte 16 */
680
  unsigned char Signature;                              /* Byte 17 */
681
  unsigned char CharacterD;                             /* Byte 18 */
682
  unsigned char HostBusType;                            /* Byte 19 */
683
  unsigned char WideTransfersPermittedID0to7;           /* Byte 20 */
684
  unsigned char WideTransfersActiveID0to7;              /* Byte 21 */
685
  BusLogic_SynchronousValues8_T SynchronousValuesID8to15; /* Bytes 22-29 */
686
  unsigned char DisconnectPermittedID8to15;             /* Byte 30 */
687
  unsigned char :8;                                     /* Byte 31 */
688
  unsigned char WideTransfersPermittedID8to15;          /* Byte 32 */
689
  unsigned char WideTransfersActiveID8to15;             /* Byte 33 */
690
}
691
BusLogic_SetupInformation_T;
692
 
693
 
694
/*
695
  Define the Initialize Extended Mailbox request structure.
696
*/
697
 
698
typedef struct BusLogic_ExtendedMailboxRequest
699
{
700
  unsigned char MailboxCount;                           /* Byte 0 */
701
  BusLogic_BusAddress_T BaseMailboxAddress;             /* Bytes 1-4 */
702
}
703
__attribute__ ((packed))
704
BusLogic_ExtendedMailboxRequest_T;
705
 
706
 
707
/*
708
  Define the Inquire Firmware Version 3rd Digit reply type.
709
*/
710
 
711
typedef unsigned char BusLogic_FirmwareVersion3rdDigit_T;
712
 
713
 
714
/*
715
  Define the Inquire Firmware Version Letter reply type.
716
*/
717
 
718
typedef unsigned char BusLogic_FirmwareVersionLetter_T;
719
 
720
 
721
/*
722
  Define the Inquire PCI Host Adapter Information reply type.  The ISA
723
  Compatible I/O Port values are defined here and are also used with
724
  the Modify I/O Address command.
725
*/
726
 
727
typedef enum BusLogic_ISACompatibleIOPort
728
{
729
  BusLogic_IO_330 =                             0,
730
  BusLogic_IO_334 =                             1,
731
  BusLogic_IO_230 =                             2,
732
  BusLogic_IO_234 =                             3,
733
  BusLogic_IO_130 =                             4,
734
  BusLogic_IO_134 =                             5,
735
  BusLogic_IO_Disable =                         6,
736
  BusLogic_IO_Disable2 =                        7
737
}
738
__attribute__ ((packed))
739
BusLogic_ISACompatibleIOPort_T;
740
 
741
typedef struct BusLogic_PCIHostAdapterInformation
742
{
743
  BusLogic_ISACompatibleIOPort_T ISACompatibleIOPort;   /* Byte 0 */
744
  unsigned char PCIAssignedIRQChannel;                  /* Byte 1 */
745
  boolean LowByteTerminated:1;                          /* Byte 2 Bit 0 */
746
  boolean HighByteTerminated:1;                         /* Byte 2 Bit 1 */
747
  unsigned char :2;                                     /* Byte 2 Bits 2-3 */
748
  boolean JP1:1;                                        /* Byte 2 Bit 4 */
749
  boolean JP2:1;                                        /* Byte 2 Bit 5 */
750
  boolean JP3:1;                                        /* Byte 2 Bit 6 */
751
  boolean GenericInfoValid:1;                           /* Byte 2 Bit 7 */
752
  unsigned char :8;                                     /* Byte 3 */
753
}
754
BusLogic_PCIHostAdapterInformation_T;
755
 
756
 
757
/*
758
  Define the Inquire Host Adapter Model Number reply type.
759
*/
760
 
761
typedef unsigned char BusLogic_HostAdapterModelNumber_T[5];
762
 
763
 
764
/*
765
  Define the Inquire Synchronous Period reply type.  For each Target Device,
766
  a byte is returned which represents the Synchronous Transfer Period in units
767
  of 10 nanoseconds.
768
*/
769
 
770
typedef unsigned char BusLogic_SynchronousPeriod_T[BusLogic_MaxTargetDevices];
771
 
772
 
773
/*
774
  Define the Inquire Extended Setup Information reply structure.
775
*/
776
 
777
typedef struct BusLogic_ExtendedSetupInformation
778
{
779
  unsigned char BusType;                                /* Byte 0 */
780
  unsigned char BIOS_Address;                           /* Byte 1 */
781
  unsigned short ScatterGatherLimit;                    /* Bytes 2-3 */
782
  unsigned char MailboxCount;                           /* Byte 4 */
783
  BusLogic_BusAddress_T BaseMailboxAddress;             /* Bytes 5-8 */
784
  struct { unsigned char :2;                            /* Byte 9 Bits 0-1 */
785
           boolean FastOnEISA:1;                        /* Byte 9 Bit 2 */
786
           unsigned char :3;                            /* Byte 9 Bits 3-5 */
787
           boolean LevelSensitiveInterrupt:1;           /* Byte 9 Bit 6 */
788
           unsigned char :1; } Misc;                    /* Byte 9 Bit 7 */
789
  unsigned char FirmwareRevision[3];                    /* Bytes 10-12 */
790
  boolean HostWideSCSI:1;                               /* Byte 13 Bit 0 */
791
  boolean HostDifferentialSCSI:1;                       /* Byte 13 Bit 1 */
792
  boolean HostSupportsSCAM:1;                           /* Byte 13 Bit 2 */
793
  boolean HostUltraSCSI:1;                              /* Byte 13 Bit 3 */
794
  boolean HostSmartTermination:1;                       /* Byte 13 Bit 4 */
795
  unsigned char :3;                                     /* Byte 13 Bits 5-7 */
796
}
797
__attribute__ ((packed))
798
BusLogic_ExtendedSetupInformation_T;
799
 
800
 
801
/*
802
  Define the Enable Strict Round Robin Mode request type.
803
*/
804
 
805
typedef enum BusLogic_RoundRobinModeRequest
806
{
807
  BusLogic_AggressiveRoundRobinMode =           0,
808
  BusLogic_StrictRoundRobinMode =               1
809
}
810
__attribute__ ((packed))
811
BusLogic_RoundRobinModeRequest_T;
812
 
813
 
814
/*
815
  Define the Fetch Host Adapter Local RAM request type.
816
*/
817
 
818
#define BusLogic_BIOS_BaseOffset                0
819
#define BusLogic_AutoSCSI_BaseOffset            64
820
 
821
typedef struct BusLogic_FetchHostAdapterLocalRAMRequest
822
{
823
  unsigned char ByteOffset;                             /* Byte 0 */
824
  unsigned char ByteCount;                              /* Byte 1 */
825
}
826
BusLogic_FetchHostAdapterLocalRAMRequest_T;
827
 
828
 
829
/*
830
  Define the Host Adapter Local RAM AutoSCSI structure.
831
*/
832
 
833
typedef struct BusLogic_AutoSCSIData
834
{
835
  unsigned char InternalFactorySignature[2];            /* Bytes 0-1 */
836
  unsigned char InformationByteCount;                   /* Byte 2 */
837
  unsigned char HostAdapterType[6];                     /* Bytes 3-8 */
838
  unsigned char :8;                                     /* Byte 9 */
839
  boolean FloppyEnabled:1;                              /* Byte 10 Bit 0 */
840
  boolean FloppySecondary:1;                            /* Byte 10 Bit 1 */
841
  boolean LevelSensitiveInterrupt:1;                    /* Byte 10 Bit 2 */
842
  unsigned char :2;                                     /* Byte 10 Bits 3-4 */
843
  unsigned char SystemRAMAreaForBIOS:3;                 /* Byte 10 Bits 5-7 */
844
  unsigned char DMA_Channel:7;                          /* Byte 11 Bits 0-6 */
845
  boolean DMA_AutoConfiguration:1;                      /* Byte 11 Bit 7 */
846
  unsigned char IRQ_Channel:7;                          /* Byte 12 Bits 0-6 */
847
  boolean IRQ_AutoConfiguration:1;                      /* Byte 12 Bit 7 */
848
  unsigned char DMA_TransferRate;                       /* Byte 13 */
849
  unsigned char SCSI_ID;                                /* Byte 14 */
850
  boolean LowByteTerminated:1;                          /* Byte 15 Bit 0 */
851
  boolean ParityCheckingEnabled:1;                      /* Byte 15 Bit 1 */
852
  boolean HighByteTerminated:1;                         /* Byte 15 Bit 2 */
853
  boolean NoisyCablingEnvironment:1;                    /* Byte 15 Bit 3 */
854
  boolean FastSynchronousNegotiation:1;                 /* Byte 15 Bit 4 */
855
  boolean BusResetEnabled:1;                            /* Byte 15 Bit 5 */
856
  boolean :1;                                           /* Byte 15 Bit 6 */
857
  boolean ActiveNegationEnabled:1;                      /* Byte 15 Bit 7 */
858
  unsigned char BusOnDelay;                             /* Byte 16 */
859
  unsigned char BusOffDelay;                            /* Byte 17 */
860
  boolean HostAdapterBIOSEnabled:1;                     /* Byte 18 Bit 0 */
861
  boolean BIOSRedirectionOfINT19Enabled:1;              /* Byte 18 Bit 1 */
862
  boolean ExtendedTranslationEnabled:1;                 /* Byte 18 Bit 2 */
863
  boolean MapRemovableAsFixedEnabled:1;                 /* Byte 18 Bit 3 */
864
  boolean :1;                                           /* Byte 18 Bit 4 */
865
  boolean BIOSSupportsMoreThan2DrivesEnabled:1;         /* Byte 18 Bit 5 */
866
  boolean BIOSInterruptModeEnabled:1;                   /* Byte 18 Bit 6 */
867
  boolean FlopticalSupportEnabled:1;                    /* Byte 19 Bit 7 */
868
  unsigned short DeviceEnabled;                         /* Bytes 19-20 */
869
  unsigned short WidePermitted;                         /* Bytes 21-22 */
870
  unsigned short FastPermitted;                         /* Bytes 23-24 */
871
  unsigned short SynchronousPermitted;                  /* Bytes 25-26 */
872
  unsigned short DisconnectPermitted;                   /* Bytes 27-28 */
873
  unsigned short SendStartUnitCommand;                  /* Bytes 29-30 */
874
  unsigned short IgnoreInBIOSScan;                      /* Bytes 31-32 */
875
  unsigned char PCIInterruptPin:2;                      /* Byte 33 Bits 0-1 */
876
  unsigned char HostAdapterIOPortAddress:2;             /* Byte 33 Bits 2-3 */
877
  boolean StrictRoundRobinModeEnabled:1;                /* Byte 33 Bit 4 */
878
  boolean VESABusSpeedGreaterThan33MHz:1;               /* Byte 33 Bit 5 */
879
  boolean VESABurstWriteEnabled:1;                      /* Byte 33 Bit 6 */
880
  boolean VESABurstReadEnabled:1;                       /* Byte 33 Bit 7 */
881
  unsigned short UltraPermitted;                        /* Bytes 34-35 */
882
  unsigned int :32;                                     /* Bytes 36-39 */
883
  unsigned char :8;                                     /* Byte 40 */
884
  unsigned char AutoSCSIMaximumLUN;                     /* Byte 41 */
885
  boolean :1;                                           /* Byte 42 Bit 0 */
886
  boolean SCAM_Dominant:1;                              /* Byte 42 Bit 1 */
887
  boolean SCAM_Enabled:1;                               /* Byte 42 Bit 2 */
888
  boolean SCAM_Level2:1;                                /* Byte 42 Bit 3 */
889
  unsigned char :4;                                     /* Byte 42 Bits 4-7 */
890
  boolean INT13ExtensionEnabled:1;                      /* Byte 43 Bit 0 */
891
  boolean :1;                                           /* Byte 43 Bit 1 */
892
  boolean CDROMBootEnabled:1;                           /* Byte 43 Bit 2 */
893
  unsigned char :5;                                     /* Byte 43 Bits 3-7 */
894
  unsigned char BootTargetID:4;                         /* Byte 44 Bits 0-3 */
895
  unsigned char BootChannel:4;                          /* Byte 44 Bits 4-7 */
896
  unsigned char ForceBusDeviceScanningOrder:1;          /* Byte 45 Bit 0 */
897
  unsigned char :7;                                     /* Byte 45 Bits 1-7 */
898
  unsigned short NonTaggedToAlternateLUNPermitted;      /* Bytes 46-47 */
899
  unsigned short RenegotiateSyncAfterCheckCondition;    /* Bytes 48-49 */
900
  unsigned char Reserved[10];                           /* Bytes 50-59 */
901
  unsigned char ManufacturingDiagnostic[2];             /* Bytes 60-61 */
902
  unsigned short Checksum;                              /* Bytes 62-63 */
903
}
904
__attribute__ ((packed))
905
BusLogic_AutoSCSIData_T;
906
 
907
 
908
/*
909
  Define the Host Adapter Local RAM Auto SCSI Byte 45 structure.
910
*/
911
 
912
typedef struct BusLogic_AutoSCSIByte45
913
{
914
  unsigned char ForceBusDeviceScanningOrder:1;          /* Bit 0 */
915
  unsigned char :7;                                     /* Bits 1-7 */
916
}
917
BusLogic_AutoSCSIByte45_T;
918
 
919
 
920
/*
921
  Define the Host Adapter Local RAM BIOS Drive Map Byte structure.
922
*/
923
 
924
#define BusLogic_BIOS_DriveMapOffset            17
925
 
926
typedef struct BusLogic_BIOSDriveMapByte
927
{
928
  unsigned char TargetIDBit3:1;                         /* Bit 0 */
929
  unsigned char :2;                                     /* Bits 1-2 */
930
  BusLogic_BIOS_DiskGeometryTranslation_T DiskGeometry:2; /* Bits 3-4 */
931
  unsigned char TargetID:3;                             /* Bits 5-7 */
932
}
933
BusLogic_BIOSDriveMapByte_T;
934
 
935
 
936
/*
937
  Define the Modify I/O Address request type.  On PCI Host Adapters, the
938
  Modify I/O Address command allows modification of the ISA compatible I/O
939
  Address that the Host Adapter responds to; it does not affect the PCI
940
  compliant I/O Address assigned at system initialization.
941
*/
942
 
943
typedef BusLogic_ISACompatibleIOPort_T BusLogic_ModifyIOAddressRequest_T;
944
 
945
 
946
/*
947
  Define the Set CCB Format request type.  Extended LUN Format CCBs are
948
  necessary to support more than 8 Logical Units per Target Device.
949
*/
950
 
951
typedef enum BusLogic_SetCCBFormatRequest
952
{
953
  BusLogic_LegacyLUNFormatCCB =                 0,
954
  BusLogic_ExtendedLUNFormatCCB =               1
955
}
956
__attribute__ ((packed))
957
BusLogic_SetCCBFormatRequest_T;
958
 
959
 
960
/*
961
  Define the Requested Reply Length type used by the Inquire Setup Information,
962
  Inquire Host Adapter Model Number, Inquire Synchronous Period, and Inquire
963
  Extended Setup Information commands.
964
*/
965
 
966
typedef unsigned char BusLogic_RequestedReplyLength_T;
967
 
968
 
969
/*
970
  Define the Outgoing Mailbox Action Codes.
971
*/
972
 
973
typedef enum
974
{
975
  BusLogic_OutgoingMailboxFree =                0x00,
976
  BusLogic_MailboxStartCommand =                0x01,
977
  BusLogic_MailboxAbortCommand =                0x02
978
}
979
__attribute__ ((packed))
980
BusLogic_ActionCode_T;
981
 
982
 
983
/*
984
  Define the Incoming Mailbox Completion Codes.  The MultiMaster Firmware
985
  only uses codes 0 - 4.  The FlashPoint SCCB Manager has no mailboxes, so
986
  completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5.
987
*/
988
 
989
typedef enum
990
{
991
  BusLogic_IncomingMailboxFree =                0x00,
992
  BusLogic_CommandCompletedWithoutError =       0x01,
993
  BusLogic_CommandAbortedAtHostRequest =        0x02,
994
  BusLogic_AbortedCommandNotFound =             0x03,
995
  BusLogic_CommandCompletedWithError =          0x04,
996
  BusLogic_InvalidCCB =                         0x05
997
}
998
__attribute__ ((packed))
999
BusLogic_CompletionCode_T;
1000
 
1001
 
1002
/*
1003
  Define the Command Control Block (CCB) Opcodes.
1004
*/
1005
 
1006
typedef enum
1007
{
1008
  BusLogic_InitiatorCCB =                       0x00,
1009
  BusLogic_TargetCCB =                          0x01,
1010
  BusLogic_InitiatorCCB_ScatterGather =         0x02,
1011
  BusLogic_InitiatorCCB_ResidualDataLength =    0x03,
1012
  BusLogic_InitiatorCCB_ScatterGatherResidual = 0x04,
1013
  BusLogic_BusDeviceReset =                     0x81
1014
}
1015
__attribute__ ((packed))
1016
BusLogic_CCB_Opcode_T;
1017
 
1018
 
1019
/*
1020
  Define the CCB Data Direction Codes.
1021
*/
1022
 
1023
typedef enum
1024
{
1025
  BusLogic_UncheckedDataTransfer =              0,
1026
  BusLogic_DataInLengthChecked =                1,
1027
  BusLogic_DataOutLengthChecked =               2,
1028
  BusLogic_NoDataTransfer =                     3
1029
}
1030
BusLogic_DataDirection_T;
1031
 
1032
 
1033
/*
1034
  Define the Host Adapter Status Codes.  The MultiMaster Firmware does not
1035
  return status code 0x0C; it uses 0x12 for both overruns and underruns.
1036
*/
1037
 
1038
typedef enum
1039
{
1040
  BusLogic_CommandCompletedNormally =           0x00,
1041
  BusLogic_LinkedCommandCompleted =             0x0A,
1042
  BusLogic_LinkedCommandCompletedWithFlag =     0x0B,
1043
  BusLogic_DataUnderRun =                       0x0C,
1044
  BusLogic_SCSISelectionTimeout =               0x11,
1045
  BusLogic_DataOverRun =                        0x12,
1046
  BusLogic_UnexpectedBusFree =                  0x13,
1047
  BusLogic_InvalidBusPhaseRequested =           0x14,
1048
  BusLogic_InvalidOutgoingMailboxActionCode =   0x15,
1049
  BusLogic_InvalidCommandOperationCode =        0x16,
1050
  BusLogic_LinkedCCBhasInvalidLUN =             0x17,
1051
  BusLogic_InvalidCommandParameter =            0x1A,
1052
  BusLogic_AutoRequestSenseFailed =             0x1B,
1053
  BusLogic_TaggedQueuingMessageRejected =       0x1C,
1054
  BusLogic_UnsupportedMessageReceived =         0x1D,
1055
  BusLogic_HostAdapterHardwareFailed =          0x20,
1056
  BusLogic_TargetFailedResponseToATN =          0x21,
1057
  BusLogic_HostAdapterAssertedRST =             0x22,
1058
  BusLogic_OtherDeviceAssertedRST =             0x23,
1059
  BusLogic_TargetDeviceReconnectedImproperly =  0x24,
1060
  BusLogic_HostAdapterAssertedBusDeviceReset =  0x25,
1061
  BusLogic_AbortQueueGenerated =                0x26,
1062
  BusLogic_HostAdapterSoftwareError =           0x27,
1063
  BusLogic_HostAdapterHardwareTimeoutError =    0x30,
1064
  BusLogic_SCSIParityErrorDetected =            0x34
1065
}
1066
__attribute__ ((packed))
1067
BusLogic_HostAdapterStatus_T;
1068
 
1069
 
1070
/*
1071
  Define the SCSI Target Device Status Codes.
1072
*/
1073
 
1074
typedef enum
1075
{
1076
  BusLogic_OperationGood =                      0x00,
1077
  BusLogic_CheckCondition =                     0x02,
1078
  BusLogic_DeviceBusy =                         0x08
1079
}
1080
__attribute__ ((packed))
1081
BusLogic_TargetDeviceStatus_T;
1082
 
1083
 
1084
/*
1085
  Define the Queue Tag Codes.
1086
*/
1087
 
1088
typedef enum
1089
{
1090
  BusLogic_SimpleQueueTag =                     0,
1091
  BusLogic_HeadOfQueueTag =                     1,
1092
  BusLogic_OrderedQueueTag =                    2,
1093
  BusLogic_ReservedQT =                         3
1094
}
1095
BusLogic_QueueTag_T;
1096
 
1097
 
1098
/*
1099
  Define the SCSI Command Descriptor Block (CDB).
1100
*/
1101
 
1102
#define BusLogic_CDB_MaxLength                  12
1103
 
1104
typedef unsigned char SCSI_CDB_T[BusLogic_CDB_MaxLength];
1105
 
1106
 
1107
/*
1108
  Define the Scatter/Gather Segment structure required by the MultiMaster
1109
  Firmware Interface and the FlashPoint SCCB Manager.
1110
*/
1111
 
1112
typedef struct BusLogic_ScatterGatherSegment
1113
{
1114
  BusLogic_ByteCount_T SegmentByteCount;                /* Bytes 0-3 */
1115
  BusLogic_BusAddress_T SegmentDataPointer;             /* Bytes 4-7 */
1116
}
1117
BusLogic_ScatterGatherSegment_T;
1118
 
1119
 
1120
/*
1121
  Define the Driver CCB Status Codes.
1122
*/
1123
 
1124
typedef enum
1125
{
1126
  BusLogic_CCB_Free =                           0,
1127
  BusLogic_CCB_Active =                         1,
1128
  BusLogic_CCB_Completed =                      2,
1129
  BusLogic_CCB_Reset =                          3
1130
}
1131
__attribute__ ((packed))
1132
BusLogic_CCB_Status_T;
1133
 
1134
 
1135
/*
1136
  Define the 32 Bit Mode Command Control Block (CCB) structure.  The first 40
1137
  bytes are defined by and common to both the MultiMaster Firmware and the
1138
  FlashPoint SCCB Manager.  The next 60 bytes are defined by the FlashPoint
1139
  SCCB Manager.  The remaining components are defined by the Linux BusLogic
1140
  Driver.  Extended LUN Format CCBs differ from Legacy LUN Format 32 Bit Mode
1141
  CCBs only in having the TagEnable and QueueTag fields moved from byte 17 to
1142
  byte 1, and the Logical Unit field in byte 17 expanded to 6 bits.  In theory,
1143
  Extended LUN Format CCBs can support up to 64 Logical Units, but in practice
1144
  many devices will respond improperly to Logical Units between 32 and 63, and
1145
  the SCSI-2 specification defines Bit 5 as LUNTAR.  Extended LUN Format CCBs
1146
  are used by recent versions of the MultiMaster Firmware, as well as by the
1147
  FlashPoint SCCB Manager; the FlashPoint SCCB Manager only supports 32 Logical
1148
  Units.  Since 64 Logical Units are unlikely to be needed in practice, and
1149
  since they are problematic for the above reasons, and since limiting them to
1150
  5 bits simplifies the CCB structure definition, this driver only supports
1151
  32 Logical Units per Target Device.
1152
*/
1153
 
1154
typedef struct BusLogic_CCB
1155
{
1156
  /*
1157
    MultiMaster Firmware and FlashPoint SCCB Manager Common Portion.
1158
  */
1159
  BusLogic_CCB_Opcode_T Opcode;                         /* Byte 0 */
1160
  unsigned char :3;                                     /* Byte 1 Bits 0-2 */
1161
  BusLogic_DataDirection_T DataDirection:2;             /* Byte 1 Bits 3-4 */
1162
  boolean TagEnable:1;                                  /* Byte 1 Bit 5 */
1163
  BusLogic_QueueTag_T QueueTag:2;                       /* Byte 1 Bits 6-7 */
1164
  unsigned char CDB_Length;                             /* Byte 2 */
1165
  unsigned char SenseDataLength;                        /* Byte 3 */
1166
  BusLogic_ByteCount_T DataLength;                      /* Bytes 4-7 */
1167
  BusLogic_BusAddress_T DataPointer;                    /* Bytes 8-11 */
1168
  unsigned char :8;                                     /* Byte 12 */
1169
  unsigned char :8;                                     /* Byte 13 */
1170
  BusLogic_HostAdapterStatus_T HostAdapterStatus;       /* Byte 14 */
1171
  BusLogic_TargetDeviceStatus_T TargetDeviceStatus;     /* Byte 15 */
1172
  unsigned char TargetID;                               /* Byte 16 */
1173
  unsigned char LogicalUnit:5;                          /* Byte 17 Bits 0-4 */
1174
  boolean LegacyTagEnable:1;                            /* Byte 17 Bit 5 */
1175
  BusLogic_QueueTag_T LegacyQueueTag:2;                 /* Byte 17 Bits 6-7 */
1176
  SCSI_CDB_T CDB;                                       /* Bytes 18-29 */
1177
  unsigned char :8;                                     /* Byte 30 */
1178
  unsigned char :8;                                     /* Byte 31 */
1179
  unsigned int :32;                                     /* Bytes 32-35 */
1180
  BusLogic_BusAddress_T SenseDataPointer;               /* Bytes 36-39 */
1181
  /*
1182
    FlashPoint SCCB Manager Defined Portion.
1183
  */
1184
  void (*CallbackFunction)(struct BusLogic_CCB *);      /* Bytes 40-43 */
1185
  BusLogic_Base_Address_T BaseAddress;                  /* Bytes 44-47 */
1186
  BusLogic_CompletionCode_T CompletionCode;             /* Byte 48 */
1187
#ifndef CONFIG_SCSI_OMIT_FLASHPOINT
1188
  unsigned char :8;                                     /* Byte 49 */
1189
  unsigned short OS_Flags;                              /* Bytes 50-51 */
1190
  unsigned char Private[48];                            /* Bytes 52-99 */
1191
#endif
1192
  /*
1193
    BusLogic Linux Driver Defined Portion.
1194
  */
1195
  boolean AllocationGroupHead;
1196
  BusLogic_CCB_Status_T Status;
1197
  unsigned long SerialNumber;
1198
  SCSI_Command_T *Command;
1199
  struct BusLogic_HostAdapter *HostAdapter;
1200
  struct BusLogic_CCB *Next;
1201
  struct BusLogic_CCB *NextAll;
1202
  BusLogic_ScatterGatherSegment_T
1203
    ScatterGatherList[BusLogic_ScatterGatherLimit];
1204
}
1205
BusLogic_CCB_T;
1206
 
1207
 
1208
/*
1209
  Define the 32 Bit Mode Outgoing Mailbox structure.
1210
*/
1211
 
1212
typedef struct BusLogic_OutgoingMailbox
1213
{
1214
  BusLogic_BusAddress_T CCB;                            /* Bytes 0-3 */
1215
  unsigned int :24;                                     /* Bytes 4-6 */
1216
  BusLogic_ActionCode_T ActionCode;                     /* Byte 7 */
1217
}
1218
BusLogic_OutgoingMailbox_T;
1219
 
1220
 
1221
/*
1222
  Define the 32 Bit Mode Incoming Mailbox structure.
1223
*/
1224
 
1225
typedef struct BusLogic_IncomingMailbox
1226
{
1227
  BusLogic_BusAddress_T CCB;                            /* Bytes 0-3 */
1228
  BusLogic_HostAdapterStatus_T HostAdapterStatus;       /* Byte 4 */
1229
  BusLogic_TargetDeviceStatus_T TargetDeviceStatus;     /* Byte 5 */
1230
  unsigned char :8;                                     /* Byte 6 */
1231
  BusLogic_CompletionCode_T CompletionCode;             /* Byte 7 */
1232
}
1233
BusLogic_IncomingMailbox_T;
1234
 
1235
 
1236
/*
1237
  Define the BusLogic Driver Options structure.
1238
*/
1239
 
1240
typedef struct BusLogic_DriverOptions
1241
{
1242
  unsigned short TaggedQueuingPermitted;
1243
  unsigned short TaggedQueuingPermittedMask;
1244
  unsigned short BusSettleTime;
1245
  BusLogic_LocalOptions_T LocalOptions;
1246
  unsigned char CommonQueueDepth;
1247
  unsigned char QueueDepth[BusLogic_MaxTargetDevices];
1248
  BusLogic_ErrorRecoveryStrategy_T
1249
    ErrorRecoveryStrategy[BusLogic_MaxTargetDevices];
1250
}
1251
BusLogic_DriverOptions_T;
1252
 
1253
 
1254
/*
1255
  Define the Host Adapter Target Flags structure.
1256
*/
1257
 
1258
typedef struct BusLogic_TargetFlags
1259
{
1260
  boolean TargetExists:1;
1261
  boolean TaggedQueuingSupported:1;
1262
  boolean WideTransfersSupported:1;
1263
  boolean TaggedQueuingActive:1;
1264
  boolean WideTransfersActive:1;
1265
  boolean CommandSuccessfulFlag:1;
1266
  boolean TargetInfoReported:1;
1267
}
1268
BusLogic_TargetFlags_T;
1269
 
1270
 
1271
/*
1272
  Define the Host Adapter Target Statistics structure.
1273
*/
1274
 
1275
#define BusLogic_SizeBuckets                    10
1276
 
1277
typedef unsigned int BusLogic_CommandSizeBuckets_T[BusLogic_SizeBuckets];
1278
 
1279
typedef struct BusLogic_TargetStatistics
1280
{
1281
  unsigned int CommandsAttempted;
1282
  unsigned int CommandsCompleted;
1283
  unsigned int ReadCommands;
1284
  unsigned int WriteCommands;
1285
  BusLogic_ByteCounter_T TotalBytesRead;
1286
  BusLogic_ByteCounter_T TotalBytesWritten;
1287
  BusLogic_CommandSizeBuckets_T ReadCommandSizeBuckets;
1288
  BusLogic_CommandSizeBuckets_T WriteCommandSizeBuckets;
1289
  unsigned short CommandAbortsRequested;
1290
  unsigned short CommandAbortsAttempted;
1291
  unsigned short CommandAbortsCompleted;
1292
  unsigned short BusDeviceResetsRequested;
1293
  unsigned short BusDeviceResetsAttempted;
1294
  unsigned short BusDeviceResetsCompleted;
1295
  unsigned short HostAdapterResetsRequested;
1296
  unsigned short HostAdapterResetsAttempted;
1297
  unsigned short HostAdapterResetsCompleted;
1298
}
1299
BusLogic_TargetStatistics_T;
1300
 
1301
 
1302
/*
1303
  Define the FlashPoint Card Handle data type.
1304
*/
1305
 
1306
#define FlashPoint_BadCardHandle                0xFFFFFFFF
1307
 
1308
typedef unsigned int FlashPoint_CardHandle_T;
1309
 
1310
 
1311
/*
1312
  Define the FlashPoint Information structure.  This structure is defined
1313
  by the FlashPoint SCCB Manager.
1314
*/
1315
 
1316
typedef struct FlashPoint_Info
1317
{
1318
  BusLogic_Base_Address_T BaseAddress;                  /* Bytes 0-3 */
1319
  boolean Present;                                      /* Byte 4 */
1320
  unsigned char IRQ_Channel;                            /* Byte 5 */
1321
  unsigned char SCSI_ID;                                /* Byte 6 */
1322
  unsigned char SCSI_LUN;                               /* Byte 7 */
1323
  unsigned short FirmwareRevision;                      /* Bytes 8-9 */
1324
  unsigned short SynchronousPermitted;                  /* Bytes 10-11 */
1325
  unsigned short FastPermitted;                         /* Bytes 12-13 */
1326
  unsigned short UltraPermitted;                        /* Bytes 14-15 */
1327
  unsigned short DisconnectPermitted;                   /* Bytes 16-17 */
1328
  unsigned short WidePermitted;                         /* Bytes 18-19 */
1329
  boolean ParityCheckingEnabled:1;                      /* Byte 20 Bit 0 */
1330
  boolean HostWideSCSI:1;                               /* Byte 20 Bit 1 */
1331
  boolean HostSoftReset:1;                              /* Byte 20 Bit 2 */
1332
  boolean ExtendedTranslationEnabled:1;                 /* Byte 20 Bit 3 */
1333
  boolean LowByteTerminated:1;                          /* Byte 20 Bit 4 */
1334
  boolean HighByteTerminated:1;                         /* Byte 20 Bit 5 */
1335
  boolean ReportDataUnderrun:1;                         /* Byte 20 Bit 6 */
1336
  boolean SCAM_Enabled:1;                               /* Byte 20 Bit 7 */
1337
  boolean SCAM_Level2:1;                                /* Byte 21 Bit 0 */
1338
  unsigned char :7;                                     /* Byte 21 Bits 1-7 */
1339
  unsigned char Family;                                 /* Byte 22 */
1340
  unsigned char BusType;                                /* Byte 23 */
1341
  unsigned char ModelNumber[3];                         /* Bytes 24-26 */
1342
  unsigned char RelativeCardNumber;                     /* Byte 27 */
1343
  unsigned char Reserved[4];                            /* Bytes 28-31 */
1344
  unsigned int OS_Reserved;                             /* Bytes 32-35 */
1345
  unsigned char TranslationInfo[4];                     /* Bytes 36-39 */
1346
  unsigned int Reserved2[5];                            /* Bytes 40-59 */
1347
  unsigned int SecondaryRange;                          /* Bytes 60-63 */
1348
}
1349
FlashPoint_Info_T;
1350
 
1351
 
1352
/*
1353
  Define the BusLogic Driver Host Adapter structure.
1354
*/
1355
 
1356
typedef struct BusLogic_HostAdapter
1357
{
1358
  SCSI_Host_T *SCSI_Host;
1359
  BusLogic_HostAdapterType_T HostAdapterType;
1360
  BusLogic_HostAdapterBusType_T HostAdapterBusType;
1361
  BusLogic_IO_Address_T IO_Address;
1362
  BusLogic_PCI_Address_T PCI_Address;
1363
  unsigned short AddressCount;
1364
  unsigned char HostNumber;
1365
  unsigned char ModelName[9];
1366
  unsigned char FirmwareVersion[6];
1367
  unsigned char FullModelName[18];
1368
  unsigned char Bus;
1369
  unsigned char Device;
1370
  unsigned char IRQ_Channel;
1371
  unsigned char DMA_Channel;
1372
  unsigned char SCSI_ID;
1373
  boolean IRQ_ChannelAcquired:1;
1374
  boolean DMA_ChannelAcquired:1;
1375
  boolean ExtendedTranslationEnabled:1;
1376
  boolean ParityCheckingEnabled:1;
1377
  boolean BusResetEnabled:1;
1378
  boolean LevelSensitiveInterrupt:1;
1379
  boolean HostWideSCSI:1;
1380
  boolean HostDifferentialSCSI:1;
1381
  boolean HostSupportsSCAM:1;
1382
  boolean HostUltraSCSI:1;
1383
  boolean ExtendedLUNSupport:1;
1384
  boolean TerminationInfoValid:1;
1385
  boolean LowByteTerminated:1;
1386
  boolean HighByteTerminated:1;
1387
  boolean BounceBuffersRequired:1;
1388
  boolean StrictRoundRobinModeSupport:1;
1389
  boolean SCAM_Enabled:1;
1390
  boolean SCAM_Level2:1;
1391
  boolean HostAdapterInitialized:1;
1392
  boolean HostAdapterExternalReset:1;
1393
  boolean HostAdapterInternalError:1;
1394
  boolean ProcessCompletedCCBsActive;
1395
  volatile boolean HostAdapterCommandCompleted;
1396
  unsigned short HostAdapterScatterGatherLimit;
1397
  unsigned short DriverScatterGatherLimit;
1398
  unsigned short MaxTargetDevices;
1399
  unsigned short MaxLogicalUnits;
1400
  unsigned short MailboxCount;
1401
  unsigned short InitialCCBs;
1402
  unsigned short IncrementalCCBs;
1403
  unsigned short AllocatedCCBs;
1404
  unsigned short DriverQueueDepth;
1405
  unsigned short HostAdapterQueueDepth;
1406
  unsigned short UntaggedQueueDepth;
1407
  unsigned short CommonQueueDepth;
1408
  unsigned short BusSettleTime;
1409
  unsigned short SynchronousPermitted;
1410
  unsigned short FastPermitted;
1411
  unsigned short UltraPermitted;
1412
  unsigned short WidePermitted;
1413
  unsigned short DisconnectPermitted;
1414
  unsigned short TaggedQueuingPermitted;
1415
  unsigned short ExternalHostAdapterResets;
1416
  unsigned short HostAdapterInternalErrors;
1417
  unsigned short TargetDeviceCount;
1418
  unsigned short MessageBufferLength;
1419
  BusLogic_BusAddress_T BIOS_Address;
1420
  BusLogic_DriverOptions_T *DriverOptions;
1421
  FlashPoint_Info_T FlashPointInfo;
1422
  FlashPoint_CardHandle_T CardHandle;
1423
  struct BusLogic_HostAdapter *Next;
1424
  BusLogic_CCB_T *All_CCBs;
1425
  BusLogic_CCB_T *Free_CCBs;
1426
  BusLogic_CCB_T *FirstCompletedCCB;
1427
  BusLogic_CCB_T *LastCompletedCCB;
1428
  BusLogic_CCB_T *BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices];
1429
  BusLogic_ErrorRecoveryStrategy_T
1430
    ErrorRecoveryStrategy[BusLogic_MaxTargetDevices];
1431
  BusLogic_TargetFlags_T TargetFlags[BusLogic_MaxTargetDevices];
1432
  unsigned char QueueDepth[BusLogic_MaxTargetDevices];
1433
  unsigned char SynchronousPeriod[BusLogic_MaxTargetDevices];
1434
  unsigned char SynchronousOffset[BusLogic_MaxTargetDevices];
1435
  unsigned char ActiveCommands[BusLogic_MaxTargetDevices];
1436
  unsigned int CommandsSinceReset[BusLogic_MaxTargetDevices];
1437
  unsigned long LastSequencePoint[BusLogic_MaxTargetDevices];
1438
  unsigned long LastResetAttempted[BusLogic_MaxTargetDevices];
1439
  unsigned long LastResetCompleted[BusLogic_MaxTargetDevices];
1440
  BusLogic_OutgoingMailbox_T *FirstOutgoingMailbox;
1441
  BusLogic_OutgoingMailbox_T *LastOutgoingMailbox;
1442
  BusLogic_OutgoingMailbox_T *NextOutgoingMailbox;
1443
  BusLogic_IncomingMailbox_T *FirstIncomingMailbox;
1444
  BusLogic_IncomingMailbox_T *LastIncomingMailbox;
1445
  BusLogic_IncomingMailbox_T *NextIncomingMailbox;
1446
  BusLogic_TargetStatistics_T TargetStatistics[BusLogic_MaxTargetDevices];
1447
  unsigned char MailboxSpace[BusLogic_MaxMailboxes
1448
                             * (sizeof(BusLogic_OutgoingMailbox_T)
1449
                                + sizeof(BusLogic_IncomingMailbox_T))];
1450
  char MessageBuffer[BusLogic_MessageBufferSize];
1451
}
1452
BusLogic_HostAdapter_T;
1453
 
1454
 
1455
/*
1456
  Define a structure for the BIOS Disk Parameters.
1457
*/
1458
 
1459
typedef struct BIOS_DiskParameters
1460
{
1461
  int Heads;
1462
  int Sectors;
1463
  int Cylinders;
1464
}
1465
BIOS_DiskParameters_T;
1466
 
1467
 
1468
/*
1469
  Define a structure for the SCSI Inquiry command results.
1470
*/
1471
 
1472
typedef struct SCSI_Inquiry
1473
{
1474
  unsigned char PeripheralDeviceType:5;                 /* Byte 0 Bits 0-4 */
1475
  unsigned char PeripheralQualifier:3;                  /* Byte 0 Bits 5-7 */
1476
  unsigned char DeviceTypeModifier:7;                   /* Byte 1 Bits 0-6 */
1477
  boolean RMB:1;                                        /* Byte 1 Bit 7 */
1478
  unsigned char ANSI_ApprovedVersion:3;                 /* Byte 2 Bits 0-2 */
1479
  unsigned char ECMA_Version:3;                         /* Byte 2 Bits 3-5 */
1480
  unsigned char ISO_Version:2;                          /* Byte 2 Bits 6-7 */
1481
  unsigned char ResponseDataFormat:4;                   /* Byte 3 Bits 0-3 */
1482
  unsigned char :2;                                     /* Byte 3 Bits 4-5 */
1483
  boolean TrmIOP:1;                                     /* Byte 3 Bit 6 */
1484
  boolean AENC:1;                                       /* Byte 3 Bit 7 */
1485
  unsigned char AdditionalLength;                       /* Byte 4 */
1486
  unsigned char :8;                                     /* Byte 5 */
1487
  unsigned char :8;                                     /* Byte 6 */
1488
  boolean SftRe:1;                                      /* Byte 7 Bit 0 */
1489
  boolean CmdQue:1;                                     /* Byte 7 Bit 1 */
1490
  boolean :1;                                           /* Byte 7 Bit 2 */
1491
  boolean Linked:1;                                     /* Byte 7 Bit 3 */
1492
  boolean Sync:1;                                       /* Byte 7 Bit 4 */
1493
  boolean WBus16:1;                                     /* Byte 7 Bit 5 */
1494
  boolean WBus32:1;                                     /* Byte 7 Bit 6 */
1495
  boolean RelAdr:1;                                     /* Byte 7 Bit 7 */
1496
  unsigned char VendorIdentification[8];                /* Bytes 8-15 */
1497
  unsigned char ProductIdentification[16];              /* Bytes 16-31 */
1498
  unsigned char ProductRevisionLevel[4];                /* Bytes 32-35 */
1499
}
1500
SCSI_Inquiry_T;
1501
 
1502
 
1503
/*
1504
  BusLogic_AcquireHostAdapterLock acquires exclusive access to Host Adapter.
1505
*/
1506
 
1507
static inline
1508
void BusLogic_AcquireHostAdapterLock(BusLogic_HostAdapter_T *HostAdapter,
1509
                                     ProcessorFlags_T *ProcessorFlags)
1510
{
1511
  save_flags(*ProcessorFlags);
1512
  cli();
1513
}
1514
 
1515
 
1516
/*
1517
  BusLogic_ReleaseHostAdapterLock releases exclusive access to Host Adapter.
1518
*/
1519
 
1520
static inline
1521
void BusLogic_ReleaseHostAdapterLock(BusLogic_HostAdapter_T *HostAdapter,
1522
                                     ProcessorFlags_T *ProcessorFlags)
1523
{
1524
  restore_flags(*ProcessorFlags);
1525
}
1526
 
1527
 
1528
/*
1529
  BusLogic_AcquireHostAdapterLockIH acquires exclusive access to Host Adapter,
1530
  but is only called from the interrupt handler when interrupts are disabled.
1531
*/
1532
 
1533
static inline
1534
void BusLogic_AcquireHostAdapterLockIH(BusLogic_HostAdapter_T *HostAdapter,
1535
                                       ProcessorFlags_T *ProcessorFlags)
1536
{
1537
}
1538
 
1539
 
1540
/*
1541
  BusLogic_ReleaseHostAdapterLockIH releases exclusive access to Host Adapter,
1542
  but is only called from the interrupt handler when interrupts are disabled.
1543
*/
1544
 
1545
static inline
1546
void BusLogic_ReleaseHostAdapterLockIH(BusLogic_HostAdapter_T *HostAdapter,
1547
                                       ProcessorFlags_T *ProcessorFlags)
1548
{
1549
}
1550
 
1551
 
1552
/*
1553
  Define functions to provide an abstraction for reading and writing the
1554
  Host Adapter I/O Registers.
1555
*/
1556
 
1557
static inline
1558
void BusLogic_SCSIBusReset(BusLogic_HostAdapter_T *HostAdapter)
1559
{
1560
  BusLogic_ControlRegister_T ControlRegister;
1561
  ControlRegister.All = 0;
1562
  ControlRegister.Bits.SCSIBusReset = true;
1563
  outb(ControlRegister.All,
1564
       HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1565
}
1566
 
1567
static inline
1568
void BusLogic_InterruptReset(BusLogic_HostAdapter_T *HostAdapter)
1569
{
1570
  BusLogic_ControlRegister_T ControlRegister;
1571
  ControlRegister.All = 0;
1572
  ControlRegister.Bits.InterruptReset = true;
1573
  outb(ControlRegister.All,
1574
       HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1575
}
1576
 
1577
static inline
1578
void BusLogic_SoftReset(BusLogic_HostAdapter_T *HostAdapter)
1579
{
1580
  BusLogic_ControlRegister_T ControlRegister;
1581
  ControlRegister.All = 0;
1582
  ControlRegister.Bits.SoftReset = true;
1583
  outb(ControlRegister.All,
1584
       HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1585
}
1586
 
1587
static inline
1588
void BusLogic_HardReset(BusLogic_HostAdapter_T *HostAdapter)
1589
{
1590
  BusLogic_ControlRegister_T ControlRegister;
1591
  ControlRegister.All = 0;
1592
  ControlRegister.Bits.HardReset = true;
1593
  outb(ControlRegister.All,
1594
       HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);
1595
}
1596
 
1597
static inline
1598
unsigned char BusLogic_ReadStatusRegister(BusLogic_HostAdapter_T *HostAdapter)
1599
{
1600
  return inb(HostAdapter->IO_Address + BusLogic_StatusRegisterOffset);
1601
}
1602
 
1603
static inline
1604
void BusLogic_WriteCommandParameterRegister(BusLogic_HostAdapter_T
1605
                                              *HostAdapter,
1606
                                            unsigned char Value)
1607
{
1608
  outb(Value,
1609
       HostAdapter->IO_Address + BusLogic_CommandParameterRegisterOffset);
1610
}
1611
 
1612
static inline
1613
unsigned char BusLogic_ReadDataInRegister(BusLogic_HostAdapter_T *HostAdapter)
1614
{
1615
  return inb(HostAdapter->IO_Address + BusLogic_DataInRegisterOffset);
1616
}
1617
 
1618
static inline
1619
unsigned char BusLogic_ReadInterruptRegister(BusLogic_HostAdapter_T
1620
                                             *HostAdapter)
1621
{
1622
  return inb(HostAdapter->IO_Address + BusLogic_InterruptRegisterOffset);
1623
}
1624
 
1625
static inline
1626
unsigned char BusLogic_ReadGeometryRegister(BusLogic_HostAdapter_T
1627
                                            *HostAdapter)
1628
{
1629
  return inb(HostAdapter->IO_Address + BusLogic_GeometryRegisterOffset);
1630
}
1631
 
1632
 
1633
/*
1634
  BusLogic_StartMailboxCommand issues an Execute Mailbox Command, which
1635
  notifies the Host Adapter that an entry has been made in an Outgoing
1636
  Mailbox.
1637
*/
1638
 
1639
static inline
1640
void BusLogic_StartMailboxCommand(BusLogic_HostAdapter_T *HostAdapter)
1641
{
1642
  BusLogic_WriteCommandParameterRegister(HostAdapter,
1643
                                         BusLogic_ExecuteMailboxCommand);
1644
}
1645
 
1646
 
1647
/*
1648
  BusLogic_Delay waits for Seconds to elapse.
1649
*/
1650
 
1651
static inline void BusLogic_Delay(int Seconds)
1652
{
1653
  int Milliseconds = 1000 * Seconds;
1654
  unsigned long ProcessorFlags;
1655
  save_flags(ProcessorFlags);
1656
  sti();
1657
  while (--Milliseconds >= 0) udelay(1000);
1658
  restore_flags(ProcessorFlags);
1659
}
1660
 
1661
 
1662
/*
1663
  Virtual_to_Bus and Bus_to_Virtual map between Kernel Virtual Addresses
1664
  and PCI/VLB/EISA/ISA Bus Addresses.
1665
*/
1666
 
1667
static inline BusLogic_BusAddress_T Virtual_to_Bus(void *VirtualAddress)
1668
{
1669
  return (BusLogic_BusAddress_T) virt_to_bus(VirtualAddress);
1670
}
1671
 
1672
static inline void *Bus_to_Virtual(BusLogic_BusAddress_T BusAddress)
1673
{
1674
  return (void *) bus_to_virt(BusAddress);
1675
}
1676
 
1677
 
1678
/*
1679
  Virtual_to_32Bit_Virtual maps between Kernel Virtual Addresses and
1680
  32 bit Kernel Virtual Addresses.  This avoids compilation warnings
1681
  on 64 bit architectures.
1682
*/
1683
 
1684
static inline
1685
BusLogic_BusAddress_T Virtual_to_32Bit_Virtual(void *VirtualAddress)
1686
{
1687
  return (BusLogic_BusAddress_T) (unsigned long) VirtualAddress;
1688
}
1689
 
1690
 
1691
/*
1692
  BusLogic_IncrementErrorCounter increments Error Counter by 1, stopping at
1693
  65535 rather than wrapping around to 0.
1694
*/
1695
 
1696
static inline void BusLogic_IncrementErrorCounter(unsigned short *ErrorCounter)
1697
{
1698
  if (*ErrorCounter < 65535) (*ErrorCounter)++;
1699
}
1700
 
1701
 
1702
/*
1703
  BusLogic_IncrementByteCounter increments Byte Counter by Amount.
1704
*/
1705
 
1706
static inline void BusLogic_IncrementByteCounter(BusLogic_ByteCounter_T
1707
                                                   *ByteCounter,
1708
                                                 unsigned int Amount)
1709
{
1710
  ByteCounter->Units += Amount;
1711
  if (ByteCounter->Units > 999999999)
1712
    {
1713
      ByteCounter->Units -= 1000000000;
1714
      ByteCounter->Billions++;
1715
    }
1716
}
1717
 
1718
 
1719
/*
1720
  BusLogic_IncrementSizeBucket increments the Bucket for Amount.
1721
*/
1722
 
1723
static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T
1724
                                                  CommandSizeBuckets,
1725
                                                unsigned int Amount)
1726
{
1727
  int Index = 0;
1728
  if (Amount < 8*1024)
1729
    {
1730
      if (Amount < 2*1024)
1731
        Index = (Amount < 1*1024 ? 0 : 1);
1732
      else Index = (Amount < 4*1024 ? 2 : 3);
1733
    }
1734
  else if (Amount < 128*1024)
1735
    {
1736
      if (Amount < 32*1024)
1737
        Index = (Amount < 16*1024 ? 4 : 5);
1738
      else Index = (Amount < 64*1024 ? 6 : 7);
1739
    }
1740
  else Index = (Amount < 256*1024 ? 8 : 9);
1741
  CommandSizeBuckets[Index]++;
1742
}
1743
 
1744
 
1745
/*
1746
  Define the version number of the FlashPoint Firmware (SCCB Manager).
1747
*/
1748
 
1749
#define FlashPoint_FirmwareVersion              "5.02"
1750
 
1751
 
1752
/*
1753
  Define the possible return values from FlashPoint_HandleInterrupt.
1754
*/
1755
 
1756
#define FlashPoint_NormalInterrupt              0x00
1757
#define FlashPoint_InternalError                0xFE
1758
#define FlashPoint_ExternalBusReset             0xFF
1759
 
1760
 
1761
/*
1762
  Define prototypes for the forward referenced BusLogic Driver
1763
  Internal Functions.
1764
*/
1765
 
1766
static void BusLogic_QueueCompletedCCB(BusLogic_CCB_T *);
1767
static void BusLogic_InterruptHandler(int, void *, Registers_T *);
1768
static int BusLogic_ResetHostAdapter(BusLogic_HostAdapter_T *,
1769
                                     SCSI_Command_T *, unsigned int);
1770
static void BusLogic_Message(BusLogic_MessageLevel_T, char *,
1771
                             BusLogic_HostAdapter_T *, ...);
1772
static void BusLogic_ParseDriverOptions(char *);
1773
 
1774
 
1775
#endif /* BusLogic_DriverVersion */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.