aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhalid Aziz <khalid.aziz@oracle.com>2013-05-16 21:44:13 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-06-26 21:18:48 -0400
commit839cb99e8f748391059d10388c8aea48a88c142c (patch)
tree718db65aa0ac282e373739ab97a6b7fbc9216069
parent3b9373e95a6019cf89abe6c8b17c07828db96ad4 (diff)
[SCSI] BusLogic: Fix style issues
Fix CamelCase and extra long lines in the buslogic driver. Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/BusLogic.c4453
-rw-r--r--drivers/scsi/BusLogic.h1482
-rw-r--r--drivers/scsi/FlashPoint.c35
3 files changed, 3105 insertions, 2865 deletions
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 344d87599cd2..6ec36d83af6c 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -26,8 +26,8 @@
26 26
27*/ 27*/
28 28
29#define BusLogic_DriverVersion "2.1.16" 29#define blogic_drvr_version "2.1.16"
30#define BusLogic_DriverDate "18 July 2002" 30#define blogic_drvr_date "18 July 2002"
31 31
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/init.h> 33#include <linux/init.h>
@@ -60,24 +60,24 @@
60#define FAILURE (-1) 60#define FAILURE (-1)
61#endif 61#endif
62 62
63static struct scsi_host_template Bus_Logic_template; 63static struct scsi_host_template blogic_template;
64 64
65/* 65/*
66 BusLogic_DriverOptionsCount is a count of the number of BusLogic Driver 66 blogic_drvr_options_count is a count of the number of BusLogic Driver
67 Options specifications provided via the Linux Kernel Command Line or via 67 Options specifications provided via the Linux Kernel Command Line or via
68 the Loadable Kernel Module Installation Facility. 68 the Loadable Kernel Module Installation Facility.
69*/ 69*/
70 70
71static int BusLogic_DriverOptionsCount; 71static int blogic_drvr_options_count;
72 72
73 73
74/* 74/*
75 BusLogic_DriverOptions is an array of Driver Options structures representing 75 blogic_drvr_options is an array of Driver Options structures representing
76 BusLogic Driver Options specifications provided via the Linux Kernel Command 76 BusLogic Driver Options specifications provided via the Linux Kernel Command
77 Line or via the Loadable Kernel Module Installation Facility. 77 Line or via the Loadable Kernel Module Installation Facility.
78*/ 78*/
79 79
80static struct BusLogic_DriverOptions BusLogic_DriverOptions[BusLogic_MaxHostAdapters]; 80static struct blogic_drvr_options blogic_drvr_options[BLOGIC_MAX_ADAPTERS];
81 81
82 82
83/* 83/*
@@ -92,241 +92,251 @@ module_param(BusLogic, charp, 0);
92 92
93 93
94/* 94/*
95 BusLogic_ProbeOptions is a set of Probe Options to be applied across 95 blogic_probe_options is a set of Probe Options to be applied across
96 all BusLogic Host Adapters. 96 all BusLogic Host Adapters.
97*/ 97*/
98 98
99static struct BusLogic_ProbeOptions BusLogic_ProbeOptions; 99static struct blogic_probe_options blogic_probe_options;
100 100
101 101
102/* 102/*
103 BusLogic_GlobalOptions is a set of Global Options to be applied across 103 blogic_global_options is a set of Global Options to be applied across
104 all BusLogic Host Adapters. 104 all BusLogic Host Adapters.
105*/ 105*/
106 106
107static struct BusLogic_GlobalOptions BusLogic_GlobalOptions; 107static struct blogic_global_options blogic_global_options;
108 108
109static LIST_HEAD(BusLogic_host_list); 109static LIST_HEAD(blogic_host_list);
110 110
111/* 111/*
112 BusLogic_ProbeInfoCount is the number of entries in BusLogic_ProbeInfoList. 112 blogic_probeinfo_count is the number of entries in blogic_probeinfo_list.
113*/ 113*/
114 114
115static int BusLogic_ProbeInfoCount; 115static int blogic_probeinfo_count;
116 116
117 117
118/* 118/*
119 BusLogic_ProbeInfoList is the list of I/O Addresses and Bus Probe Information 119 blogic_probeinfo_list is the list of I/O Addresses and Bus Probe Information
120 to be checked for potential BusLogic Host Adapters. It is initialized by 120 to be checked for potential BusLogic Host Adapters. It is initialized by
121 interrogating the PCI Configuration Space on PCI machines as well as from the 121 interrogating the PCI Configuration Space on PCI machines as well as from the
122 list of standard BusLogic I/O Addresses. 122 list of standard BusLogic I/O Addresses.
123*/ 123*/
124 124
125static struct BusLogic_ProbeInfo *BusLogic_ProbeInfoList; 125static struct blogic_probeinfo *blogic_probeinfo_list;
126 126
127 127
128/* 128/*
129 BusLogic_CommandFailureReason holds a string identifying the reason why a 129 blogic_cmd_failure_reason holds a string identifying the reason why a
130 call to BusLogic_Command failed. It is only non-NULL when BusLogic_Command 130 call to blogic_cmd failed. It is only non-NULL when blogic_cmd
131 returns a failure code. 131 returns a failure code.
132*/ 132*/
133 133
134static char *BusLogic_CommandFailureReason; 134static char *blogic_cmd_failure_reason;
135 135
136/* 136/*
137 BusLogic_AnnounceDriver announces the Driver Version and Date, Author's 137 blogic_announce_drvr announces the Driver Version and Date, Author's
138 Name, Copyright Notice, and Electronic Mail Address. 138 Name, Copyright Notice, and Electronic Mail Address.
139*/ 139*/
140 140
141static void BusLogic_AnnounceDriver(struct BusLogic_HostAdapter *HostAdapter) 141static void blogic_announce_drvr(struct blogic_adapter *adapter)
142{ 142{
143 BusLogic_Announce("***** BusLogic SCSI Driver Version " BusLogic_DriverVersion " of " BusLogic_DriverDate " *****\n", HostAdapter); 143 blogic_announce("***** BusLogic SCSI Driver Version " blogic_drvr_version " of " blogic_drvr_date " *****\n", adapter);
144 BusLogic_Announce("Copyright 1995-1998 by Leonard N. Zubkoff " "<lnz@dandelion.com>\n", HostAdapter); 144 blogic_announce("Copyright 1995-1998 by Leonard N. Zubkoff " "<lnz@dandelion.com>\n", adapter);
145} 145}
146 146
147 147
148/* 148/*
149 BusLogic_DriverInfo returns the Host Adapter Name to identify this SCSI 149 blogic_drvr_info returns the Host Adapter Name to identify this SCSI
150 Driver and Host Adapter. 150 Driver and Host Adapter.
151*/ 151*/
152 152
153static const char *BusLogic_DriverInfo(struct Scsi_Host *Host) 153static const char *blogic_drvr_info(struct Scsi_Host *host)
154{ 154{
155 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Host->hostdata; 155 struct blogic_adapter *adapter =
156 return HostAdapter->FullModelName; 156 (struct blogic_adapter *) host->hostdata;
157 return adapter->full_model;
157} 158}
158 159
159/* 160/*
160 BusLogic_InitializeCCBs initializes a group of Command Control Blocks (CCBs) 161 blogic_init_ccbs initializes a group of Command Control Blocks (CCBs)
161 for Host Adapter from the BlockSize bytes located at BlockPointer. The newly 162 for Host Adapter from the blk_size bytes located at blk_pointer. The newly
162 created CCBs are added to Host Adapter's free list. 163 created CCBs are added to Host Adapter's free list.
163*/ 164*/
164 165
165static void BusLogic_InitializeCCBs(struct BusLogic_HostAdapter *HostAdapter, void *BlockPointer, int BlockSize, dma_addr_t BlockPointerHandle) 166static void blogic_init_ccbs(struct blogic_adapter *adapter, void *blk_pointer,
167 int blk_size, dma_addr_t blkp)
166{ 168{
167 struct BusLogic_CCB *CCB = (struct BusLogic_CCB *) BlockPointer; 169 struct blogic_ccb *ccb = (struct blogic_ccb *) blk_pointer;
168 unsigned int offset = 0; 170 unsigned int offset = 0;
169 memset(BlockPointer, 0, BlockSize); 171 memset(blk_pointer, 0, blk_size);
170 CCB->AllocationGroupHead = BlockPointerHandle; 172 ccb->allocgrp_head = blkp;
171 CCB->AllocationGroupSize = BlockSize; 173 ccb->allocgrp_size = blk_size;
172 while ((BlockSize -= sizeof(struct BusLogic_CCB)) >= 0) { 174 while ((blk_size -= sizeof(struct blogic_ccb)) >= 0) {
173 CCB->Status = BusLogic_CCB_Free; 175 ccb->status = BLOGIC_CCB_FREE;
174 CCB->HostAdapter = HostAdapter; 176 ccb->adapter = adapter;
175 CCB->DMA_Handle = (u32) BlockPointerHandle + offset; 177 ccb->dma_handle = (u32) blkp + offset;
176 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) { 178 if (blogic_flashpoint_type(adapter)) {
177 CCB->CallbackFunction = BusLogic_QueueCompletedCCB; 179 ccb->callback = blogic_qcompleted_ccb;
178 CCB->BaseAddress = HostAdapter->FlashPointInfo.BaseAddress; 180 ccb->base_addr = adapter->fpinfo.base_addr;
179 } 181 }
180 CCB->Next = HostAdapter->Free_CCBs; 182 ccb->next = adapter->free_ccbs;
181 CCB->NextAll = HostAdapter->All_CCBs; 183 ccb->next_all = adapter->all_ccbs;
182 HostAdapter->Free_CCBs = CCB; 184 adapter->free_ccbs = ccb;
183 HostAdapter->All_CCBs = CCB; 185 adapter->all_ccbs = ccb;
184 HostAdapter->AllocatedCCBs++; 186 adapter->alloc_ccbs++;
185 CCB++; 187 ccb++;
186 offset += sizeof(struct BusLogic_CCB); 188 offset += sizeof(struct blogic_ccb);
187 } 189 }
188} 190}
189 191
190 192
191/* 193/*
192 BusLogic_CreateInitialCCBs allocates the initial CCBs for Host Adapter. 194 blogic_create_initccbs allocates the initial CCBs for Host Adapter.
193*/ 195*/
194 196
195static bool __init BusLogic_CreateInitialCCBs(struct BusLogic_HostAdapter *HostAdapter) 197static bool __init blogic_create_initccbs(struct blogic_adapter *adapter)
196{ 198{
197 int BlockSize = BusLogic_CCB_AllocationGroupSize * sizeof(struct BusLogic_CCB); 199 int blk_size = BLOGIC_CCB_GRP_ALLOCSIZE * sizeof(struct blogic_ccb);
198 void *BlockPointer; 200 void *blk_pointer;
199 dma_addr_t BlockPointerHandle; 201 dma_addr_t blkp;
200 while (HostAdapter->AllocatedCCBs < HostAdapter->InitialCCBs) { 202
201 BlockPointer = pci_alloc_consistent(HostAdapter->PCI_Device, BlockSize, &BlockPointerHandle); 203 while (adapter->alloc_ccbs < adapter->initccbs) {
202 if (BlockPointer == NULL) { 204 blk_pointer = pci_alloc_consistent(adapter->pci_device,
203 BusLogic_Error("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n", HostAdapter); 205 blk_size, &blkp);
206 if (blk_pointer == NULL) {
207 blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n",
208 adapter);
204 return false; 209 return false;
205 } 210 }
206 BusLogic_InitializeCCBs(HostAdapter, BlockPointer, BlockSize, BlockPointerHandle); 211 blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp);
207 } 212 }
208 return true; 213 return true;
209} 214}
210 215
211 216
212/* 217/*
213 BusLogic_DestroyCCBs deallocates the CCBs for Host Adapter. 218 blogic_destroy_ccbs deallocates the CCBs for Host Adapter.
214*/ 219*/
215 220
216static void BusLogic_DestroyCCBs(struct BusLogic_HostAdapter *HostAdapter) 221static void blogic_destroy_ccbs(struct blogic_adapter *adapter)
217{ 222{
218 struct BusLogic_CCB *NextCCB = HostAdapter->All_CCBs, *CCB, *Last_CCB = NULL; 223 struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL;
219 HostAdapter->All_CCBs = NULL; 224 adapter->all_ccbs = NULL;
220 HostAdapter->Free_CCBs = NULL; 225 adapter->free_ccbs = NULL;
221 while ((CCB = NextCCB) != NULL) { 226 while ((ccb = next_ccb) != NULL) {
222 NextCCB = CCB->NextAll; 227 next_ccb = ccb->next_all;
223 if (CCB->AllocationGroupHead) { 228 if (ccb->allocgrp_head) {
224 if (Last_CCB) 229 if (lastccb)
225 pci_free_consistent(HostAdapter->PCI_Device, Last_CCB->AllocationGroupSize, Last_CCB, Last_CCB->AllocationGroupHead); 230 pci_free_consistent(adapter->pci_device,
226 Last_CCB = CCB; 231 lastccb->allocgrp_size, lastccb,
232 lastccb->allocgrp_head);
233 lastccb = ccb;
227 } 234 }
228 } 235 }
229 if (Last_CCB) 236 if (lastccb)
230 pci_free_consistent(HostAdapter->PCI_Device, Last_CCB->AllocationGroupSize, Last_CCB, Last_CCB->AllocationGroupHead); 237 pci_free_consistent(adapter->pci_device, lastccb->allocgrp_size,
238 lastccb, lastccb->allocgrp_head);
231} 239}
232 240
233 241
234/* 242/*
235 BusLogic_CreateAdditionalCCBs allocates Additional CCBs for Host Adapter. If 243 blogic_create_addlccbs allocates Additional CCBs for Host Adapter. If
236 allocation fails and there are no remaining CCBs available, the Driver Queue 244 allocation fails and there are no remaining CCBs available, the Driver Queue
237 Depth is decreased to a known safe value to avoid potential deadlocks when 245 Depth is decreased to a known safe value to avoid potential deadlocks when
238 multiple host adapters share the same IRQ Channel. 246 multiple host adapters share the same IRQ Channel.
239*/ 247*/
240 248
241static void BusLogic_CreateAdditionalCCBs(struct BusLogic_HostAdapter *HostAdapter, int AdditionalCCBs, bool SuccessMessageP) 249static void blogic_create_addlccbs(struct blogic_adapter *adapter,
250 int addl_ccbs, bool print_success)
242{ 251{
243 int BlockSize = BusLogic_CCB_AllocationGroupSize * sizeof(struct BusLogic_CCB); 252 int blk_size = BLOGIC_CCB_GRP_ALLOCSIZE * sizeof(struct blogic_ccb);
244 int PreviouslyAllocated = HostAdapter->AllocatedCCBs; 253 int prev_alloc = adapter->alloc_ccbs;
245 void *BlockPointer; 254 void *blk_pointer;
246 dma_addr_t BlockPointerHandle; 255 dma_addr_t blkp;
247 if (AdditionalCCBs <= 0) 256 if (addl_ccbs <= 0)
248 return; 257 return;
249 while (HostAdapter->AllocatedCCBs - PreviouslyAllocated < AdditionalCCBs) { 258 while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) {
250 BlockPointer = pci_alloc_consistent(HostAdapter->PCI_Device, BlockSize, &BlockPointerHandle); 259 blk_pointer = pci_alloc_consistent(adapter->pci_device,
251 if (BlockPointer == NULL) 260 blk_size, &blkp);
261 if (blk_pointer == NULL)
252 break; 262 break;
253 BusLogic_InitializeCCBs(HostAdapter, BlockPointer, BlockSize, BlockPointerHandle); 263 blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp);
254 } 264 }
255 if (HostAdapter->AllocatedCCBs > PreviouslyAllocated) { 265 if (adapter->alloc_ccbs > prev_alloc) {
256 if (SuccessMessageP) 266 if (print_success)
257 BusLogic_Notice("Allocated %d additional CCBs (total now %d)\n", HostAdapter, HostAdapter->AllocatedCCBs - PreviouslyAllocated, HostAdapter->AllocatedCCBs); 267 blogic_notice("Allocated %d additional CCBs (total now %d)\n", adapter, adapter->alloc_ccbs - prev_alloc, adapter->alloc_ccbs);
258 return; 268 return;
259 } 269 }
260 BusLogic_Notice("Failed to allocate additional CCBs\n", HostAdapter); 270 blogic_notice("Failed to allocate additional CCBs\n", adapter);
261 if (HostAdapter->DriverQueueDepth > HostAdapter->AllocatedCCBs - HostAdapter->TargetDeviceCount) { 271 if (adapter->drvr_qdepth > adapter->alloc_ccbs - adapter->tgt_count) {
262 HostAdapter->DriverQueueDepth = HostAdapter->AllocatedCCBs - HostAdapter->TargetDeviceCount; 272 adapter->drvr_qdepth = adapter->alloc_ccbs - adapter->tgt_count;
263 HostAdapter->SCSI_Host->can_queue = HostAdapter->DriverQueueDepth; 273 adapter->scsi_host->can_queue = adapter->drvr_qdepth;
264 } 274 }
265} 275}
266 276
267/* 277/*
268 BusLogic_AllocateCCB allocates a CCB from Host Adapter's free list, 278 blogic_alloc_ccb allocates a CCB from Host Adapter's free list,
269 allocating more memory from the Kernel if necessary. The Host Adapter's 279 allocating more memory from the Kernel if necessary. The Host Adapter's
270 Lock should already have been acquired by the caller. 280 Lock should already have been acquired by the caller.
271*/ 281*/
272 282
273static struct BusLogic_CCB *BusLogic_AllocateCCB(struct BusLogic_HostAdapter 283static struct blogic_ccb *blogic_alloc_ccb(struct blogic_adapter *adapter)
274 *HostAdapter)
275{ 284{
276 static unsigned long SerialNumber = 0; 285 static unsigned long serial;
277 struct BusLogic_CCB *CCB; 286 struct blogic_ccb *ccb;
278 CCB = HostAdapter->Free_CCBs; 287 ccb = adapter->free_ccbs;
279 if (CCB != NULL) { 288 if (ccb != NULL) {
280 CCB->SerialNumber = ++SerialNumber; 289 ccb->serial = ++serial;
281 HostAdapter->Free_CCBs = CCB->Next; 290 adapter->free_ccbs = ccb->next;
282 CCB->Next = NULL; 291 ccb->next = NULL;
283 if (HostAdapter->Free_CCBs == NULL) 292 if (adapter->free_ccbs == NULL)
284 BusLogic_CreateAdditionalCCBs(HostAdapter, HostAdapter->IncrementalCCBs, true); 293 blogic_create_addlccbs(adapter, adapter->inc_ccbs,
285 return CCB; 294 true);
286 } 295 return ccb;
287 BusLogic_CreateAdditionalCCBs(HostAdapter, HostAdapter->IncrementalCCBs, true); 296 }
288 CCB = HostAdapter->Free_CCBs; 297 blogic_create_addlccbs(adapter, adapter->inc_ccbs, true);
289 if (CCB == NULL) 298 ccb = adapter->free_ccbs;
299 if (ccb == NULL)
290 return NULL; 300 return NULL;
291 CCB->SerialNumber = ++SerialNumber; 301 ccb->serial = ++serial;
292 HostAdapter->Free_CCBs = CCB->Next; 302 adapter->free_ccbs = ccb->next;
293 CCB->Next = NULL; 303 ccb->next = NULL;
294 return CCB; 304 return ccb;
295} 305}
296 306
297 307
298/* 308/*
299 BusLogic_DeallocateCCB deallocates a CCB, returning it to the Host Adapter's 309 blogic_dealloc_ccb deallocates a CCB, returning it to the Host Adapter's
300 free list. The Host Adapter's Lock should already have been acquired by the 310 free list. The Host Adapter's Lock should already have been acquired by the
301 caller. 311 caller.
302*/ 312*/
303 313
304static void BusLogic_DeallocateCCB(struct BusLogic_CCB *CCB) 314static void blogic_dealloc_ccb(struct blogic_ccb *ccb)
305{ 315{
306 struct BusLogic_HostAdapter *HostAdapter = CCB->HostAdapter; 316 struct blogic_adapter *adapter = ccb->adapter;
307 317
308 scsi_dma_unmap(CCB->Command); 318 scsi_dma_unmap(ccb->command);
309 pci_unmap_single(HostAdapter->PCI_Device, CCB->SenseDataPointer, 319 pci_unmap_single(adapter->pci_device, ccb->sensedata,
310 CCB->SenseDataLength, PCI_DMA_FROMDEVICE); 320 ccb->sense_datalen, PCI_DMA_FROMDEVICE);
311 321
312 CCB->Command = NULL; 322 ccb->command = NULL;
313 CCB->Status = BusLogic_CCB_Free; 323 ccb->status = BLOGIC_CCB_FREE;
314 CCB->Next = HostAdapter->Free_CCBs; 324 ccb->next = adapter->free_ccbs;
315 HostAdapter->Free_CCBs = CCB; 325 adapter->free_ccbs = ccb;
316} 326}
317 327
318 328
319/* 329/*
320 BusLogic_Command sends the command OperationCode to HostAdapter, optionally 330 blogic_cmd sends the command opcode to adapter, optionally
321 providing ParameterLength bytes of ParameterData and receiving at most 331 providing paramlen bytes of param and receiving at most
322 ReplyLength bytes of ReplyData; any excess reply data is received but 332 replylen bytes of reply; any excess reply data is received but
323 discarded. 333 discarded.
324 334
325 On success, this function returns the number of reply bytes read from 335 On success, this function returns the number of reply bytes read from
326 the Host Adapter (including any discarded data); on failure, it returns 336 the Host Adapter (including any discarded data); on failure, it returns
327 -1 if the command was invalid, or -2 if a timeout occurred. 337 -1 if the command was invalid, or -2 if a timeout occurred.
328 338
329 BusLogic_Command is called exclusively during host adapter detection and 339 blogic_cmd is called exclusively during host adapter detection and
330 initialization, so performance and latency are not critical, and exclusive 340 initialization, so performance and latency are not critical, and exclusive
331 access to the Host Adapter hardware is assumed. Once the host adapter and 341 access to the Host Adapter hardware is assumed. Once the host adapter and
332 driver are initialized, the only Host Adapter command that is issued is the 342 driver are initialized, the only Host Adapter command that is issued is the
@@ -334,255 +344,274 @@ static void BusLogic_DeallocateCCB(struct BusLogic_CCB *CCB)
334 waiting for the Host Adapter Ready bit to be set in the Status Register. 344 waiting for the Host Adapter Ready bit to be set in the Status Register.
335*/ 345*/
336 346
337static int BusLogic_Command(struct BusLogic_HostAdapter *HostAdapter, enum BusLogic_OperationCode OperationCode, void *ParameterData, int ParameterLength, void *ReplyData, int ReplyLength) 347static int blogic_cmd(struct blogic_adapter *adapter, enum blogic_opcode opcode,
348 void *param, int paramlen, void *reply, int replylen)
338{ 349{
339 unsigned char *ParameterPointer = (unsigned char *) ParameterData; 350 unsigned char *param_p = (unsigned char *) param;
340 unsigned char *ReplyPointer = (unsigned char *) ReplyData; 351 unsigned char *reply_p = (unsigned char *) reply;
341 union BusLogic_StatusRegister StatusRegister; 352 union blogic_stat_reg statusreg;
342 union BusLogic_InterruptRegister InterruptRegister; 353 union blogic_int_reg intreg;
343 unsigned long ProcessorFlags = 0; 354 unsigned long processor_flag = 0;
344 int ReplyBytes = 0, Result; 355 int reply_b = 0, result;
345 long TimeoutCounter; 356 long timeout;
346 /* 357 /*
347 Clear out the Reply Data if provided. 358 Clear out the Reply Data if provided.
348 */ 359 */
349 if (ReplyLength > 0) 360 if (replylen > 0)
350 memset(ReplyData, 0, ReplyLength); 361 memset(reply, 0, replylen);
351 /* 362 /*
352 If the IRQ Channel has not yet been acquired, then interrupts must be 363 If the IRQ Channel has not yet been acquired, then interrupts
353 disabled while issuing host adapter commands since a Command Complete 364 must be disabled while issuing host adapter commands since a
354 interrupt could occur if the IRQ Channel was previously enabled by another 365 Command Complete interrupt could occur if the IRQ Channel was
355 BusLogic Host Adapter or another driver sharing the same IRQ Channel. 366 previously enabled by another BusLogic Host Adapter or another
367 driver sharing the same IRQ Channel.
356 */ 368 */
357 if (!HostAdapter->IRQ_ChannelAcquired) 369 if (!adapter->irq_acquired)
358 local_irq_save(ProcessorFlags); 370 local_irq_save(processor_flag);
359 /* 371 /*
360 Wait for the Host Adapter Ready bit to be set and the Command/Parameter 372 Wait for the Host Adapter Ready bit to be set and the
361 Register Busy bit to be reset in the Status Register. 373 Command/Parameter Register Busy bit to be reset in the Status
374 Register.
362 */ 375 */
363 TimeoutCounter = 10000; 376 timeout = 10000;
364 while (--TimeoutCounter >= 0) { 377 while (--timeout >= 0) {
365 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); 378 statusreg.all = blogic_rdstatus(adapter);
366 if (StatusRegister.sr.HostAdapterReady && !StatusRegister.sr.CommandParameterRegisterBusy) 379 if (statusreg.sr.adapter_ready && !statusreg.sr.cmd_param_busy)
367 break; 380 break;
368 udelay(100); 381 udelay(100);
369 } 382 }
370 if (TimeoutCounter < 0) { 383 if (timeout < 0) {
371 BusLogic_CommandFailureReason = "Timeout waiting for Host Adapter Ready"; 384 blogic_cmd_failure_reason =
372 Result = -2; 385 "Timeout waiting for Host Adapter Ready";
373 goto Done; 386 result = -2;
387 goto done;
374 } 388 }
375 /* 389 /*
376 Write the OperationCode to the Command/Parameter Register. 390 Write the opcode to the Command/Parameter Register.
377 */ 391 */
378 HostAdapter->HostAdapterCommandCompleted = false; 392 adapter->adapter_cmd_complete = false;
379 BusLogic_WriteCommandParameterRegister(HostAdapter, OperationCode); 393 blogic_setcmdparam(adapter, opcode);
380 /* 394 /*
381 Write any additional Parameter Bytes. 395 Write any additional Parameter Bytes.
382 */ 396 */
383 TimeoutCounter = 10000; 397 timeout = 10000;
384 while (ParameterLength > 0 && --TimeoutCounter >= 0) { 398 while (paramlen > 0 && --timeout >= 0) {
385 /* 399 /*
386 Wait 100 microseconds to give the Host Adapter enough time to determine 400 Wait 100 microseconds to give the Host Adapter enough
387 whether the last value written to the Command/Parameter Register was 401 time to determine whether the last value written to the
388 valid or not. If the Command Complete bit is set in the Interrupt 402 Command/Parameter Register was valid or not. If the
389 Register, then the Command Invalid bit in the Status Register will be 403 Command Complete bit is set in the Interrupt Register,
390 reset if the Operation Code or Parameter was valid and the command 404 then the Command Invalid bit in the Status Register will
391 has completed, or set if the Operation Code or Parameter was invalid. 405 be reset if the Operation Code or Parameter was valid
392 If the Data In Register Ready bit is set in the Status Register, then 406 and the command has completed, or set if the Operation
393 the Operation Code was valid, and data is waiting to be read back 407 Code or Parameter was invalid. If the Data In Register
394 from the Host Adapter. Otherwise, wait for the Command/Parameter 408 Ready bit is set in the Status Register, then the
395 Register Busy bit in the Status Register to be reset. 409 Operation Code was valid, and data is waiting to be read
410 back from the Host Adapter. Otherwise, wait for the
411 Command/Parameter Register Busy bit in the Status
412 Register to be reset.
396 */ 413 */
397 udelay(100); 414 udelay(100);
398 InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter); 415 intreg.all = blogic_rdint(adapter);
399 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); 416 statusreg.all = blogic_rdstatus(adapter);
400 if (InterruptRegister.ir.CommandComplete) 417 if (intreg.ir.cmd_complete)
401 break; 418 break;
402 if (HostAdapter->HostAdapterCommandCompleted) 419 if (adapter->adapter_cmd_complete)
403 break; 420 break;
404 if (StatusRegister.sr.DataInRegisterReady) 421 if (statusreg.sr.datain_ready)
405 break; 422 break;
406 if (StatusRegister.sr.CommandParameterRegisterBusy) 423 if (statusreg.sr.cmd_param_busy)
407 continue; 424 continue;
408 BusLogic_WriteCommandParameterRegister(HostAdapter, *ParameterPointer++); 425 blogic_setcmdparam(adapter, *param_p++);
409 ParameterLength--; 426 paramlen--;
410 } 427 }
411 if (TimeoutCounter < 0) { 428 if (timeout < 0) {
412 BusLogic_CommandFailureReason = "Timeout waiting for Parameter Acceptance"; 429 blogic_cmd_failure_reason =
413 Result = -2; 430 "Timeout waiting for Parameter Acceptance";
414 goto Done; 431 result = -2;
415 } 432 goto done;
416 /* 433 }
417 The Modify I/O Address command does not cause a Command Complete Interrupt. 434 /*
418 */ 435 The Modify I/O Address command does not cause a Command Complete
419 if (OperationCode == BusLogic_ModifyIOAddress) { 436 Interrupt.
420 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); 437 */
421 if (StatusRegister.sr.CommandInvalid) { 438 if (opcode == BLOGIC_MOD_IOADDR) {
422 BusLogic_CommandFailureReason = "Modify I/O Address Invalid"; 439 statusreg.all = blogic_rdstatus(adapter);
423 Result = -1; 440 if (statusreg.sr.cmd_invalid) {
424 goto Done; 441 blogic_cmd_failure_reason =
442 "Modify I/O Address Invalid";
443 result = -1;
444 goto done;
425 } 445 }
426 if (BusLogic_GlobalOptions.TraceConfiguration) 446 if (blogic_global_options.trace_config)
427 BusLogic_Notice("BusLogic_Command(%02X) Status = %02X: " "(Modify I/O Address)\n", HostAdapter, OperationCode, StatusRegister.All); 447 blogic_notice("blogic_cmd(%02X) Status = %02X: " "(Modify I/O Address)\n", adapter, opcode, statusreg.all);
428 Result = 0; 448 result = 0;
429 goto Done; 449 goto done;
430 } 450 }
431 /* 451 /*
432 Select an appropriate timeout value for awaiting command completion. 452 Select an appropriate timeout value for awaiting command completion.
433 */ 453 */
434 switch (OperationCode) { 454 switch (opcode) {
435 case BusLogic_InquireInstalledDevicesID0to7: 455 case BLOGIC_INQ_DEV0TO7:
436 case BusLogic_InquireInstalledDevicesID8to15: 456 case BLOGIC_INQ_DEV8TO15:
437 case BusLogic_InquireTargetDevices: 457 case BLOGIC_INQ_DEV:
438 /* Approximately 60 seconds. */ 458 /* Approximately 60 seconds. */
439 TimeoutCounter = 60 * 10000; 459 timeout = 60 * 10000;
440 break; 460 break;
441 default: 461 default:
442 /* Approximately 1 second. */ 462 /* Approximately 1 second. */
443 TimeoutCounter = 10000; 463 timeout = 10000;
444 break; 464 break;
445 } 465 }
446 /* 466 /*
447 Receive any Reply Bytes, waiting for either the Command Complete bit to 467 Receive any Reply Bytes, waiting for either the Command
448 be set in the Interrupt Register, or for the Interrupt Handler to set the 468 Complete bit to be set in the Interrupt Register, or for the
449 Host Adapter Command Completed bit in the Host Adapter structure. 469 Interrupt Handler to set the Host Adapter Command Completed
470 bit in the Host Adapter structure.
450 */ 471 */
451 while (--TimeoutCounter >= 0) { 472 while (--timeout >= 0) {
452 InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter); 473 intreg.all = blogic_rdint(adapter);
453 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); 474 statusreg.all = blogic_rdstatus(adapter);
454 if (InterruptRegister.ir.CommandComplete) 475 if (intreg.ir.cmd_complete)
455 break; 476 break;
456 if (HostAdapter->HostAdapterCommandCompleted) 477 if (adapter->adapter_cmd_complete)
457 break; 478 break;
458 if (StatusRegister.sr.DataInRegisterReady) { 479 if (statusreg.sr.datain_ready) {
459 if (++ReplyBytes <= ReplyLength) 480 if (++reply_b <= replylen)
460 *ReplyPointer++ = BusLogic_ReadDataInRegister(HostAdapter); 481 *reply_p++ = blogic_rddatain(adapter);
461 else 482 else
462 BusLogic_ReadDataInRegister(HostAdapter); 483 blogic_rddatain(adapter);
463 } 484 }
464 if (OperationCode == BusLogic_FetchHostAdapterLocalRAM && StatusRegister.sr.HostAdapterReady) 485 if (opcode == BLOGIC_FETCH_LOCALRAM &&
486 statusreg.sr.adapter_ready)
465 break; 487 break;
466 udelay(100); 488 udelay(100);
467 } 489 }
468 if (TimeoutCounter < 0) { 490 if (timeout < 0) {
469 BusLogic_CommandFailureReason = "Timeout waiting for Command Complete"; 491 blogic_cmd_failure_reason =
470 Result = -2; 492 "Timeout waiting for Command Complete";
471 goto Done; 493 result = -2;
494 goto done;
472 } 495 }
473 /* 496 /*
474 Clear any pending Command Complete Interrupt. 497 Clear any pending Command Complete Interrupt.
475 */ 498 */
476 BusLogic_InterruptReset(HostAdapter); 499 blogic_intreset(adapter);
477 /* 500 /*
478 Provide tracing information if requested. 501 Provide tracing information if requested.
479 */ 502 */
480 if (BusLogic_GlobalOptions.TraceConfiguration) { 503 if (blogic_global_options.trace_config) {
481 int i; 504 int i;
482 BusLogic_Notice("BusLogic_Command(%02X) Status = %02X: %2d ==> %2d:", HostAdapter, OperationCode, StatusRegister.All, ReplyLength, ReplyBytes); 505 blogic_notice("blogic_cmd(%02X) Status = %02X: %2d ==> %2d:",
483 if (ReplyLength > ReplyBytes) 506 adapter, opcode, statusreg.all, replylen,
484 ReplyLength = ReplyBytes; 507 reply_b);
485 for (i = 0; i < ReplyLength; i++) 508 if (replylen > reply_b)
486 BusLogic_Notice(" %02X", HostAdapter, ((unsigned char *) ReplyData)[i]); 509 replylen = reply_b;
487 BusLogic_Notice("\n", HostAdapter); 510 for (i = 0; i < replylen; i++)
511 blogic_notice(" %02X", adapter,
512 ((unsigned char *) reply)[i]);
513 blogic_notice("\n", adapter);
488 } 514 }
489 /* 515 /*
490 Process Command Invalid conditions. 516 Process Command Invalid conditions.
491 */ 517 */
492 if (StatusRegister.sr.CommandInvalid) { 518 if (statusreg.sr.cmd_invalid) {
493 /* 519 /*
494 Some early BusLogic Host Adapters may not recover properly from 520 Some early BusLogic Host Adapters may not recover
495 a Command Invalid condition, so if this appears to be the case, 521 properly from a Command Invalid condition, so if this
496 a Soft Reset is issued to the Host Adapter. Potentially invalid 522 appears to be the case, a Soft Reset is issued to the
497 commands are never attempted after Mailbox Initialization is 523 Host Adapter. Potentially invalid commands are never
498 performed, so there should be no Host Adapter state lost by a 524 attempted after Mailbox Initialization is performed,
525 so there should be no Host Adapter state lost by a
499 Soft Reset in response to a Command Invalid condition. 526 Soft Reset in response to a Command Invalid condition.
500 */ 527 */
501 udelay(1000); 528 udelay(1000);
502 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); 529 statusreg.all = blogic_rdstatus(adapter);
503 if (StatusRegister.sr.CommandInvalid || 530 if (statusreg.sr.cmd_invalid || statusreg.sr.rsvd ||
504 StatusRegister.sr.Reserved || 531 statusreg.sr.datain_ready ||
505 StatusRegister.sr.DataInRegisterReady || 532 statusreg.sr.cmd_param_busy ||
506 StatusRegister.sr.CommandParameterRegisterBusy || !StatusRegister.sr.HostAdapterReady || !StatusRegister.sr.InitializationRequired || StatusRegister.sr.DiagnosticActive || StatusRegister.sr.DiagnosticFailure) { 533 !statusreg.sr.adapter_ready ||
507 BusLogic_SoftReset(HostAdapter); 534 !statusreg.sr.init_reqd ||
535 statusreg.sr.diag_active ||
536 statusreg.sr.diag_failed) {
537 blogic_softreset(adapter);
508 udelay(1000); 538 udelay(1000);
509 } 539 }
510 BusLogic_CommandFailureReason = "Command Invalid"; 540 blogic_cmd_failure_reason = "Command Invalid";
511 Result = -1; 541 result = -1;
512 goto Done; 542 goto done;
513 } 543 }
514 /* 544 /*
515 Handle Excess Parameters Supplied conditions. 545 Handle Excess Parameters Supplied conditions.
516 */ 546 */
517 if (ParameterLength > 0) { 547 if (paramlen > 0) {
518 BusLogic_CommandFailureReason = "Excess Parameters Supplied"; 548 blogic_cmd_failure_reason = "Excess Parameters Supplied";
519 Result = -1; 549 result = -1;
520 goto Done; 550 goto done;
521 } 551 }
522 /* 552 /*
523 Indicate the command completed successfully. 553 Indicate the command completed successfully.
524 */ 554 */
525 BusLogic_CommandFailureReason = NULL; 555 blogic_cmd_failure_reason = NULL;
526 Result = ReplyBytes; 556 result = reply_b;
527 /* 557 /*
528 Restore the interrupt status if necessary and return. 558 Restore the interrupt status if necessary and return.
529 */ 559 */
530 Done: 560done:
531 if (!HostAdapter->IRQ_ChannelAcquired) 561 if (!adapter->irq_acquired)
532 local_irq_restore(ProcessorFlags); 562 local_irq_restore(processor_flag);
533 return Result; 563 return result;
534} 564}
535 565
536 566
537/* 567/*
538 BusLogic_AppendProbeAddressISA appends a single ISA I/O Address to the list 568 blogic_add_probeaddr_isa appends a single ISA I/O Address to the list
539 of I/O Address and Bus Probe Information to be checked for potential BusLogic 569 of I/O Address and Bus Probe Information to be checked for potential BusLogic
540 Host Adapters. 570 Host Adapters.
541*/ 571*/
542 572
543static void __init BusLogic_AppendProbeAddressISA(unsigned long IO_Address) 573static void __init blogic_add_probeaddr_isa(unsigned long io_addr)
544{ 574{
545 struct BusLogic_ProbeInfo *ProbeInfo; 575 struct blogic_probeinfo *probeinfo;
546 if (BusLogic_ProbeInfoCount >= BusLogic_MaxHostAdapters) 576 if (blogic_probeinfo_count >= BLOGIC_MAX_ADAPTERS)
547 return; 577 return;
548 ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; 578 probeinfo = &blogic_probeinfo_list[blogic_probeinfo_count++];
549 ProbeInfo->HostAdapterType = BusLogic_MultiMaster; 579 probeinfo->adapter_type = BLOGIC_MULTIMASTER;
550 ProbeInfo->HostAdapterBusType = BusLogic_ISA_Bus; 580 probeinfo->adapter_bus_type = BLOGIC_ISA_BUS;
551 ProbeInfo->IO_Address = IO_Address; 581 probeinfo->io_addr = io_addr;
552 ProbeInfo->PCI_Device = NULL; 582 probeinfo->pci_device = NULL;
553} 583}
554 584
555 585
556/* 586/*
557 BusLogic_InitializeProbeInfoListISA initializes the list of I/O Address and 587 blogic_init_probeinfo_isa initializes the list of I/O Address and
558 Bus Probe Information to be checked for potential BusLogic SCSI Host Adapters 588 Bus Probe Information to be checked for potential BusLogic SCSI Host Adapters
559 only from the list of standard BusLogic MultiMaster ISA I/O Addresses. 589 only from the list of standard BusLogic MultiMaster ISA I/O Addresses.
560*/ 590*/
561 591
562static void __init BusLogic_InitializeProbeInfoListISA(struct BusLogic_HostAdapter 592static void __init blogic_init_probeinfo_isa(struct blogic_adapter *adapter)
563 *PrototypeHostAdapter)
564{ 593{
565 /* 594 /*
566 If BusLogic Driver Options specifications requested that ISA Bus Probes 595 If BusLogic Driver Options specifications requested that ISA
567 be inhibited, do not proceed further. 596 Bus Probes be inhibited, do not proceed further.
568 */ 597 */
569 if (BusLogic_ProbeOptions.NoProbeISA) 598 if (blogic_probe_options.noprobe_isa)
570 return; 599 return;
571 /* 600 /*
572 Append the list of standard BusLogic MultiMaster ISA I/O Addresses. 601 Append the list of standard BusLogic MultiMaster ISA I/O Addresses.
573 */ 602 */
574 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe330) 603 if (!blogic_probe_options.limited_isa || blogic_probe_options.probe330)
575 BusLogic_AppendProbeAddressISA(0x330); 604 blogic_add_probeaddr_isa(0x330);
576 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe334) 605 if (!blogic_probe_options.limited_isa || blogic_probe_options.probe334)
577 BusLogic_AppendProbeAddressISA(0x334); 606 blogic_add_probeaddr_isa(0x334);
578 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe230) 607 if (!blogic_probe_options.limited_isa || blogic_probe_options.probe230)
579 BusLogic_AppendProbeAddressISA(0x230); 608 blogic_add_probeaddr_isa(0x230);
580 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe234) 609 if (!blogic_probe_options.limited_isa || blogic_probe_options.probe234)
581 BusLogic_AppendProbeAddressISA(0x234); 610 blogic_add_probeaddr_isa(0x234);
582 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe130) 611 if (!blogic_probe_options.limited_isa || blogic_probe_options.probe130)
583 BusLogic_AppendProbeAddressISA(0x130); 612 blogic_add_probeaddr_isa(0x130);
584 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe134) 613 if (!blogic_probe_options.limited_isa || blogic_probe_options.probe134)
585 BusLogic_AppendProbeAddressISA(0x134); 614 blogic_add_probeaddr_isa(0x134);
586} 615}
587 616
588 617
@@ -590,25 +619,35 @@ static void __init BusLogic_InitializeProbeInfoListISA(struct BusLogic_HostAdapt
590 619
591 620
592/* 621/*
593 BusLogic_SortProbeInfo sorts a section of BusLogic_ProbeInfoList in order 622 blogic_sort_probeinfo sorts a section of blogic_probeinfo_list in order
594 of increasing PCI Bus and Device Number. 623 of increasing PCI Bus and Device Number.
595*/ 624*/
596 625
597static void __init BusLogic_SortProbeInfo(struct BusLogic_ProbeInfo *ProbeInfoList, int ProbeInfoCount) 626static void __init blogic_sort_probeinfo(struct blogic_probeinfo
627 *probeinfo_list, int probeinfo_cnt)
598{ 628{
599 int LastInterchange = ProbeInfoCount - 1, Bound, j; 629 int last_exchange = probeinfo_cnt - 1, bound, j;
600 while (LastInterchange > 0) { 630
601 Bound = LastInterchange; 631 while (last_exchange > 0) {
602 LastInterchange = 0; 632 bound = last_exchange;
603 for (j = 0; j < Bound; j++) { 633 last_exchange = 0;
604 struct BusLogic_ProbeInfo *ProbeInfo1 = &ProbeInfoList[j]; 634 for (j = 0; j < bound; j++) {
605 struct BusLogic_ProbeInfo *ProbeInfo2 = &ProbeInfoList[j + 1]; 635 struct blogic_probeinfo *probeinfo1 =
606 if (ProbeInfo1->Bus > ProbeInfo2->Bus || (ProbeInfo1->Bus == ProbeInfo2->Bus && (ProbeInfo1->Device > ProbeInfo2->Device))) { 636 &probeinfo_list[j];
607 struct BusLogic_ProbeInfo TempProbeInfo; 637 struct blogic_probeinfo *probeinfo2 =
608 memcpy(&TempProbeInfo, ProbeInfo1, sizeof(struct BusLogic_ProbeInfo)); 638 &probeinfo_list[j + 1];
609 memcpy(ProbeInfo1, ProbeInfo2, sizeof(struct BusLogic_ProbeInfo)); 639 if (probeinfo1->bus > probeinfo2->bus ||
610 memcpy(ProbeInfo2, &TempProbeInfo, sizeof(struct BusLogic_ProbeInfo)); 640 (probeinfo1->bus == probeinfo2->bus &&
611 LastInterchange = j; 641 (probeinfo1->dev > probeinfo2->dev))) {
642 struct blogic_probeinfo tmp_probeinfo;
643
644 memcpy(&tmp_probeinfo, probeinfo1,
645 sizeof(struct blogic_probeinfo));
646 memcpy(probeinfo1, probeinfo2,
647 sizeof(struct blogic_probeinfo));
648 memcpy(probeinfo2, &tmp_probeinfo,
649 sizeof(struct blogic_probeinfo));
650 last_exchange = j;
612 } 651 }
613 } 652 }
614 } 653 }
@@ -616,84 +655,88 @@ static void __init BusLogic_SortProbeInfo(struct BusLogic_ProbeInfo *ProbeInfoLi
616 655
617 656
618/* 657/*
619 BusLogic_InitializeMultiMasterProbeInfo initializes the list of I/O Address 658 blogic_init_mm_probeinfo initializes the list of I/O Address
620 and Bus Probe Information to be checked for potential BusLogic MultiMaster 659 and Bus Probe Information to be checked for potential BusLogic MultiMaster
621 SCSI Host Adapters by interrogating the PCI Configuration Space on PCI 660 SCSI Host Adapters by interrogating the PCI Configuration Space on PCI
622 machines as well as from the list of standard BusLogic MultiMaster ISA 661 machines as well as from the list of standard BusLogic MultiMaster ISA
623 I/O Addresses. It returns the number of PCI MultiMaster Host Adapters found. 662 I/O Addresses. It returns the number of PCI MultiMaster Host Adapters found.
624*/ 663*/
625 664
626static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAdapter 665static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter)
627 *PrototypeHostAdapter)
628{ 666{
629 struct BusLogic_ProbeInfo *PrimaryProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount]; 667 struct blogic_probeinfo *pr_probeinfo =
630 int NonPrimaryPCIMultiMasterIndex = BusLogic_ProbeInfoCount + 1; 668 &blogic_probeinfo_list[blogic_probeinfo_count];
631 int NonPrimaryPCIMultiMasterCount = 0, PCIMultiMasterCount = 0; 669 int nonpr_mmindex = blogic_probeinfo_count + 1;
632 bool ForceBusDeviceScanningOrder = false; 670 int nonpr_mmcount = 0, mmcount = 0;
633 bool ForceBusDeviceScanningOrderChecked = false; 671 bool force_scan_order = false;
634 bool StandardAddressSeen[6]; 672 bool force_scan_order_checked = false;
635 struct pci_dev *PCI_Device = NULL; 673 bool addr_seen[6];
674 struct pci_dev *pci_device = NULL;
636 int i; 675 int i;
637 if (BusLogic_ProbeInfoCount >= BusLogic_MaxHostAdapters) 676 if (blogic_probeinfo_count >= BLOGIC_MAX_ADAPTERS)
638 return 0; 677 return 0;
639 BusLogic_ProbeInfoCount++; 678 blogic_probeinfo_count++;
640 for (i = 0; i < 6; i++) 679 for (i = 0; i < 6; i++)
641 StandardAddressSeen[i] = false; 680 addr_seen[i] = false;
642 /* 681 /*
643 Iterate over the MultiMaster PCI Host Adapters. For each enumerated host 682 Iterate over the MultiMaster PCI Host Adapters. For each
644 adapter, determine whether its ISA Compatible I/O Port is enabled and if 683 enumerated host adapter, determine whether its ISA Compatible
645 so, whether it is assigned the Primary I/O Address. A host adapter that is 684 I/O Port is enabled and if so, whether it is assigned the
646 assigned the Primary I/O Address will always be the preferred boot device. 685 Primary I/O Address. A host adapter that is assigned the
647 The MultiMaster BIOS will first recognize a host adapter at the Primary I/O 686 Primary I/O Address will always be the preferred boot device.
648 Address, then any other PCI host adapters, and finally any host adapters 687 The MultiMaster BIOS will first recognize a host adapter at
649 located at the remaining standard ISA I/O Addresses. When a PCI host 688 the Primary I/O Address, then any other PCI host adapters,
650 adapter is found with its ISA Compatible I/O Port enabled, a command is 689 and finally any host adapters located at the remaining
651 issued to disable the ISA Compatible I/O Port, and it is noted that the 690 standard ISA I/O Addresses. When a PCI host adapter is found
691 with its ISA Compatible I/O Port enabled, a command is issued
692 to disable the ISA Compatible I/O Port, and it is noted that the
652 particular standard ISA I/O Address need not be probed. 693 particular standard ISA I/O Address need not be probed.
653 */ 694 */
654 PrimaryProbeInfo->IO_Address = 0; 695 pr_probeinfo->io_addr = 0;
655 while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, PCI_Device)) != NULL) { 696 while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
656 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; 697 PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
657 struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation; 698 pci_device)) != NULL) {
658 enum BusLogic_ISACompatibleIOPort ModifyIOAddressRequest; 699 struct blogic_adapter *adapter = adapter;
659 unsigned char Bus; 700 struct blogic_adapter_info adapter_info;
660 unsigned char Device; 701 enum blogic_isa_ioport mod_ioaddr_req;
661 unsigned int IRQ_Channel; 702 unsigned char bus;
662 unsigned long BaseAddress0; 703 unsigned char device;
663 unsigned long BaseAddress1; 704 unsigned int irq_ch;
664 unsigned long IO_Address; 705 unsigned long base_addr0;
665 unsigned long PCI_Address; 706 unsigned long base_addr1;
666 707 unsigned long io_addr;
667 if (pci_enable_device(PCI_Device)) 708 unsigned long pci_addr;
709
710 if (pci_enable_device(pci_device))
668 continue; 711 continue;
669 712
670 if (pci_set_dma_mask(PCI_Device, DMA_BIT_MASK(32) )) 713 if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32)))
671 continue; 714 continue;
672 715
673 Bus = PCI_Device->bus->number; 716 bus = pci_device->bus->number;
674 Device = PCI_Device->devfn >> 3; 717 device = pci_device->devfn >> 3;
675 IRQ_Channel = PCI_Device->irq; 718 irq_ch = pci_device->irq;
676 IO_Address = BaseAddress0 = pci_resource_start(PCI_Device, 0); 719 io_addr = base_addr0 = pci_resource_start(pci_device, 0);
677 PCI_Address = BaseAddress1 = pci_resource_start(PCI_Device, 1); 720 pci_addr = base_addr1 = pci_resource_start(pci_device, 1);
678 721
679 if (pci_resource_flags(PCI_Device, 0) & IORESOURCE_MEM) { 722 if (pci_resource_flags(pci_device, 0) & IORESOURCE_MEM) {
680 BusLogic_Error("BusLogic: Base Address0 0x%X not I/O for " "MultiMaster Host Adapter\n", NULL, BaseAddress0); 723 blogic_err("BusLogic: Base Address0 0x%X not I/O for " "MultiMaster Host Adapter\n", NULL, base_addr0);
681 BusLogic_Error("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, Bus, Device, IO_Address); 724 blogic_err("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, bus, device, io_addr);
682 continue; 725 continue;
683 } 726 }
684 if (pci_resource_flags(PCI_Device, 1) & IORESOURCE_IO) { 727 if (pci_resource_flags(pci_device, 1) & IORESOURCE_IO) {
685 BusLogic_Error("BusLogic: Base Address1 0x%X not Memory for " "MultiMaster Host Adapter\n", NULL, BaseAddress1); 728 blogic_err("BusLogic: Base Address1 0x%X not Memory for " "MultiMaster Host Adapter\n", NULL, base_addr1);
686 BusLogic_Error("at PCI Bus %d Device %d PCI Address 0x%X\n", NULL, Bus, Device, PCI_Address); 729 blogic_err("at PCI Bus %d Device %d PCI Address 0x%X\n", NULL, bus, device, pci_addr);
687 continue; 730 continue;
688 } 731 }
689 if (IRQ_Channel == 0) { 732 if (irq_ch == 0) {
690 BusLogic_Error("BusLogic: IRQ Channel %d invalid for " "MultiMaster Host Adapter\n", NULL, IRQ_Channel); 733 blogic_err("BusLogic: IRQ Channel %d invalid for " "MultiMaster Host Adapter\n", NULL, irq_ch);
691 BusLogic_Error("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, Bus, Device, IO_Address); 734 blogic_err("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, bus, device, io_addr);
692 continue; 735 continue;
693 } 736 }
694 if (BusLogic_GlobalOptions.TraceProbe) { 737 if (blogic_global_options.trace_probe) {
695 BusLogic_Notice("BusLogic: PCI MultiMaster Host Adapter " "detected at\n", NULL); 738 blogic_notice("BusLogic: PCI MultiMaster Host Adapter " "detected at\n", NULL);
696 BusLogic_Notice("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n", NULL, Bus, Device, IO_Address, PCI_Address); 739 blogic_notice("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n", NULL, bus, device, io_addr, pci_addr);
697 } 740 }
698 /* 741 /*
699 Issue the Inquire PCI Host Adapter Information command to determine 742 Issue the Inquire PCI Host Adapter Information command to determine
@@ -701,238 +744,258 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
701 known and enabled, note that the particular Standard ISA I/O 744 known and enabled, note that the particular Standard ISA I/O
702 Address should not be probed. 745 Address should not be probed.
703 */ 746 */
704 HostAdapter->IO_Address = IO_Address; 747 adapter->io_addr = io_addr;
705 BusLogic_InterruptReset(HostAdapter); 748 blogic_intreset(adapter);
706 if (BusLogic_Command(HostAdapter, BusLogic_InquirePCIHostAdapterInformation, NULL, 0, &PCIHostAdapterInformation, sizeof(PCIHostAdapterInformation)) 749 if (blogic_cmd(adapter, BLOGIC_INQ_PCI_INFO, NULL, 0,
707 == sizeof(PCIHostAdapterInformation)) { 750 &adapter_info, sizeof(adapter_info)) ==
708 if (PCIHostAdapterInformation.ISACompatibleIOPort < 6) 751 sizeof(adapter_info)) {
709 StandardAddressSeen[PCIHostAdapterInformation.ISACompatibleIOPort] = true; 752 if (adapter_info.isa_port < 6)
753 addr_seen[adapter_info.isa_port] = true;
710 } else 754 } else
711 PCIHostAdapterInformation.ISACompatibleIOPort = BusLogic_IO_Disable; 755 adapter_info.isa_port = BLOGIC_IO_DISABLE;
712 /* 756 /*
713 * Issue the Modify I/O Address command to disable the ISA Compatible 757 Issue the Modify I/O Address command to disable the
714 * I/O Port. On PCI Host Adapters, the Modify I/O Address command 758 ISA Compatible I/O Port. On PCI Host Adapters, the
715 * allows modification of the ISA compatible I/O Address that the Host 759 Modify I/O Address command allows modification of the
716 * Adapter responds to; it does not affect the PCI compliant I/O Address 760 ISA compatible I/O Address that the Host Adapter
717 * assigned at system initialization. 761 responds to; it does not affect the PCI compliant
762 I/O Address assigned at system initialization.
718 */ 763 */
719 ModifyIOAddressRequest = BusLogic_IO_Disable; 764 mod_ioaddr_req = BLOGIC_IO_DISABLE;
720 BusLogic_Command(HostAdapter, BusLogic_ModifyIOAddress, &ModifyIOAddressRequest, sizeof(ModifyIOAddressRequest), NULL, 0); 765 blogic_cmd(adapter, BLOGIC_MOD_IOADDR, &mod_ioaddr_req,
766 sizeof(mod_ioaddr_req), NULL, 0);
721 /* 767 /*
722 For the first MultiMaster Host Adapter enumerated, issue the Fetch 768 For the first MultiMaster Host Adapter enumerated,
723 Host Adapter Local RAM command to read byte 45 of the AutoSCSI area, 769 issue the Fetch Host Adapter Local RAM command to read
724 for the setting of the "Use Bus And Device # For PCI Scanning Seq." 770 byte 45 of the AutoSCSI area, for the setting of the
725 option. Issue the Inquire Board ID command since this option is 771 "Use Bus And Device # For PCI Scanning Seq." option.
772 Issue the Inquire Board ID command since this option is
726 only valid for the BT-948/958/958D. 773 only valid for the BT-948/958/958D.
727 */ 774 */
728 if (!ForceBusDeviceScanningOrderChecked) { 775 if (!force_scan_order_checked) {
729 struct BusLogic_FetchHostAdapterLocalRAMRequest FetchHostAdapterLocalRAMRequest; 776 struct blogic_fetch_localram fetch_localram;
730 struct BusLogic_AutoSCSIByte45 AutoSCSIByte45; 777 struct blogic_autoscsi_byte45 autoscsi_byte45;
731 struct BusLogic_BoardID BoardID; 778 struct blogic_board_id id;
732 FetchHostAdapterLocalRAMRequest.ByteOffset = BusLogic_AutoSCSI_BaseOffset + 45; 779
733 FetchHostAdapterLocalRAMRequest.ByteCount = sizeof(AutoSCSIByte45); 780 fetch_localram.offset = BLOGIC_AUTOSCSI_BASE + 45;
734 BusLogic_Command(HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest, sizeof(FetchHostAdapterLocalRAMRequest), &AutoSCSIByte45, sizeof(AutoSCSIByte45)); 781 fetch_localram.count = sizeof(autoscsi_byte45);
735 BusLogic_Command(HostAdapter, BusLogic_InquireBoardID, NULL, 0, &BoardID, sizeof(BoardID)); 782 blogic_cmd(adapter, BLOGIC_FETCH_LOCALRAM,
736 if (BoardID.FirmwareVersion1stDigit == '5') 783 &fetch_localram, sizeof(fetch_localram),
737 ForceBusDeviceScanningOrder = AutoSCSIByte45.ForceBusDeviceScanningOrder; 784 &autoscsi_byte45,
738 ForceBusDeviceScanningOrderChecked = true; 785 sizeof(autoscsi_byte45));
786 blogic_cmd(adapter, BLOGIC_GET_BOARD_ID, NULL, 0, &id,
787 sizeof(id));
788 if (id.fw_ver_digit1 == '5')
789 force_scan_order =
790 autoscsi_byte45.force_scan_order;
791 force_scan_order_checked = true;
739 } 792 }
740 /* 793 /*
741 Determine whether this MultiMaster Host Adapter has its ISA 794 Determine whether this MultiMaster Host Adapter has its
742 Compatible I/O Port enabled and is assigned the Primary I/O Address. 795 ISA Compatible I/O Port enabled and is assigned the
743 If it does, then it is the Primary MultiMaster Host Adapter and must 796 Primary I/O Address. If it does, then it is the Primary
744 be recognized first. If it does not, then it is added to the list 797 MultiMaster Host Adapter and must be recognized first.
745 for probing after any Primary MultiMaster Host Adapter is probed. 798 If it does not, then it is added to the list for probing
799 after any Primary MultiMaster Host Adapter is probed.
746 */ 800 */
747 if (PCIHostAdapterInformation.ISACompatibleIOPort == BusLogic_IO_330) { 801 if (adapter_info.isa_port == BLOGIC_IO_330) {
748 PrimaryProbeInfo->HostAdapterType = BusLogic_MultiMaster; 802 pr_probeinfo->adapter_type = BLOGIC_MULTIMASTER;
749 PrimaryProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; 803 pr_probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
750 PrimaryProbeInfo->IO_Address = IO_Address; 804 pr_probeinfo->io_addr = io_addr;
751 PrimaryProbeInfo->PCI_Address = PCI_Address; 805 pr_probeinfo->pci_addr = pci_addr;
752 PrimaryProbeInfo->Bus = Bus; 806 pr_probeinfo->bus = bus;
753 PrimaryProbeInfo->Device = Device; 807 pr_probeinfo->dev = device;
754 PrimaryProbeInfo->IRQ_Channel = IRQ_Channel; 808 pr_probeinfo->irq_ch = irq_ch;
755 PrimaryProbeInfo->PCI_Device = pci_dev_get(PCI_Device); 809 pr_probeinfo->pci_device = pci_dev_get(pci_device);
756 PCIMultiMasterCount++; 810 mmcount++;
757 } else if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) { 811 } else if (blogic_probeinfo_count < BLOGIC_MAX_ADAPTERS) {
758 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; 812 struct blogic_probeinfo *probeinfo =
759 ProbeInfo->HostAdapterType = BusLogic_MultiMaster; 813 &blogic_probeinfo_list[blogic_probeinfo_count++];
760 ProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; 814 probeinfo->adapter_type = BLOGIC_MULTIMASTER;
761 ProbeInfo->IO_Address = IO_Address; 815 probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
762 ProbeInfo->PCI_Address = PCI_Address; 816 probeinfo->io_addr = io_addr;
763 ProbeInfo->Bus = Bus; 817 probeinfo->pci_addr = pci_addr;
764 ProbeInfo->Device = Device; 818 probeinfo->bus = bus;
765 ProbeInfo->IRQ_Channel = IRQ_Channel; 819 probeinfo->dev = device;
766 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device); 820 probeinfo->irq_ch = irq_ch;
767 NonPrimaryPCIMultiMasterCount++; 821 probeinfo->pci_device = pci_dev_get(pci_device);
768 PCIMultiMasterCount++; 822 nonpr_mmcount++;
823 mmcount++;
769 } else 824 } else
770 BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL); 825 blogic_warn("BusLogic: Too many Host Adapters " "detected\n", NULL);
771 } 826 }
772 /* 827 /*
773 If the AutoSCSI "Use Bus And Device # For PCI Scanning Seq." option is ON 828 If the AutoSCSI "Use Bus And Device # For PCI Scanning Seq."
774 for the first enumerated MultiMaster Host Adapter, and if that host adapter 829 option is ON for the first enumerated MultiMaster Host Adapter,
775 is a BT-948/958/958D, then the MultiMaster BIOS will recognize MultiMaster 830 and if that host adapter is a BT-948/958/958D, then the
776 Host Adapters in the order of increasing PCI Bus and Device Number. In 831 MultiMaster BIOS will recognize MultiMaster Host Adapters in
777 that case, sort the probe information into the same order the BIOS uses. 832 the order of increasing PCI Bus and Device Number. In that case,
778 If this option is OFF, then the MultiMaster BIOS will recognize MultiMaster 833 sort the probe information into the same order the BIOS uses.
779 Host Adapters in the order they are enumerated by the PCI BIOS, and hence 834 If this option is OFF, then the MultiMaster BIOS will recognize
780 no sorting is necessary. 835 MultiMaster Host Adapters in the order they are enumerated by
781 */ 836 the PCI BIOS, and hence no sorting is necessary.
782 if (ForceBusDeviceScanningOrder) 837 */
783 BusLogic_SortProbeInfo(&BusLogic_ProbeInfoList[NonPrimaryPCIMultiMasterIndex], NonPrimaryPCIMultiMasterCount); 838 if (force_scan_order)
784 /* 839 blogic_sort_probeinfo(&blogic_probeinfo_list[nonpr_mmindex],
785 If no PCI MultiMaster Host Adapter is assigned the Primary I/O Address, 840 nonpr_mmcount);
786 then the Primary I/O Address must be probed explicitly before any PCI 841 /*
787 host adapters are probed. 842 If no PCI MultiMaster Host Adapter is assigned the Primary
788 */ 843 I/O Address, then the Primary I/O Address must be probed
789 if (!BusLogic_ProbeOptions.NoProbeISA) 844 explicitly before any PCI host adapters are probed.
790 if (PrimaryProbeInfo->IO_Address == 0 && 845 */
791 (!BusLogic_ProbeOptions.LimitedProbeISA || 846 if (!blogic_probe_options.noprobe_isa)
792 BusLogic_ProbeOptions.Probe330)) { 847 if (pr_probeinfo->io_addr == 0 &&
793 PrimaryProbeInfo->HostAdapterType = BusLogic_MultiMaster; 848 (!blogic_probe_options.limited_isa ||
794 PrimaryProbeInfo->HostAdapterBusType = BusLogic_ISA_Bus; 849 blogic_probe_options.probe330)) {
795 PrimaryProbeInfo->IO_Address = 0x330; 850 pr_probeinfo->adapter_type = BLOGIC_MULTIMASTER;
851 pr_probeinfo->adapter_bus_type = BLOGIC_ISA_BUS;
852 pr_probeinfo->io_addr = 0x330;
796 } 853 }
797 /* 854 /*
798 Append the list of standard BusLogic MultiMaster ISA I/O Addresses, 855 Append the list of standard BusLogic MultiMaster ISA I/O Addresses,
799 omitting the Primary I/O Address which has already been handled. 856 omitting the Primary I/O Address which has already been handled.
800 */ 857 */
801 if (!BusLogic_ProbeOptions.NoProbeISA) { 858 if (!blogic_probe_options.noprobe_isa) {
802 if (!StandardAddressSeen[1] && 859 if (!addr_seen[1] &&
803 (!BusLogic_ProbeOptions.LimitedProbeISA || 860 (!blogic_probe_options.limited_isa ||
804 BusLogic_ProbeOptions.Probe334)) 861 blogic_probe_options.probe334))
805 BusLogic_AppendProbeAddressISA(0x334); 862 blogic_add_probeaddr_isa(0x334);
806 if (!StandardAddressSeen[2] && 863 if (!addr_seen[2] &&
807 (!BusLogic_ProbeOptions.LimitedProbeISA || 864 (!blogic_probe_options.limited_isa ||
808 BusLogic_ProbeOptions.Probe230)) 865 blogic_probe_options.probe230))
809 BusLogic_AppendProbeAddressISA(0x230); 866 blogic_add_probeaddr_isa(0x230);
810 if (!StandardAddressSeen[3] && 867 if (!addr_seen[3] &&
811 (!BusLogic_ProbeOptions.LimitedProbeISA || 868 (!blogic_probe_options.limited_isa ||
812 BusLogic_ProbeOptions.Probe234)) 869 blogic_probe_options.probe234))
813 BusLogic_AppendProbeAddressISA(0x234); 870 blogic_add_probeaddr_isa(0x234);
814 if (!StandardAddressSeen[4] && 871 if (!addr_seen[4] &&
815 (!BusLogic_ProbeOptions.LimitedProbeISA || 872 (!blogic_probe_options.limited_isa ||
816 BusLogic_ProbeOptions.Probe130)) 873 blogic_probe_options.probe130))
817 BusLogic_AppendProbeAddressISA(0x130); 874 blogic_add_probeaddr_isa(0x130);
818 if (!StandardAddressSeen[5] && 875 if (!addr_seen[5] &&
819 (!BusLogic_ProbeOptions.LimitedProbeISA || 876 (!blogic_probe_options.limited_isa ||
820 BusLogic_ProbeOptions.Probe134)) 877 blogic_probe_options.probe134))
821 BusLogic_AppendProbeAddressISA(0x134); 878 blogic_add_probeaddr_isa(0x134);
822 } 879 }
823 /* 880 /*
824 Iterate over the older non-compliant MultiMaster PCI Host Adapters, 881 Iterate over the older non-compliant MultiMaster PCI Host Adapters,
825 noting the PCI bus location and assigned IRQ Channel. 882 noting the PCI bus location and assigned IRQ Channel.
826 */ 883 */
827 PCI_Device = NULL; 884 pci_device = NULL;
828 while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, PCI_Device)) != NULL) { 885 while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
829 unsigned char Bus; 886 PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC,
830 unsigned char Device; 887 pci_device)) != NULL) {
831 unsigned int IRQ_Channel; 888 unsigned char bus;
832 unsigned long IO_Address; 889 unsigned char device;
890 unsigned int irq_ch;
891 unsigned long io_addr;
833 892
834 if (pci_enable_device(PCI_Device)) 893 if (pci_enable_device(pci_device))
835 continue; 894 continue;
836 895
837 if (pci_set_dma_mask(PCI_Device, DMA_BIT_MASK(32))) 896 if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32)))
838 continue; 897 continue;
839 898
840 Bus = PCI_Device->bus->number; 899 bus = pci_device->bus->number;
841 Device = PCI_Device->devfn >> 3; 900 device = pci_device->devfn >> 3;
842 IRQ_Channel = PCI_Device->irq; 901 irq_ch = pci_device->irq;
843 IO_Address = pci_resource_start(PCI_Device, 0); 902 io_addr = pci_resource_start(pci_device, 0);
844 903
845 if (IO_Address == 0 || IRQ_Channel == 0) 904 if (io_addr == 0 || irq_ch == 0)
846 continue; 905 continue;
847 for (i = 0; i < BusLogic_ProbeInfoCount; i++) { 906 for (i = 0; i < blogic_probeinfo_count; i++) {
848 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[i]; 907 struct blogic_probeinfo *probeinfo =
849 if (ProbeInfo->IO_Address == IO_Address && ProbeInfo->HostAdapterType == BusLogic_MultiMaster) { 908 &blogic_probeinfo_list[i];
850 ProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; 909 if (probeinfo->io_addr == io_addr &&
851 ProbeInfo->PCI_Address = 0; 910 probeinfo->adapter_type == BLOGIC_MULTIMASTER) {
852 ProbeInfo->Bus = Bus; 911 probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
853 ProbeInfo->Device = Device; 912 probeinfo->pci_addr = 0;
854 ProbeInfo->IRQ_Channel = IRQ_Channel; 913 probeinfo->bus = bus;
855 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device); 914 probeinfo->dev = device;
915 probeinfo->irq_ch = irq_ch;
916 probeinfo->pci_device = pci_dev_get(pci_device);
856 break; 917 break;
857 } 918 }
858 } 919 }
859 } 920 }
860 return PCIMultiMasterCount; 921 return mmcount;
861} 922}
862 923
863 924
864/* 925/*
865 BusLogic_InitializeFlashPointProbeInfo initializes the list of I/O Address 926 blogic_init_fp_probeinfo initializes the list of I/O Address
866 and Bus Probe Information to be checked for potential BusLogic FlashPoint 927 and Bus Probe Information to be checked for potential BusLogic FlashPoint
867 Host Adapters by interrogating the PCI Configuration Space. It returns the 928 Host Adapters by interrogating the PCI Configuration Space. It returns the
868 number of FlashPoint Host Adapters found. 929 number of FlashPoint Host Adapters found.
869*/ 930*/
870 931
871static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAdapter 932static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter)
872 *PrototypeHostAdapter)
873{ 933{
874 int FlashPointIndex = BusLogic_ProbeInfoCount, FlashPointCount = 0; 934 int fpindex = blogic_probeinfo_count, fpcount = 0;
875 struct pci_dev *PCI_Device = NULL; 935 struct pci_dev *pci_device = NULL;
876 /* 936 /*
877 Interrogate PCI Configuration Space for any FlashPoint Host Adapters. 937 Interrogate PCI Configuration Space for any FlashPoint Host Adapters.
878 */ 938 */
879 while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, PCI_Device)) != NULL) { 939 while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
880 unsigned char Bus; 940 PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT,
881 unsigned char Device; 941 pci_device)) != NULL) {
882 unsigned int IRQ_Channel; 942 unsigned char bus;
883 unsigned long BaseAddress0; 943 unsigned char device;
884 unsigned long BaseAddress1; 944 unsigned int irq_ch;
885 unsigned long IO_Address; 945 unsigned long base_addr0;
886 unsigned long PCI_Address; 946 unsigned long base_addr1;
887 947 unsigned long io_addr;
888 if (pci_enable_device(PCI_Device)) 948 unsigned long pci_addr;
949
950 if (pci_enable_device(pci_device))
889 continue; 951 continue;
890 952
891 if (pci_set_dma_mask(PCI_Device, DMA_BIT_MASK(32))) 953 if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32)))
892 continue; 954 continue;
893 955
894 Bus = PCI_Device->bus->number; 956 bus = pci_device->bus->number;
895 Device = PCI_Device->devfn >> 3; 957 device = pci_device->devfn >> 3;
896 IRQ_Channel = PCI_Device->irq; 958 irq_ch = pci_device->irq;
897 IO_Address = BaseAddress0 = pci_resource_start(PCI_Device, 0); 959 io_addr = base_addr0 = pci_resource_start(pci_device, 0);
898 PCI_Address = BaseAddress1 = pci_resource_start(PCI_Device, 1); 960 pci_addr = base_addr1 = pci_resource_start(pci_device, 1);
899#ifdef CONFIG_SCSI_FLASHPOINT 961#ifdef CONFIG_SCSI_FLASHPOINT
900 if (pci_resource_flags(PCI_Device, 0) & IORESOURCE_MEM) { 962 if (pci_resource_flags(pci_device, 0) & IORESOURCE_MEM) {
901 BusLogic_Error("BusLogic: Base Address0 0x%X not I/O for " "FlashPoint Host Adapter\n", NULL, BaseAddress0); 963 blogic_err("BusLogic: Base Address0 0x%X not I/O for " "FlashPoint Host Adapter\n", NULL, base_addr0);
902 BusLogic_Error("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, Bus, Device, IO_Address); 964 blogic_err("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, bus, device, io_addr);
903 continue; 965 continue;
904 } 966 }
905 if (pci_resource_flags(PCI_Device, 1) & IORESOURCE_IO) { 967 if (pci_resource_flags(pci_device, 1) & IORESOURCE_IO) {
906 BusLogic_Error("BusLogic: Base Address1 0x%X not Memory for " "FlashPoint Host Adapter\n", NULL, BaseAddress1); 968 blogic_err("BusLogic: Base Address1 0x%X not Memory for " "FlashPoint Host Adapter\n", NULL, base_addr1);
907 BusLogic_Error("at PCI Bus %d Device %d PCI Address 0x%X\n", NULL, Bus, Device, PCI_Address); 969 blogic_err("at PCI Bus %d Device %d PCI Address 0x%X\n", NULL, bus, device, pci_addr);
908 continue; 970 continue;
909 } 971 }
910 if (IRQ_Channel == 0) { 972 if (irq_ch == 0) {
911 BusLogic_Error("BusLogic: IRQ Channel %d invalid for " "FlashPoint Host Adapter\n", NULL, IRQ_Channel); 973 blogic_err("BusLogic: IRQ Channel %d invalid for " "FlashPoint Host Adapter\n", NULL, irq_ch);
912 BusLogic_Error("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, Bus, Device, IO_Address); 974 blogic_err("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, bus, device, io_addr);
913 continue; 975 continue;
914 } 976 }
915 if (BusLogic_GlobalOptions.TraceProbe) { 977 if (blogic_global_options.trace_probe) {
916 BusLogic_Notice("BusLogic: FlashPoint Host Adapter " "detected at\n", NULL); 978 blogic_notice("BusLogic: FlashPoint Host Adapter " "detected at\n", NULL);
917 BusLogic_Notice("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n", NULL, Bus, Device, IO_Address, PCI_Address); 979 blogic_notice("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n", NULL, bus, device, io_addr, pci_addr);
918 } 980 }
919 if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) { 981 if (blogic_probeinfo_count < BLOGIC_MAX_ADAPTERS) {
920 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; 982 struct blogic_probeinfo *probeinfo =
921 ProbeInfo->HostAdapterType = BusLogic_FlashPoint; 983 &blogic_probeinfo_list[blogic_probeinfo_count++];
922 ProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; 984 probeinfo->adapter_type = BLOGIC_FLASHPOINT;
923 ProbeInfo->IO_Address = IO_Address; 985 probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
924 ProbeInfo->PCI_Address = PCI_Address; 986 probeinfo->io_addr = io_addr;
925 ProbeInfo->Bus = Bus; 987 probeinfo->pci_addr = pci_addr;
926 ProbeInfo->Device = Device; 988 probeinfo->bus = bus;
927 ProbeInfo->IRQ_Channel = IRQ_Channel; 989 probeinfo->dev = device;
928 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device); 990 probeinfo->irq_ch = irq_ch;
929 FlashPointCount++; 991 probeinfo->pci_device = pci_dev_get(pci_device);
992 fpcount++;
930 } else 993 } else
931 BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL); 994 blogic_warn("BusLogic: Too many Host Adapters " "detected\n", NULL);
932#else 995#else
933 BusLogic_Error("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n", NULL, Bus, Device); 996 blogic_err("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n", NULL, bus, device);
934 BusLogic_Error("BusLogic: I/O Address 0x%X PCI Address 0x%X, irq %d, " "but FlashPoint\n", NULL, IO_Address, PCI_Address, IRQ_Channel); 997 blogic_err("BusLogic: I/O Address 0x%X PCI Address 0x%X, irq %d, " "but FlashPoint\n", NULL, io_addr, pci_addr, irq_ch);
935 BusLogic_Error("BusLogic: support was omitted in this kernel " "configuration.\n", NULL); 998 blogic_err("BusLogic: support was omitted in this kernel " "configuration.\n", NULL);
936#endif 999#endif
937 } 1000 }
938 /* 1001 /*
@@ -940,13 +1003,13 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
940 increasing PCI Bus and Device Number, so sort the probe information into 1003 increasing PCI Bus and Device Number, so sort the probe information into
941 the same order the BIOS uses. 1004 the same order the BIOS uses.
942 */ 1005 */
943 BusLogic_SortProbeInfo(&BusLogic_ProbeInfoList[FlashPointIndex], FlashPointCount); 1006 blogic_sort_probeinfo(&blogic_probeinfo_list[fpindex], fpcount);
944 return FlashPointCount; 1007 return fpcount;
945} 1008}
946 1009
947 1010
948/* 1011/*
949 BusLogic_InitializeProbeInfoList initializes the list of I/O Address and Bus 1012 blogic_init_probeinfo_list initializes the list of I/O Address and Bus
950 Probe Information to be checked for potential BusLogic SCSI Host Adapters by 1013 Probe Information to be checked for potential BusLogic SCSI Host Adapters by
951 interrogating the PCI Configuration Space on PCI machines as well as from the 1014 interrogating the PCI Configuration Space on PCI machines as well as from the
952 list of standard BusLogic MultiMaster ISA I/O Addresses. By default, if both 1015 list of standard BusLogic MultiMaster ISA I/O Addresses. By default, if both
@@ -958,104 +1021,125 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
958 a particular probe order. 1021 a particular probe order.
959*/ 1022*/
960 1023
961static void __init BusLogic_InitializeProbeInfoList(struct BusLogic_HostAdapter 1024static void __init blogic_init_probeinfo_list(struct blogic_adapter *adapter)
962 *PrototypeHostAdapter)
963{ 1025{
964 /* 1026 /*
965 If a PCI BIOS is present, interrogate it for MultiMaster and FlashPoint 1027 If a PCI BIOS is present, interrogate it for MultiMaster and
966 Host Adapters; otherwise, default to the standard ISA MultiMaster probe. 1028 FlashPoint Host Adapters; otherwise, default to the standard
967 */ 1029 ISA MultiMaster probe.
968 if (!BusLogic_ProbeOptions.NoProbePCI) { 1030 */
969 if (BusLogic_ProbeOptions.MultiMasterFirst) { 1031 if (!blogic_probe_options.noprobe_pci) {
970 BusLogic_InitializeMultiMasterProbeInfo(PrototypeHostAdapter); 1032 if (blogic_probe_options.multimaster_first) {
971 BusLogic_InitializeFlashPointProbeInfo(PrototypeHostAdapter); 1033 blogic_init_mm_probeinfo(adapter);
972 } else if (BusLogic_ProbeOptions.FlashPointFirst) { 1034 blogic_init_fp_probeinfo(adapter);
973 BusLogic_InitializeFlashPointProbeInfo(PrototypeHostAdapter); 1035 } else if (blogic_probe_options.flashpoint_first) {
974 BusLogic_InitializeMultiMasterProbeInfo(PrototypeHostAdapter); 1036 blogic_init_fp_probeinfo(adapter);
1037 blogic_init_mm_probeinfo(adapter);
975 } else { 1038 } else {
976 int FlashPointCount = BusLogic_InitializeFlashPointProbeInfo(PrototypeHostAdapter); 1039 int fpcount = blogic_init_fp_probeinfo(adapter);
977 int PCIMultiMasterCount = BusLogic_InitializeMultiMasterProbeInfo(PrototypeHostAdapter); 1040 int mmcount = blogic_init_mm_probeinfo(adapter);
978 if (FlashPointCount > 0 && PCIMultiMasterCount > 0) { 1041 if (fpcount > 0 && mmcount > 0) {
979 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[FlashPointCount]; 1042 struct blogic_probeinfo *probeinfo =
980 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; 1043 &blogic_probeinfo_list[fpcount];
981 struct BusLogic_FetchHostAdapterLocalRAMRequest FetchHostAdapterLocalRAMRequest; 1044 struct blogic_adapter *myadapter = adapter;
982 struct BusLogic_BIOSDriveMapByte Drive0MapByte; 1045 struct blogic_fetch_localram fetch_localram;
983 while (ProbeInfo->HostAdapterBusType != BusLogic_PCI_Bus) 1046 struct blogic_bios_drvmap d0_mapbyte;
984 ProbeInfo++; 1047
985 HostAdapter->IO_Address = ProbeInfo->IO_Address; 1048 while (probeinfo->adapter_bus_type !=
986 FetchHostAdapterLocalRAMRequest.ByteOffset = BusLogic_BIOS_BaseOffset + BusLogic_BIOS_DriveMapOffset + 0; 1049 BLOGIC_PCI_BUS)
987 FetchHostAdapterLocalRAMRequest.ByteCount = sizeof(Drive0MapByte); 1050 probeinfo++;
988 BusLogic_Command(HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest, sizeof(FetchHostAdapterLocalRAMRequest), &Drive0MapByte, sizeof(Drive0MapByte)); 1051 myadapter->io_addr = probeinfo->io_addr;
1052 fetch_localram.offset =
1053 BLOGIC_BIOS_BASE + BLOGIC_BIOS_DRVMAP;
1054 fetch_localram.count = sizeof(d0_mapbyte);
1055 blogic_cmd(myadapter, BLOGIC_FETCH_LOCALRAM,
1056 &fetch_localram,
1057 sizeof(fetch_localram),
1058 &d0_mapbyte,
1059 sizeof(d0_mapbyte));
989 /* 1060 /*
990 If the Map Byte for BIOS Drive 0 indicates that BIOS Drive 0 1061 If the Map Byte for BIOS Drive 0 indicates
991 is controlled by this PCI MultiMaster Host Adapter, then 1062 that BIOS Drive 0 is controlled by this
992 reverse the probe order so that MultiMaster Host Adapters are 1063 PCI MultiMaster Host Adapter, then reverse
993 probed before FlashPoint Host Adapters. 1064 the probe order so that MultiMaster Host
1065 Adapters are probed before FlashPoint Host
1066 Adapters.
994 */ 1067 */
995 if (Drive0MapByte.DiskGeometry != BusLogic_BIOS_Disk_Not_Installed) { 1068 if (d0_mapbyte.diskgeom != BLOGIC_BIOS_NODISK) {
996 struct BusLogic_ProbeInfo SavedProbeInfo[BusLogic_MaxHostAdapters]; 1069 struct blogic_probeinfo saved_probeinfo[BLOGIC_MAX_ADAPTERS];
997 int MultiMasterCount = BusLogic_ProbeInfoCount - FlashPointCount; 1070 int mmcount = blogic_probeinfo_count - fpcount;
998 memcpy(SavedProbeInfo, BusLogic_ProbeInfoList, BusLogic_ProbeInfoCount * sizeof(struct BusLogic_ProbeInfo)); 1071
999 memcpy(&BusLogic_ProbeInfoList[0], &SavedProbeInfo[FlashPointCount], MultiMasterCount * sizeof(struct BusLogic_ProbeInfo)); 1072 memcpy(saved_probeinfo,
1000 memcpy(&BusLogic_ProbeInfoList[MultiMasterCount], &SavedProbeInfo[0], FlashPointCount * sizeof(struct BusLogic_ProbeInfo)); 1073 blogic_probeinfo_list,
1074 blogic_probeinfo_count * sizeof(struct blogic_probeinfo));
1075 memcpy(&blogic_probeinfo_list[0],
1076 &saved_probeinfo[fpcount],
1077 mmcount * sizeof(struct blogic_probeinfo));
1078 memcpy(&blogic_probeinfo_list[mmcount],
1079 &saved_probeinfo[0],
1080 fpcount * sizeof(struct blogic_probeinfo));
1001 } 1081 }
1002 } 1082 }
1003 } 1083 }
1004 } else 1084 } else {
1005 BusLogic_InitializeProbeInfoListISA(PrototypeHostAdapter); 1085 blogic_init_probeinfo_isa(adapter);
1086 }
1006} 1087}
1007 1088
1008 1089
1009#else 1090#else
1010#define BusLogic_InitializeProbeInfoList(adapter) \ 1091#define blogic_init_probeinfo_list(adapter) \
1011 BusLogic_InitializeProbeInfoListISA(adapter) 1092 blogic_init_probeinfo_isa(adapter)
1012#endif /* CONFIG_PCI */ 1093#endif /* CONFIG_PCI */
1013 1094
1014 1095
1015/* 1096/*
1016 BusLogic_Failure prints a standardized error message, and then returns false. 1097 blogic_failure prints a standardized error message, and then returns false.
1017*/ 1098*/
1018 1099
1019static bool BusLogic_Failure(struct BusLogic_HostAdapter *HostAdapter, char *ErrorMessage) 1100static bool blogic_failure(struct blogic_adapter *adapter, char *msg)
1020{ 1101{
1021 BusLogic_AnnounceDriver(HostAdapter); 1102 blogic_announce_drvr(adapter);
1022 if (HostAdapter->HostAdapterBusType == BusLogic_PCI_Bus) { 1103 if (adapter->adapter_bus_type == BLOGIC_PCI_BUS) {
1023 BusLogic_Error("While configuring BusLogic PCI Host Adapter at\n", HostAdapter); 1104 blogic_err("While configuring BusLogic PCI Host Adapter at\n",
1024 BusLogic_Error("Bus %d Device %d I/O Address 0x%X PCI Address 0x%X:\n", HostAdapter, HostAdapter->Bus, HostAdapter->Device, HostAdapter->IO_Address, HostAdapter->PCI_Address); 1105 adapter);
1106 blogic_err("Bus %d Device %d I/O Address 0x%X PCI Address 0x%X:\n", adapter, adapter->bus, adapter->dev, adapter->io_addr, adapter->pci_addr);
1025 } else 1107 } else
1026 BusLogic_Error("While configuring BusLogic Host Adapter at " "I/O Address 0x%X:\n", HostAdapter, HostAdapter->IO_Address); 1108 blogic_err("While configuring BusLogic Host Adapter at " "I/O Address 0x%X:\n", adapter, adapter->io_addr);
1027 BusLogic_Error("%s FAILED - DETACHING\n", HostAdapter, ErrorMessage); 1109 blogic_err("%s FAILED - DETACHING\n", adapter, msg);
1028 if (BusLogic_CommandFailureReason != NULL) 1110 if (blogic_cmd_failure_reason != NULL)
1029 BusLogic_Error("ADDITIONAL FAILURE INFO - %s\n", HostAdapter, BusLogic_CommandFailureReason); 1111 blogic_err("ADDITIONAL FAILURE INFO - %s\n", adapter,
1112 blogic_cmd_failure_reason);
1030 return false; 1113 return false;
1031} 1114}
1032 1115
1033 1116
1034/* 1117/*
1035 BusLogic_ProbeHostAdapter probes for a BusLogic Host Adapter. 1118 blogic_probe probes for a BusLogic Host Adapter.
1036*/ 1119*/
1037 1120
1038static bool __init BusLogic_ProbeHostAdapter(struct BusLogic_HostAdapter *HostAdapter) 1121static bool __init blogic_probe(struct blogic_adapter *adapter)
1039{ 1122{
1040 union BusLogic_StatusRegister StatusRegister; 1123 union blogic_stat_reg statusreg;
1041 union BusLogic_InterruptRegister InterruptRegister; 1124 union blogic_int_reg intreg;
1042 union BusLogic_GeometryRegister GeometryRegister; 1125 union blogic_geo_reg georeg;
1043 /* 1126 /*
1044 FlashPoint Host Adapters are Probed by the FlashPoint SCCB Manager. 1127 FlashPoint Host Adapters are Probed by the FlashPoint SCCB Manager.
1045 */ 1128 */
1046 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) { 1129 if (blogic_flashpoint_type(adapter)) {
1047 struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo; 1130 struct fpoint_info *fpinfo = &adapter->fpinfo;
1048 FlashPointInfo->BaseAddress = (u32) HostAdapter->IO_Address; 1131 fpinfo->base_addr = (u32) adapter->io_addr;
1049 FlashPointInfo->IRQ_Channel = HostAdapter->IRQ_Channel; 1132 fpinfo->irq_ch = adapter->irq_ch;
1050 FlashPointInfo->Present = false; 1133 fpinfo->present = false;
1051 if (!(FlashPoint_ProbeHostAdapter(FlashPointInfo) == 0 && FlashPointInfo->Present)) { 1134 if (!(FlashPoint_ProbeHostAdapter(fpinfo) == 0 &&
1052 BusLogic_Error("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n", HostAdapter, HostAdapter->Bus, HostAdapter->Device); 1135 fpinfo->present)) {
1053 BusLogic_Error("BusLogic: I/O Address 0x%X PCI Address 0x%X, " "but FlashPoint\n", HostAdapter, HostAdapter->IO_Address, HostAdapter->PCI_Address); 1136 blogic_err("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n", adapter, adapter->bus, adapter->dev);
1054 BusLogic_Error("BusLogic: Probe Function failed to validate it.\n", HostAdapter); 1137 blogic_err("BusLogic: I/O Address 0x%X PCI Address 0x%X, " "but FlashPoint\n", adapter, adapter->io_addr, adapter->pci_addr);
1138 blogic_err("BusLogic: Probe Function failed to validate it.\n", adapter);
1055 return false; 1139 return false;
1056 } 1140 }
1057 if (BusLogic_GlobalOptions.TraceProbe) 1141 if (blogic_global_options.trace_probe)
1058 BusLogic_Notice("BusLogic_Probe(0x%X): FlashPoint Found\n", HostAdapter, HostAdapter->IO_Address); 1142 blogic_notice("BusLogic_Probe(0x%X): FlashPoint Found\n", adapter, adapter->io_addr);
1059 /* 1143 /*
1060 Indicate the Host Adapter Probe completed successfully. 1144 Indicate the Host Adapter Probe completed successfully.
1061 */ 1145 */
@@ -1068,28 +1152,32 @@ static bool __init BusLogic_ProbeHostAdapter(struct BusLogic_HostAdapter *HostAd
1068 case there is definitely no BusLogic Host Adapter at this base I/O Address. 1152 case there is definitely no BusLogic Host Adapter at this base I/O Address.
1069 The test here is a subset of that used by the BusLogic Host Adapter BIOS. 1153 The test here is a subset of that used by the BusLogic Host Adapter BIOS.
1070 */ 1154 */
1071 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); 1155 statusreg.all = blogic_rdstatus(adapter);
1072 InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter); 1156 intreg.all = blogic_rdint(adapter);
1073 GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter); 1157 georeg.all = blogic_rdgeom(adapter);
1074 if (BusLogic_GlobalOptions.TraceProbe) 1158 if (blogic_global_options.trace_probe)
1075 BusLogic_Notice("BusLogic_Probe(0x%X): Status 0x%02X, Interrupt 0x%02X, " "Geometry 0x%02X\n", HostAdapter, HostAdapter->IO_Address, StatusRegister.All, InterruptRegister.All, GeometryRegister.All); 1159 blogic_notice("BusLogic_Probe(0x%X): Status 0x%02X, Interrupt 0x%02X, " "Geometry 0x%02X\n", adapter, adapter->io_addr, statusreg.all, intreg.all, georeg.all);
1076 if (StatusRegister.All == 0 || StatusRegister.sr.DiagnosticActive || StatusRegister.sr.CommandParameterRegisterBusy || StatusRegister.sr.Reserved || StatusRegister.sr.CommandInvalid || InterruptRegister.ir.Reserved != 0) 1160 if (statusreg.all == 0 || statusreg.sr.diag_active ||
1161 statusreg.sr.cmd_param_busy || statusreg.sr.rsvd ||
1162 statusreg.sr.cmd_invalid || intreg.ir.rsvd != 0)
1077 return false; 1163 return false;
1078 /* 1164 /*
1079 Check the undocumented Geometry Register to test if there is an I/O port 1165 Check the undocumented Geometry Register to test if there is
1080 that responded. Adaptec Host Adapters do not implement the Geometry 1166 an I/O port that responded. Adaptec Host Adapters do not
1081 Register, so this test helps serve to avoid incorrectly recognizing an 1167 implement the Geometry Register, so this test helps serve to
1082 Adaptec 1542A or 1542B as a BusLogic. Unfortunately, the Adaptec 1542C 1168 avoid incorrectly recognizing an Adaptec 1542A or 1542B as a
1083 series does respond to the Geometry Register I/O port, but it will be 1169 BusLogic. Unfortunately, the Adaptec 1542C series does respond
1084 rejected later when the Inquire Extended Setup Information command is 1170 to the Geometry Register I/O port, but it will be rejected
1085 issued in BusLogic_CheckHostAdapter. The AMI FastDisk Host Adapter is a 1171 later when the Inquire Extended Setup Information command is
1086 BusLogic clone that implements the same interface as earlier BusLogic 1172 issued in blogic_checkadapter. The AMI FastDisk Host Adapter
1087 Host Adapters, including the undocumented commands, and is therefore 1173 is a BusLogic clone that implements the same interface as
1088 supported by this driver. However, the AMI FastDisk always returns 0x00 1174 earlier BusLogic Host Adapters, including the undocumented
1089 upon reading the Geometry Register, so the extended translation option 1175 commands, and is therefore supported by this driver. However,
1090 should always be left disabled on the AMI FastDisk. 1176 the AMI FastDisk always returns 0x00 upon reading the Geometry
1091 */ 1177 Register, so the extended translation option should always be
1092 if (GeometryRegister.All == 0xFF) 1178 left disabled on the AMI FastDisk.
1179 */
1180 if (georeg.all == 0xFF)
1093 return false; 1181 return false;
1094 /* 1182 /*
1095 Indicate the Host Adapter Probe completed successfully. 1183 Indicate the Host Adapter Probe completed successfully.
@@ -1099,27 +1187,28 @@ static bool __init BusLogic_ProbeHostAdapter(struct BusLogic_HostAdapter *HostAd
1099 1187
1100 1188
1101/* 1189/*
1102 BusLogic_HardwareResetHostAdapter issues a Hardware Reset to the Host Adapter 1190 blogic_hwreset issues a Hardware Reset to the Host Adapter
1103 and waits for Host Adapter Diagnostics to complete. If HardReset is true, a 1191 and waits for Host Adapter Diagnostics to complete. If hard_reset is true, a
1104 Hard Reset is performed which also initiates a SCSI Bus Reset. Otherwise, a 1192 Hard Reset is performed which also initiates a SCSI Bus Reset. Otherwise, a
1105 Soft Reset is performed which only resets the Host Adapter without forcing a 1193 Soft Reset is performed which only resets the Host Adapter without forcing a
1106 SCSI Bus Reset. 1194 SCSI Bus Reset.
1107*/ 1195*/
1108 1196
1109static bool BusLogic_HardwareResetHostAdapter(struct BusLogic_HostAdapter 1197static bool blogic_hwreset(struct blogic_adapter *adapter, bool hard_reset)
1110 *HostAdapter, bool HardReset)
1111{ 1198{
1112 union BusLogic_StatusRegister StatusRegister; 1199 union blogic_stat_reg statusreg;
1113 int TimeoutCounter; 1200 int timeout;
1114 /* 1201 /*
1115 FlashPoint Host Adapters are Hard Reset by the FlashPoint SCCB Manager. 1202 FlashPoint Host Adapters are Hard Reset by the FlashPoint
1203 SCCB Manager.
1116 */ 1204 */
1117 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) { 1205 if (blogic_flashpoint_type(adapter)) {
1118 struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo; 1206 struct fpoint_info *fpinfo = &adapter->fpinfo;
1119 FlashPointInfo->HostSoftReset = !HardReset; 1207 fpinfo->softreset = !hard_reset;
1120 FlashPointInfo->ReportDataUnderrun = true; 1208 fpinfo->report_underrun = true;
1121 HostAdapter->CardHandle = FlashPoint_HardwareResetHostAdapter(FlashPointInfo); 1209 adapter->cardhandle =
1122 if (HostAdapter->CardHandle == FlashPoint_BadCardHandle) 1210 FlashPoint_HardwareResetHostAdapter(fpinfo);
1211 if (adapter->cardhandle == FPOINT_BADCARD_HANDLE)
1123 return false; 1212 return false;
1124 /* 1213 /*
1125 Indicate the Host Adapter Hard Reset completed successfully. 1214 Indicate the Host Adapter Hard Reset completed successfully.
@@ -1127,26 +1216,27 @@ static bool BusLogic_HardwareResetHostAdapter(struct BusLogic_HostAdapter
1127 return true; 1216 return true;
1128 } 1217 }
1129 /* 1218 /*
1130 Issue a Hard Reset or Soft Reset Command to the Host Adapter. The Host 1219 Issue a Hard Reset or Soft Reset Command to the Host Adapter.
1131 Adapter should respond by setting Diagnostic Active in the Status Register. 1220 The Host Adapter should respond by setting Diagnostic Active in
1221 the Status Register.
1132 */ 1222 */
1133 if (HardReset) 1223 if (hard_reset)
1134 BusLogic_HardReset(HostAdapter); 1224 blogic_hardreset(adapter);
1135 else 1225 else
1136 BusLogic_SoftReset(HostAdapter); 1226 blogic_softreset(adapter);
1137 /* 1227 /*
1138 Wait until Diagnostic Active is set in the Status Register. 1228 Wait until Diagnostic Active is set in the Status Register.
1139 */ 1229 */
1140 TimeoutCounter = 5 * 10000; 1230 timeout = 5 * 10000;
1141 while (--TimeoutCounter >= 0) { 1231 while (--timeout >= 0) {
1142 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); 1232 statusreg.all = blogic_rdstatus(adapter);
1143 if (StatusRegister.sr.DiagnosticActive) 1233 if (statusreg.sr.diag_active)
1144 break; 1234 break;
1145 udelay(100); 1235 udelay(100);
1146 } 1236 }
1147 if (BusLogic_GlobalOptions.TraceHardwareReset) 1237 if (blogic_global_options.trace_hw_reset)
1148 BusLogic_Notice("BusLogic_HardwareReset(0x%X): Diagnostic Active, " "Status 0x%02X\n", HostAdapter, HostAdapter->IO_Address, StatusRegister.All); 1238 blogic_notice("BusLogic_HardwareReset(0x%X): Diagnostic Active, " "Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
1149 if (TimeoutCounter < 0) 1239 if (timeout < 0)
1150 return false; 1240 return false;
1151 /* 1241 /*
1152 Wait 100 microseconds to allow completion of any initial diagnostic 1242 Wait 100 microseconds to allow completion of any initial diagnostic
@@ -1157,45 +1247,47 @@ static bool BusLogic_HardwareResetHostAdapter(struct BusLogic_HostAdapter
1157 /* 1247 /*
1158 Wait until Diagnostic Active is reset in the Status Register. 1248 Wait until Diagnostic Active is reset in the Status Register.
1159 */ 1249 */
1160 TimeoutCounter = 10 * 10000; 1250 timeout = 10 * 10000;
1161 while (--TimeoutCounter >= 0) { 1251 while (--timeout >= 0) {
1162 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); 1252 statusreg.all = blogic_rdstatus(adapter);
1163 if (!StatusRegister.sr.DiagnosticActive) 1253 if (!statusreg.sr.diag_active)
1164 break; 1254 break;
1165 udelay(100); 1255 udelay(100);
1166 } 1256 }
1167 if (BusLogic_GlobalOptions.TraceHardwareReset) 1257 if (blogic_global_options.trace_hw_reset)
1168 BusLogic_Notice("BusLogic_HardwareReset(0x%X): Diagnostic Completed, " "Status 0x%02X\n", HostAdapter, HostAdapter->IO_Address, StatusRegister.All); 1258 blogic_notice("BusLogic_HardwareReset(0x%X): Diagnostic Completed, " "Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
1169 if (TimeoutCounter < 0) 1259 if (timeout < 0)
1170 return false; 1260 return false;
1171 /* 1261 /*
1172 Wait until at least one of the Diagnostic Failure, Host Adapter Ready, 1262 Wait until at least one of the Diagnostic Failure, Host Adapter
1173 or Data In Register Ready bits is set in the Status Register. 1263 Ready, or Data In Register Ready bits is set in the Status Register.
1174 */ 1264 */
1175 TimeoutCounter = 10000; 1265 timeout = 10000;
1176 while (--TimeoutCounter >= 0) { 1266 while (--timeout >= 0) {
1177 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); 1267 statusreg.all = blogic_rdstatus(adapter);
1178 if (StatusRegister.sr.DiagnosticFailure || StatusRegister.sr.HostAdapterReady || StatusRegister.sr.DataInRegisterReady) 1268 if (statusreg.sr.diag_failed || statusreg.sr.adapter_ready ||
1269 statusreg.sr.datain_ready)
1179 break; 1270 break;
1180 udelay(100); 1271 udelay(100);
1181 } 1272 }
1182 if (BusLogic_GlobalOptions.TraceHardwareReset) 1273 if (blogic_global_options.trace_hw_reset)
1183 BusLogic_Notice("BusLogic_HardwareReset(0x%X): Host Adapter Ready, " "Status 0x%02X\n", HostAdapter, HostAdapter->IO_Address, StatusRegister.All); 1274 blogic_notice("BusLogic_HardwareReset(0x%X): Host Adapter Ready, " "Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
1184 if (TimeoutCounter < 0) 1275 if (timeout < 0)
1185 return false; 1276 return false;
1186 /* 1277 /*
1187 If Diagnostic Failure is set or Host Adapter Ready is reset, then an 1278 If Diagnostic Failure is set or Host Adapter Ready is reset,
1188 error occurred during the Host Adapter diagnostics. If Data In Register 1279 then an error occurred during the Host Adapter diagnostics.
1189 Ready is set, then there is an Error Code available. 1280 If Data In Register Ready is set, then there is an Error Code
1190 */ 1281 available.
1191 if (StatusRegister.sr.DiagnosticFailure || !StatusRegister.sr.HostAdapterReady) { 1282 */
1192 BusLogic_CommandFailureReason = NULL; 1283 if (statusreg.sr.diag_failed || !statusreg.sr.adapter_ready) {
1193 BusLogic_Failure(HostAdapter, "HARD RESET DIAGNOSTICS"); 1284 blogic_cmd_failure_reason = NULL;
1194 BusLogic_Error("HOST ADAPTER STATUS REGISTER = %02X\n", HostAdapter, StatusRegister.All); 1285 blogic_failure(adapter, "HARD RESET DIAGNOSTICS");
1195 if (StatusRegister.sr.DataInRegisterReady) { 1286 blogic_err("HOST ADAPTER STATUS REGISTER = %02X\n", adapter,
1196 unsigned char ErrorCode = BusLogic_ReadDataInRegister(HostAdapter); 1287 statusreg.all);
1197 BusLogic_Error("HOST ADAPTER ERROR CODE = %d\n", HostAdapter, ErrorCode); 1288 if (statusreg.sr.datain_ready)
1198 } 1289 blogic_err("HOST ADAPTER ERROR CODE = %d\n", adapter,
1290 blogic_rddatain(adapter));
1199 return false; 1291 return false;
1200 } 1292 }
1201 /* 1293 /*
@@ -1206,161 +1298,175 @@ static bool BusLogic_HardwareResetHostAdapter(struct BusLogic_HostAdapter
1206 1298
1207 1299
1208/* 1300/*
1209 BusLogic_CheckHostAdapter checks to be sure this really is a BusLogic 1301 blogic_checkadapter checks to be sure this really is a BusLogic
1210 Host Adapter. 1302 Host Adapter.
1211*/ 1303*/
1212 1304
1213static bool __init BusLogic_CheckHostAdapter(struct BusLogic_HostAdapter *HostAdapter) 1305static bool __init blogic_checkadapter(struct blogic_adapter *adapter)
1214{ 1306{
1215 struct BusLogic_ExtendedSetupInformation ExtendedSetupInformation; 1307 struct blogic_ext_setup ext_setupinfo;
1216 unsigned char RequestedReplyLength; 1308 unsigned char req_replylen;
1217 bool Result = true; 1309 bool result = true;
1218 /* 1310 /*
1219 FlashPoint Host Adapters do not require this protection. 1311 FlashPoint Host Adapters do not require this protection.
1220 */ 1312 */
1221 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) 1313 if (blogic_flashpoint_type(adapter))
1222 return true; 1314 return true;
1223 /* 1315 /*
1224 Issue the Inquire Extended Setup Information command. Only genuine 1316 Issue the Inquire Extended Setup Information command. Only genuine
1225 BusLogic Host Adapters and true clones support this command. Adaptec 1542C 1317 BusLogic Host Adapters and true clones support this command.
1226 series Host Adapters that respond to the Geometry Register I/O port will 1318 Adaptec 1542C series Host Adapters that respond to the Geometry
1227 fail this command. 1319 Register I/O port will fail this command.
1228 */ 1320 */
1229 RequestedReplyLength = sizeof(ExtendedSetupInformation); 1321 req_replylen = sizeof(ext_setupinfo);
1230 if (BusLogic_Command(HostAdapter, BusLogic_InquireExtendedSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &ExtendedSetupInformation, sizeof(ExtendedSetupInformation)) 1322 if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen,
1231 != sizeof(ExtendedSetupInformation)) 1323 sizeof(req_replylen), &ext_setupinfo,
1232 Result = false; 1324 sizeof(ext_setupinfo)) != sizeof(ext_setupinfo))
1325 result = false;
1233 /* 1326 /*
1234 Provide tracing information if requested and return. 1327 Provide tracing information if requested and return.
1235 */ 1328 */
1236 if (BusLogic_GlobalOptions.TraceProbe) 1329 if (blogic_global_options.trace_probe)
1237 BusLogic_Notice("BusLogic_Check(0x%X): MultiMaster %s\n", HostAdapter, HostAdapter->IO_Address, (Result ? "Found" : "Not Found")); 1330 blogic_notice("BusLogic_Check(0x%X): MultiMaster %s\n", adapter,
1238 return Result; 1331 adapter->io_addr,
1332 (result ? "Found" : "Not Found"));
1333 return result;
1239} 1334}
1240 1335
1241 1336
1242/* 1337/*
1243 BusLogic_ReadHostAdapterConfiguration reads the Configuration Information 1338 blogic_rdconfig reads the Configuration Information
1244 from Host Adapter and initializes the Host Adapter structure. 1339 from Host Adapter and initializes the Host Adapter structure.
1245*/ 1340*/
1246 1341
1247static bool __init BusLogic_ReadHostAdapterConfiguration(struct BusLogic_HostAdapter 1342static bool __init blogic_rdconfig(struct blogic_adapter *adapter)
1248 *HostAdapter)
1249{ 1343{
1250 struct BusLogic_BoardID BoardID; 1344 struct blogic_board_id id;
1251 struct BusLogic_Configuration Configuration; 1345 struct blogic_config config;
1252 struct BusLogic_SetupInformation SetupInformation; 1346 struct blogic_setup_info setupinfo;
1253 struct BusLogic_ExtendedSetupInformation ExtendedSetupInformation; 1347 struct blogic_ext_setup ext_setupinfo;
1254 unsigned char HostAdapterModelNumber[5]; 1348 unsigned char model[5];
1255 unsigned char FirmwareVersion3rdDigit; 1349 unsigned char fw_ver_digit3;
1256 unsigned char FirmwareVersionLetter; 1350 unsigned char fw_ver_letter;
1257 struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation; 1351 struct blogic_adapter_info adapter_info;
1258 struct BusLogic_FetchHostAdapterLocalRAMRequest FetchHostAdapterLocalRAMRequest; 1352 struct blogic_fetch_localram fetch_localram;
1259 struct BusLogic_AutoSCSIData AutoSCSIData; 1353 struct blogic_autoscsi autoscsi;
1260 union BusLogic_GeometryRegister GeometryRegister; 1354 union blogic_geo_reg georeg;
1261 unsigned char RequestedReplyLength; 1355 unsigned char req_replylen;
1262 unsigned char *TargetPointer, Character; 1356 unsigned char *tgt, ch;
1263 int TargetID, i; 1357 int tgt_id, i;
1264 /* 1358 /*
1265 Configuration Information for FlashPoint Host Adapters is provided in the 1359 Configuration Information for FlashPoint Host Adapters is
1266 FlashPoint_Info structure by the FlashPoint SCCB Manager's Probe Function. 1360 provided in the fpoint_info structure by the FlashPoint
1267 Initialize fields in the Host Adapter structure from the FlashPoint_Info 1361 SCCB Manager's Probe Function. Initialize fields in the
1268 structure. 1362 Host Adapter structure from the fpoint_info structure.
1269 */ 1363 */
1270 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) { 1364 if (blogic_flashpoint_type(adapter)) {
1271 struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo; 1365 struct fpoint_info *fpinfo = &adapter->fpinfo;
1272 TargetPointer = HostAdapter->ModelName; 1366 tgt = adapter->model;
1273 *TargetPointer++ = 'B'; 1367 *tgt++ = 'B';
1274 *TargetPointer++ = 'T'; 1368 *tgt++ = 'T';
1275 *TargetPointer++ = '-'; 1369 *tgt++ = '-';
1276 for (i = 0; i < sizeof(FlashPointInfo->ModelNumber); i++) 1370 for (i = 0; i < sizeof(fpinfo->model); i++)
1277 *TargetPointer++ = FlashPointInfo->ModelNumber[i]; 1371 *tgt++ = fpinfo->model[i];
1278 *TargetPointer++ = '\0'; 1372 *tgt++ = '\0';
1279 strcpy(HostAdapter->FirmwareVersion, FlashPoint_FirmwareVersion); 1373 strcpy(adapter->fw_ver, FLASHPOINT_FW_VER);
1280 HostAdapter->SCSI_ID = FlashPointInfo->SCSI_ID; 1374 adapter->scsi_id = fpinfo->scsi_id;
1281 HostAdapter->ExtendedTranslationEnabled = FlashPointInfo->ExtendedTranslationEnabled; 1375 adapter->ext_trans_enable = fpinfo->ext_trans_enable;
1282 HostAdapter->ParityCheckingEnabled = FlashPointInfo->ParityCheckingEnabled; 1376 adapter->parity = fpinfo->parity;
1283 HostAdapter->BusResetEnabled = !FlashPointInfo->HostSoftReset; 1377 adapter->reset_enabled = !fpinfo->softreset;
1284 HostAdapter->LevelSensitiveInterrupt = true; 1378 adapter->level_int = true;
1285 HostAdapter->HostWideSCSI = FlashPointInfo->HostWideSCSI; 1379 adapter->wide = fpinfo->wide;
1286 HostAdapter->HostDifferentialSCSI = false; 1380 adapter->differential = false;
1287 HostAdapter->HostSupportsSCAM = true; 1381 adapter->scam = true;
1288 HostAdapter->HostUltraSCSI = true; 1382 adapter->ultra = true;
1289 HostAdapter->ExtendedLUNSupport = true; 1383 adapter->ext_lun = true;
1290 HostAdapter->TerminationInfoValid = true; 1384 adapter->terminfo_valid = true;
1291 HostAdapter->LowByteTerminated = FlashPointInfo->LowByteTerminated; 1385 adapter->low_term = fpinfo->low_term;
1292 HostAdapter->HighByteTerminated = FlashPointInfo->HighByteTerminated; 1386 adapter->high_term = fpinfo->high_term;
1293 HostAdapter->SCAM_Enabled = FlashPointInfo->SCAM_Enabled; 1387 adapter->scam_enabled = fpinfo->scam_enabled;
1294 HostAdapter->SCAM_Level2 = FlashPointInfo->SCAM_Level2; 1388 adapter->scam_lev2 = fpinfo->scam_lev2;
1295 HostAdapter->DriverScatterGatherLimit = BusLogic_ScatterGatherLimit; 1389 adapter->drvr_sglimit = BLOGIC_SG_LIMIT;
1296 HostAdapter->MaxTargetDevices = (HostAdapter->HostWideSCSI ? 16 : 8); 1390 adapter->maxdev = (adapter->wide ? 16 : 8);
1297 HostAdapter->MaxLogicalUnits = 32; 1391 adapter->maxlun = 32;
1298 HostAdapter->InitialCCBs = 4 * BusLogic_CCB_AllocationGroupSize; 1392 adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE;
1299 HostAdapter->IncrementalCCBs = BusLogic_CCB_AllocationGroupSize; 1393 adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE;
1300 HostAdapter->DriverQueueDepth = 255; 1394 adapter->drvr_qdepth = 255;
1301 HostAdapter->HostAdapterQueueDepth = HostAdapter->DriverQueueDepth; 1395 adapter->adapter_qdepth = adapter->drvr_qdepth;
1302 HostAdapter->SynchronousPermitted = FlashPointInfo->SynchronousPermitted; 1396 adapter->sync_ok = fpinfo->sync_ok;
1303 HostAdapter->FastPermitted = FlashPointInfo->FastPermitted; 1397 adapter->fast_ok = fpinfo->fast_ok;
1304 HostAdapter->UltraPermitted = FlashPointInfo->UltraPermitted; 1398 adapter->ultra_ok = fpinfo->ultra_ok;
1305 HostAdapter->WidePermitted = FlashPointInfo->WidePermitted; 1399 adapter->wide_ok = fpinfo->wide_ok;
1306 HostAdapter->DisconnectPermitted = FlashPointInfo->DisconnectPermitted; 1400 adapter->discon_ok = fpinfo->discon_ok;
1307 HostAdapter->TaggedQueuingPermitted = 0xFFFF; 1401 adapter->tagq_ok = 0xFFFF;
1308 goto Common; 1402 goto common;
1309 } 1403 }
1310 /* 1404 /*
1311 Issue the Inquire Board ID command. 1405 Issue the Inquire Board ID command.
1312 */ 1406 */
1313 if (BusLogic_Command(HostAdapter, BusLogic_InquireBoardID, NULL, 0, &BoardID, sizeof(BoardID)) != sizeof(BoardID)) 1407 if (blogic_cmd(adapter, BLOGIC_GET_BOARD_ID, NULL, 0, &id,
1314 return BusLogic_Failure(HostAdapter, "INQUIRE BOARD ID"); 1408 sizeof(id)) != sizeof(id))
1409 return blogic_failure(adapter, "INQUIRE BOARD ID");
1315 /* 1410 /*
1316 Issue the Inquire Configuration command. 1411 Issue the Inquire Configuration command.
1317 */ 1412 */
1318 if (BusLogic_Command(HostAdapter, BusLogic_InquireConfiguration, NULL, 0, &Configuration, sizeof(Configuration)) 1413 if (blogic_cmd(adapter, BLOGIC_INQ_CONFIG, NULL, 0, &config,
1319 != sizeof(Configuration)) 1414 sizeof(config))
1320 return BusLogic_Failure(HostAdapter, "INQUIRE CONFIGURATION"); 1415 != sizeof(config))
1416 return blogic_failure(adapter, "INQUIRE CONFIGURATION");
1321 /* 1417 /*
1322 Issue the Inquire Setup Information command. 1418 Issue the Inquire Setup Information command.
1323 */ 1419 */
1324 RequestedReplyLength = sizeof(SetupInformation); 1420 req_replylen = sizeof(setupinfo);
1325 if (BusLogic_Command(HostAdapter, BusLogic_InquireSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &SetupInformation, sizeof(SetupInformation)) 1421 if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen,
1326 != sizeof(SetupInformation)) 1422 sizeof(req_replylen), &setupinfo,
1327 return BusLogic_Failure(HostAdapter, "INQUIRE SETUP INFORMATION"); 1423 sizeof(setupinfo)) != sizeof(setupinfo))
1424 return blogic_failure(adapter, "INQUIRE SETUP INFORMATION");
1328 /* 1425 /*
1329 Issue the Inquire Extended Setup Information command. 1426 Issue the Inquire Extended Setup Information command.
1330 */ 1427 */
1331 RequestedReplyLength = sizeof(ExtendedSetupInformation); 1428 req_replylen = sizeof(ext_setupinfo);
1332 if (BusLogic_Command(HostAdapter, BusLogic_InquireExtendedSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &ExtendedSetupInformation, sizeof(ExtendedSetupInformation)) 1429 if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen,
1333 != sizeof(ExtendedSetupInformation)) 1430 sizeof(req_replylen), &ext_setupinfo,
1334 return BusLogic_Failure(HostAdapter, "INQUIRE EXTENDED SETUP INFORMATION"); 1431 sizeof(ext_setupinfo)) != sizeof(ext_setupinfo))
1432 return blogic_failure(adapter,
1433 "INQUIRE EXTENDED SETUP INFORMATION");
1335 /* 1434 /*
1336 Issue the Inquire Firmware Version 3rd Digit command. 1435 Issue the Inquire Firmware Version 3rd Digit command.
1337 */ 1436 */
1338 FirmwareVersion3rdDigit = '\0'; 1437 fw_ver_digit3 = '\0';
1339 if (BoardID.FirmwareVersion1stDigit > '0') 1438 if (id.fw_ver_digit1 > '0')
1340 if (BusLogic_Command(HostAdapter, BusLogic_InquireFirmwareVersion3rdDigit, NULL, 0, &FirmwareVersion3rdDigit, sizeof(FirmwareVersion3rdDigit)) 1439 if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_D3, NULL, 0,
1341 != sizeof(FirmwareVersion3rdDigit)) 1440 &fw_ver_digit3,
1342 return BusLogic_Failure(HostAdapter, "INQUIRE FIRMWARE 3RD DIGIT"); 1441 sizeof(fw_ver_digit3)) != sizeof(fw_ver_digit3))
1442 return blogic_failure(adapter,
1443 "INQUIRE FIRMWARE 3RD DIGIT");
1343 /* 1444 /*
1344 Issue the Inquire Host Adapter Model Number command. 1445 Issue the Inquire Host Adapter Model Number command.
1345 */ 1446 */
1346 if (ExtendedSetupInformation.BusType == 'A' && BoardID.FirmwareVersion1stDigit == '2') 1447 if (ext_setupinfo.bus_type == 'A' && id.fw_ver_digit1 == '2')
1347 /* BusLogic BT-542B ISA 2.xx */ 1448 /* BusLogic BT-542B ISA 2.xx */
1348 strcpy(HostAdapterModelNumber, "542B"); 1449 strcpy(model, "542B");
1349 else if (ExtendedSetupInformation.BusType == 'E' && BoardID.FirmwareVersion1stDigit == '2' && (BoardID.FirmwareVersion2ndDigit <= '1' || (BoardID.FirmwareVersion2ndDigit == '2' && FirmwareVersion3rdDigit == '0'))) 1450 else if (ext_setupinfo.bus_type == 'E' && id.fw_ver_digit1 == '2' &&
1451 (id.fw_ver_digit2 <= '1' || (id.fw_ver_digit2 == '2' &&
1452 fw_ver_digit3 == '0')))
1350 /* BusLogic BT-742A EISA 2.1x or 2.20 */ 1453 /* BusLogic BT-742A EISA 2.1x or 2.20 */
1351 strcpy(HostAdapterModelNumber, "742A"); 1454 strcpy(model, "742A");
1352 else if (ExtendedSetupInformation.BusType == 'E' && BoardID.FirmwareVersion1stDigit == '0') 1455 else if (ext_setupinfo.bus_type == 'E' && id.fw_ver_digit1 == '0')
1353 /* AMI FastDisk EISA Series 441 0.x */ 1456 /* AMI FastDisk EISA Series 441 0.x */
1354 strcpy(HostAdapterModelNumber, "747A"); 1457 strcpy(model, "747A");
1355 else { 1458 else {
1356 RequestedReplyLength = sizeof(HostAdapterModelNumber); 1459 req_replylen = sizeof(model);
1357 if (BusLogic_Command(HostAdapter, BusLogic_InquireHostAdapterModelNumber, &RequestedReplyLength, sizeof(RequestedReplyLength), &HostAdapterModelNumber, sizeof(HostAdapterModelNumber)) 1460 if (blogic_cmd(adapter, BLOGIC_INQ_MODELNO, &req_replylen,
1358 != sizeof(HostAdapterModelNumber)) 1461 sizeof(req_replylen), &model,
1359 return BusLogic_Failure(HostAdapter, "INQUIRE HOST ADAPTER MODEL NUMBER"); 1462 sizeof(model)) != sizeof(model))
1463 return blogic_failure(adapter,
1464 "INQUIRE HOST ADAPTER MODEL NUMBER");
1360 } 1465 }
1361 /* 1466 /*
1362 BusLogic MultiMaster Host Adapters can be identified by their model number 1467 BusLogic MultiMaster Host Adapters can be identified by their
1363 and the major version number of their firmware as follows: 1468 model number and the major version number of their firmware
1469 as follows:
1364 1470
1365 5.xx BusLogic "W" Series Host Adapters: 1471 5.xx BusLogic "W" Series Host Adapters:
1366 BT-948/958/958D 1472 BT-948/958/958D
@@ -1374,497 +1480,535 @@ static bool __init BusLogic_ReadHostAdapterConfiguration(struct BusLogic_HostAda
1374 0.xx AMI FastDisk VLB/EISA BusLogic Clone Host Adapter 1480 0.xx AMI FastDisk VLB/EISA BusLogic Clone Host Adapter
1375 */ 1481 */
1376 /* 1482 /*
1377 Save the Model Name and Host Adapter Name in the Host Adapter structure. 1483 Save the Model Name and Host Adapter Name in the Host Adapter
1484 structure.
1378 */ 1485 */
1379 TargetPointer = HostAdapter->ModelName; 1486 tgt = adapter->model;
1380 *TargetPointer++ = 'B'; 1487 *tgt++ = 'B';
1381 *TargetPointer++ = 'T'; 1488 *tgt++ = 'T';
1382 *TargetPointer++ = '-'; 1489 *tgt++ = '-';
1383 for (i = 0; i < sizeof(HostAdapterModelNumber); i++) { 1490 for (i = 0; i < sizeof(model); i++) {
1384 Character = HostAdapterModelNumber[i]; 1491 ch = model[i];
1385 if (Character == ' ' || Character == '\0') 1492 if (ch == ' ' || ch == '\0')
1386 break; 1493 break;
1387 *TargetPointer++ = Character; 1494 *tgt++ = ch;
1388 } 1495 }
1389 *TargetPointer++ = '\0'; 1496 *tgt++ = '\0';
1390 /* 1497 /*
1391 Save the Firmware Version in the Host Adapter structure. 1498 Save the Firmware Version in the Host Adapter structure.
1392 */ 1499 */
1393 TargetPointer = HostAdapter->FirmwareVersion; 1500 tgt = adapter->fw_ver;
1394 *TargetPointer++ = BoardID.FirmwareVersion1stDigit; 1501 *tgt++ = id.fw_ver_digit1;
1395 *TargetPointer++ = '.'; 1502 *tgt++ = '.';
1396 *TargetPointer++ = BoardID.FirmwareVersion2ndDigit; 1503 *tgt++ = id.fw_ver_digit2;
1397 if (FirmwareVersion3rdDigit != ' ' && FirmwareVersion3rdDigit != '\0') 1504 if (fw_ver_digit3 != ' ' && fw_ver_digit3 != '\0')
1398 *TargetPointer++ = FirmwareVersion3rdDigit; 1505 *tgt++ = fw_ver_digit3;
1399 *TargetPointer = '\0'; 1506 *tgt = '\0';
1400 /* 1507 /*
1401 Issue the Inquire Firmware Version Letter command. 1508 Issue the Inquire Firmware Version Letter command.
1402 */ 1509 */
1403 if (strcmp(HostAdapter->FirmwareVersion, "3.3") >= 0) { 1510 if (strcmp(adapter->fw_ver, "3.3") >= 0) {
1404 if (BusLogic_Command(HostAdapter, BusLogic_InquireFirmwareVersionLetter, NULL, 0, &FirmwareVersionLetter, sizeof(FirmwareVersionLetter)) 1511 if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_LETTER, NULL, 0,
1405 != sizeof(FirmwareVersionLetter)) 1512 &fw_ver_letter,
1406 return BusLogic_Failure(HostAdapter, "INQUIRE FIRMWARE VERSION LETTER"); 1513 sizeof(fw_ver_letter)) != sizeof(fw_ver_letter))
1407 if (FirmwareVersionLetter != ' ' && FirmwareVersionLetter != '\0') 1514 return blogic_failure(adapter,
1408 *TargetPointer++ = FirmwareVersionLetter; 1515 "INQUIRE FIRMWARE VERSION LETTER");
1409 *TargetPointer = '\0'; 1516 if (fw_ver_letter != ' ' && fw_ver_letter != '\0')
1517 *tgt++ = fw_ver_letter;
1518 *tgt = '\0';
1410 } 1519 }
1411 /* 1520 /*
1412 Save the Host Adapter SCSI ID in the Host Adapter structure. 1521 Save the Host Adapter SCSI ID in the Host Adapter structure.
1413 */ 1522 */
1414 HostAdapter->SCSI_ID = Configuration.HostAdapterID; 1523 adapter->scsi_id = config.id;
1415 /* 1524 /*
1416 Determine the Bus Type and save it in the Host Adapter structure, determine 1525 Determine the Bus Type and save it in the Host Adapter structure,
1417 and save the IRQ Channel if necessary, and determine and save the DMA 1526 determine and save the IRQ Channel if necessary, and determine
1418 Channel for ISA Host Adapters. 1527 and save the DMA Channel for ISA Host Adapters.
1419 */ 1528 */
1420 HostAdapter->HostAdapterBusType = BusLogic_HostAdapterBusTypes[HostAdapter->ModelName[3] - '4']; 1529 adapter->adapter_bus_type =
1421 if (HostAdapter->IRQ_Channel == 0) { 1530 blogic_adater_bus_types[adapter->model[3] - '4'];
1422 if (Configuration.IRQ_Channel9) 1531 if (adapter->irq_ch == 0) {
1423 HostAdapter->IRQ_Channel = 9; 1532 if (config.irq_ch9)
1424 else if (Configuration.IRQ_Channel10) 1533 adapter->irq_ch = 9;
1425 HostAdapter->IRQ_Channel = 10; 1534 else if (config.irq_ch10)
1426 else if (Configuration.IRQ_Channel11) 1535 adapter->irq_ch = 10;
1427 HostAdapter->IRQ_Channel = 11; 1536 else if (config.irq_ch11)
1428 else if (Configuration.IRQ_Channel12) 1537 adapter->irq_ch = 11;
1429 HostAdapter->IRQ_Channel = 12; 1538 else if (config.irq_ch12)
1430 else if (Configuration.IRQ_Channel14) 1539 adapter->irq_ch = 12;
1431 HostAdapter->IRQ_Channel = 14; 1540 else if (config.irq_ch14)
1432 else if (Configuration.IRQ_Channel15) 1541 adapter->irq_ch = 14;
1433 HostAdapter->IRQ_Channel = 15; 1542 else if (config.irq_ch15)
1434 } 1543 adapter->irq_ch = 15;
1435 if (HostAdapter->HostAdapterBusType == BusLogic_ISA_Bus) { 1544 }
1436 if (Configuration.DMA_Channel5) 1545 if (adapter->adapter_bus_type == BLOGIC_ISA_BUS) {
1437 HostAdapter->DMA_Channel = 5; 1546 if (config.dma_ch5)
1438 else if (Configuration.DMA_Channel6) 1547 adapter->dma_ch = 5;
1439 HostAdapter->DMA_Channel = 6; 1548 else if (config.dma_ch6)
1440 else if (Configuration.DMA_Channel7) 1549 adapter->dma_ch = 6;
1441 HostAdapter->DMA_Channel = 7; 1550 else if (config.dma_ch7)
1551 adapter->dma_ch = 7;
1442 } 1552 }
1443 /* 1553 /*
1444 Determine whether Extended Translation is enabled and save it in 1554 Determine whether Extended Translation is enabled and save it in
1445 the Host Adapter structure. 1555 the Host Adapter structure.
1446 */ 1556 */
1447 GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter); 1557 georeg.all = blogic_rdgeom(adapter);
1448 HostAdapter->ExtendedTranslationEnabled = GeometryRegister.gr.ExtendedTranslationEnabled; 1558 adapter->ext_trans_enable = georeg.gr.ext_trans_enable;
1449 /* 1559 /*
1450 Save the Scatter Gather Limits, Level Sensitive Interrupt flag, Wide 1560 Save the Scatter Gather Limits, Level Sensitive Interrupt flag, Wide
1451 SCSI flag, Differential SCSI flag, SCAM Supported flag, and 1561 SCSI flag, Differential SCSI flag, SCAM Supported flag, and
1452 Ultra SCSI flag in the Host Adapter structure. 1562 Ultra SCSI flag in the Host Adapter structure.
1453 */ 1563 */
1454 HostAdapter->HostAdapterScatterGatherLimit = ExtendedSetupInformation.ScatterGatherLimit; 1564 adapter->adapter_sglimit = ext_setupinfo.sg_limit;
1455 HostAdapter->DriverScatterGatherLimit = HostAdapter->HostAdapterScatterGatherLimit; 1565 adapter->drvr_sglimit = adapter->adapter_sglimit;
1456 if (HostAdapter->HostAdapterScatterGatherLimit > BusLogic_ScatterGatherLimit) 1566 if (adapter->adapter_sglimit > BLOGIC_SG_LIMIT)
1457 HostAdapter->DriverScatterGatherLimit = BusLogic_ScatterGatherLimit; 1567 adapter->drvr_sglimit = BLOGIC_SG_LIMIT;
1458 if (ExtendedSetupInformation.Misc.LevelSensitiveInterrupt) 1568 if (ext_setupinfo.misc.level_int)
1459 HostAdapter->LevelSensitiveInterrupt = true; 1569 adapter->level_int = true;
1460 HostAdapter->HostWideSCSI = ExtendedSetupInformation.HostWideSCSI; 1570 adapter->wide = ext_setupinfo.wide;
1461 HostAdapter->HostDifferentialSCSI = ExtendedSetupInformation.HostDifferentialSCSI; 1571 adapter->differential = ext_setupinfo.differential;
1462 HostAdapter->HostSupportsSCAM = ExtendedSetupInformation.HostSupportsSCAM; 1572 adapter->scam = ext_setupinfo.scam;
1463 HostAdapter->HostUltraSCSI = ExtendedSetupInformation.HostUltraSCSI; 1573 adapter->ultra = ext_setupinfo.ultra;
1464 /* 1574 /*
1465 Determine whether Extended LUN Format CCBs are supported and save the 1575 Determine whether Extended LUN Format CCBs are supported and save the
1466 information in the Host Adapter structure. 1576 information in the Host Adapter structure.
1467 */ 1577 */
1468 if (HostAdapter->FirmwareVersion[0] == '5' || (HostAdapter->FirmwareVersion[0] == '4' && HostAdapter->HostWideSCSI)) 1578 if (adapter->fw_ver[0] == '5' || (adapter->fw_ver[0] == '4' &&
1469 HostAdapter->ExtendedLUNSupport = true; 1579 adapter->wide))
1580 adapter->ext_lun = true;
1470 /* 1581 /*
1471 Issue the Inquire PCI Host Adapter Information command to read the 1582 Issue the Inquire PCI Host Adapter Information command to read the
1472 Termination Information from "W" series MultiMaster Host Adapters. 1583 Termination Information from "W" series MultiMaster Host Adapters.
1473 */ 1584 */
1474 if (HostAdapter->FirmwareVersion[0] == '5') { 1585 if (adapter->fw_ver[0] == '5') {
1475 if (BusLogic_Command(HostAdapter, BusLogic_InquirePCIHostAdapterInformation, NULL, 0, &PCIHostAdapterInformation, sizeof(PCIHostAdapterInformation)) 1586 if (blogic_cmd(adapter, BLOGIC_INQ_PCI_INFO, NULL, 0,
1476 != sizeof(PCIHostAdapterInformation)) 1587 &adapter_info,
1477 return BusLogic_Failure(HostAdapter, "INQUIRE PCI HOST ADAPTER INFORMATION"); 1588 sizeof(adapter_info)) != sizeof(adapter_info))
1589 return blogic_failure(adapter,
1590 "INQUIRE PCI HOST ADAPTER INFORMATION");
1478 /* 1591 /*
1479 Save the Termination Information in the Host Adapter structure. 1592 Save the Termination Information in the Host Adapter
1593 structure.
1480 */ 1594 */
1481 if (PCIHostAdapterInformation.GenericInfoValid) { 1595 if (adapter_info.genericinfo_valid) {
1482 HostAdapter->TerminationInfoValid = true; 1596 adapter->terminfo_valid = true;
1483 HostAdapter->LowByteTerminated = PCIHostAdapterInformation.LowByteTerminated; 1597 adapter->low_term = adapter_info.low_term;
1484 HostAdapter->HighByteTerminated = PCIHostAdapterInformation.HighByteTerminated; 1598 adapter->high_term = adapter_info.high_term;
1485 } 1599 }
1486 } 1600 }
1487 /* 1601 /*
1488 Issue the Fetch Host Adapter Local RAM command to read the AutoSCSI data 1602 Issue the Fetch Host Adapter Local RAM command to read the
1489 from "W" and "C" series MultiMaster Host Adapters. 1603 AutoSCSI data from "W" and "C" series MultiMaster Host Adapters.
1490 */ 1604 */
1491 if (HostAdapter->FirmwareVersion[0] >= '4') { 1605 if (adapter->fw_ver[0] >= '4') {
1492 FetchHostAdapterLocalRAMRequest.ByteOffset = BusLogic_AutoSCSI_BaseOffset; 1606 fetch_localram.offset = BLOGIC_AUTOSCSI_BASE;
1493 FetchHostAdapterLocalRAMRequest.ByteCount = sizeof(AutoSCSIData); 1607 fetch_localram.count = sizeof(autoscsi);
1494 if (BusLogic_Command(HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest, sizeof(FetchHostAdapterLocalRAMRequest), &AutoSCSIData, sizeof(AutoSCSIData)) 1608 if (blogic_cmd(adapter, BLOGIC_FETCH_LOCALRAM, &fetch_localram,
1495 != sizeof(AutoSCSIData)) 1609 sizeof(fetch_localram), &autoscsi,
1496 return BusLogic_Failure(HostAdapter, "FETCH HOST ADAPTER LOCAL RAM"); 1610 sizeof(autoscsi)) != sizeof(autoscsi))
1611 return blogic_failure(adapter,
1612 "FETCH HOST ADAPTER LOCAL RAM");
1497 /* 1613 /*
1498 Save the Parity Checking Enabled, Bus Reset Enabled, and Termination 1614 Save the Parity Checking Enabled, Bus Reset Enabled,
1499 Information in the Host Adapter structure. 1615 and Termination Information in the Host Adapter structure.
1500 */ 1616 */
1501 HostAdapter->ParityCheckingEnabled = AutoSCSIData.ParityCheckingEnabled; 1617 adapter->parity = autoscsi.parity;
1502 HostAdapter->BusResetEnabled = AutoSCSIData.BusResetEnabled; 1618 adapter->reset_enabled = autoscsi.reset_enabled;
1503 if (HostAdapter->FirmwareVersion[0] == '4') { 1619 if (adapter->fw_ver[0] == '4') {
1504 HostAdapter->TerminationInfoValid = true; 1620 adapter->terminfo_valid = true;
1505 HostAdapter->LowByteTerminated = AutoSCSIData.LowByteTerminated; 1621 adapter->low_term = autoscsi.low_term;
1506 HostAdapter->HighByteTerminated = AutoSCSIData.HighByteTerminated; 1622 adapter->high_term = autoscsi.high_term;
1507 } 1623 }
1508 /* 1624 /*
1509 Save the Wide Permitted, Fast Permitted, Synchronous Permitted, 1625 Save the Wide Permitted, Fast Permitted, Synchronous
1510 Disconnect Permitted, Ultra Permitted, and SCAM Information in the 1626 Permitted, Disconnect Permitted, Ultra Permitted, and
1511 Host Adapter structure. 1627 SCAM Information in the Host Adapter structure.
1512 */ 1628 */
1513 HostAdapter->WidePermitted = AutoSCSIData.WidePermitted; 1629 adapter->wide_ok = autoscsi.wide_ok;
1514 HostAdapter->FastPermitted = AutoSCSIData.FastPermitted; 1630 adapter->fast_ok = autoscsi.fast_ok;
1515 HostAdapter->SynchronousPermitted = AutoSCSIData.SynchronousPermitted; 1631 adapter->sync_ok = autoscsi.sync_ok;
1516 HostAdapter->DisconnectPermitted = AutoSCSIData.DisconnectPermitted; 1632 adapter->discon_ok = autoscsi.discon_ok;
1517 if (HostAdapter->HostUltraSCSI) 1633 if (adapter->ultra)
1518 HostAdapter->UltraPermitted = AutoSCSIData.UltraPermitted; 1634 adapter->ultra_ok = autoscsi.ultra_ok;
1519 if (HostAdapter->HostSupportsSCAM) { 1635 if (adapter->scam) {
1520 HostAdapter->SCAM_Enabled = AutoSCSIData.SCAM_Enabled; 1636 adapter->scam_enabled = autoscsi.scam_enabled;
1521 HostAdapter->SCAM_Level2 = AutoSCSIData.SCAM_Level2; 1637 adapter->scam_lev2 = autoscsi.scam_lev2;
1522 } 1638 }
1523 } 1639 }
1524 /* 1640 /*
1525 Initialize fields in the Host Adapter structure for "S" and "A" series 1641 Initialize fields in the Host Adapter structure for "S" and "A"
1526 MultiMaster Host Adapters. 1642 series MultiMaster Host Adapters.
1527 */ 1643 */
1528 if (HostAdapter->FirmwareVersion[0] < '4') { 1644 if (adapter->fw_ver[0] < '4') {
1529 if (SetupInformation.SynchronousInitiationEnabled) { 1645 if (setupinfo.sync) {
1530 HostAdapter->SynchronousPermitted = 0xFF; 1646 adapter->sync_ok = 0xFF;
1531 if (HostAdapter->HostAdapterBusType == BusLogic_EISA_Bus) { 1647 if (adapter->adapter_bus_type == BLOGIC_EISA_BUS) {
1532 if (ExtendedSetupInformation.Misc.FastOnEISA) 1648 if (ext_setupinfo.misc.fast_on_eisa)
1533 HostAdapter->FastPermitted = 0xFF; 1649 adapter->fast_ok = 0xFF;
1534 if (strcmp(HostAdapter->ModelName, "BT-757") == 0) 1650 if (strcmp(adapter->model, "BT-757") == 0)
1535 HostAdapter->WidePermitted = 0xFF; 1651 adapter->wide_ok = 0xFF;
1536 } 1652 }
1537 } 1653 }
1538 HostAdapter->DisconnectPermitted = 0xFF; 1654 adapter->discon_ok = 0xFF;
1539 HostAdapter->ParityCheckingEnabled = SetupInformation.ParityCheckingEnabled; 1655 adapter->parity = setupinfo.parity;
1540 HostAdapter->BusResetEnabled = true; 1656 adapter->reset_enabled = true;
1541 } 1657 }
1542 /* 1658 /*
1543 Determine the maximum number of Target IDs and Logical Units supported by 1659 Determine the maximum number of Target IDs and Logical Units
1544 this driver for Wide and Narrow Host Adapters. 1660 supported by this driver for Wide and Narrow Host Adapters.
1545 */ 1661 */
1546 HostAdapter->MaxTargetDevices = (HostAdapter->HostWideSCSI ? 16 : 8); 1662 adapter->maxdev = (adapter->wide ? 16 : 8);
1547 HostAdapter->MaxLogicalUnits = (HostAdapter->ExtendedLUNSupport ? 32 : 8); 1663 adapter->maxlun = (adapter->ext_lun ? 32 : 8);
1548 /* 1664 /*
1549 Select appropriate values for the Mailbox Count, Driver Queue Depth, 1665 Select appropriate values for the Mailbox Count, Driver Queue Depth,
1550 Initial CCBs, and Incremental CCBs variables based on whether or not Strict 1666 Initial CCBs, and Incremental CCBs variables based on whether
1551 Round Robin Mode is supported. If Strict Round Robin Mode is supported, 1667 or not Strict Round Robin Mode is supported. If Strict Round
1552 then there is no performance degradation in using the maximum possible 1668 Robin Mode is supported, then there is no performance degradation
1553 number of Outgoing and Incoming Mailboxes and allowing the Tagged and 1669 in using the maximum possible number of Outgoing and Incoming
1554 Untagged Queue Depths to determine the actual utilization. If Strict Round 1670 Mailboxes and allowing the Tagged and Untagged Queue Depths to
1555 Robin Mode is not supported, then the Host Adapter must scan all the 1671 determine the actual utilization. If Strict Round Robin Mode is
1556 Outgoing Mailboxes whenever an Outgoing Mailbox entry is made, which can 1672 not supported, then the Host Adapter must scan all the Outgoing
1557 cause a substantial performance penalty. The host adapters actually have 1673 Mailboxes whenever an Outgoing Mailbox entry is made, which can
1558 room to store the following number of CCBs internally; that is, they can 1674 cause a substantial performance penalty. The host adapters
1559 internally queue and manage this many active commands on the SCSI bus 1675 actually have room to store the following number of CCBs
1560 simultaneously. Performance measurements demonstrate that the Driver Queue 1676 internally; that is, they can internally queue and manage this
1561 Depth should be set to the Mailbox Count, rather than the Host Adapter 1677 many active commands on the SCSI bus simultaneously. Performance
1562 Queue Depth (internal CCB capacity), as it is more efficient to have the 1678 measurements demonstrate that the Driver Queue Depth should be
1563 queued commands waiting in Outgoing Mailboxes if necessary than to block 1679 set to the Mailbox Count, rather than the Host Adapter Queue
1564 the process in the higher levels of the SCSI Subsystem. 1680 Depth (internal CCB capacity), as it is more efficient to have the
1681 queued commands waiting in Outgoing Mailboxes if necessary than
1682 to block the process in the higher levels of the SCSI Subsystem.
1565 1683
1566 192 BT-948/958/958D 1684 192 BT-948/958/958D
1567 100 BT-946C/956C/956CD/747C/757C/757CD/445C 1685 100 BT-946C/956C/956CD/747C/757C/757CD/445C
1568 50 BT-545C/540CF 1686 50 BT-545C/540CF
1569 30 BT-747S/747D/757S/757D/445S/545S/542D/542B/742A 1687 30 BT-747S/747D/757S/757D/445S/545S/542D/542B/742A
1570 */ 1688 */
1571 if (HostAdapter->FirmwareVersion[0] == '5') 1689 if (adapter->fw_ver[0] == '5')
1572 HostAdapter->HostAdapterQueueDepth = 192; 1690 adapter->adapter_qdepth = 192;
1573 else if (HostAdapter->FirmwareVersion[0] == '4') 1691 else if (adapter->fw_ver[0] == '4')
1574 HostAdapter->HostAdapterQueueDepth = (HostAdapter->HostAdapterBusType != BusLogic_ISA_Bus ? 100 : 50); 1692 adapter->adapter_qdepth = (adapter->adapter_bus_type !=
1693 BLOGIC_ISA_BUS ? 100 : 50);
1575 else 1694 else
1576 HostAdapter->HostAdapterQueueDepth = 30; 1695 adapter->adapter_qdepth = 30;
1577 if (strcmp(HostAdapter->FirmwareVersion, "3.31") >= 0) { 1696 if (strcmp(adapter->fw_ver, "3.31") >= 0) {
1578 HostAdapter->StrictRoundRobinModeSupport = true; 1697 adapter->strict_rr = true;
1579 HostAdapter->MailboxCount = BusLogic_MaxMailboxes; 1698 adapter->mbox_count = BLOGIC_MAX_MAILBOX;
1580 } else { 1699 } else {
1581 HostAdapter->StrictRoundRobinModeSupport = false; 1700 adapter->strict_rr = false;
1582 HostAdapter->MailboxCount = 32; 1701 adapter->mbox_count = 32;
1583 } 1702 }
1584 HostAdapter->DriverQueueDepth = HostAdapter->MailboxCount; 1703 adapter->drvr_qdepth = adapter->mbox_count;
1585 HostAdapter->InitialCCBs = 4 * BusLogic_CCB_AllocationGroupSize; 1704 adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE;
1586 HostAdapter->IncrementalCCBs = BusLogic_CCB_AllocationGroupSize; 1705 adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE;
1587 /* 1706 /*
1588 Tagged Queuing support is available and operates properly on all "W" series 1707 Tagged Queuing support is available and operates properly on
1589 MultiMaster Host Adapters, on "C" series MultiMaster Host Adapters with 1708 all "W" series MultiMaster Host Adapters, on "C" series
1590 firmware version 4.22 and above, and on "S" series MultiMaster Host 1709 MultiMaster Host Adapters with firmware version 4.22 and above,
1591 Adapters with firmware version 3.35 and above. 1710 and on "S" series MultiMaster Host Adapters with firmware version
1711 3.35 and above.
1592 */ 1712 */
1593 HostAdapter->TaggedQueuingPermitted = 0; 1713 adapter->tagq_ok = 0;
1594 switch (HostAdapter->FirmwareVersion[0]) { 1714 switch (adapter->fw_ver[0]) {
1595 case '5': 1715 case '5':
1596 HostAdapter->TaggedQueuingPermitted = 0xFFFF; 1716 adapter->tagq_ok = 0xFFFF;
1597 break; 1717 break;
1598 case '4': 1718 case '4':
1599 if (strcmp(HostAdapter->FirmwareVersion, "4.22") >= 0) 1719 if (strcmp(adapter->fw_ver, "4.22") >= 0)
1600 HostAdapter->TaggedQueuingPermitted = 0xFFFF; 1720 adapter->tagq_ok = 0xFFFF;
1601 break; 1721 break;
1602 case '3': 1722 case '3':
1603 if (strcmp(HostAdapter->FirmwareVersion, "3.35") >= 0) 1723 if (strcmp(adapter->fw_ver, "3.35") >= 0)
1604 HostAdapter->TaggedQueuingPermitted = 0xFFFF; 1724 adapter->tagq_ok = 0xFFFF;
1605 break; 1725 break;
1606 } 1726 }
1607 /* 1727 /*
1608 Determine the Host Adapter BIOS Address if the BIOS is enabled and 1728 Determine the Host Adapter BIOS Address if the BIOS is enabled and
1609 save it in the Host Adapter structure. The BIOS is disabled if the 1729 save it in the Host Adapter structure. The BIOS is disabled if the
1610 BIOS_Address is 0. 1730 bios_addr is 0.
1611 */ 1731 */
1612 HostAdapter->BIOS_Address = ExtendedSetupInformation.BIOS_Address << 12; 1732 adapter->bios_addr = ext_setupinfo.bios_addr << 12;
1613 /* 1733 /*
1614 ISA Host Adapters require Bounce Buffers if there is more than 16MB memory. 1734 ISA Host Adapters require Bounce Buffers if there is more than
1735 16MB memory.
1615 */ 1736 */
1616 if (HostAdapter->HostAdapterBusType == BusLogic_ISA_Bus && (void *) high_memory > (void *) MAX_DMA_ADDRESS) 1737 if (adapter->adapter_bus_type == BLOGIC_ISA_BUS &&
1617 HostAdapter->BounceBuffersRequired = true; 1738 (void *) high_memory > (void *) MAX_DMA_ADDRESS)
1739 adapter->need_bouncebuf = true;
1618 /* 1740 /*
1619 BusLogic BT-445S Host Adapters prior to board revision E have a hardware 1741 BusLogic BT-445S Host Adapters prior to board revision E have a
1620 bug whereby when the BIOS is enabled, transfers to/from the same address 1742 hardware bug whereby when the BIOS is enabled, transfers to/from
1621 range the BIOS occupies modulo 16MB are handled incorrectly. Only properly 1743 the same address range the BIOS occupies modulo 16MB are handled
1622 functioning BT-445S Host Adapters have firmware version 3.37, so require 1744 incorrectly. Only properly functioning BT-445S Host Adapters
1623 that ISA Bounce Buffers be used for the buggy BT-445S models if there is 1745 have firmware version 3.37, so require that ISA Bounce Buffers
1624 more than 16MB memory. 1746 be used for the buggy BT-445S models if there is more than 16MB
1747 memory.
1625 */ 1748 */
1626 if (HostAdapter->BIOS_Address > 0 && strcmp(HostAdapter->ModelName, "BT-445S") == 0 && strcmp(HostAdapter->FirmwareVersion, "3.37") < 0 && (void *) high_memory > (void *) MAX_DMA_ADDRESS) 1749 if (adapter->bios_addr > 0 && strcmp(adapter->model, "BT-445S") == 0 &&
1627 HostAdapter->BounceBuffersRequired = true; 1750 strcmp(adapter->fw_ver, "3.37") < 0 &&
1751 (void *) high_memory > (void *) MAX_DMA_ADDRESS)
1752 adapter->need_bouncebuf = true;
1628 /* 1753 /*
1629 Initialize parameters common to MultiMaster and FlashPoint Host Adapters. 1754 Initialize parameters common to MultiMaster and FlashPoint
1755 Host Adapters.
1630 */ 1756 */
1631 Common: 1757common:
1632 /* 1758 /*
1633 Initialize the Host Adapter Full Model Name from the Model Name. 1759 Initialize the Host Adapter Full Model Name from the Model Name.
1634 */ 1760 */
1635 strcpy(HostAdapter->FullModelName, "BusLogic "); 1761 strcpy(adapter->full_model, "BusLogic ");
1636 strcat(HostAdapter->FullModelName, HostAdapter->ModelName); 1762 strcat(adapter->full_model, adapter->model);
1637 /* 1763 /*
1638 Select an appropriate value for the Tagged Queue Depth either from a 1764 Select an appropriate value for the Tagged Queue Depth either from a
1639 BusLogic Driver Options specification, or based on whether this Host 1765 BusLogic Driver Options specification, or based on whether this Host
1640 Adapter requires that ISA Bounce Buffers be used. The Tagged Queue Depth 1766 Adapter requires that ISA Bounce Buffers be used. The Tagged Queue
1641 is left at 0 for automatic determination in BusLogic_SelectQueueDepths. 1767 Depth is left at 0 for automatic determination in
1642 Initialize the Untagged Queue Depth. 1768 BusLogic_SelectQueueDepths. Initialize the Untagged Queue Depth.
1643 */ 1769 */
1644 for (TargetID = 0; TargetID < BusLogic_MaxTargetDevices; TargetID++) { 1770 for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) {
1645 unsigned char QueueDepth = 0; 1771 unsigned char qdepth = 0;
1646 if (HostAdapter->DriverOptions != NULL && HostAdapter->DriverOptions->QueueDepth[TargetID] > 0) 1772 if (adapter->drvr_opts != NULL &&
1647 QueueDepth = HostAdapter->DriverOptions->QueueDepth[TargetID]; 1773 adapter->drvr_opts->qdepth[tgt_id] > 0)
1648 else if (HostAdapter->BounceBuffersRequired) 1774 qdepth = adapter->drvr_opts->qdepth[tgt_id];
1649 QueueDepth = BusLogic_TaggedQueueDepthBB; 1775 else if (adapter->need_bouncebuf)
1650 HostAdapter->QueueDepth[TargetID] = QueueDepth; 1776 qdepth = BLOGIC_TAG_DEPTH_BB;
1651 } 1777 adapter->qdepth[tgt_id] = qdepth;
1652 if (HostAdapter->BounceBuffersRequired) 1778 }
1653 HostAdapter->UntaggedQueueDepth = BusLogic_UntaggedQueueDepthBB; 1779 if (adapter->need_bouncebuf)
1780 adapter->untag_qdepth = BLOGIC_UNTAG_DEPTH_BB;
1654 else 1781 else
1655 HostAdapter->UntaggedQueueDepth = BusLogic_UntaggedQueueDepth; 1782 adapter->untag_qdepth = BLOGIC_UNTAG_DEPTH;
1656 if (HostAdapter->DriverOptions != NULL) 1783 if (adapter->drvr_opts != NULL)
1657 HostAdapter->CommonQueueDepth = HostAdapter->DriverOptions->CommonQueueDepth; 1784 adapter->common_qdepth = adapter->drvr_opts->common_qdepth;
1658 if (HostAdapter->CommonQueueDepth > 0 && HostAdapter->CommonQueueDepth < HostAdapter->UntaggedQueueDepth) 1785 if (adapter->common_qdepth > 0 &&
1659 HostAdapter->UntaggedQueueDepth = HostAdapter->CommonQueueDepth; 1786 adapter->common_qdepth < adapter->untag_qdepth)
1787 adapter->untag_qdepth = adapter->common_qdepth;
1660 /* 1788 /*
1661 Tagged Queuing is only allowed if Disconnect/Reconnect is permitted. 1789 Tagged Queuing is only allowed if Disconnect/Reconnect is permitted.
1662 Therefore, mask the Tagged Queuing Permitted Default bits with the 1790 Therefore, mask the Tagged Queuing Permitted Default bits with the
1663 Disconnect/Reconnect Permitted bits. 1791 Disconnect/Reconnect Permitted bits.
1664 */ 1792 */
1665 HostAdapter->TaggedQueuingPermitted &= HostAdapter->DisconnectPermitted; 1793 adapter->tagq_ok &= adapter->discon_ok;
1666 /* 1794 /*
1667 Combine the default Tagged Queuing Permitted bits with any BusLogic Driver 1795 Combine the default Tagged Queuing Permitted bits with any
1668 Options Tagged Queuing specification. 1796 BusLogic Driver Options Tagged Queuing specification.
1669 */ 1797 */
1670 if (HostAdapter->DriverOptions != NULL) 1798 if (adapter->drvr_opts != NULL)
1671 HostAdapter->TaggedQueuingPermitted = 1799 adapter->tagq_ok = (adapter->drvr_opts->tagq_ok &
1672 (HostAdapter->DriverOptions->TaggedQueuingPermitted & HostAdapter->DriverOptions->TaggedQueuingPermittedMask) | (HostAdapter->TaggedQueuingPermitted & ~HostAdapter->DriverOptions->TaggedQueuingPermittedMask); 1800 adapter->drvr_opts->tagq_ok_mask) |
1801 (adapter->tagq_ok & ~adapter->drvr_opts->tagq_ok_mask);
1673 1802
1674 /* 1803 /*
1675 Select an appropriate value for Bus Settle Time either from a BusLogic 1804 Select an appropriate value for Bus Settle Time either from a
1676 Driver Options specification, or from BusLogic_DefaultBusSettleTime. 1805 BusLogic Driver Options specification, or from
1806 BLOGIC_BUS_SETTLE_TIME.
1677 */ 1807 */
1678 if (HostAdapter->DriverOptions != NULL && HostAdapter->DriverOptions->BusSettleTime > 0) 1808 if (adapter->drvr_opts != NULL &&
1679 HostAdapter->BusSettleTime = HostAdapter->DriverOptions->BusSettleTime; 1809 adapter->drvr_opts->bus_settle_time > 0)
1810 adapter->bus_settle_time = adapter->drvr_opts->bus_settle_time;
1680 else 1811 else
1681 HostAdapter->BusSettleTime = BusLogic_DefaultBusSettleTime; 1812 adapter->bus_settle_time = BLOGIC_BUS_SETTLE_TIME;
1682 /* 1813 /*
1683 Indicate reading the Host Adapter Configuration completed successfully. 1814 Indicate reading the Host Adapter Configuration completed
1815 successfully.
1684 */ 1816 */
1685 return true; 1817 return true;
1686} 1818}
1687 1819
1688 1820
1689/* 1821/*
1690 BusLogic_ReportHostAdapterConfiguration reports the configuration of 1822 blogic_reportconfig reports the configuration of Host Adapter.
1691 Host Adapter.
1692*/ 1823*/
1693 1824
1694static bool __init BusLogic_ReportHostAdapterConfiguration(struct BusLogic_HostAdapter 1825static bool __init blogic_reportconfig(struct blogic_adapter *adapter)
1695 *HostAdapter)
1696{ 1826{
1697 unsigned short AllTargetsMask = (1 << HostAdapter->MaxTargetDevices) - 1; 1827 unsigned short alltgt_mask = (1 << adapter->maxdev) - 1;
1698 unsigned short SynchronousPermitted, FastPermitted; 1828 unsigned short sync_ok, fast_ok;
1699 unsigned short UltraPermitted, WidePermitted; 1829 unsigned short ultra_ok, wide_ok;
1700 unsigned short DisconnectPermitted, TaggedQueuingPermitted; 1830 unsigned short discon_ok, tagq_ok;
1701 bool CommonSynchronousNegotiation, CommonTaggedQueueDepth; 1831 bool common_syncneg, common_tagq_depth;
1702 char SynchronousString[BusLogic_MaxTargetDevices + 1]; 1832 char syncstr[BLOGIC_MAXDEV + 1];
1703 char WideString[BusLogic_MaxTargetDevices + 1]; 1833 char widestr[BLOGIC_MAXDEV + 1];
1704 char DisconnectString[BusLogic_MaxTargetDevices + 1]; 1834 char discon_str[BLOGIC_MAXDEV + 1];
1705 char TaggedQueuingString[BusLogic_MaxTargetDevices + 1]; 1835 char tagq_str[BLOGIC_MAXDEV + 1];
1706 char *SynchronousMessage = SynchronousString; 1836 char *syncmsg = syncstr;
1707 char *WideMessage = WideString; 1837 char *widemsg = widestr;
1708 char *DisconnectMessage = DisconnectString; 1838 char *discon_msg = discon_str;
1709 char *TaggedQueuingMessage = TaggedQueuingString; 1839 char *tagq_msg = tagq_str;
1710 int TargetID; 1840 int tgt_id;
1711 BusLogic_Info("Configuring BusLogic Model %s %s%s%s%s SCSI Host Adapter\n", 1841
1712 HostAdapter, HostAdapter->ModelName, 1842 blogic_info("Configuring BusLogic Model %s %s%s%s%s SCSI Host Adapter\n", adapter, adapter->model, blogic_adapter_busnames[adapter->adapter_bus_type], (adapter->wide ? " Wide" : ""), (adapter->differential ? " Differential" : ""), (adapter->ultra ? " Ultra" : ""));
1713 BusLogic_HostAdapterBusNames[HostAdapter->HostAdapterBusType], (HostAdapter->HostWideSCSI ? " Wide" : ""), (HostAdapter->HostDifferentialSCSI ? " Differential" : ""), (HostAdapter->HostUltraSCSI ? " Ultra" : "")); 1843 blogic_info(" Firmware Version: %s, I/O Address: 0x%X, " "IRQ Channel: %d/%s\n", adapter, adapter->fw_ver, adapter->io_addr, adapter->irq_ch, (adapter->level_int ? "Level" : "Edge"));
1714 BusLogic_Info(" Firmware Version: %s, I/O Address: 0x%X, " "IRQ Channel: %d/%s\n", HostAdapter, HostAdapter->FirmwareVersion, HostAdapter->IO_Address, HostAdapter->IRQ_Channel, (HostAdapter->LevelSensitiveInterrupt ? "Level" : "Edge")); 1844 if (adapter->adapter_bus_type != BLOGIC_PCI_BUS) {
1715 if (HostAdapter->HostAdapterBusType != BusLogic_PCI_Bus) { 1845 blogic_info(" DMA Channel: ", adapter);
1716 BusLogic_Info(" DMA Channel: ", HostAdapter); 1846 if (adapter->dma_ch > 0)
1717 if (HostAdapter->DMA_Channel > 0) 1847 blogic_info("%d, ", adapter, adapter->dma_ch);
1718 BusLogic_Info("%d, ", HostAdapter, HostAdapter->DMA_Channel);
1719 else 1848 else
1720 BusLogic_Info("None, ", HostAdapter); 1849 blogic_info("None, ", adapter);
1721 if (HostAdapter->BIOS_Address > 0) 1850 if (adapter->bios_addr > 0)
1722 BusLogic_Info("BIOS Address: 0x%X, ", HostAdapter, HostAdapter->BIOS_Address); 1851 blogic_info("BIOS Address: 0x%X, ", adapter,
1852 adapter->bios_addr);
1723 else 1853 else
1724 BusLogic_Info("BIOS Address: None, ", HostAdapter); 1854 blogic_info("BIOS Address: None, ", adapter);
1725 } else { 1855 } else {
1726 BusLogic_Info(" PCI Bus: %d, Device: %d, Address: ", HostAdapter, HostAdapter->Bus, HostAdapter->Device); 1856 blogic_info(" PCI Bus: %d, Device: %d, Address: ", adapter,
1727 if (HostAdapter->PCI_Address > 0) 1857 adapter->bus, adapter->dev);
1728 BusLogic_Info("0x%X, ", HostAdapter, HostAdapter->PCI_Address); 1858 if (adapter->pci_addr > 0)
1859 blogic_info("0x%X, ", adapter, adapter->pci_addr);
1729 else 1860 else
1730 BusLogic_Info("Unassigned, ", HostAdapter); 1861 blogic_info("Unassigned, ", adapter);
1731 } 1862 }
1732 BusLogic_Info("Host Adapter SCSI ID: %d\n", HostAdapter, HostAdapter->SCSI_ID); 1863 blogic_info("Host Adapter SCSI ID: %d\n", adapter, adapter->scsi_id);
1733 BusLogic_Info(" Parity Checking: %s, Extended Translation: %s\n", HostAdapter, (HostAdapter->ParityCheckingEnabled ? "Enabled" : "Disabled"), (HostAdapter->ExtendedTranslationEnabled ? "Enabled" : "Disabled")); 1864 blogic_info(" Parity Checking: %s, Extended Translation: %s\n",
1734 AllTargetsMask &= ~(1 << HostAdapter->SCSI_ID); 1865 adapter, (adapter->parity ? "Enabled" : "Disabled"),
1735 SynchronousPermitted = HostAdapter->SynchronousPermitted & AllTargetsMask; 1866 (adapter->ext_trans_enable ? "Enabled" : "Disabled"));
1736 FastPermitted = HostAdapter->FastPermitted & AllTargetsMask; 1867 alltgt_mask &= ~(1 << adapter->scsi_id);
1737 UltraPermitted = HostAdapter->UltraPermitted & AllTargetsMask; 1868 sync_ok = adapter->sync_ok & alltgt_mask;
1738 if ((BusLogic_MultiMasterHostAdapterP(HostAdapter) && (HostAdapter->FirmwareVersion[0] >= '4' || HostAdapter->HostAdapterBusType == BusLogic_EISA_Bus)) || BusLogic_FlashPointHostAdapterP(HostAdapter)) { 1869 fast_ok = adapter->fast_ok & alltgt_mask;
1739 CommonSynchronousNegotiation = false; 1870 ultra_ok = adapter->ultra_ok & alltgt_mask;
1740 if (SynchronousPermitted == 0) { 1871 if ((blogic_multimaster_type(adapter) &&
1741 SynchronousMessage = "Disabled"; 1872 (adapter->fw_ver[0] >= '4' ||
1742 CommonSynchronousNegotiation = true; 1873 adapter->adapter_bus_type == BLOGIC_EISA_BUS)) ||
1743 } else if (SynchronousPermitted == AllTargetsMask) { 1874 blogic_flashpoint_type(adapter)) {
1744 if (FastPermitted == 0) { 1875 common_syncneg = false;
1745 SynchronousMessage = "Slow"; 1876 if (sync_ok == 0) {
1746 CommonSynchronousNegotiation = true; 1877 syncmsg = "Disabled";
1747 } else if (FastPermitted == AllTargetsMask) { 1878 common_syncneg = true;
1748 if (UltraPermitted == 0) { 1879 } else if (sync_ok == alltgt_mask) {
1749 SynchronousMessage = "Fast"; 1880 if (fast_ok == 0) {
1750 CommonSynchronousNegotiation = true; 1881 syncmsg = "Slow";
1751 } else if (UltraPermitted == AllTargetsMask) { 1882 common_syncneg = true;
1752 SynchronousMessage = "Ultra"; 1883 } else if (fast_ok == alltgt_mask) {
1753 CommonSynchronousNegotiation = true; 1884 if (ultra_ok == 0) {
1885 syncmsg = "Fast";
1886 common_syncneg = true;
1887 } else if (ultra_ok == alltgt_mask) {
1888 syncmsg = "Ultra";
1889 common_syncneg = true;
1754 } 1890 }
1755 } 1891 }
1756 } 1892 }
1757 if (!CommonSynchronousNegotiation) { 1893 if (!common_syncneg) {
1758 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) 1894 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
1759 SynchronousString[TargetID] = ((!(SynchronousPermitted & (1 << TargetID))) ? 'N' : (!(FastPermitted & (1 << TargetID)) ? 'S' : (!(UltraPermitted & (1 << TargetID)) ? 'F' : 'U'))); 1895 syncstr[tgt_id] = ((!(sync_ok & (1 << tgt_id))) ? 'N' : (!(fast_ok & (1 << tgt_id)) ? 'S' : (!(ultra_ok & (1 << tgt_id)) ? 'F' : 'U')));
1760 SynchronousString[HostAdapter->SCSI_ID] = '#'; 1896 syncstr[adapter->scsi_id] = '#';
1761 SynchronousString[HostAdapter->MaxTargetDevices] = '\0'; 1897 syncstr[adapter->maxdev] = '\0';
1762 } 1898 }
1763 } else 1899 } else
1764 SynchronousMessage = (SynchronousPermitted == 0 ? "Disabled" : "Enabled"); 1900 syncmsg = (sync_ok == 0 ? "Disabled" : "Enabled");
1765 WidePermitted = HostAdapter->WidePermitted & AllTargetsMask; 1901 wide_ok = adapter->wide_ok & alltgt_mask;
1766 if (WidePermitted == 0) 1902 if (wide_ok == 0)
1767 WideMessage = "Disabled"; 1903 widemsg = "Disabled";
1768 else if (WidePermitted == AllTargetsMask) 1904 else if (wide_ok == alltgt_mask)
1769 WideMessage = "Enabled"; 1905 widemsg = "Enabled";
1770 else { 1906 else {
1771 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) 1907 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
1772 WideString[TargetID] = ((WidePermitted & (1 << TargetID)) ? 'Y' : 'N'); 1908 widestr[tgt_id] = ((wide_ok & (1 << tgt_id)) ? 'Y' : 'N');
1773 WideString[HostAdapter->SCSI_ID] = '#'; 1909 widestr[adapter->scsi_id] = '#';
1774 WideString[HostAdapter->MaxTargetDevices] = '\0'; 1910 widestr[adapter->maxdev] = '\0';
1775 } 1911 }
1776 DisconnectPermitted = HostAdapter->DisconnectPermitted & AllTargetsMask; 1912 discon_ok = adapter->discon_ok & alltgt_mask;
1777 if (DisconnectPermitted == 0) 1913 if (discon_ok == 0)
1778 DisconnectMessage = "Disabled"; 1914 discon_msg = "Disabled";
1779 else if (DisconnectPermitted == AllTargetsMask) 1915 else if (discon_ok == alltgt_mask)
1780 DisconnectMessage = "Enabled"; 1916 discon_msg = "Enabled";
1781 else { 1917 else {
1782 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) 1918 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
1783 DisconnectString[TargetID] = ((DisconnectPermitted & (1 << TargetID)) ? 'Y' : 'N'); 1919 discon_str[tgt_id] = ((discon_ok & (1 << tgt_id)) ? 'Y' : 'N');
1784 DisconnectString[HostAdapter->SCSI_ID] = '#'; 1920 discon_str[adapter->scsi_id] = '#';
1785 DisconnectString[HostAdapter->MaxTargetDevices] = '\0'; 1921 discon_str[adapter->maxdev] = '\0';
1786 } 1922 }
1787 TaggedQueuingPermitted = HostAdapter->TaggedQueuingPermitted & AllTargetsMask; 1923 tagq_ok = adapter->tagq_ok & alltgt_mask;
1788 if (TaggedQueuingPermitted == 0) 1924 if (tagq_ok == 0)
1789 TaggedQueuingMessage = "Disabled"; 1925 tagq_msg = "Disabled";
1790 else if (TaggedQueuingPermitted == AllTargetsMask) 1926 else if (tagq_ok == alltgt_mask)
1791 TaggedQueuingMessage = "Enabled"; 1927 tagq_msg = "Enabled";
1792 else { 1928 else {
1793 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) 1929 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
1794 TaggedQueuingString[TargetID] = ((TaggedQueuingPermitted & (1 << TargetID)) ? 'Y' : 'N'); 1930 tagq_str[tgt_id] = ((tagq_ok & (1 << tgt_id)) ? 'Y' : 'N');
1795 TaggedQueuingString[HostAdapter->SCSI_ID] = '#'; 1931 tagq_str[adapter->scsi_id] = '#';
1796 TaggedQueuingString[HostAdapter->MaxTargetDevices] = '\0'; 1932 tagq_str[adapter->maxdev] = '\0';
1797 } 1933 }
1798 BusLogic_Info(" Synchronous Negotiation: %s, Wide Negotiation: %s\n", HostAdapter, SynchronousMessage, WideMessage); 1934 blogic_info(" Synchronous Negotiation: %s, Wide Negotiation: %s\n",
1799 BusLogic_Info(" Disconnect/Reconnect: %s, Tagged Queuing: %s\n", HostAdapter, DisconnectMessage, TaggedQueuingMessage); 1935 adapter, syncmsg, widemsg);
1800 if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) { 1936 blogic_info(" Disconnect/Reconnect: %s, Tagged Queuing: %s\n", adapter,
1801 BusLogic_Info(" Scatter/Gather Limit: %d of %d segments, " "Mailboxes: %d\n", HostAdapter, HostAdapter->DriverScatterGatherLimit, HostAdapter->HostAdapterScatterGatherLimit, HostAdapter->MailboxCount); 1937 discon_msg, tagq_msg);
1802 BusLogic_Info(" Driver Queue Depth: %d, " "Host Adapter Queue Depth: %d\n", HostAdapter, HostAdapter->DriverQueueDepth, HostAdapter->HostAdapterQueueDepth); 1938 if (blogic_multimaster_type(adapter)) {
1939 blogic_info(" Scatter/Gather Limit: %d of %d segments, " "Mailboxes: %d\n", adapter, adapter->drvr_sglimit, adapter->adapter_sglimit, adapter->mbox_count);
1940 blogic_info(" Driver Queue Depth: %d, " "Host Adapter Queue Depth: %d\n", adapter, adapter->drvr_qdepth, adapter->adapter_qdepth);
1803 } else 1941 } else
1804 BusLogic_Info(" Driver Queue Depth: %d, " "Scatter/Gather Limit: %d segments\n", HostAdapter, HostAdapter->DriverQueueDepth, HostAdapter->DriverScatterGatherLimit); 1942 blogic_info(" Driver Queue Depth: %d, " "Scatter/Gather Limit: %d segments\n", adapter, adapter->drvr_qdepth, adapter->drvr_sglimit);
1805 BusLogic_Info(" Tagged Queue Depth: ", HostAdapter); 1943 blogic_info(" Tagged Queue Depth: ", adapter);
1806 CommonTaggedQueueDepth = true; 1944 common_tagq_depth = true;
1807 for (TargetID = 1; TargetID < HostAdapter->MaxTargetDevices; TargetID++) 1945 for (tgt_id = 1; tgt_id < adapter->maxdev; tgt_id++)
1808 if (HostAdapter->QueueDepth[TargetID] != HostAdapter->QueueDepth[0]) { 1946 if (adapter->qdepth[tgt_id] != adapter->qdepth[0]) {
1809 CommonTaggedQueueDepth = false; 1947 common_tagq_depth = false;
1810 break; 1948 break;
1811 } 1949 }
1812 if (CommonTaggedQueueDepth) { 1950 if (common_tagq_depth) {
1813 if (HostAdapter->QueueDepth[0] > 0) 1951 if (adapter->qdepth[0] > 0)
1814 BusLogic_Info("%d", HostAdapter, HostAdapter->QueueDepth[0]); 1952 blogic_info("%d", adapter, adapter->qdepth[0]);
1815 else 1953 else
1816 BusLogic_Info("Automatic", HostAdapter); 1954 blogic_info("Automatic", adapter);
1817 } else 1955 } else
1818 BusLogic_Info("Individual", HostAdapter); 1956 blogic_info("Individual", adapter);
1819 BusLogic_Info(", Untagged Queue Depth: %d\n", HostAdapter, HostAdapter->UntaggedQueueDepth); 1957 blogic_info(", Untagged Queue Depth: %d\n", adapter,
1820 if (HostAdapter->TerminationInfoValid) { 1958 adapter->untag_qdepth);
1821 if (HostAdapter->HostWideSCSI) 1959 if (adapter->terminfo_valid) {
1822 BusLogic_Info(" SCSI Bus Termination: %s", HostAdapter, (HostAdapter->LowByteTerminated ? (HostAdapter->HighByteTerminated ? "Both Enabled" : "Low Enabled") 1960 if (adapter->wide)
1823 : (HostAdapter->HighByteTerminated ? "High Enabled" : "Both Disabled"))); 1961 blogic_info(" SCSI Bus Termination: %s", adapter,
1962 (adapter->low_term ? (adapter->high_term ? "Both Enabled" : "Low Enabled") : (adapter->high_term ? "High Enabled" : "Both Disabled")));
1824 else 1963 else
1825 BusLogic_Info(" SCSI Bus Termination: %s", HostAdapter, (HostAdapter->LowByteTerminated ? "Enabled" : "Disabled")); 1964 blogic_info(" SCSI Bus Termination: %s", adapter,
1826 if (HostAdapter->HostSupportsSCAM) 1965 (adapter->low_term ? "Enabled" : "Disabled"));
1827 BusLogic_Info(", SCAM: %s", HostAdapter, (HostAdapter->SCAM_Enabled ? (HostAdapter->SCAM_Level2 ? "Enabled, Level 2" : "Enabled, Level 1") 1966 if (adapter->scam)
1828 : "Disabled")); 1967 blogic_info(", SCAM: %s", adapter,
1829 BusLogic_Info("\n", HostAdapter); 1968 (adapter->scam_enabled ? (adapter->scam_lev2 ? "Enabled, Level 2" : "Enabled, Level 1") : "Disabled"));
1969 blogic_info("\n", adapter);
1830 } 1970 }
1831 /* 1971 /*
1832 Indicate reporting the Host Adapter configuration completed successfully. 1972 Indicate reporting the Host Adapter configuration completed
1973 successfully.
1833 */ 1974 */
1834 return true; 1975 return true;
1835} 1976}
1836 1977
1837 1978
1838/* 1979/*
1839 BusLogic_AcquireResources acquires the system resources necessary to use 1980 blogic_getres acquires the system resources necessary to use
1840 Host Adapter. 1981 Host Adapter.
1841*/ 1982*/
1842 1983
1843static bool __init BusLogic_AcquireResources(struct BusLogic_HostAdapter *HostAdapter) 1984static bool __init blogic_getres(struct blogic_adapter *adapter)
1844{ 1985{
1845 if (HostAdapter->IRQ_Channel == 0) { 1986 if (adapter->irq_ch == 0) {
1846 BusLogic_Error("NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n", HostAdapter); 1987 blogic_err("NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n",
1988 adapter);
1847 return false; 1989 return false;
1848 } 1990 }
1849 /* 1991 /*
1850 Acquire shared access to the IRQ Channel. 1992 Acquire shared access to the IRQ Channel.
1851 */ 1993 */
1852 if (request_irq(HostAdapter->IRQ_Channel, BusLogic_InterruptHandler, IRQF_SHARED, HostAdapter->FullModelName, HostAdapter) < 0) { 1994 if (request_irq(adapter->irq_ch, blogic_inthandler, IRQF_SHARED,
1853 BusLogic_Error("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n", HostAdapter, HostAdapter->IRQ_Channel); 1995 adapter->full_model, adapter) < 0) {
1996 blogic_err("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n",
1997 adapter, adapter->irq_ch);
1854 return false; 1998 return false;
1855 } 1999 }
1856 HostAdapter->IRQ_ChannelAcquired = true; 2000 adapter->irq_acquired = true;
1857 /* 2001 /*
1858 Acquire exclusive access to the DMA Channel. 2002 Acquire exclusive access to the DMA Channel.
1859 */ 2003 */
1860 if (HostAdapter->DMA_Channel > 0) { 2004 if (adapter->dma_ch > 0) {
1861 if (request_dma(HostAdapter->DMA_Channel, HostAdapter->FullModelName) < 0) { 2005 if (request_dma(adapter->dma_ch, adapter->full_model) < 0) {
1862 BusLogic_Error("UNABLE TO ACQUIRE DMA CHANNEL %d - DETACHING\n", HostAdapter, HostAdapter->DMA_Channel); 2006 blogic_err("UNABLE TO ACQUIRE DMA CHANNEL %d - DETACHING\n", adapter, adapter->dma_ch);
1863 return false; 2007 return false;
1864 } 2008 }
1865 set_dma_mode(HostAdapter->DMA_Channel, DMA_MODE_CASCADE); 2009 set_dma_mode(adapter->dma_ch, DMA_MODE_CASCADE);
1866 enable_dma(HostAdapter->DMA_Channel); 2010 enable_dma(adapter->dma_ch);
1867 HostAdapter->DMA_ChannelAcquired = true; 2011 adapter->dma_chan_acquired = true;
1868 } 2012 }
1869 /* 2013 /*
1870 Indicate the System Resource Acquisition completed successfully, 2014 Indicate the System Resource Acquisition completed successfully,
@@ -1874,127 +2018,146 @@ static bool __init BusLogic_AcquireResources(struct BusLogic_HostAdapter *HostAd
1874 2018
1875 2019
1876/* 2020/*
1877 BusLogic_ReleaseResources releases any system resources previously acquired 2021 blogic_relres releases any system resources previously acquired
1878 by BusLogic_AcquireResources. 2022 by blogic_getres.
1879*/ 2023*/
1880 2024
1881static void BusLogic_ReleaseResources(struct BusLogic_HostAdapter *HostAdapter) 2025static void blogic_relres(struct blogic_adapter *adapter)
1882{ 2026{
1883 /* 2027 /*
1884 Release shared access to the IRQ Channel. 2028 Release shared access to the IRQ Channel.
1885 */ 2029 */
1886 if (HostAdapter->IRQ_ChannelAcquired) 2030 if (adapter->irq_acquired)
1887 free_irq(HostAdapter->IRQ_Channel, HostAdapter); 2031 free_irq(adapter->irq_ch, adapter);
1888 /* 2032 /*
1889 Release exclusive access to the DMA Channel. 2033 Release exclusive access to the DMA Channel.
1890 */ 2034 */
1891 if (HostAdapter->DMA_ChannelAcquired) 2035 if (adapter->dma_chan_acquired)
1892 free_dma(HostAdapter->DMA_Channel); 2036 free_dma(adapter->dma_ch);
1893 /* 2037 /*
1894 Release any allocated memory structs not released elsewhere 2038 Release any allocated memory structs not released elsewhere
1895 */ 2039 */
1896 if (HostAdapter->MailboxSpace) 2040 if (adapter->mbox_space)
1897 pci_free_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, HostAdapter->MailboxSpace, HostAdapter->MailboxSpaceHandle); 2041 pci_free_consistent(adapter->pci_device, adapter->mbox_sz,
1898 pci_dev_put(HostAdapter->PCI_Device); 2042 adapter->mbox_space, adapter->mbox_space_handle);
1899 HostAdapter->MailboxSpace = NULL; 2043 pci_dev_put(adapter->pci_device);
1900 HostAdapter->MailboxSpaceHandle = 0; 2044 adapter->mbox_space = NULL;
1901 HostAdapter->MailboxSize = 0; 2045 adapter->mbox_space_handle = 0;
2046 adapter->mbox_sz = 0;
1902} 2047}
1903 2048
1904 2049
1905/* 2050/*
1906 BusLogic_InitializeHostAdapter initializes Host Adapter. This is the only 2051 blogic_initadapter initializes Host Adapter. This is the only
1907 function called during SCSI Host Adapter detection which modifies the state 2052 function called during SCSI Host Adapter detection which modifies the state
1908 of the Host Adapter from its initial power on or hard reset state. 2053 of the Host Adapter from its initial power on or hard reset state.
1909*/ 2054*/
1910 2055
1911static bool BusLogic_InitializeHostAdapter(struct BusLogic_HostAdapter 2056static bool blogic_initadapter(struct blogic_adapter *adapter)
1912 *HostAdapter)
1913{ 2057{
1914 struct BusLogic_ExtendedMailboxRequest ExtendedMailboxRequest; 2058 struct blogic_extmbox_req extmbox_req;
1915 enum BusLogic_RoundRobinModeRequest RoundRobinModeRequest; 2059 enum blogic_rr_req rr_req;
1916 enum BusLogic_SetCCBFormatRequest SetCCBFormatRequest; 2060 enum blogic_setccb_fmt setccb_fmt;
1917 int TargetID; 2061 int tgt_id;
2062
1918 /* 2063 /*
1919 Initialize the pointers to the first and last CCBs that are queued for 2064 Initialize the pointers to the first and last CCBs that are
1920 completion processing. 2065 queued for completion processing.
1921 */ 2066 */
1922 HostAdapter->FirstCompletedCCB = NULL; 2067 adapter->firstccb = NULL;
1923 HostAdapter->LastCompletedCCB = NULL; 2068 adapter->lastccb = NULL;
2069
1924 /* 2070 /*
1925 Initialize the Bus Device Reset Pending CCB, Tagged Queuing Active, 2071 Initialize the Bus Device Reset Pending CCB, Tagged Queuing Active,
1926 Command Successful Flag, Active Commands, and Commands Since Reset 2072 Command Successful Flag, Active Commands, and Commands Since Reset
1927 for each Target Device. 2073 for each Target Device.
1928 */ 2074 */
1929 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { 2075 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
1930 HostAdapter->BusDeviceResetPendingCCB[TargetID] = NULL; 2076 adapter->bdr_pend[tgt_id] = NULL;
1931 HostAdapter->TargetFlags[TargetID].TaggedQueuingActive = false; 2077 adapter->tgt_flags[tgt_id].tagq_active = false;
1932 HostAdapter->TargetFlags[TargetID].CommandSuccessfulFlag = false; 2078 adapter->tgt_flags[tgt_id].cmd_good = false;
1933 HostAdapter->ActiveCommands[TargetID] = 0; 2079 adapter->active_cmds[tgt_id] = 0;
1934 HostAdapter->CommandsSinceReset[TargetID] = 0; 2080 adapter->cmds_since_rst[tgt_id] = 0;
1935 } 2081 }
2082
1936 /* 2083 /*
1937 FlashPoint Host Adapters do not use Outgoing and Incoming Mailboxes. 2084 FlashPoint Host Adapters do not use Outgoing and Incoming Mailboxes.
1938 */ 2085 */
1939 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) 2086 if (blogic_flashpoint_type(adapter))
1940 goto Done; 2087 goto done;
2088
1941 /* 2089 /*
1942 Initialize the Outgoing and Incoming Mailbox pointers. 2090 Initialize the Outgoing and Incoming Mailbox pointers.
1943 */ 2091 */
1944 HostAdapter->MailboxSize = HostAdapter->MailboxCount * (sizeof(struct BusLogic_OutgoingMailbox) + sizeof(struct BusLogic_IncomingMailbox)); 2092 adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbox));
1945 HostAdapter->MailboxSpace = pci_alloc_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, &HostAdapter->MailboxSpaceHandle); 2093 adapter->mbox_space = pci_alloc_consistent(adapter->pci_device,
1946 if (HostAdapter->MailboxSpace == NULL) 2094 adapter->mbox_sz, &adapter->mbox_space_handle);
1947 return BusLogic_Failure(HostAdapter, "MAILBOX ALLOCATION"); 2095 if (adapter->mbox_space == NULL)
1948 HostAdapter->FirstOutgoingMailbox = (struct BusLogic_OutgoingMailbox *) HostAdapter->MailboxSpace; 2096 return blogic_failure(adapter, "MAILBOX ALLOCATION");
1949 HostAdapter->LastOutgoingMailbox = HostAdapter->FirstOutgoingMailbox + HostAdapter->MailboxCount - 1; 2097 adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space;
1950 HostAdapter->NextOutgoingMailbox = HostAdapter->FirstOutgoingMailbox; 2098 adapter->last_outbox = adapter->first_outbox + adapter->mbox_count - 1;
1951 HostAdapter->FirstIncomingMailbox = (struct BusLogic_IncomingMailbox *) (HostAdapter->LastOutgoingMailbox + 1); 2099 adapter->next_outbox = adapter->first_outbox;
1952 HostAdapter->LastIncomingMailbox = HostAdapter->FirstIncomingMailbox + HostAdapter->MailboxCount - 1; 2100 adapter->first_inbox = (struct blogic_inbox *) (adapter->last_outbox + 1);
1953 HostAdapter->NextIncomingMailbox = HostAdapter->FirstIncomingMailbox; 2101 adapter->last_inbox = adapter->first_inbox + adapter->mbox_count - 1;
2102 adapter->next_inbox = adapter->first_inbox;
1954 2103
1955 /* 2104 /*
1956 Initialize the Outgoing and Incoming Mailbox structures. 2105 Initialize the Outgoing and Incoming Mailbox structures.
1957 */ 2106 */
1958 memset(HostAdapter->FirstOutgoingMailbox, 0, HostAdapter->MailboxCount * sizeof(struct BusLogic_OutgoingMailbox)); 2107 memset(adapter->first_outbox, 0,
1959 memset(HostAdapter->FirstIncomingMailbox, 0, HostAdapter->MailboxCount * sizeof(struct BusLogic_IncomingMailbox)); 2108 adapter->mbox_count * sizeof(struct blogic_outbox));
2109 memset(adapter->first_inbox, 0,
2110 adapter->mbox_count * sizeof(struct blogic_inbox));
2111
1960 /* 2112 /*
1961 Initialize the Host Adapter's Pointer to the Outgoing/Incoming Mailboxes. 2113 Initialize the Host Adapter's Pointer to the Outgoing/Incoming
2114 Mailboxes.
1962 */ 2115 */
1963 ExtendedMailboxRequest.MailboxCount = HostAdapter->MailboxCount; 2116 extmbox_req.mbox_count = adapter->mbox_count;
1964 ExtendedMailboxRequest.BaseMailboxAddress = (u32) HostAdapter->MailboxSpaceHandle; 2117 extmbox_req.base_mbox_addr = (u32) adapter->mbox_space_handle;
1965 if (BusLogic_Command(HostAdapter, BusLogic_InitializeExtendedMailbox, &ExtendedMailboxRequest, sizeof(ExtendedMailboxRequest), NULL, 0) < 0) 2118 if (blogic_cmd(adapter, BLOGIC_INIT_EXT_MBOX, &extmbox_req,
1966 return BusLogic_Failure(HostAdapter, "MAILBOX INITIALIZATION"); 2119 sizeof(extmbox_req), NULL, 0) < 0)
2120 return blogic_failure(adapter, "MAILBOX INITIALIZATION");
1967 /* 2121 /*
1968 Enable Strict Round Robin Mode if supported by the Host Adapter. In 2122 Enable Strict Round Robin Mode if supported by the Host Adapter. In
1969 Strict Round Robin Mode, the Host Adapter only looks at the next Outgoing 2123 Strict Round Robin Mode, the Host Adapter only looks at the next
1970 Mailbox for each new command, rather than scanning through all the 2124 Outgoing Mailbox for each new command, rather than scanning
1971 Outgoing Mailboxes to find any that have new commands in them. Strict 2125 through all the Outgoing Mailboxes to find any that have new
1972 Round Robin Mode is significantly more efficient. 2126 commands in them. Strict Round Robin Mode is significantly more
2127 efficient.
1973 */ 2128 */
1974 if (HostAdapter->StrictRoundRobinModeSupport) { 2129 if (adapter->strict_rr) {
1975 RoundRobinModeRequest = BusLogic_StrictRoundRobinMode; 2130 rr_req = BLOGIC_STRICT_RR_MODE;
1976 if (BusLogic_Command(HostAdapter, BusLogic_EnableStrictRoundRobinMode, &RoundRobinModeRequest, sizeof(RoundRobinModeRequest), NULL, 0) < 0) 2131 if (blogic_cmd(adapter, BLOGIC_STRICT_RR, &rr_req,
1977 return BusLogic_Failure(HostAdapter, "ENABLE STRICT ROUND ROBIN MODE"); 2132 sizeof(rr_req), NULL, 0) < 0)
2133 return blogic_failure(adapter,
2134 "ENABLE STRICT ROUND ROBIN MODE");
1978 } 2135 }
2136
1979 /* 2137 /*
1980 For Host Adapters that support Extended LUN Format CCBs, issue the Set CCB 2138 For Host Adapters that support Extended LUN Format CCBs, issue the
1981 Format command to allow 32 Logical Units per Target Device. 2139 Set CCB Format command to allow 32 Logical Units per Target Device.
1982 */ 2140 */
1983 if (HostAdapter->ExtendedLUNSupport) { 2141 if (adapter->ext_lun) {
1984 SetCCBFormatRequest = BusLogic_ExtendedLUNFormatCCB; 2142 setccb_fmt = BLOGIC_EXT_LUN_CCB;
1985 if (BusLogic_Command(HostAdapter, BusLogic_SetCCBFormat, &SetCCBFormatRequest, sizeof(SetCCBFormatRequest), NULL, 0) < 0) 2143 if (blogic_cmd(adapter, BLOGIC_SETCCB_FMT, &setccb_fmt,
1986 return BusLogic_Failure(HostAdapter, "SET CCB FORMAT"); 2144 sizeof(setccb_fmt), NULL, 0) < 0)
2145 return blogic_failure(adapter, "SET CCB FORMAT");
1987 } 2146 }
2147
1988 /* 2148 /*
1989 Announce Successful Initialization. 2149 Announce Successful Initialization.
1990 */ 2150 */
1991 Done: 2151done:
1992 if (!HostAdapter->HostAdapterInitialized) { 2152 if (!adapter->adapter_initd) {
1993 BusLogic_Info("*** %s Initialized Successfully ***\n", HostAdapter, HostAdapter->FullModelName); 2153 blogic_info("*** %s Initialized Successfully ***\n", adapter,
1994 BusLogic_Info("\n", HostAdapter); 2154 adapter->full_model);
2155 blogic_info("\n", adapter);
1995 } else 2156 } else
1996 BusLogic_Warning("*** %s Initialized Successfully ***\n", HostAdapter, HostAdapter->FullModelName); 2157 blogic_warn("*** %s Initialized Successfully ***\n", adapter,
1997 HostAdapter->HostAdapterInitialized = true; 2158 adapter->full_model);
2159 adapter->adapter_initd = true;
2160
1998 /* 2161 /*
1999 Indicate the Host Adapter Initialization completed successfully. 2162 Indicate the Host Adapter Initialization completed successfully.
2000 */ 2163 */
@@ -2003,109 +2166,116 @@ static bool BusLogic_InitializeHostAdapter(struct BusLogic_HostAdapter
2003 2166
2004 2167
2005/* 2168/*
2006 BusLogic_TargetDeviceInquiry inquires about the Target Devices accessible 2169 blogic_inquiry inquires about the Target Devices accessible
2007 through Host Adapter. 2170 through Host Adapter.
2008*/ 2171*/
2009 2172
2010static bool __init BusLogic_TargetDeviceInquiry(struct BusLogic_HostAdapter 2173static bool __init blogic_inquiry(struct blogic_adapter *adapter)
2011 *HostAdapter)
2012{ 2174{
2013 u16 InstalledDevices; 2175 u16 installed_devs;
2014 u8 InstalledDevicesID0to7[8]; 2176 u8 installed_devs0to7[8];
2015 struct BusLogic_SetupInformation SetupInformation; 2177 struct blogic_setup_info setupinfo;
2016 u8 SynchronousPeriod[BusLogic_MaxTargetDevices]; 2178 u8 sync_period[BLOGIC_MAXDEV];
2017 unsigned char RequestedReplyLength; 2179 unsigned char req_replylen;
2018 int TargetID; 2180 int tgt_id;
2181
2019 /* 2182 /*
2020 Wait a few seconds between the Host Adapter Hard Reset which initiates 2183 Wait a few seconds between the Host Adapter Hard Reset which
2021 a SCSI Bus Reset and issuing any SCSI Commands. Some SCSI devices get 2184 initiates a SCSI Bus Reset and issuing any SCSI Commands. Some
2022 confused if they receive SCSI Commands too soon after a SCSI Bus Reset. 2185 SCSI devices get confused if they receive SCSI Commands too soon
2186 after a SCSI Bus Reset.
2023 */ 2187 */
2024 BusLogic_Delay(HostAdapter->BusSettleTime); 2188 blogic_delay(adapter->bus_settle_time);
2025 /* 2189 /*
2026 FlashPoint Host Adapters do not provide for Target Device Inquiry. 2190 FlashPoint Host Adapters do not provide for Target Device Inquiry.
2027 */ 2191 */
2028 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) 2192 if (blogic_flashpoint_type(adapter))
2029 return true; 2193 return true;
2030 /* 2194 /*
2031 Inhibit the Target Device Inquiry if requested. 2195 Inhibit the Target Device Inquiry if requested.
2032 */ 2196 */
2033 if (HostAdapter->DriverOptions != NULL && HostAdapter->DriverOptions->LocalOptions.InhibitTargetInquiry) 2197 if (adapter->drvr_opts != NULL && adapter->drvr_opts->stop_tgt_inquiry)
2034 return true; 2198 return true;
2035 /* 2199 /*
2036 Issue the Inquire Target Devices command for host adapters with firmware 2200 Issue the Inquire Target Devices command for host adapters with
2037 version 4.25 or later, or the Inquire Installed Devices ID 0 to 7 command 2201 firmware version 4.25 or later, or the Inquire Installed Devices
2038 for older host adapters. This is necessary to force Synchronous Transfer 2202 ID 0 to 7 command for older host adapters. This is necessary to
2039 Negotiation so that the Inquire Setup Information and Inquire Synchronous 2203 force Synchronous Transfer Negotiation so that the Inquire Setup
2040 Period commands will return valid data. The Inquire Target Devices command 2204 Information and Inquire Synchronous Period commands will return
2041 is preferable to Inquire Installed Devices ID 0 to 7 since it only probes 2205 valid data. The Inquire Target Devices command is preferable to
2042 Logical Unit 0 of each Target Device. 2206 Inquire Installed Devices ID 0 to 7 since it only probes Logical
2207 Unit 0 of each Target Device.
2043 */ 2208 */
2044 if (strcmp(HostAdapter->FirmwareVersion, "4.25") >= 0) { 2209 if (strcmp(adapter->fw_ver, "4.25") >= 0) {
2045 2210
2046 /* 2211 /*
2047 * Issue a Inquire Target Devices command. Inquire Target Devices only 2212 Issue a Inquire Target Devices command. Inquire Target
2048 * tests Logical Unit 0 of each Target Device unlike the Inquire Installed 2213 Devices only tests Logical Unit 0 of each Target Device
2049 * Devices commands which test Logical Units 0 - 7. Two bytes are 2214 unlike the Inquire Installed Devices commands which test
2050 * returned, where byte 0 bit 0 set indicates that Target Device 0 exists, 2215 Logical Units 0 - 7. Two bytes are returned, where byte
2051 * and so on. 2216 0 bit 0 set indicates that Target Device 0 exists, and so on.
2052 */ 2217 */
2053 2218
2054 if (BusLogic_Command(HostAdapter, BusLogic_InquireTargetDevices, NULL, 0, &InstalledDevices, sizeof(InstalledDevices)) 2219 if (blogic_cmd(adapter, BLOGIC_INQ_DEV, NULL, 0,
2055 != sizeof(InstalledDevices)) 2220 &installed_devs, sizeof(installed_devs))
2056 return BusLogic_Failure(HostAdapter, "INQUIRE TARGET DEVICES"); 2221 != sizeof(installed_devs))
2057 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) 2222 return blogic_failure(adapter, "INQUIRE TARGET DEVICES");
2058 HostAdapter->TargetFlags[TargetID].TargetExists = (InstalledDevices & (1 << TargetID) ? true : false); 2223 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
2224 adapter->tgt_flags[tgt_id].tgt_exists =
2225 (installed_devs & (1 << tgt_id) ? true : false);
2059 } else { 2226 } else {
2060 2227
2061 /* 2228 /*
2062 * Issue an Inquire Installed Devices command. For each Target Device, 2229 Issue an Inquire Installed Devices command. For each
2063 * a byte is returned where bit 0 set indicates that Logical Unit 0 2230 Target Device, a byte is returned where bit 0 set
2064 * exists, bit 1 set indicates that Logical Unit 1 exists, and so on. 2231 indicates that Logical Unit 0 * exists, bit 1 set
2232 indicates that Logical Unit 1 exists, and so on.
2065 */ 2233 */
2066 2234
2067 if (BusLogic_Command(HostAdapter, BusLogic_InquireInstalledDevicesID0to7, NULL, 0, &InstalledDevicesID0to7, sizeof(InstalledDevicesID0to7)) 2235 if (blogic_cmd(adapter, BLOGIC_INQ_DEV0TO7, NULL, 0,
2068 != sizeof(InstalledDevicesID0to7)) 2236 &installed_devs0to7, sizeof(installed_devs0to7))
2069 return BusLogic_Failure(HostAdapter, "INQUIRE INSTALLED DEVICES ID 0 TO 7"); 2237 != sizeof(installed_devs0to7))
2070 for (TargetID = 0; TargetID < 8; TargetID++) 2238 return blogic_failure(adapter,
2071 HostAdapter->TargetFlags[TargetID].TargetExists = (InstalledDevicesID0to7[TargetID] != 0 ? true : false); 2239 "INQUIRE INSTALLED DEVICES ID 0 TO 7");
2240 for (tgt_id = 0; tgt_id < 8; tgt_id++)
2241 adapter->tgt_flags[tgt_id].tgt_exists =
2242 (installed_devs0to7[tgt_id] != 0 ? true : false);
2072 } 2243 }
2073 /* 2244 /*
2074 Issue the Inquire Setup Information command. 2245 Issue the Inquire Setup Information command.
2075 */ 2246 */
2076 RequestedReplyLength = sizeof(SetupInformation); 2247 req_replylen = sizeof(setupinfo);
2077 if (BusLogic_Command(HostAdapter, BusLogic_InquireSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &SetupInformation, sizeof(SetupInformation)) 2248 if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen,
2078 != sizeof(SetupInformation)) 2249 sizeof(req_replylen), &setupinfo, sizeof(setupinfo))
2079 return BusLogic_Failure(HostAdapter, "INQUIRE SETUP INFORMATION"); 2250 != sizeof(setupinfo))
2080 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) 2251 return blogic_failure(adapter, "INQUIRE SETUP INFORMATION");
2081 HostAdapter->SynchronousOffset[TargetID] = (TargetID < 8 ? SetupInformation.SynchronousValuesID0to7[TargetID].Offset : SetupInformation.SynchronousValuesID8to15[TargetID - 8].Offset); 2252 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
2082 if (strcmp(HostAdapter->FirmwareVersion, "5.06L") >= 0) 2253 adapter->sync_offset[tgt_id] = (tgt_id < 8 ? setupinfo.sync0to7[tgt_id].offset : setupinfo.sync8to15[tgt_id - 8].offset);
2083 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) 2254 if (strcmp(adapter->fw_ver, "5.06L") >= 0)
2084 HostAdapter->TargetFlags[TargetID].WideTransfersActive = (TargetID < 8 ? (SetupInformation.WideTransfersActiveID0to7 & (1 << TargetID) 2255 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
2085 ? true : false) 2256 adapter->tgt_flags[tgt_id].wide_active = (tgt_id < 8 ? (setupinfo.wide_tx_active0to7 & (1 << tgt_id) ? true : false) : (setupinfo.wide_tx_active8to15 & (1 << (tgt_id - 8)) ? true : false));
2086 : (SetupInformation.WideTransfersActiveID8to15 & (1 << (TargetID - 8))
2087 ? true : false));
2088 /* 2257 /*
2089 Issue the Inquire Synchronous Period command. 2258 Issue the Inquire Synchronous Period command.
2090 */ 2259 */
2091 if (HostAdapter->FirmwareVersion[0] >= '3') { 2260 if (adapter->fw_ver[0] >= '3') {
2092 2261
2093 /* Issue a Inquire Synchronous Period command. For each Target Device, 2262 /* Issue a Inquire Synchronous Period command. For each
2094 * a byte is returned which represents the Synchronous Transfer Period 2263 Target Device, a byte is returned which represents the
2095 * in units of 10 nanoseconds. 2264 Synchronous Transfer Period in units of 10 nanoseconds.
2096 */ 2265 */
2097 2266
2098 RequestedReplyLength = sizeof(SynchronousPeriod); 2267 req_replylen = sizeof(sync_period);
2099 if (BusLogic_Command(HostAdapter, BusLogic_InquireSynchronousPeriod, &RequestedReplyLength, sizeof(RequestedReplyLength), &SynchronousPeriod, sizeof(SynchronousPeriod)) 2268 if (blogic_cmd(adapter, BLOGIC_INQ_SYNC_PERIOD, &req_replylen,
2100 != sizeof(SynchronousPeriod)) 2269 sizeof(req_replylen), &sync_period,
2101 return BusLogic_Failure(HostAdapter, "INQUIRE SYNCHRONOUS PERIOD"); 2270 sizeof(sync_period)) != sizeof(sync_period))
2102 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) 2271 return blogic_failure(adapter,
2103 HostAdapter->SynchronousPeriod[TargetID] = SynchronousPeriod[TargetID]; 2272 "INQUIRE SYNCHRONOUS PERIOD");
2273 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
2274 adapter->sync_period[tgt_id] = sync_period[tgt_id];
2104 } else 2275 } else
2105 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) 2276 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
2106 if (SetupInformation.SynchronousValuesID0to7[TargetID].Offset > 0) 2277 if (setupinfo.sync0to7[tgt_id].offset > 0)
2107 HostAdapter->SynchronousPeriod[TargetID] = 20 + 5 * SetupInformation.SynchronousValuesID0to7[TargetID] 2278 adapter->sync_period[tgt_id] = 20 + 5 * setupinfo.sync0to7[tgt_id].tx_period;
2108 .TransferPeriod;
2109 /* 2279 /*
2110 Indicate the Target Device Inquiry completed successfully. 2280 Indicate the Target Device Inquiry completed successfully.
2111 */ 2281 */
@@ -2113,7 +2283,7 @@ static bool __init BusLogic_TargetDeviceInquiry(struct BusLogic_HostAdapter
2113} 2283}
2114 2284
2115/* 2285/*
2116 BusLogic_InitializeHostStructure initializes the fields in the SCSI Host 2286 blogic_inithoststruct initializes the fields in the SCSI Host
2117 structure. The base, io_port, n_io_ports, irq, and dma_channel fields in the 2287 structure. The base, io_port, n_io_ports, irq, and dma_channel fields in the
2118 SCSI Host structure are intentionally left uninitialized, as this driver 2288 SCSI Host structure are intentionally left uninitialized, as this driver
2119 handles acquisition and release of these resources explicitly, as well as 2289 handles acquisition and release of these resources explicitly, as well as
@@ -2121,517 +2291,556 @@ static bool __init BusLogic_TargetDeviceInquiry(struct BusLogic_HostAdapter
2121 through explicit acquisition and release of the Host Adapter's Lock. 2291 through explicit acquisition and release of the Host Adapter's Lock.
2122*/ 2292*/
2123 2293
2124static void __init BusLogic_InitializeHostStructure(struct BusLogic_HostAdapter 2294static void __init blogic_inithoststruct(struct blogic_adapter *adapter,
2125 *HostAdapter, struct Scsi_Host *Host) 2295 struct Scsi_Host *host)
2126{ 2296{
2127 Host->max_id = HostAdapter->MaxTargetDevices; 2297 host->max_id = adapter->maxdev;
2128 Host->max_lun = HostAdapter->MaxLogicalUnits; 2298 host->max_lun = adapter->maxlun;
2129 Host->max_channel = 0; 2299 host->max_channel = 0;
2130 Host->unique_id = HostAdapter->IO_Address; 2300 host->unique_id = adapter->io_addr;
2131 Host->this_id = HostAdapter->SCSI_ID; 2301 host->this_id = adapter->scsi_id;
2132 Host->can_queue = HostAdapter->DriverQueueDepth; 2302 host->can_queue = adapter->drvr_qdepth;
2133 Host->sg_tablesize = HostAdapter->DriverScatterGatherLimit; 2303 host->sg_tablesize = adapter->drvr_sglimit;
2134 Host->unchecked_isa_dma = HostAdapter->BounceBuffersRequired; 2304 host->unchecked_isa_dma = adapter->need_bouncebuf;
2135 Host->cmd_per_lun = HostAdapter->UntaggedQueueDepth; 2305 host->cmd_per_lun = adapter->untag_qdepth;
2136} 2306}
2137 2307
2138/* 2308/*
2139 BusLogic_SlaveConfigure will actually set the queue depth on individual 2309 blogic_slaveconfig will actually set the queue depth on individual
2140 scsi devices as they are permanently added to the device chain. We 2310 scsi devices as they are permanently added to the device chain. We
2141 shamelessly rip off the SelectQueueDepths code to make this work mostly 2311 shamelessly rip off the SelectQueueDepths code to make this work mostly
2142 like it used to. Since we don't get called once at the end of the scan 2312 like it used to. Since we don't get called once at the end of the scan
2143 but instead get called for each device, we have to do things a bit 2313 but instead get called for each device, we have to do things a bit
2144 differently. 2314 differently.
2145*/ 2315*/
2146static int BusLogic_SlaveConfigure(struct scsi_device *Device) 2316static int blogic_slaveconfig(struct scsi_device *dev)
2147{ 2317{
2148 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Device->host->hostdata; 2318 struct blogic_adapter *adapter =
2149 int TargetID = Device->id; 2319 (struct blogic_adapter *) dev->host->hostdata;
2150 int QueueDepth = HostAdapter->QueueDepth[TargetID]; 2320 int tgt_id = dev->id;
2151 2321 int qdepth = adapter->qdepth[tgt_id];
2152 if (HostAdapter->TargetFlags[TargetID].TaggedQueuingSupported && (HostAdapter->TaggedQueuingPermitted & (1 << TargetID))) { 2322
2153 if (QueueDepth == 0) 2323 if (adapter->tgt_flags[tgt_id].tagq_ok &&
2154 QueueDepth = BusLogic_MaxAutomaticTaggedQueueDepth; 2324 (adapter->tagq_ok & (1 << tgt_id))) {
2155 HostAdapter->QueueDepth[TargetID] = QueueDepth; 2325 if (qdepth == 0)
2156 scsi_adjust_queue_depth(Device, MSG_SIMPLE_TAG, QueueDepth); 2326 qdepth = BLOGIC_MAX_AUTO_TAG_DEPTH;
2327 adapter->qdepth[tgt_id] = qdepth;
2328 scsi_adjust_queue_depth(dev, MSG_SIMPLE_TAG, qdepth);
2157 } else { 2329 } else {
2158 HostAdapter->TaggedQueuingPermitted &= ~(1 << TargetID); 2330 adapter->tagq_ok &= ~(1 << tgt_id);
2159 QueueDepth = HostAdapter->UntaggedQueueDepth; 2331 qdepth = adapter->untag_qdepth;
2160 HostAdapter->QueueDepth[TargetID] = QueueDepth; 2332 adapter->qdepth[tgt_id] = qdepth;
2161 scsi_adjust_queue_depth(Device, 0, QueueDepth); 2333 scsi_adjust_queue_depth(dev, 0, qdepth);
2162 } 2334 }
2163 QueueDepth = 0; 2335 qdepth = 0;
2164 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) 2336 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
2165 if (HostAdapter->TargetFlags[TargetID].TargetExists) { 2337 if (adapter->tgt_flags[tgt_id].tgt_exists)
2166 QueueDepth += HostAdapter->QueueDepth[TargetID]; 2338 qdepth += adapter->qdepth[tgt_id];
2167 } 2339 if (qdepth > adapter->alloc_ccbs)
2168 if (QueueDepth > HostAdapter->AllocatedCCBs) 2340 blogic_create_addlccbs(adapter, qdepth - adapter->alloc_ccbs,
2169 BusLogic_CreateAdditionalCCBs(HostAdapter, QueueDepth - HostAdapter->AllocatedCCBs, false); 2341 false);
2170 return 0; 2342 return 0;
2171} 2343}
2172 2344
2173/* 2345/*
2174 BusLogic_DetectHostAdapter probes for BusLogic Host Adapters at the standard 2346 blogic_init probes for BusLogic Host Adapters at the standard
2175 I/O Addresses where they may be located, initializing, registering, and 2347 I/O Addresses where they may be located, initializing, registering, and
2176 reporting the configuration of each BusLogic Host Adapter it finds. It 2348 reporting the configuration of each BusLogic Host Adapter it finds. It
2177 returns the number of BusLogic Host Adapters successfully initialized and 2349 returns the number of BusLogic Host Adapters successfully initialized and
2178 registered. 2350 registered.
2179*/ 2351*/
2180 2352
2181static int __init BusLogic_init(void) 2353static int __init blogic_init(void)
2182{ 2354{
2183 int BusLogicHostAdapterCount = 0, DriverOptionsIndex = 0, ProbeIndex; 2355 int adapter_count = 0, drvr_optindex = 0, probeindex;
2184 struct BusLogic_HostAdapter *PrototypeHostAdapter; 2356 struct blogic_adapter *adapter;
2185 int ret = 0; 2357 int ret = 0;
2186 2358
2187#ifdef MODULE 2359#ifdef MODULE
2188 if (BusLogic) 2360 if (BusLogic)
2189 BusLogic_Setup(BusLogic); 2361 blogic_setup(BusLogic);
2190#endif 2362#endif
2191 2363
2192 if (BusLogic_ProbeOptions.NoProbe) 2364 if (blogic_probe_options.noprobe)
2193 return -ENODEV; 2365 return -ENODEV;
2194 BusLogic_ProbeInfoList = 2366 blogic_probeinfo_list =
2195 kzalloc(BusLogic_MaxHostAdapters * sizeof(struct BusLogic_ProbeInfo), GFP_KERNEL); 2367 kzalloc(BLOGIC_MAX_ADAPTERS * sizeof(struct blogic_probeinfo),
2196 if (BusLogic_ProbeInfoList == NULL) { 2368 GFP_KERNEL);
2197 BusLogic_Error("BusLogic: Unable to allocate Probe Info List\n", NULL); 2369 if (blogic_probeinfo_list == NULL) {
2370 blogic_err("BusLogic: Unable to allocate Probe Info List\n",
2371 NULL);
2198 return -ENOMEM; 2372 return -ENOMEM;
2199 } 2373 }
2200 2374
2201 PrototypeHostAdapter = 2375 adapter =
2202 kzalloc(sizeof(struct BusLogic_HostAdapter), GFP_KERNEL); 2376 kzalloc(sizeof(struct blogic_adapter), GFP_KERNEL);
2203 if (PrototypeHostAdapter == NULL) { 2377 if (adapter == NULL) {
2204 kfree(BusLogic_ProbeInfoList); 2378 kfree(blogic_probeinfo_list);
2205 BusLogic_Error("BusLogic: Unable to allocate Prototype " "Host Adapter\n", NULL); 2379 blogic_err("BusLogic: Unable to allocate Prototype Host Adapter\n", NULL);
2206 return -ENOMEM; 2380 return -ENOMEM;
2207 } 2381 }
2208 2382
2209#ifdef MODULE 2383#ifdef MODULE
2210 if (BusLogic != NULL) 2384 if (BusLogic != NULL)
2211 BusLogic_Setup(BusLogic); 2385 blogic_setup(BusLogic);
2212#endif 2386#endif
2213 BusLogic_InitializeProbeInfoList(PrototypeHostAdapter); 2387 blogic_init_probeinfo_list(adapter);
2214 for (ProbeIndex = 0; ProbeIndex < BusLogic_ProbeInfoCount; ProbeIndex++) { 2388 for (probeindex = 0; probeindex < blogic_probeinfo_count; probeindex++) {
2215 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[ProbeIndex]; 2389 struct blogic_probeinfo *probeinfo =
2216 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; 2390 &blogic_probeinfo_list[probeindex];
2217 struct Scsi_Host *Host; 2391 struct blogic_adapter *myadapter = adapter;
2218 if (ProbeInfo->IO_Address == 0) 2392 struct Scsi_Host *host;
2393
2394 if (probeinfo->io_addr == 0)
2219 continue; 2395 continue;
2220 memset(HostAdapter, 0, sizeof(struct BusLogic_HostAdapter)); 2396 memset(myadapter, 0, sizeof(struct blogic_adapter));
2221 HostAdapter->HostAdapterType = ProbeInfo->HostAdapterType; 2397 myadapter->adapter_type = probeinfo->adapter_type;
2222 HostAdapter->HostAdapterBusType = ProbeInfo->HostAdapterBusType; 2398 myadapter->adapter_bus_type = probeinfo->adapter_bus_type;
2223 HostAdapter->IO_Address = ProbeInfo->IO_Address; 2399 myadapter->io_addr = probeinfo->io_addr;
2224 HostAdapter->PCI_Address = ProbeInfo->PCI_Address; 2400 myadapter->pci_addr = probeinfo->pci_addr;
2225 HostAdapter->Bus = ProbeInfo->Bus; 2401 myadapter->bus = probeinfo->bus;
2226 HostAdapter->Device = ProbeInfo->Device; 2402 myadapter->dev = probeinfo->dev;
2227 HostAdapter->PCI_Device = ProbeInfo->PCI_Device; 2403 myadapter->pci_device = probeinfo->pci_device;
2228 HostAdapter->IRQ_Channel = ProbeInfo->IRQ_Channel; 2404 myadapter->irq_ch = probeinfo->irq_ch;
2229 HostAdapter->AddressCount = BusLogic_HostAdapterAddressCount[HostAdapter->HostAdapterType]; 2405 myadapter->addr_count =
2406 blogic_adapter_addr_count[myadapter->adapter_type];
2230 2407
2231 /* 2408 /*
2232 Make sure region is free prior to probing. 2409 Make sure region is free prior to probing.
2233 */ 2410 */
2234 if (!request_region(HostAdapter->IO_Address, HostAdapter->AddressCount, 2411 if (!request_region(myadapter->io_addr, myadapter->addr_count,
2235 "BusLogic")) 2412 "BusLogic"))
2236 continue; 2413 continue;
2237 /* 2414 /*
2238 Probe the Host Adapter. If unsuccessful, abort further initialization. 2415 Probe the Host Adapter. If unsuccessful, abort further
2416 initialization.
2239 */ 2417 */
2240 if (!BusLogic_ProbeHostAdapter(HostAdapter)) { 2418 if (!blogic_probe(myadapter)) {
2241 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); 2419 release_region(myadapter->io_addr,
2420 myadapter->addr_count);
2242 continue; 2421 continue;
2243 } 2422 }
2244 /* 2423 /*
2245 Hard Reset the Host Adapter. If unsuccessful, abort further 2424 Hard Reset the Host Adapter. If unsuccessful, abort further
2246 initialization. 2425 initialization.
2247 */ 2426 */
2248 if (!BusLogic_HardwareResetHostAdapter(HostAdapter, true)) { 2427 if (!blogic_hwreset(myadapter, true)) {
2249 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); 2428 release_region(myadapter->io_addr,
2429 myadapter->addr_count);
2250 continue; 2430 continue;
2251 } 2431 }
2252 /* 2432 /*
2253 Check the Host Adapter. If unsuccessful, abort further initialization. 2433 Check the Host Adapter. If unsuccessful, abort further
2434 initialization.
2254 */ 2435 */
2255 if (!BusLogic_CheckHostAdapter(HostAdapter)) { 2436 if (!blogic_checkadapter(myadapter)) {
2256 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); 2437 release_region(myadapter->io_addr,
2438 myadapter->addr_count);
2257 continue; 2439 continue;
2258 } 2440 }
2259 /* 2441 /*
2260 Initialize the Driver Options field if provided. 2442 Initialize the Driver Options field if provided.
2261 */ 2443 */
2262 if (DriverOptionsIndex < BusLogic_DriverOptionsCount) 2444 if (drvr_optindex < blogic_drvr_options_count)
2263 HostAdapter->DriverOptions = &BusLogic_DriverOptions[DriverOptionsIndex++]; 2445 myadapter->drvr_opts =
2446 &blogic_drvr_options[drvr_optindex++];
2264 /* 2447 /*
2265 Announce the Driver Version and Date, Author's Name, Copyright Notice, 2448 Announce the Driver Version and Date, Author's Name,
2266 and Electronic Mail Address. 2449 Copyright Notice, and Electronic Mail Address.
2267 */ 2450 */
2268 BusLogic_AnnounceDriver(HostAdapter); 2451 blogic_announce_drvr(myadapter);
2269 /* 2452 /*
2270 Register the SCSI Host structure. 2453 Register the SCSI Host structure.
2271 */ 2454 */
2272 2455
2273 Host = scsi_host_alloc(&Bus_Logic_template, sizeof(struct BusLogic_HostAdapter)); 2456 host = scsi_host_alloc(&blogic_template,
2274 if (Host == NULL) { 2457 sizeof(struct blogic_adapter));
2275 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); 2458 if (host == NULL) {
2459 release_region(myadapter->io_addr,
2460 myadapter->addr_count);
2276 continue; 2461 continue;
2277 } 2462 }
2278 HostAdapter = (struct BusLogic_HostAdapter *) Host->hostdata; 2463 myadapter = (struct blogic_adapter *) host->hostdata;
2279 memcpy(HostAdapter, PrototypeHostAdapter, sizeof(struct BusLogic_HostAdapter)); 2464 memcpy(myadapter, adapter, sizeof(struct blogic_adapter));
2280 HostAdapter->SCSI_Host = Host; 2465 myadapter->scsi_host = host;
2281 HostAdapter->HostNumber = Host->host_no; 2466 myadapter->host_no = host->host_no;
2282 /* 2467 /*
2283 Add Host Adapter to the end of the list of registered BusLogic 2468 Add Host Adapter to the end of the list of registered
2284 Host Adapters. 2469 BusLogic Host Adapters.
2285 */ 2470 */
2286 list_add_tail(&HostAdapter->host_list, &BusLogic_host_list); 2471 list_add_tail(&myadapter->host_list, &blogic_host_list);
2287 2472
2288 /* 2473 /*
2289 Read the Host Adapter Configuration, Configure the Host Adapter, 2474 Read the Host Adapter Configuration, Configure the Host
2290 Acquire the System Resources necessary to use the Host Adapter, then 2475 Adapter, Acquire the System Resources necessary to use
2291 Create the Initial CCBs, Initialize the Host Adapter, and finally 2476 the Host Adapter, then Create the Initial CCBs, Initialize
2292 perform Target Device Inquiry. 2477 the Host Adapter, and finally perform Target Device
2293 2478 Inquiry. From this point onward, any failure will be
2294 From this point onward, any failure will be assumed to be due to a 2479 assumed to be due to a problem with the Host Adapter,
2295 problem with the Host Adapter, rather than due to having mistakenly 2480 rather than due to having mistakenly identified this port
2296 identified this port as belonging to a BusLogic Host Adapter. The 2481 as belonging to a BusLogic Host Adapter. The I/O Address
2297 I/O Address range will not be released, thereby preventing it from 2482 range will not be released, thereby preventing it from
2298 being incorrectly identified as any other type of Host Adapter. 2483 being incorrectly identified as any other type of Host
2484 Adapter.
2299 */ 2485 */
2300 if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) && 2486 if (blogic_rdconfig(myadapter) &&
2301 BusLogic_ReportHostAdapterConfiguration(HostAdapter) && 2487 blogic_reportconfig(myadapter) &&
2302 BusLogic_AcquireResources(HostAdapter) && 2488 blogic_getres(myadapter) &&
2303 BusLogic_CreateInitialCCBs(HostAdapter) && 2489 blogic_create_initccbs(myadapter) &&
2304 BusLogic_InitializeHostAdapter(HostAdapter) && 2490 blogic_initadapter(myadapter) &&
2305 BusLogic_TargetDeviceInquiry(HostAdapter)) { 2491 blogic_inquiry(myadapter)) {
2306 /* 2492 /*
2307 Initialization has been completed successfully. Release and 2493 Initialization has been completed successfully.
2308 re-register usage of the I/O Address range so that the Model 2494 Release and re-register usage of the I/O Address
2309 Name of the Host Adapter will appear, and initialize the SCSI 2495 range so that the Model Name of the Host Adapter
2310 Host structure. 2496 will appear, and initialize the SCSI Host structure.
2311 */ 2497 */
2312 release_region(HostAdapter->IO_Address, 2498 release_region(myadapter->io_addr,
2313 HostAdapter->AddressCount); 2499 myadapter->addr_count);
2314 if (!request_region(HostAdapter->IO_Address, 2500 if (!request_region(myadapter->io_addr,
2315 HostAdapter->AddressCount, 2501 myadapter->addr_count,
2316 HostAdapter->FullModelName)) { 2502 myadapter->full_model)) {
2317 printk(KERN_WARNING 2503 printk(KERN_WARNING
2318 "BusLogic: Release and re-register of " 2504 "BusLogic: Release and re-register of "
2319 "port 0x%04lx failed \n", 2505 "port 0x%04lx failed \n",
2320 (unsigned long)HostAdapter->IO_Address); 2506 (unsigned long)myadapter->io_addr);
2321 BusLogic_DestroyCCBs(HostAdapter); 2507 blogic_destroy_ccbs(myadapter);
2322 BusLogic_ReleaseResources(HostAdapter); 2508 blogic_relres(myadapter);
2323 list_del(&HostAdapter->host_list); 2509 list_del(&myadapter->host_list);
2324 scsi_host_put(Host); 2510 scsi_host_put(host);
2325 ret = -ENOMEM; 2511 ret = -ENOMEM;
2326 } else { 2512 } else {
2327 BusLogic_InitializeHostStructure(HostAdapter, 2513 blogic_inithoststruct(myadapter,
2328 Host); 2514 host);
2329 if (scsi_add_host(Host, HostAdapter->PCI_Device 2515 if (scsi_add_host(host, myadapter->pci_device
2330 ? &HostAdapter->PCI_Device->dev 2516 ? &myadapter->pci_device->dev
2331 : NULL)) { 2517 : NULL)) {
2332 printk(KERN_WARNING 2518 printk(KERN_WARNING
2333 "BusLogic: scsi_add_host()" 2519 "BusLogic: scsi_add_host()"
2334 "failed!\n"); 2520 "failed!\n");
2335 BusLogic_DestroyCCBs(HostAdapter); 2521 blogic_destroy_ccbs(myadapter);
2336 BusLogic_ReleaseResources(HostAdapter); 2522 blogic_relres(myadapter);
2337 list_del(&HostAdapter->host_list); 2523 list_del(&myadapter->host_list);
2338 scsi_host_put(Host); 2524 scsi_host_put(host);
2339 ret = -ENODEV; 2525 ret = -ENODEV;
2340 } else { 2526 } else {
2341 scsi_scan_host(Host); 2527 scsi_scan_host(host);
2342 BusLogicHostAdapterCount++; 2528 adapter_count++;
2343 } 2529 }
2344 } 2530 }
2345 } else { 2531 } else {
2346 /* 2532 /*
2347 An error occurred during Host Adapter Configuration Querying, Host 2533 An error occurred during Host Adapter Configuration
2348 Adapter Configuration, Resource Acquisition, CCB Creation, Host 2534 Querying, Host Adapter Configuration, Resource
2349 Adapter Initialization, or Target Device Inquiry, so remove Host 2535 Acquisition, CCB Creation, Host Adapter
2350 Adapter from the list of registered BusLogic Host Adapters, destroy 2536 Initialization, or Target Device Inquiry, so
2351 the CCBs, Release the System Resources, and Unregister the SCSI 2537 remove Host Adapter from the list of registered
2538 BusLogic Host Adapters, destroy the CCBs, Release
2539 the System Resources, and Unregister the SCSI
2352 Host. 2540 Host.
2353 */ 2541 */
2354 BusLogic_DestroyCCBs(HostAdapter); 2542 blogic_destroy_ccbs(myadapter);
2355 BusLogic_ReleaseResources(HostAdapter); 2543 blogic_relres(myadapter);
2356 list_del(&HostAdapter->host_list); 2544 list_del(&myadapter->host_list);
2357 scsi_host_put(Host); 2545 scsi_host_put(host);
2358 ret = -ENODEV; 2546 ret = -ENODEV;
2359 } 2547 }
2360 } 2548 }
2361 kfree(PrototypeHostAdapter); 2549 kfree(adapter);
2362 kfree(BusLogic_ProbeInfoList); 2550 kfree(blogic_probeinfo_list);
2363 BusLogic_ProbeInfoList = NULL; 2551 blogic_probeinfo_list = NULL;
2364 return ret; 2552 return ret;
2365} 2553}
2366 2554
2367 2555
2368/* 2556/*
2369 BusLogic_ReleaseHostAdapter releases all resources previously acquired to 2557 blogic_deladapter releases all resources previously acquired to
2370 support a specific Host Adapter, including the I/O Address range, and 2558 support a specific Host Adapter, including the I/O Address range, and
2371 unregisters the BusLogic Host Adapter. 2559 unregisters the BusLogic Host Adapter.
2372*/ 2560*/
2373 2561
2374static int __exit BusLogic_ReleaseHostAdapter(struct BusLogic_HostAdapter *HostAdapter) 2562static int __exit blogic_deladapter(struct blogic_adapter *adapter)
2375{ 2563{
2376 struct Scsi_Host *Host = HostAdapter->SCSI_Host; 2564 struct Scsi_Host *host = adapter->scsi_host;
2377 2565
2378 scsi_remove_host(Host); 2566 scsi_remove_host(host);
2379 2567
2380 /* 2568 /*
2381 FlashPoint Host Adapters must first be released by the FlashPoint 2569 FlashPoint Host Adapters must first be released by the FlashPoint
2382 SCCB Manager. 2570 SCCB Manager.
2383 */ 2571 */
2384 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) 2572 if (blogic_flashpoint_type(adapter))
2385 FlashPoint_ReleaseHostAdapter(HostAdapter->CardHandle); 2573 FlashPoint_ReleaseHostAdapter(adapter->cardhandle);
2386 /* 2574 /*
2387 Destroy the CCBs and release any system resources acquired to 2575 Destroy the CCBs and release any system resources acquired to
2388 support Host Adapter. 2576 support Host Adapter.
2389 */ 2577 */
2390 BusLogic_DestroyCCBs(HostAdapter); 2578 blogic_destroy_ccbs(adapter);
2391 BusLogic_ReleaseResources(HostAdapter); 2579 blogic_relres(adapter);
2392 /* 2580 /*
2393 Release usage of the I/O Address range. 2581 Release usage of the I/O Address range.
2394 */ 2582 */
2395 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); 2583 release_region(adapter->io_addr, adapter->addr_count);
2396 /* 2584 /*
2397 Remove Host Adapter from the list of registered BusLogic Host Adapters. 2585 Remove Host Adapter from the list of registered BusLogic
2586 Host Adapters.
2398 */ 2587 */
2399 list_del(&HostAdapter->host_list); 2588 list_del(&adapter->host_list);
2400 2589
2401 scsi_host_put(Host); 2590 scsi_host_put(host);
2402 return 0; 2591 return 0;
2403} 2592}
2404 2593
2405 2594
2406/* 2595/*
2407 BusLogic_QueueCompletedCCB queues CCB for completion processing. 2596 blogic_qcompleted_ccb queues CCB for completion processing.
2408*/ 2597*/
2409 2598
2410static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *CCB) 2599static void blogic_qcompleted_ccb(struct blogic_ccb *ccb)
2411{ 2600{
2412 struct BusLogic_HostAdapter *HostAdapter = CCB->HostAdapter; 2601 struct blogic_adapter *adapter = ccb->adapter;
2413 CCB->Status = BusLogic_CCB_Completed; 2602
2414 CCB->Next = NULL; 2603 ccb->status = BLOGIC_CCB_COMPLETE;
2415 if (HostAdapter->FirstCompletedCCB == NULL) { 2604 ccb->next = NULL;
2416 HostAdapter->FirstCompletedCCB = CCB; 2605 if (adapter->firstccb == NULL) {
2417 HostAdapter->LastCompletedCCB = CCB; 2606 adapter->firstccb = ccb;
2607 adapter->lastccb = ccb;
2418 } else { 2608 } else {
2419 HostAdapter->LastCompletedCCB->Next = CCB; 2609 adapter->lastccb->next = ccb;
2420 HostAdapter->LastCompletedCCB = CCB; 2610 adapter->lastccb = ccb;
2421 } 2611 }
2422 HostAdapter->ActiveCommands[CCB->TargetID]--; 2612 adapter->active_cmds[ccb->tgt_id]--;
2423} 2613}
2424 2614
2425 2615
2426/* 2616/*
2427 BusLogic_ComputeResultCode computes a SCSI Subsystem Result Code from 2617 blogic_resultcode computes a SCSI Subsystem Result Code from
2428 the Host Adapter Status and Target Device Status. 2618 the Host Adapter Status and Target Device Status.
2429*/ 2619*/
2430 2620
2431static int BusLogic_ComputeResultCode(struct BusLogic_HostAdapter *HostAdapter, enum BusLogic_HostAdapterStatus HostAdapterStatus, enum BusLogic_TargetDeviceStatus TargetDeviceStatus) 2621static int blogic_resultcode(struct blogic_adapter *adapter,
2622 enum blogic_adapter_status adapter_status,
2623 enum blogic_tgt_status tgt_status)
2432{ 2624{
2433 int HostStatus; 2625 int hoststatus;
2434 switch (HostAdapterStatus) { 2626
2435 case BusLogic_CommandCompletedNormally: 2627 switch (adapter_status) {
2436 case BusLogic_LinkedCommandCompleted: 2628 case BLOGIC_CMD_CMPLT_NORMAL:
2437 case BusLogic_LinkedCommandCompletedWithFlag: 2629 case BLOGIC_LINK_CMD_CMPLT:
2438 HostStatus = DID_OK; 2630 case BLOGIC_LINK_CMD_CMPLT_FLAG:
2631 hoststatus = DID_OK;
2439 break; 2632 break;
2440 case BusLogic_SCSISelectionTimeout: 2633 case BLOGIC_SELECT_TIMEOUT:
2441 HostStatus = DID_TIME_OUT; 2634 hoststatus = DID_TIME_OUT;
2442 break; 2635 break;
2443 case BusLogic_InvalidOutgoingMailboxActionCode: 2636 case BLOGIC_INVALID_OUTBOX_CODE:
2444 case BusLogic_InvalidCommandOperationCode: 2637 case BLOGIC_INVALID_CMD_CODE:
2445 case BusLogic_InvalidCommandParameter: 2638 case BLOGIC_BAD_CMD_PARAM:
2446 BusLogic_Warning("BusLogic Driver Protocol Error 0x%02X\n", HostAdapter, HostAdapterStatus); 2639 blogic_warn("BusLogic Driver Protocol Error 0x%02X\n",
2447 case BusLogic_DataUnderRun: 2640 adapter, adapter_status);
2448 case BusLogic_DataOverRun: 2641 case BLOGIC_DATA_UNDERRUN:
2449 case BusLogic_UnexpectedBusFree: 2642 case BLOGIC_DATA_OVERRUN:
2450 case BusLogic_LinkedCCBhasInvalidLUN: 2643 case BLOGIC_NOEXPECT_BUSFREE:
2451 case BusLogic_AutoRequestSenseFailed: 2644 case BLOGIC_LINKCCB_BADLUN:
2452 case BusLogic_TaggedQueuingMessageRejected: 2645 case BLOGIC_AUTOREQSENSE_FAIL:
2453 case BusLogic_UnsupportedMessageReceived: 2646 case BLOGIC_TAGQUEUE_REJECT:
2454 case BusLogic_HostAdapterHardwareFailed: 2647 case BLOGIC_BAD_MSG_RCVD:
2455 case BusLogic_TargetDeviceReconnectedImproperly: 2648 case BLOGIC_HW_FAIL:
2456 case BusLogic_AbortQueueGenerated: 2649 case BLOGIC_BAD_RECONNECT:
2457 case BusLogic_HostAdapterSoftwareError: 2650 case BLOGIC_ABRT_QUEUE:
2458 case BusLogic_HostAdapterHardwareTimeoutError: 2651 case BLOGIC_ADAPTER_SW_ERROR:
2459 case BusLogic_SCSIParityErrorDetected: 2652 case BLOGIC_HW_TIMEOUT:
2460 HostStatus = DID_ERROR; 2653 case BLOGIC_PARITY_ERR:
2654 hoststatus = DID_ERROR;
2461 break; 2655 break;
2462 case BusLogic_InvalidBusPhaseRequested: 2656 case BLOGIC_INVALID_BUSPHASE:
2463 case BusLogic_TargetFailedResponseToATN: 2657 case BLOGIC_NORESPONSE_TO_ATN:
2464 case BusLogic_HostAdapterAssertedRST: 2658 case BLOGIC_HW_RESET:
2465 case BusLogic_OtherDeviceAssertedRST: 2659 case BLOGIC_RST_FROM_OTHERDEV:
2466 case BusLogic_HostAdapterAssertedBusDeviceReset: 2660 case BLOGIC_HW_BDR:
2467 HostStatus = DID_RESET; 2661 hoststatus = DID_RESET;
2468 break; 2662 break;
2469 default: 2663 default:
2470 BusLogic_Warning("Unknown Host Adapter Status 0x%02X\n", HostAdapter, HostAdapterStatus); 2664 blogic_warn("Unknown Host Adapter Status 0x%02X\n", adapter,
2471 HostStatus = DID_ERROR; 2665 adapter_status);
2666 hoststatus = DID_ERROR;
2472 break; 2667 break;
2473 } 2668 }
2474 return (HostStatus << 16) | TargetDeviceStatus; 2669 return (hoststatus << 16) | tgt_status;
2475} 2670}
2476 2671
2477 2672
2478/* 2673/*
2479 BusLogic_ScanIncomingMailboxes scans the Incoming Mailboxes saving any 2674 blogic_scan_inbox scans the Incoming Mailboxes saving any
2480 Incoming Mailbox entries for completion processing. 2675 Incoming Mailbox entries for completion processing.
2481*/ 2676*/
2482 2677
2483static void BusLogic_ScanIncomingMailboxes(struct BusLogic_HostAdapter *HostAdapter) 2678static void blogic_scan_inbox(struct blogic_adapter *adapter)
2484{ 2679{
2485 /* 2680 /*
2486 Scan through the Incoming Mailboxes in Strict Round Robin fashion, saving 2681 Scan through the Incoming Mailboxes in Strict Round Robin
2487 any completed CCBs for further processing. It is essential that for each 2682 fashion, saving any completed CCBs for further processing. It
2488 CCB and SCSI Command issued, command completion processing is performed 2683 is essential that for each CCB and SCSI Command issued, command
2489 exactly once. Therefore, only Incoming Mailboxes with completion code 2684 completion processing is performed exactly once. Therefore,
2490 Command Completed Without Error, Command Completed With Error, or Command 2685 only Incoming Mailboxes with completion code Command Completed
2491 Aborted At Host Request are saved for completion processing. When an 2686 Without Error, Command Completed With Error, or Command Aborted
2492 Incoming Mailbox has a completion code of Aborted Command Not Found, the 2687 At Host Request are saved for completion processing. When an
2493 CCB had already completed or been aborted before the current Abort request 2688 Incoming Mailbox has a completion code of Aborted Command Not
2494 was processed, and so completion processing has already occurred and no 2689 Found, the CCB had already completed or been aborted before the
2495 further action should be taken. 2690 current Abort request was processed, and so completion processing
2496 */ 2691 has already occurred and no further action should be taken.
2497 struct BusLogic_IncomingMailbox *NextIncomingMailbox = HostAdapter->NextIncomingMailbox; 2692 */
2498 enum BusLogic_CompletionCode CompletionCode; 2693 struct blogic_inbox *next_inbox = adapter->next_inbox;
2499 while ((CompletionCode = NextIncomingMailbox->CompletionCode) != BusLogic_IncomingMailboxFree) { 2694 enum blogic_cmplt_code comp_code;
2695
2696 while ((comp_code = next_inbox->comp_code) != BLOGIC_INBOX_FREE) {
2500 /* 2697 /*
2501 We are only allowed to do this because we limit our architectures we 2698 We are only allowed to do this because we limit our
2502 run on to machines where bus_to_virt() actually works. There *needs* 2699 architectures we run on to machines where bus_to_virt(
2503 to be a dma_addr_to_virt() in the new PCI DMA mapping interface to 2700 actually works. There *needs* to be a dma_addr_to_virt()
2504 replace bus_to_virt() or else this code is going to become very 2701 in the new PCI DMA mapping interface to replace
2702 bus_to_virt() or else this code is going to become very
2505 innefficient. 2703 innefficient.
2506 */ 2704 */
2507 struct BusLogic_CCB *CCB = (struct BusLogic_CCB *) Bus_to_Virtual(NextIncomingMailbox->CCB); 2705 struct blogic_ccb *ccb =
2508 if (CompletionCode != BusLogic_AbortedCommandNotFound) { 2706 (struct blogic_ccb *) bus_to_virt(next_inbox->ccb);
2509 if (CCB->Status == BusLogic_CCB_Active || CCB->Status == BusLogic_CCB_Reset) { 2707 if (comp_code != BLOGIC_CMD_NOTFOUND) {
2708 if (ccb->status == BLOGIC_CCB_ACTIVE ||
2709 ccb->status == BLOGIC_CCB_RESET) {
2510 /* 2710 /*
2511 Save the Completion Code for this CCB and queue the CCB 2711 Save the Completion Code for this CCB and
2512 for completion processing. 2712 queue the CCB for completion processing.
2513 */ 2713 */
2514 CCB->CompletionCode = CompletionCode; 2714 ccb->comp_code = comp_code;
2515 BusLogic_QueueCompletedCCB(CCB); 2715 blogic_qcompleted_ccb(ccb);
2516 } else { 2716 } else {
2517 /* 2717 /*
2518 If a CCB ever appears in an Incoming Mailbox and is not marked 2718 If a CCB ever appears in an Incoming Mailbox
2519 as status Active or Reset, then there is most likely a bug in 2719 and is not marked as status Active or Reset,
2720 then there is most likely a bug in
2520 the Host Adapter firmware. 2721 the Host Adapter firmware.
2521 */ 2722 */
2522 BusLogic_Warning("Illegal CCB #%ld status %d in " "Incoming Mailbox\n", HostAdapter, CCB->SerialNumber, CCB->Status); 2723 blogic_warn("Illegal CCB #%ld status %d in " "Incoming Mailbox\n", adapter, ccb->serial, ccb->status);
2523 } 2724 }
2524 } 2725 }
2525 NextIncomingMailbox->CompletionCode = BusLogic_IncomingMailboxFree; 2726 next_inbox->comp_code = BLOGIC_INBOX_FREE;
2526 if (++NextIncomingMailbox > HostAdapter->LastIncomingMailbox) 2727 if (++next_inbox > adapter->last_inbox)
2527 NextIncomingMailbox = HostAdapter->FirstIncomingMailbox; 2728 next_inbox = adapter->first_inbox;
2528 } 2729 }
2529 HostAdapter->NextIncomingMailbox = NextIncomingMailbox; 2730 adapter->next_inbox = next_inbox;
2530} 2731}
2531 2732
2532 2733
2533/* 2734/*
2534 BusLogic_ProcessCompletedCCBs iterates over the completed CCBs for Host 2735 blogic_process_ccbs iterates over the completed CCBs for Host
2535 Adapter setting the SCSI Command Result Codes, deallocating the CCBs, and 2736 Adapter setting the SCSI Command Result Codes, deallocating the CCBs, and
2536 calling the SCSI Subsystem Completion Routines. The Host Adapter's Lock 2737 calling the SCSI Subsystem Completion Routines. The Host Adapter's Lock
2537 should already have been acquired by the caller. 2738 should already have been acquired by the caller.
2538*/ 2739*/
2539 2740
2540static void BusLogic_ProcessCompletedCCBs(struct BusLogic_HostAdapter *HostAdapter) 2741static void blogic_process_ccbs(struct blogic_adapter *adapter)
2541{ 2742{
2542 if (HostAdapter->ProcessCompletedCCBsActive) 2743 if (adapter->processing_ccbs)
2543 return; 2744 return;
2544 HostAdapter->ProcessCompletedCCBsActive = true; 2745 adapter->processing_ccbs = true;
2545 while (HostAdapter->FirstCompletedCCB != NULL) { 2746 while (adapter->firstccb != NULL) {
2546 struct BusLogic_CCB *CCB = HostAdapter->FirstCompletedCCB; 2747 struct blogic_ccb *ccb = adapter->firstccb;
2547 struct scsi_cmnd *Command = CCB->Command; 2748 struct scsi_cmnd *command = ccb->command;
2548 HostAdapter->FirstCompletedCCB = CCB->Next; 2749 adapter->firstccb = ccb->next;
2549 if (HostAdapter->FirstCompletedCCB == NULL) 2750 if (adapter->firstccb == NULL)
2550 HostAdapter->LastCompletedCCB = NULL; 2751 adapter->lastccb = NULL;
2551 /* 2752 /*
2552 Process the Completed CCB. 2753 Process the Completed CCB.
2553 */ 2754 */
2554 if (CCB->Opcode == BusLogic_BusDeviceReset) { 2755 if (ccb->opcode == BLOGIC_BDR) {
2555 int TargetID = CCB->TargetID; 2756 int tgt_id = ccb->tgt_id;
2556 BusLogic_Warning("Bus Device Reset CCB #%ld to Target " "%d Completed\n", HostAdapter, CCB->SerialNumber, TargetID); 2757
2557 BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].BusDeviceResetsCompleted); 2758 blogic_warn("Bus Device Reset CCB #%ld to Target " "%d Completed\n", adapter, ccb->serial, tgt_id);
2558 HostAdapter->TargetFlags[TargetID].TaggedQueuingActive = false; 2759 blogic_inc_count(&adapter->tgt_stats[tgt_id].bdr_done);
2559 HostAdapter->CommandsSinceReset[TargetID] = 0; 2760 adapter->tgt_flags[tgt_id].tagq_active = false;
2560 HostAdapter->LastResetCompleted[TargetID] = jiffies; 2761 adapter->cmds_since_rst[tgt_id] = 0;
2762 adapter->last_resetdone[tgt_id] = jiffies;
2561 /* 2763 /*
2562 Place CCB back on the Host Adapter's free list. 2764 Place CCB back on the Host Adapter's free list.
2563 */ 2765 */
2564 BusLogic_DeallocateCCB(CCB); 2766 blogic_dealloc_ccb(ccb);
2565#if 0 /* this needs to be redone different for new EH */ 2767#if 0 /* this needs to be redone different for new EH */
2566 /* 2768 /*
2567 Bus Device Reset CCBs have the Command field non-NULL only when a 2769 Bus Device Reset CCBs have the command field
2568 Bus Device Reset was requested for a Command that did not have a 2770 non-NULL only when a Bus Device Reset was requested
2569 currently active CCB in the Host Adapter (i.e., a Synchronous 2771 for a command that did not have a currently active
2570 Bus Device Reset), and hence would not have its Completion Routine 2772 CCB in the Host Adapter (i.e., a Synchronous Bus
2571 called otherwise. 2773 Device Reset), and hence would not have its
2774 Completion Routine called otherwise.
2572 */ 2775 */
2573 while (Command != NULL) { 2776 while (command != NULL) {
2574 struct scsi_cmnd *NextCommand = Command->reset_chain; 2777 struct scsi_cmnd *nxt_cmd =
2575 Command->reset_chain = NULL; 2778 command->reset_chain;
2576 Command->result = DID_RESET << 16; 2779 command->reset_chain = NULL;
2577 Command->scsi_done(Command); 2780 command->result = DID_RESET << 16;
2578 Command = NextCommand; 2781 command->scsi_done(command);
2782 command = nxt_cmd;
2579 } 2783 }
2580#endif 2784#endif
2581 /* 2785 /*
2582 Iterate over the CCBs for this Host Adapter performing completion 2786 Iterate over the CCBs for this Host Adapter
2583 processing for any CCBs marked as Reset for this Target. 2787 performing completion processing for any CCBs
2788 marked as Reset for this Target.
2584 */ 2789 */
2585 for (CCB = HostAdapter->All_CCBs; CCB != NULL; CCB = CCB->NextAll) 2790 for (ccb = adapter->all_ccbs; ccb != NULL;
2586 if (CCB->Status == BusLogic_CCB_Reset && CCB->TargetID == TargetID) { 2791 ccb = ccb->next_all)
2587 Command = CCB->Command; 2792 if (ccb->status == BLOGIC_CCB_RESET &&
2588 BusLogic_DeallocateCCB(CCB); 2793 ccb->tgt_id == tgt_id) {
2589 HostAdapter->ActiveCommands[TargetID]--; 2794 command = ccb->command;
2590 Command->result = DID_RESET << 16; 2795 blogic_dealloc_ccb(ccb);
2591 Command->scsi_done(Command); 2796 adapter->active_cmds[tgt_id]--;
2797 command->result = DID_RESET << 16;
2798 command->scsi_done(command);
2592 } 2799 }
2593 HostAdapter->BusDeviceResetPendingCCB[TargetID] = NULL; 2800 adapter->bdr_pend[tgt_id] = NULL;
2594 } else { 2801 } else {
2595 /* 2802 /*
2596 Translate the Completion Code, Host Adapter Status, and Target 2803 Translate the Completion Code, Host Adapter Status,
2597 Device Status into a SCSI Subsystem Result Code. 2804 and Target Device Status into a SCSI Subsystem
2805 Result Code.
2598 */ 2806 */
2599 switch (CCB->CompletionCode) { 2807 switch (ccb->comp_code) {
2600 case BusLogic_IncomingMailboxFree: 2808 case BLOGIC_INBOX_FREE:
2601 case BusLogic_AbortedCommandNotFound: 2809 case BLOGIC_CMD_NOTFOUND:
2602 case BusLogic_InvalidCCB: 2810 case BLOGIC_INVALID_CCB:
2603 BusLogic_Warning("CCB #%ld to Target %d Impossible State\n", HostAdapter, CCB->SerialNumber, CCB->TargetID); 2811 blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id);
2604 break; 2812 break;
2605 case BusLogic_CommandCompletedWithoutError: 2813 case BLOGIC_CMD_COMPLETE_GOOD:
2606 HostAdapter->TargetStatistics[CCB->TargetID] 2814 adapter->tgt_stats[ccb->tgt_id]
2607 .CommandsCompleted++; 2815 .cmds_complete++;
2608 HostAdapter->TargetFlags[CCB->TargetID] 2816 adapter->tgt_flags[ccb->tgt_id]
2609 .CommandSuccessfulFlag = true; 2817 .cmd_good = true;
2610 Command->result = DID_OK << 16; 2818 command->result = DID_OK << 16;
2611 break; 2819 break;
2612 case BusLogic_CommandAbortedAtHostRequest: 2820 case BLOGIC_CMD_ABORT_BY_HOST:
2613 BusLogic_Warning("CCB #%ld to Target %d Aborted\n", HostAdapter, CCB->SerialNumber, CCB->TargetID); 2821 blogic_warn("CCB #%ld to Target %d Aborted\n",
2614 BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[CCB->TargetID] 2822 adapter, ccb->serial, ccb->tgt_id);
2615 .CommandAbortsCompleted); 2823 blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done);
2616 Command->result = DID_ABORT << 16; 2824 command->result = DID_ABORT << 16;
2617 break; 2825 break;
2618 case BusLogic_CommandCompletedWithError: 2826 case BLOGIC_CMD_COMPLETE_ERROR:
2619 Command->result = BusLogic_ComputeResultCode(HostAdapter, CCB->HostAdapterStatus, CCB->TargetDeviceStatus); 2827 command->result = blogic_resultcode(adapter,
2620 if (CCB->HostAdapterStatus != BusLogic_SCSISelectionTimeout) { 2828 ccb->adapter_status, ccb->tgt_status);
2621 HostAdapter->TargetStatistics[CCB->TargetID] 2829 if (ccb->adapter_status != BLOGIC_SELECT_TIMEOUT) {
2622 .CommandsCompleted++; 2830 adapter->tgt_stats[ccb->tgt_id]
2623 if (BusLogic_GlobalOptions.TraceErrors) { 2831 .cmds_complete++;
2832 if (blogic_global_options.trace_err) {
2624 int i; 2833 int i;
2625 BusLogic_Notice("CCB #%ld Target %d: Result %X Host " 2834 blogic_notice("CCB #%ld Target %d: Result %X Host "
2626 "Adapter Status %02X " "Target Status %02X\n", HostAdapter, CCB->SerialNumber, CCB->TargetID, Command->result, CCB->HostAdapterStatus, CCB->TargetDeviceStatus); 2835 "Adapter Status %02X " "Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result, ccb->adapter_status, ccb->tgt_status);
2627 BusLogic_Notice("CDB ", HostAdapter); 2836 blogic_notice("CDB ", adapter);
2628 for (i = 0; i < CCB->CDB_Length; i++) 2837 for (i = 0; i < ccb->cdblen; i++)
2629 BusLogic_Notice(" %02X", HostAdapter, CCB->CDB[i]); 2838 blogic_notice(" %02X", adapter, ccb->cdb[i]);
2630 BusLogic_Notice("\n", HostAdapter); 2839 blogic_notice("\n", adapter);
2631 BusLogic_Notice("Sense ", HostAdapter); 2840 blogic_notice("Sense ", adapter);
2632 for (i = 0; i < CCB->SenseDataLength; i++) 2841 for (i = 0; i < ccb->sense_datalen; i++)
2633 BusLogic_Notice(" %02X", HostAdapter, Command->sense_buffer[i]); 2842 blogic_notice(" %02X", adapter, command->sense_buffer[i]);
2634 BusLogic_Notice("\n", HostAdapter); 2843 blogic_notice("\n", adapter);
2635 } 2844 }
2636 } 2845 }
2637 break; 2846 break;
@@ -2641,141 +2850,145 @@ static void BusLogic_ProcessCompletedCCBs(struct BusLogic_HostAdapter *HostAdapt
2641 CmdQue (Tagged Queuing Supported) and WBus16 (16 Bit 2850 CmdQue (Tagged Queuing Supported) and WBus16 (16 Bit
2642 Wide Data Transfers Supported) bits. 2851 Wide Data Transfers Supported) bits.
2643 */ 2852 */
2644 if (CCB->CDB[0] == INQUIRY && CCB->CDB[1] == 0 && CCB->HostAdapterStatus == BusLogic_CommandCompletedNormally) { 2853 if (ccb->cdb[0] == INQUIRY && ccb->cdb[1] == 0 &&
2645 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[CCB->TargetID]; 2854 ccb->adapter_status == BLOGIC_CMD_CMPLT_NORMAL) {
2646 struct SCSI_Inquiry *InquiryResult = 2855 struct blogic_tgt_flags *tgt_flags =
2647 (struct SCSI_Inquiry *) scsi_sglist(Command); 2856 &adapter->tgt_flags[ccb->tgt_id];
2648 TargetFlags->TargetExists = true; 2857 struct scsi_inquiry *inquiry =
2649 TargetFlags->TaggedQueuingSupported = InquiryResult->CmdQue; 2858 (struct scsi_inquiry *) scsi_sglist(command);
2650 TargetFlags->WideTransfersSupported = InquiryResult->WBus16; 2859 tgt_flags->tgt_exists = true;
2860 tgt_flags->tagq_ok = inquiry->CmdQue;
2861 tgt_flags->wide_ok = inquiry->WBus16;
2651 } 2862 }
2652 /* 2863 /*
2653 Place CCB back on the Host Adapter's free list. 2864 Place CCB back on the Host Adapter's free list.
2654 */ 2865 */
2655 BusLogic_DeallocateCCB(CCB); 2866 blogic_dealloc_ccb(ccb);
2656 /* 2867 /*
2657 Call the SCSI Command Completion Routine. 2868 Call the SCSI Command Completion Routine.
2658 */ 2869 */
2659 Command->scsi_done(Command); 2870 command->scsi_done(command);
2660 } 2871 }
2661 } 2872 }
2662 HostAdapter->ProcessCompletedCCBsActive = false; 2873 adapter->processing_ccbs = false;
2663} 2874}
2664 2875
2665 2876
2666/* 2877/*
2667 BusLogic_InterruptHandler handles hardware interrupts from BusLogic Host 2878 blogic_inthandler handles hardware interrupts from BusLogic Host
2668 Adapters. 2879 Adapters.
2669*/ 2880*/
2670 2881
2671static irqreturn_t BusLogic_InterruptHandler(int IRQ_Channel, void *DeviceIdentifier) 2882static irqreturn_t blogic_inthandler(int irq_ch, void *devid)
2672{ 2883{
2673 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) DeviceIdentifier; 2884 struct blogic_adapter *adapter = (struct blogic_adapter *) devid;
2674 unsigned long ProcessorFlags; 2885 unsigned long processor_flag;
2675 /* 2886 /*
2676 Acquire exclusive access to Host Adapter. 2887 Acquire exclusive access to Host Adapter.
2677 */ 2888 */
2678 spin_lock_irqsave(HostAdapter->SCSI_Host->host_lock, ProcessorFlags); 2889 spin_lock_irqsave(adapter->scsi_host->host_lock, processor_flag);
2679 /* 2890 /*
2680 Handle Interrupts appropriately for each Host Adapter type. 2891 Handle Interrupts appropriately for each Host Adapter type.
2681 */ 2892 */
2682 if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) { 2893 if (blogic_multimaster_type(adapter)) {
2683 union BusLogic_InterruptRegister InterruptRegister; 2894 union blogic_int_reg intreg;
2684 /* 2895 /*
2685 Read the Host Adapter Interrupt Register. 2896 Read the Host Adapter Interrupt Register.
2686 */ 2897 */
2687 InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter); 2898 intreg.all = blogic_rdint(adapter);
2688 if (InterruptRegister.ir.InterruptValid) { 2899 if (intreg.ir.int_valid) {
2689 /* 2900 /*
2690 Acknowledge the interrupt and reset the Host Adapter 2901 Acknowledge the interrupt and reset the Host Adapter
2691 Interrupt Register. 2902 Interrupt Register.
2692 */ 2903 */
2693 BusLogic_InterruptReset(HostAdapter); 2904 blogic_intreset(adapter);
2694 /* 2905 /*
2695 Process valid External SCSI Bus Reset and Incoming Mailbox 2906 Process valid External SCSI Bus Reset and Incoming
2696 Loaded Interrupts. Command Complete Interrupts are noted, 2907 Mailbox Loaded Interrupts. Command Complete
2697 and Outgoing Mailbox Available Interrupts are ignored, as 2908 Interrupts are noted, and Outgoing Mailbox Available
2698 they are never enabled. 2909 Interrupts are ignored, as they are never enabled.
2699 */ 2910 */
2700 if (InterruptRegister.ir.ExternalBusReset) 2911 if (intreg.ir.ext_busreset)
2701 HostAdapter->HostAdapterExternalReset = true; 2912 adapter->adapter_extreset = true;
2702 else if (InterruptRegister.ir.IncomingMailboxLoaded) 2913 else if (intreg.ir.mailin_loaded)
2703 BusLogic_ScanIncomingMailboxes(HostAdapter); 2914 blogic_scan_inbox(adapter);
2704 else if (InterruptRegister.ir.CommandComplete) 2915 else if (intreg.ir.cmd_complete)
2705 HostAdapter->HostAdapterCommandCompleted = true; 2916 adapter->adapter_cmd_complete = true;
2706 } 2917 }
2707 } else { 2918 } else {
2708 /* 2919 /*
2709 Check if there is a pending interrupt for this Host Adapter. 2920 Check if there is a pending interrupt for this Host Adapter.
2710 */ 2921 */
2711 if (FlashPoint_InterruptPending(HostAdapter->CardHandle)) 2922 if (FlashPoint_InterruptPending(adapter->cardhandle))
2712 switch (FlashPoint_HandleInterrupt(HostAdapter->CardHandle)) { 2923 switch (FlashPoint_HandleInterrupt(adapter->cardhandle)) {
2713 case FlashPoint_NormalInterrupt: 2924 case FPOINT_NORMAL_INT:
2714 break; 2925 break;
2715 case FlashPoint_ExternalBusReset: 2926 case FPOINT_EXT_RESET:
2716 HostAdapter->HostAdapterExternalReset = true; 2927 adapter->adapter_extreset = true;
2717 break; 2928 break;
2718 case FlashPoint_InternalError: 2929 case FPOINT_INTERN_ERR:
2719 BusLogic_Warning("Internal FlashPoint Error detected" " - Resetting Host Adapter\n", HostAdapter); 2930 blogic_warn("Internal FlashPoint Error detected - Resetting Host Adapter\n", adapter);
2720 HostAdapter->HostAdapterInternalError = true; 2931 adapter->adapter_intern_err = true;
2721 break; 2932 break;
2722 } 2933 }
2723 } 2934 }
2724 /* 2935 /*
2725 Process any completed CCBs. 2936 Process any completed CCBs.
2726 */ 2937 */
2727 if (HostAdapter->FirstCompletedCCB != NULL) 2938 if (adapter->firstccb != NULL)
2728 BusLogic_ProcessCompletedCCBs(HostAdapter); 2939 blogic_process_ccbs(adapter);
2729 /* 2940 /*
2730 Reset the Host Adapter if requested. 2941 Reset the Host Adapter if requested.
2731 */ 2942 */
2732 if (HostAdapter->HostAdapterExternalReset) { 2943 if (adapter->adapter_extreset) {
2733 BusLogic_Warning("Resetting %s due to External SCSI Bus Reset\n", HostAdapter, HostAdapter->FullModelName); 2944 blogic_warn("Resetting %s due to External SCSI Bus Reset\n", adapter, adapter->full_model);
2734 BusLogic_IncrementErrorCounter(&HostAdapter->ExternalHostAdapterResets); 2945 blogic_inc_count(&adapter->ext_resets);
2735 BusLogic_ResetHostAdapter(HostAdapter, false); 2946 blogic_resetadapter(adapter, false);
2736 HostAdapter->HostAdapterExternalReset = false; 2947 adapter->adapter_extreset = false;
2737 } else if (HostAdapter->HostAdapterInternalError) { 2948 } else if (adapter->adapter_intern_err) {
2738 BusLogic_Warning("Resetting %s due to Host Adapter Internal Error\n", HostAdapter, HostAdapter->FullModelName); 2949 blogic_warn("Resetting %s due to Host Adapter Internal Error\n", adapter, adapter->full_model);
2739 BusLogic_IncrementErrorCounter(&HostAdapter->HostAdapterInternalErrors); 2950 blogic_inc_count(&adapter->adapter_intern_errors);
2740 BusLogic_ResetHostAdapter(HostAdapter, true); 2951 blogic_resetadapter(adapter, true);
2741 HostAdapter->HostAdapterInternalError = false; 2952 adapter->adapter_intern_err = false;
2742 } 2953 }
2743 /* 2954 /*
2744 Release exclusive access to Host Adapter. 2955 Release exclusive access to Host Adapter.
2745 */ 2956 */
2746 spin_unlock_irqrestore(HostAdapter->SCSI_Host->host_lock, ProcessorFlags); 2957 spin_unlock_irqrestore(adapter->scsi_host->host_lock, processor_flag);
2747 return IRQ_HANDLED; 2958 return IRQ_HANDLED;
2748} 2959}
2749 2960
2750 2961
2751/* 2962/*
2752 BusLogic_WriteOutgoingMailbox places CCB and Action Code into an Outgoing 2963 blogic_write_outbox places CCB and Action Code into an Outgoing
2753 Mailbox for execution by Host Adapter. The Host Adapter's Lock should 2964 Mailbox for execution by Host Adapter. The Host Adapter's Lock should
2754 already have been acquired by the caller. 2965 already have been acquired by the caller.
2755*/ 2966*/
2756 2967
2757static bool BusLogic_WriteOutgoingMailbox(struct BusLogic_HostAdapter 2968static bool blogic_write_outbox(struct blogic_adapter *adapter,
2758 *HostAdapter, enum BusLogic_ActionCode ActionCode, struct BusLogic_CCB *CCB) 2969 enum blogic_action action, struct blogic_ccb *ccb)
2759{ 2970{
2760 struct BusLogic_OutgoingMailbox *NextOutgoingMailbox; 2971 struct blogic_outbox *next_outbox;
2761 NextOutgoingMailbox = HostAdapter->NextOutgoingMailbox; 2972
2762 if (NextOutgoingMailbox->ActionCode == BusLogic_OutgoingMailboxFree) { 2973 next_outbox = adapter->next_outbox;
2763 CCB->Status = BusLogic_CCB_Active; 2974 if (next_outbox->action == BLOGIC_OUTBOX_FREE) {
2975 ccb->status = BLOGIC_CCB_ACTIVE;
2764 /* 2976 /*
2765 The CCB field must be written before the Action Code field since 2977 The CCB field must be written before the Action Code field
2766 the Host Adapter is operating asynchronously and the locking code 2978 since the Host Adapter is operating asynchronously and the
2767 does not protect against simultaneous access by the Host Adapter. 2979 locking code does not protect against simultaneous access
2980 by the Host Adapter.
2768 */ 2981 */
2769 NextOutgoingMailbox->CCB = CCB->DMA_Handle; 2982 next_outbox->ccb = ccb->dma_handle;
2770 NextOutgoingMailbox->ActionCode = ActionCode; 2983 next_outbox->action = action;
2771 BusLogic_StartMailboxCommand(HostAdapter); 2984 blogic_execmbox(adapter);
2772 if (++NextOutgoingMailbox > HostAdapter->LastOutgoingMailbox) 2985 if (++next_outbox > adapter->last_outbox)
2773 NextOutgoingMailbox = HostAdapter->FirstOutgoingMailbox; 2986 next_outbox = adapter->first_outbox;
2774 HostAdapter->NextOutgoingMailbox = NextOutgoingMailbox; 2987 adapter->next_outbox = next_outbox;
2775 if (ActionCode == BusLogic_MailboxStartCommand) { 2988 if (action == BLOGIC_MBOX_START) {
2776 HostAdapter->ActiveCommands[CCB->TargetID]++; 2989 adapter->active_cmds[ccb->tgt_id]++;
2777 if (CCB->Opcode != BusLogic_BusDeviceReset) 2990 if (ccb->opcode != BLOGIC_BDR)
2778 HostAdapter->TargetStatistics[CCB->TargetID].CommandsAttempted++; 2991 adapter->tgt_stats[ccb->tgt_id].cmds_tried++;
2779 } 2992 }
2780 return true; 2993 return true;
2781 } 2994 }
@@ -2784,65 +2997,72 @@ static bool BusLogic_WriteOutgoingMailbox(struct BusLogic_HostAdapter
2784 2997
2785/* Error Handling (EH) support */ 2998/* Error Handling (EH) support */
2786 2999
2787static int BusLogic_host_reset(struct scsi_cmnd * SCpnt) 3000static int blogic_hostreset(struct scsi_cmnd *SCpnt)
2788{ 3001{
2789 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) SCpnt->device->host->hostdata; 3002 struct blogic_adapter *adapter =
3003 (struct blogic_adapter *) SCpnt->device->host->hostdata;
2790 3004
2791 unsigned int id = SCpnt->device->id; 3005 unsigned int id = SCpnt->device->id;
2792 struct BusLogic_TargetStatistics *stats = &HostAdapter->TargetStatistics[id]; 3006 struct blogic_tgt_stats *stats = &adapter->tgt_stats[id];
2793 int rc; 3007 int rc;
2794 3008
2795 spin_lock_irq(SCpnt->device->host->host_lock); 3009 spin_lock_irq(SCpnt->device->host->host_lock);
2796 3010
2797 BusLogic_IncrementErrorCounter(&stats->HostAdapterResetsRequested); 3011 blogic_inc_count(&stats->adatper_reset_req);
2798 3012
2799 rc = BusLogic_ResetHostAdapter(HostAdapter, false); 3013 rc = blogic_resetadapter(adapter, false);
2800 spin_unlock_irq(SCpnt->device->host->host_lock); 3014 spin_unlock_irq(SCpnt->device->host->host_lock);
2801 return rc; 3015 return rc;
2802} 3016}
2803 3017
2804/* 3018/*
2805 BusLogic_QueueCommand creates a CCB for Command and places it into an 3019 blogic_qcmd creates a CCB for Command and places it into an
2806 Outgoing Mailbox for execution by the associated Host Adapter. 3020 Outgoing Mailbox for execution by the associated Host Adapter.
2807*/ 3021*/
2808 3022
2809static int BusLogic_QueueCommand_lck(struct scsi_cmnd *Command, void (*CompletionRoutine) (struct scsi_cmnd *)) 3023static int blogic_qcmd_lck(struct scsi_cmnd *command,
3024 void (*comp_cb) (struct scsi_cmnd *))
2810{ 3025{
2811 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata; 3026 struct blogic_adapter *adapter =
2812 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[Command->device->id]; 3027 (struct blogic_adapter *) command->device->host->hostdata;
2813 struct BusLogic_TargetStatistics *TargetStatistics = HostAdapter->TargetStatistics; 3028 struct blogic_tgt_flags *tgt_flags =
2814 unsigned char *CDB = Command->cmnd; 3029 &adapter->tgt_flags[command->device->id];
2815 int CDB_Length = Command->cmd_len; 3030 struct blogic_tgt_stats *tgt_stats = adapter->tgt_stats;
2816 int TargetID = Command->device->id; 3031 unsigned char *cdb = command->cmnd;
2817 int LogicalUnit = Command->device->lun; 3032 int cdblen = command->cmd_len;
2818 int BufferLength = scsi_bufflen(Command); 3033 int tgt_id = command->device->id;
2819 int Count; 3034 int lun = command->device->lun;
2820 struct BusLogic_CCB *CCB; 3035 int buflen = scsi_bufflen(command);
2821 /* 3036 int count;
2822 SCSI REQUEST_SENSE commands will be executed automatically by the Host 3037 struct blogic_ccb *ccb;
2823 Adapter for any errors, so they should not be executed explicitly unless 3038
2824 the Sense Data is zero indicating that no error occurred. 3039 /*
2825 */ 3040 SCSI REQUEST_SENSE commands will be executed automatically by the
2826 if (CDB[0] == REQUEST_SENSE && Command->sense_buffer[0] != 0) { 3041 Host Adapter for any errors, so they should not be executed
2827 Command->result = DID_OK << 16; 3042 explicitly unless the Sense Data is zero indicating that no error
2828 CompletionRoutine(Command); 3043 occurred.
3044 */
3045 if (cdb[0] == REQUEST_SENSE && command->sense_buffer[0] != 0) {
3046 command->result = DID_OK << 16;
3047 comp_cb(command);
2829 return 0; 3048 return 0;
2830 } 3049 }
2831 /* 3050 /*
2832 Allocate a CCB from the Host Adapter's free list. In the unlikely event 3051 Allocate a CCB from the Host Adapter's free list. In the unlikely
2833 that there are none available and memory allocation fails, wait 1 second 3052 event that there are none available and memory allocation fails,
2834 and try again. If that fails, the Host Adapter is probably hung so signal 3053 wait 1 second and try again. If that fails, the Host Adapter is
2835 an error as a Host Adapter Hard Reset should be initiated soon. 3054 probably hung so signal an error as a Host Adapter Hard Reset
2836 */ 3055 should be initiated soon.
2837 CCB = BusLogic_AllocateCCB(HostAdapter); 3056 */
2838 if (CCB == NULL) { 3057 ccb = blogic_alloc_ccb(adapter);
2839 spin_unlock_irq(HostAdapter->SCSI_Host->host_lock); 3058 if (ccb == NULL) {
2840 BusLogic_Delay(1); 3059 spin_unlock_irq(adapter->scsi_host->host_lock);
2841 spin_lock_irq(HostAdapter->SCSI_Host->host_lock); 3060 blogic_delay(1);
2842 CCB = BusLogic_AllocateCCB(HostAdapter); 3061 spin_lock_irq(adapter->scsi_host->host_lock);
2843 if (CCB == NULL) { 3062 ccb = blogic_alloc_ccb(adapter);
2844 Command->result = DID_ERROR << 16; 3063 if (ccb == NULL) {
2845 CompletionRoutine(Command); 3064 command->result = DID_ERROR << 16;
3065 comp_cb(command);
2846 return 0; 3066 return 0;
2847 } 3067 }
2848 } 3068 }
@@ -2850,217 +3070,241 @@ static int BusLogic_QueueCommand_lck(struct scsi_cmnd *Command, void (*Completio
2850 /* 3070 /*
2851 Initialize the fields in the BusLogic Command Control Block (CCB). 3071 Initialize the fields in the BusLogic Command Control Block (CCB).
2852 */ 3072 */
2853 Count = scsi_dma_map(Command); 3073 count = scsi_dma_map(command);
2854 BUG_ON(Count < 0); 3074 BUG_ON(count < 0);
2855 if (Count) { 3075 if (count) {
2856 struct scatterlist *sg; 3076 struct scatterlist *sg;
2857 int i; 3077 int i;
2858 3078
2859 CCB->Opcode = BusLogic_InitiatorCCB_ScatterGather; 3079 ccb->opcode = BLOGIC_INITIATOR_CCB_SG;
2860 CCB->DataLength = Count * sizeof(struct BusLogic_ScatterGatherSegment); 3080 ccb->datalen = count * sizeof(struct blogic_sg_seg);
2861 if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) 3081 if (blogic_multimaster_type(adapter))
2862 CCB->DataPointer = (unsigned int) CCB->DMA_Handle + ((unsigned long) &CCB->ScatterGatherList - (unsigned long) CCB); 3082 ccb->data = (unsigned int) ccb->dma_handle +
3083 ((unsigned long) &ccb->sglist -
3084 (unsigned long) ccb);
2863 else 3085 else
2864 CCB->DataPointer = Virtual_to_32Bit_Virtual(CCB->ScatterGatherList); 3086 ccb->data = virt_to_32bit_virt(ccb->sglist);
2865 3087
2866 scsi_for_each_sg(Command, sg, Count, i) { 3088 scsi_for_each_sg(command, sg, count, i) {
2867 CCB->ScatterGatherList[i].SegmentByteCount = 3089 ccb->sglist[i].segbytes = sg_dma_len(sg);
2868 sg_dma_len(sg); 3090 ccb->sglist[i].segdata = sg_dma_address(sg);
2869 CCB->ScatterGatherList[i].SegmentDataPointer =
2870 sg_dma_address(sg);
2871 } 3091 }
2872 } else if (!Count) { 3092 } else if (!count) {
2873 CCB->Opcode = BusLogic_InitiatorCCB; 3093 ccb->opcode = BLOGIC_INITIATOR_CCB;
2874 CCB->DataLength = BufferLength; 3094 ccb->datalen = buflen;
2875 CCB->DataPointer = 0; 3095 ccb->data = 0;
2876 } 3096 }
2877 3097
2878 switch (CDB[0]) { 3098 switch (cdb[0]) {
2879 case READ_6: 3099 case READ_6:
2880 case READ_10: 3100 case READ_10:
2881 CCB->DataDirection = BusLogic_DataInLengthChecked; 3101 ccb->datadir = BLOGIC_DATAIN_CHECKED;
2882 TargetStatistics[TargetID].ReadCommands++; 3102 tgt_stats[tgt_id].read_cmds++;
2883 BusLogic_IncrementByteCounter(&TargetStatistics[TargetID].TotalBytesRead, BufferLength); 3103 blogic_addcount(&tgt_stats[tgt_id].bytesread, buflen);
2884 BusLogic_IncrementSizeBucket(TargetStatistics[TargetID].ReadCommandSizeBuckets, BufferLength); 3104 blogic_incszbucket(tgt_stats[tgt_id].read_sz_buckets, buflen);
2885 break; 3105 break;
2886 case WRITE_6: 3106 case WRITE_6:
2887 case WRITE_10: 3107 case WRITE_10:
2888 CCB->DataDirection = BusLogic_DataOutLengthChecked; 3108 ccb->datadir = BLOGIC_DATAOUT_CHECKED;
2889 TargetStatistics[TargetID].WriteCommands++; 3109 tgt_stats[tgt_id].write_cmds++;
2890 BusLogic_IncrementByteCounter(&TargetStatistics[TargetID].TotalBytesWritten, BufferLength); 3110 blogic_addcount(&tgt_stats[tgt_id].byteswritten, buflen);
2891 BusLogic_IncrementSizeBucket(TargetStatistics[TargetID].WriteCommandSizeBuckets, BufferLength); 3111 blogic_incszbucket(tgt_stats[tgt_id].write_sz_buckets, buflen);
2892 break; 3112 break;
2893 default: 3113 default:
2894 CCB->DataDirection = BusLogic_UncheckedDataTransfer; 3114 ccb->datadir = BLOGIC_UNCHECKED_TX;
2895 break; 3115 break;
2896 } 3116 }
2897 CCB->CDB_Length = CDB_Length; 3117 ccb->cdblen = cdblen;
2898 CCB->HostAdapterStatus = 0; 3118 ccb->adapter_status = 0;
2899 CCB->TargetDeviceStatus = 0; 3119 ccb->tgt_status = 0;
2900 CCB->TargetID = TargetID; 3120 ccb->tgt_id = tgt_id;
2901 CCB->LogicalUnit = LogicalUnit; 3121 ccb->lun = lun;
2902 CCB->TagEnable = false; 3122 ccb->tag_enable = false;
2903 CCB->LegacyTagEnable = false; 3123 ccb->legacytag_enable = false;
2904 /* 3124 /*
2905 BusLogic recommends that after a Reset the first couple of commands that 3125 BusLogic recommends that after a Reset the first couple of
2906 are sent to a Target Device be sent in a non Tagged Queue fashion so that 3126 commands that are sent to a Target Device be sent in a non
2907 the Host Adapter and Target Device can establish Synchronous and Wide 3127 Tagged Queue fashion so that the Host Adapter and Target Device
2908 Transfer before Queue Tag messages can interfere with the Synchronous and 3128 can establish Synchronous and Wide Transfer before Queue Tag
2909 Wide Negotiation messages. By waiting to enable Tagged Queuing until after 3129 messages can interfere with the Synchronous and Wide Negotiation
2910 the first BusLogic_MaxTaggedQueueDepth commands have been queued, it is 3130 messages. By waiting to enable Tagged Queuing until after the
2911 assured that after a Reset any pending commands are requeued before Tagged 3131 first BLOGIC_MAX_TAG_DEPTH commands have been queued, it is
2912 Queuing is enabled and that the Tagged Queuing message will not occur while 3132 assured that after a Reset any pending commands are requeued
2913 the partition table is being printed. In addition, some devices do not 3133 before Tagged Queuing is enabled and that the Tagged Queuing
2914 properly handle the transition from non-tagged to tagged commands, so it is 3134 message will not occur while the partition table is being printed.
2915 necessary to wait until there are no pending commands for a target device 3135 In addition, some devices do not properly handle the transition
3136 from non-tagged to tagged commands, so it is necessary to wait
3137 until there are no pending commands for a target device
2916 before queuing tagged commands. 3138 before queuing tagged commands.
2917 */ 3139 */
2918 if (HostAdapter->CommandsSinceReset[TargetID]++ >= 3140 if (adapter->cmds_since_rst[tgt_id]++ >= BLOGIC_MAX_TAG_DEPTH &&
2919 BusLogic_MaxTaggedQueueDepth && !TargetFlags->TaggedQueuingActive && HostAdapter->ActiveCommands[TargetID] == 0 && TargetFlags->TaggedQueuingSupported && (HostAdapter->TaggedQueuingPermitted & (1 << TargetID))) { 3141 !tgt_flags->tagq_active &&
2920 TargetFlags->TaggedQueuingActive = true; 3142 adapter->active_cmds[tgt_id] == 0
2921 BusLogic_Notice("Tagged Queuing now active for Target %d\n", HostAdapter, TargetID); 3143 && tgt_flags->tagq_ok &&
2922 } 3144 (adapter->tagq_ok & (1 << tgt_id))) {
2923 if (TargetFlags->TaggedQueuingActive) { 3145 tgt_flags->tagq_active = true;
2924 enum BusLogic_QueueTag QueueTag = BusLogic_SimpleQueueTag; 3146 blogic_notice("Tagged Queuing now active for Target %d\n",
3147 adapter, tgt_id);
3148 }
3149 if (tgt_flags->tagq_active) {
3150 enum blogic_queuetag queuetag = BLOGIC_SIMPLETAG;
2925 /* 3151 /*
2926 When using Tagged Queuing with Simple Queue Tags, it appears that disk 3152 When using Tagged Queuing with Simple Queue Tags, it
2927 drive controllers do not guarantee that a queued command will not 3153 appears that disk drive controllers do not guarantee that
2928 remain in a disconnected state indefinitely if commands that read or 3154 a queued command will not remain in a disconnected state
2929 write nearer the head position continue to arrive without interruption. 3155 indefinitely if commands that read or write nearer the
2930 Therefore, for each Target Device this driver keeps track of the last 3156 head position continue to arrive without interruption.
2931 time either the queue was empty or an Ordered Queue Tag was issued. If 3157 Therefore, for each Target Device this driver keeps track
2932 more than 4 seconds (one fifth of the 20 second disk timeout) have 3158 of the last time either the queue was empty or an Ordered
2933 elapsed since this last sequence point, this command will be issued 3159 Queue Tag was issued. If more than 4 seconds (one fifth
2934 with an Ordered Queue Tag rather than a Simple Queue Tag, which forces 3160 of the 20 second disk timeout) have elapsed since this
2935 the Target Device to complete all previously queued commands before 3161 last sequence point, this command will be issued with an
2936 this command may be executed. 3162 Ordered Queue Tag rather than a Simple Queue Tag, which
3163 forces the Target Device to complete all previously
3164 queued commands before this command may be executed.
2937 */ 3165 */
2938 if (HostAdapter->ActiveCommands[TargetID] == 0) 3166 if (adapter->active_cmds[tgt_id] == 0)
2939 HostAdapter->LastSequencePoint[TargetID] = jiffies; 3167 adapter->last_seqpoint[tgt_id] = jiffies;
2940 else if (time_after(jiffies, HostAdapter->LastSequencePoint[TargetID] + 4 * HZ)) { 3168 else if (time_after(jiffies,
2941 HostAdapter->LastSequencePoint[TargetID] = jiffies; 3169 adapter->last_seqpoint[tgt_id] + 4 * HZ)) {
2942 QueueTag = BusLogic_OrderedQueueTag; 3170 adapter->last_seqpoint[tgt_id] = jiffies;
3171 queuetag = BLOGIC_ORDEREDTAG;
2943 } 3172 }
2944 if (HostAdapter->ExtendedLUNSupport) { 3173 if (adapter->ext_lun) {
2945 CCB->TagEnable = true; 3174 ccb->tag_enable = true;
2946 CCB->QueueTag = QueueTag; 3175 ccb->queuetag = queuetag;
2947 } else { 3176 } else {
2948 CCB->LegacyTagEnable = true; 3177 ccb->legacytag_enable = true;
2949 CCB->LegacyQueueTag = QueueTag; 3178 ccb->legacy_tag = queuetag;
2950 } 3179 }
2951 } 3180 }
2952 memcpy(CCB->CDB, CDB, CDB_Length); 3181 memcpy(ccb->cdb, cdb, cdblen);
2953 CCB->SenseDataLength = SCSI_SENSE_BUFFERSIZE; 3182 ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE;
2954 CCB->SenseDataPointer = pci_map_single(HostAdapter->PCI_Device, Command->sense_buffer, CCB->SenseDataLength, PCI_DMA_FROMDEVICE); 3183 ccb->sensedata = pci_map_single(adapter->pci_device,
2955 CCB->Command = Command; 3184 command->sense_buffer, ccb->sense_datalen,
2956 Command->scsi_done = CompletionRoutine; 3185 PCI_DMA_FROMDEVICE);
2957 if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) { 3186 ccb->command = command;
3187 command->scsi_done = comp_cb;
3188 if (blogic_multimaster_type(adapter)) {
2958 /* 3189 /*
2959 Place the CCB in an Outgoing Mailbox. The higher levels of the SCSI 3190 Place the CCB in an Outgoing Mailbox. The higher levels
2960 Subsystem should not attempt to queue more commands than can be placed 3191 of the SCSI Subsystem should not attempt to queue more
2961 in Outgoing Mailboxes, so there should always be one free. In the 3192 commands than can be placed in Outgoing Mailboxes, so
2962 unlikely event that there are none available, wait 1 second and try 3193 there should always be one free. In the unlikely event
2963 again. If that fails, the Host Adapter is probably hung so signal an 3194 that there are none available, wait 1 second and try
2964 error as a Host Adapter Hard Reset should be initiated soon. 3195 again. If that fails, the Host Adapter is probably hung
3196 so signal an error as a Host Adapter Hard Reset should
3197 be initiated soon.
2965 */ 3198 */
2966 if (!BusLogic_WriteOutgoingMailbox(HostAdapter, BusLogic_MailboxStartCommand, CCB)) { 3199 if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) {
2967 spin_unlock_irq(HostAdapter->SCSI_Host->host_lock); 3200 spin_unlock_irq(adapter->scsi_host->host_lock);
2968 BusLogic_Warning("Unable to write Outgoing Mailbox - " "Pausing for 1 second\n", HostAdapter); 3201 blogic_warn("Unable to write Outgoing Mailbox - " "Pausing for 1 second\n", adapter);
2969 BusLogic_Delay(1); 3202 blogic_delay(1);
2970 spin_lock_irq(HostAdapter->SCSI_Host->host_lock); 3203 spin_lock_irq(adapter->scsi_host->host_lock);
2971 if (!BusLogic_WriteOutgoingMailbox(HostAdapter, BusLogic_MailboxStartCommand, CCB)) { 3204 if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START,
2972 BusLogic_Warning("Still unable to write Outgoing Mailbox - " "Host Adapter Dead?\n", HostAdapter); 3205 ccb)) {
2973 BusLogic_DeallocateCCB(CCB); 3206 blogic_warn("Still unable to write Outgoing Mailbox - " "Host Adapter Dead?\n", adapter);
2974 Command->result = DID_ERROR << 16; 3207 blogic_dealloc_ccb(ccb);
2975 Command->scsi_done(Command); 3208 command->result = DID_ERROR << 16;
3209 command->scsi_done(command);
2976 } 3210 }
2977 } 3211 }
2978 } else { 3212 } else {
2979 /* 3213 /*
2980 Call the FlashPoint SCCB Manager to start execution of the CCB. 3214 Call the FlashPoint SCCB Manager to start execution of
3215 the CCB.
2981 */ 3216 */
2982 CCB->Status = BusLogic_CCB_Active; 3217 ccb->status = BLOGIC_CCB_ACTIVE;
2983 HostAdapter->ActiveCommands[TargetID]++; 3218 adapter->active_cmds[tgt_id]++;
2984 TargetStatistics[TargetID].CommandsAttempted++; 3219 tgt_stats[tgt_id].cmds_tried++;
2985 FlashPoint_StartCCB(HostAdapter->CardHandle, CCB); 3220 FlashPoint_StartCCB(adapter->cardhandle, ccb);
2986 /* 3221 /*
2987 The Command may have already completed and BusLogic_QueueCompletedCCB 3222 The Command may have already completed and
2988 been called, or it may still be pending. 3223 blogic_qcompleted_ccb been called, or it may still be
3224 pending.
2989 */ 3225 */
2990 if (CCB->Status == BusLogic_CCB_Completed) 3226 if (ccb->status == BLOGIC_CCB_COMPLETE)
2991 BusLogic_ProcessCompletedCCBs(HostAdapter); 3227 blogic_process_ccbs(adapter);
2992 } 3228 }
2993 return 0; 3229 return 0;
2994} 3230}
2995 3231
2996static DEF_SCSI_QCMD(BusLogic_QueueCommand) 3232static DEF_SCSI_QCMD(blogic_qcmd)
2997 3233
2998#if 0 3234#if 0
2999/* 3235/*
3000 BusLogic_AbortCommand aborts Command if possible. 3236 blogic_abort aborts Command if possible.
3001*/ 3237*/
3002 3238
3003static int BusLogic_AbortCommand(struct scsi_cmnd *Command) 3239static int blogic_abort(struct scsi_cmnd *command)
3004{ 3240{
3005 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata; 3241 struct blogic_adapter *adapter =
3242 (struct blogic_adapter *) command->device->host->hostdata;
3243
3244 int tgt_id = command->device->id;
3245 struct blogic_ccb *ccb;
3246 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_request);
3006 3247
3007 int TargetID = Command->device->id;
3008 struct BusLogic_CCB *CCB;
3009 BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsRequested);
3010 /* 3248 /*
3011 Attempt to find an Active CCB for this Command. If no Active CCB for this 3249 Attempt to find an Active CCB for this Command. If no Active
3012 Command is found, then no Abort is necessary. 3250 CCB for this Command is found, then no Abort is necessary.
3013 */ 3251 */
3014 for (CCB = HostAdapter->All_CCBs; CCB != NULL; CCB = CCB->NextAll) 3252 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
3015 if (CCB->Command == Command) 3253 if (ccb->command == command)
3016 break; 3254 break;
3017 if (CCB == NULL) { 3255 if (ccb == NULL) {
3018 BusLogic_Warning("Unable to Abort Command to Target %d - " "No CCB Found\n", HostAdapter, TargetID); 3256 blogic_warn("Unable to Abort Command to Target %d - No CCB Found\n", adapter, tgt_id);
3019 return SUCCESS; 3257 return SUCCESS;
3020 } else if (CCB->Status == BusLogic_CCB_Completed) { 3258 } else if (ccb->status == BLOGIC_CCB_COMPLETE) {
3021 BusLogic_Warning("Unable to Abort Command to Target %d - " "CCB Completed\n", HostAdapter, TargetID); 3259 blogic_warn("Unable to Abort Command to Target %d - CCB Completed\n", adapter, tgt_id);
3022 return SUCCESS; 3260 return SUCCESS;
3023 } else if (CCB->Status == BusLogic_CCB_Reset) { 3261 } else if (ccb->status == BLOGIC_CCB_RESET) {
3024 BusLogic_Warning("Unable to Abort Command to Target %d - " "CCB Reset\n", HostAdapter, TargetID); 3262 blogic_warn("Unable to Abort Command to Target %d - CCB Reset\n", adapter, tgt_id);
3025 return SUCCESS; 3263 return SUCCESS;
3026 } 3264 }
3027 if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) { 3265 if (blogic_multimaster_type(adapter)) {
3028 /* 3266 /*
3029 Attempt to Abort this CCB. MultiMaster Firmware versions prior to 5.xx 3267 Attempt to Abort this CCB. MultiMaster Firmware versions
3030 do not generate Abort Tag messages, but only generate the non-tagged 3268 prior to 5.xx do not generate Abort Tag messages, but only
3031 Abort message. Since non-tagged commands are not sent by the Host 3269 generate the non-tagged Abort message. Since non-tagged
3032 Adapter until the queue of outstanding tagged commands has completed, 3270 commands are not sent by the Host Adapter until the queue
3033 and the Abort message is treated as a non-tagged command, it is 3271 of outstanding tagged commands has completed, and the
3034 effectively impossible to abort commands when Tagged Queuing is active. 3272 Abort message is treated as a non-tagged command, it is
3035 Firmware version 5.xx does generate Abort Tag messages, so it is 3273 effectively impossible to abort commands when Tagged
3036 possible to abort commands when Tagged Queuing is active. 3274 Queuing is active. Firmware version 5.xx does generate
3275 Abort Tag messages, so it is possible to abort commands
3276 when Tagged Queuing is active.
3037 */ 3277 */
3038 if (HostAdapter->TargetFlags[TargetID].TaggedQueuingActive && HostAdapter->FirmwareVersion[0] < '5') { 3278 if (adapter->tgt_flags[tgt_id].tagq_active &&
3039 BusLogic_Warning("Unable to Abort CCB #%ld to Target %d - " "Abort Tag Not Supported\n", HostAdapter, CCB->SerialNumber, TargetID); 3279 adapter->fw_ver[0] < '5') {
3280 blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->serial, tgt_id);
3040 return FAILURE; 3281 return FAILURE;
3041 } else if (BusLogic_WriteOutgoingMailbox(HostAdapter, BusLogic_MailboxAbortCommand, CCB)) { 3282 } else if (blogic_write_outbox(adapter, BLOGIC_MBOX_ABORT,
3042 BusLogic_Warning("Aborting CCB #%ld to Target %d\n", HostAdapter, CCB->SerialNumber, TargetID); 3283 ccb)) {
3043 BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsAttempted); 3284 blogic_warn("Aborting CCB #%ld to Target %d\n",
3285 adapter, ccb->serial, tgt_id);
3286 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried);
3044 return SUCCESS; 3287 return SUCCESS;
3045 } else { 3288 } else {
3046 BusLogic_Warning("Unable to Abort CCB #%ld to Target %d - " "No Outgoing Mailboxes\n", HostAdapter, CCB->SerialNumber, TargetID); 3289 blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->serial, tgt_id);
3047 return FAILURE; 3290 return FAILURE;
3048 } 3291 }
3049 } else { 3292 } else {
3050 /* 3293 /*
3051 Call the FlashPoint SCCB Manager to abort execution of the CCB. 3294 Call the FlashPoint SCCB Manager to abort execution of
3295 the CCB.
3052 */ 3296 */
3053 BusLogic_Warning("Aborting CCB #%ld to Target %d\n", HostAdapter, CCB->SerialNumber, TargetID); 3297 blogic_warn("Aborting CCB #%ld to Target %d\n", adapter,
3054 BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsAttempted); 3298 ccb->serial, tgt_id);
3055 FlashPoint_AbortCCB(HostAdapter->CardHandle, CCB); 3299 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried);
3300 FlashPoint_AbortCCB(adapter->cardhandle, ccb);
3056 /* 3301 /*
3057 The Abort may have already been completed and 3302 The Abort may have already been completed and
3058 BusLogic_QueueCompletedCCB been called, or it 3303 blogic_qcompleted_ccb been called, or it
3059 may still be pending. 3304 may still be pending.
3060 */ 3305 */
3061 if (CCB->Status == BusLogic_CCB_Completed) { 3306 if (ccb->status == BLOGIC_CCB_COMPLETE)
3062 BusLogic_ProcessCompletedCCBs(HostAdapter); 3307 blogic_process_ccbs(adapter);
3063 }
3064 return SUCCESS; 3308 return SUCCESS;
3065 } 3309 }
3066 return SUCCESS; 3310 return SUCCESS;
@@ -3068,21 +3312,23 @@ static int BusLogic_AbortCommand(struct scsi_cmnd *Command)
3068 3312
3069#endif 3313#endif
3070/* 3314/*
3071 BusLogic_ResetHostAdapter resets Host Adapter if possible, marking all 3315 blogic_resetadapter resets Host Adapter if possible, marking all
3072 currently executing SCSI Commands as having been Reset. 3316 currently executing SCSI Commands as having been Reset.
3073*/ 3317*/
3074 3318
3075static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *HostAdapter, bool HardReset) 3319static int blogic_resetadapter(struct blogic_adapter *adapter, bool hard_reset)
3076{ 3320{
3077 struct BusLogic_CCB *CCB; 3321 struct blogic_ccb *ccb;
3078 int TargetID; 3322 int tgt_id;
3079 3323
3080 /* 3324 /*
3081 * Attempt to Reset and Reinitialize the Host Adapter. 3325 * Attempt to Reset and Reinitialize the Host Adapter.
3082 */ 3326 */
3083 3327
3084 if (!(BusLogic_HardwareResetHostAdapter(HostAdapter, HardReset) && BusLogic_InitializeHostAdapter(HostAdapter))) { 3328 if (!(blogic_hwreset(adapter, hard_reset) &&
3085 BusLogic_Error("Resetting %s Failed\n", HostAdapter, HostAdapter->FullModelName); 3329 blogic_initadapter(adapter))) {
3330 blogic_err("Resetting %s Failed\n", adapter,
3331 adapter->full_model);
3086 return FAILURE; 3332 return FAILURE;
3087 } 3333 }
3088 3334
@@ -3090,9 +3336,9 @@ static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *HostAdapter, b
3090 * Deallocate all currently executing CCBs. 3336 * Deallocate all currently executing CCBs.
3091 */ 3337 */
3092 3338
3093 for (CCB = HostAdapter->All_CCBs; CCB != NULL; CCB = CCB->NextAll) 3339 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
3094 if (CCB->Status == BusLogic_CCB_Active) 3340 if (ccb->status == BLOGIC_CCB_ACTIVE)
3095 BusLogic_DeallocateCCB(CCB); 3341 blogic_dealloc_ccb(ccb);
3096 /* 3342 /*
3097 * Wait a few seconds between the Host Adapter Hard Reset which 3343 * Wait a few seconds between the Host Adapter Hard Reset which
3098 * initiates a SCSI Bus Reset and issuing any SCSI Commands. Some 3344 * initiates a SCSI Bus Reset and issuing any SCSI Commands. Some
@@ -3100,21 +3346,21 @@ static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *HostAdapter, b
3100 * after a SCSI Bus Reset. 3346 * after a SCSI Bus Reset.
3101 */ 3347 */
3102 3348
3103 if (HardReset) { 3349 if (hard_reset) {
3104 spin_unlock_irq(HostAdapter->SCSI_Host->host_lock); 3350 spin_unlock_irq(adapter->scsi_host->host_lock);
3105 BusLogic_Delay(HostAdapter->BusSettleTime); 3351 blogic_delay(adapter->bus_settle_time);
3106 spin_lock_irq(HostAdapter->SCSI_Host->host_lock); 3352 spin_lock_irq(adapter->scsi_host->host_lock);
3107 } 3353 }
3108 3354
3109 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { 3355 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
3110 HostAdapter->LastResetAttempted[TargetID] = jiffies; 3356 adapter->last_resettried[tgt_id] = jiffies;
3111 HostAdapter->LastResetCompleted[TargetID] = jiffies; 3357 adapter->last_resetdone[tgt_id] = jiffies;
3112 } 3358 }
3113 return SUCCESS; 3359 return SUCCESS;
3114} 3360}
3115 3361
3116/* 3362/*
3117 BusLogic_BIOSDiskParameters returns the Heads/Sectors/Cylinders BIOS Disk 3363 blogic_diskparam returns the Heads/Sectors/Cylinders BIOS Disk
3118 Parameters for Disk. The default disk geometry is 64 heads, 32 sectors, and 3364 Parameters for Disk. The default disk geometry is 64 heads, 32 sectors, and
3119 the appropriate number of cylinders so as not to exceed drive capacity. In 3365 the appropriate number of cylinders so as not to exceed drive capacity. In
3120 order for disks equal to or larger than 1 GB to be addressable by the BIOS 3366 order for disks equal to or larger than 1 GB to be addressable by the BIOS
@@ -3130,66 +3376,70 @@ static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *HostAdapter, b
3130 the BIOS, and a warning may be displayed. 3376 the BIOS, and a warning may be displayed.
3131*/ 3377*/
3132 3378
3133static int BusLogic_BIOSDiskParameters(struct scsi_device *sdev, struct block_device *Device, sector_t capacity, int *Parameters) 3379static int blogic_diskparam(struct scsi_device *sdev, struct block_device *dev,
3380 sector_t capacity, int *params)
3134{ 3381{
3135 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) sdev->host->hostdata; 3382 struct blogic_adapter *adapter =
3136 struct BIOS_DiskParameters *DiskParameters = (struct BIOS_DiskParameters *) Parameters; 3383 (struct blogic_adapter *) sdev->host->hostdata;
3384 struct bios_diskparam *diskparam = (struct bios_diskparam *) params;
3137 unsigned char *buf; 3385 unsigned char *buf;
3138 if (HostAdapter->ExtendedTranslationEnabled && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */ ) { 3386
3139 if (capacity >= 4 * 1024 * 1024 /* 2 GB in 512 byte sectors */ ) { 3387 if (adapter->ext_trans_enable && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */) {
3140 DiskParameters->Heads = 255; 3388 if (capacity >= 4 * 1024 * 1024 /* 2 GB in 512 byte sectors */) {
3141 DiskParameters->Sectors = 63; 3389 diskparam->heads = 255;
3390 diskparam->sectors = 63;
3142 } else { 3391 } else {
3143 DiskParameters->Heads = 128; 3392 diskparam->heads = 128;
3144 DiskParameters->Sectors = 32; 3393 diskparam->sectors = 32;
3145 } 3394 }
3146 } else { 3395 } else {
3147 DiskParameters->Heads = 64; 3396 diskparam->heads = 64;
3148 DiskParameters->Sectors = 32; 3397 diskparam->sectors = 32;
3149 } 3398 }
3150 DiskParameters->Cylinders = (unsigned long) capacity / (DiskParameters->Heads * DiskParameters->Sectors); 3399 diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors);
3151 buf = scsi_bios_ptable(Device); 3400 buf = scsi_bios_ptable(dev);
3152 if (buf == NULL) 3401 if (buf == NULL)
3153 return 0; 3402 return 0;
3154 /* 3403 /*
3155 If the boot sector partition table flag is valid, search for a partition 3404 If the boot sector partition table flag is valid, search for
3156 table entry whose end_head matches one of the standard BusLogic geometry 3405 a partition table entry whose end_head matches one of the
3157 translations (64/32, 128/32, or 255/63). 3406 standard BusLogic geometry translations (64/32, 128/32, or 255/63).
3158 */ 3407 */
3159 if (*(unsigned short *) (buf + 64) == 0xAA55) { 3408 if (*(unsigned short *) (buf + 64) == 0xAA55) {
3160 struct partition *FirstPartitionEntry = (struct partition *) buf; 3409 struct partition *part1_entry = (struct partition *) buf;
3161 struct partition *PartitionEntry = FirstPartitionEntry; 3410 struct partition *part_entry = part1_entry;
3162 int SavedCylinders = DiskParameters->Cylinders, PartitionNumber; 3411 int saved_cyl = diskparam->cylinders, part_no;
3163 unsigned char PartitionEntryEndHead = 0, PartitionEntryEndSector = 0; 3412 unsigned char part_end_head = 0, part_end_sector = 0;
3164 for (PartitionNumber = 0; PartitionNumber < 4; PartitionNumber++) { 3413
3165 PartitionEntryEndHead = PartitionEntry->end_head; 3414 for (part_no = 0; part_no < 4; part_no++) {
3166 PartitionEntryEndSector = PartitionEntry->end_sector & 0x3F; 3415 part_end_head = part_entry->end_head;
3167 if (PartitionEntryEndHead == 64 - 1) { 3416 part_end_sector = part_entry->end_sector & 0x3F;
3168 DiskParameters->Heads = 64; 3417 if (part_end_head == 64 - 1) {
3169 DiskParameters->Sectors = 32; 3418 diskparam->heads = 64;
3419 diskparam->sectors = 32;
3170 break; 3420 break;
3171 } else if (PartitionEntryEndHead == 128 - 1) { 3421 } else if (part_end_head == 128 - 1) {
3172 DiskParameters->Heads = 128; 3422 diskparam->heads = 128;
3173 DiskParameters->Sectors = 32; 3423 diskparam->sectors = 32;
3174 break; 3424 break;
3175 } else if (PartitionEntryEndHead == 255 - 1) { 3425 } else if (part_end_head == 255 - 1) {
3176 DiskParameters->Heads = 255; 3426 diskparam->heads = 255;
3177 DiskParameters->Sectors = 63; 3427 diskparam->sectors = 63;
3178 break; 3428 break;
3179 } 3429 }
3180 PartitionEntry++; 3430 part_entry++;
3181 } 3431 }
3182 if (PartitionNumber == 4) { 3432 if (part_no == 4) {
3183 PartitionEntryEndHead = FirstPartitionEntry->end_head; 3433 part_end_head = part1_entry->end_head;
3184 PartitionEntryEndSector = FirstPartitionEntry->end_sector & 0x3F; 3434 part_end_sector = part1_entry->end_sector & 0x3F;
3185 } 3435 }
3186 DiskParameters->Cylinders = (unsigned long) capacity / (DiskParameters->Heads * DiskParameters->Sectors); 3436 diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors);
3187 if (PartitionNumber < 4 && PartitionEntryEndSector == DiskParameters->Sectors) { 3437 if (part_no < 4 && part_end_sector == diskparam->sectors) {
3188 if (DiskParameters->Cylinders != SavedCylinders) 3438 if (diskparam->cylinders != saved_cyl)
3189 BusLogic_Warning("Adopting Geometry %d/%d from Partition Table\n", HostAdapter, DiskParameters->Heads, DiskParameters->Sectors); 3439 blogic_warn("Adopting Geometry %d/%d from Partition Table\n", adapter, diskparam->heads, diskparam->sectors);
3190 } else if (PartitionEntryEndHead > 0 || PartitionEntryEndSector > 0) { 3440 } else if (part_end_head > 0 || part_end_sector > 0) {
3191 BusLogic_Warning("Warning: Partition Table appears to " "have Geometry %d/%d which is\n", HostAdapter, PartitionEntryEndHead + 1, PartitionEntryEndSector); 3441 blogic_warn("Warning: Partition Table appears to " "have Geometry %d/%d which is\n", adapter, part_end_head + 1, part_end_sector);
3192 BusLogic_Warning("not compatible with current BusLogic " "Host Adapter Geometry %d/%d\n", HostAdapter, DiskParameters->Heads, DiskParameters->Sectors); 3442 blogic_warn("not compatible with current BusLogic " "Host Adapter Geometry %d/%d\n", adapter, diskparam->heads, diskparam->sectors);
3193 } 3443 }
3194 } 3444 }
3195 kfree(buf); 3445 kfree(buf);
@@ -3201,92 +3451,94 @@ static int BusLogic_BIOSDiskParameters(struct scsi_device *sdev, struct block_de
3201 BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>. 3451 BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>.
3202*/ 3452*/
3203 3453
3204static int BusLogic_write_info(struct Scsi_Host *shost, char *ProcBuffer, int BytesAvailable) 3454static int blogic_write_info(struct Scsi_Host *shost, char *procbuf,
3455 int bytes_avail)
3205{ 3456{
3206 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; 3457 struct blogic_adapter *adapter =
3207 struct BusLogic_TargetStatistics *TargetStatistics; 3458 (struct blogic_adapter *) shost->hostdata;
3208 3459 struct blogic_tgt_stats *tgt_stats;
3209 TargetStatistics = HostAdapter->TargetStatistics; 3460
3210 HostAdapter->ExternalHostAdapterResets = 0; 3461 tgt_stats = adapter->tgt_stats;
3211 HostAdapter->HostAdapterInternalErrors = 0; 3462 adapter->ext_resets = 0;
3212 memset(TargetStatistics, 0, BusLogic_MaxTargetDevices * sizeof(struct BusLogic_TargetStatistics)); 3463 adapter->adapter_intern_errors = 0;
3464 memset(tgt_stats, 0, BLOGIC_MAXDEV * sizeof(struct blogic_tgt_stats));
3213 return 0; 3465 return 0;
3214} 3466}
3215 3467
3216static int BusLogic_show_info(struct seq_file *m, struct Scsi_Host *shost) 3468static int blogic_show_info(struct seq_file *m, struct Scsi_Host *shost)
3217{ 3469{
3218 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; 3470 struct blogic_adapter *adapter = (struct blogic_adapter *) shost->hostdata;
3219 struct BusLogic_TargetStatistics *TargetStatistics; 3471 struct blogic_tgt_stats *tgt_stats;
3220 int TargetID; 3472 int tgt;
3221 3473
3222 TargetStatistics = HostAdapter->TargetStatistics; 3474 tgt_stats = adapter->tgt_stats;
3223 seq_write(m, HostAdapter->MessageBuffer, HostAdapter->MessageBufferLength); 3475 seq_write(m, adapter->msgbuf, adapter->msgbuflen);
3224 seq_printf(m, "\n\ 3476 seq_printf(m, "\n\
3225Current Driver Queue Depth: %d\n\ 3477Current Driver Queue Depth: %d\n\
3226Currently Allocated CCBs: %d\n", HostAdapter->DriverQueueDepth, HostAdapter->AllocatedCCBs); 3478Currently Allocated CCBs: %d\n", adapter->drvr_qdepth, adapter->alloc_ccbs);
3227 seq_printf(m, "\n\n\ 3479 seq_printf(m, "\n\n\
3228 DATA TRANSFER STATISTICS\n\ 3480 DATA TRANSFER STATISTICS\n\
3229\n\ 3481\n\
3230Target Tagged Queuing Queue Depth Active Attempted Completed\n\ 3482Target Tagged Queuing Queue Depth Active Attempted Completed\n\
3231====== ============== =========== ====== ========= =========\n"); 3483====== ============== =========== ====== ========= =========\n");
3232 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { 3484 for (tgt = 0; tgt < adapter->maxdev; tgt++) {
3233 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; 3485 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
3234 if (!TargetFlags->TargetExists) 3486 if (!tgt_flags->tgt_exists)
3235 continue; 3487 continue;
3236 seq_printf(m, " %2d %s", TargetID, (TargetFlags->TaggedQueuingSupported ? (TargetFlags->TaggedQueuingActive ? " Active" : (HostAdapter->TaggedQueuingPermitted & (1 << TargetID) 3488 seq_printf(m, " %2d %s", tgt, (tgt_flags->tagq_ok ? (tgt_flags->tagq_active ? " Active" : (adapter->tagq_ok & (1 << tgt)
3237 ? " Permitted" : " Disabled")) 3489 ? " Permitted" : " Disabled"))
3238 : "Not Supported")); 3490 : "Not Supported"));
3239 seq_printf(m, 3491 seq_printf(m,
3240 " %3d %3u %9u %9u\n", HostAdapter->QueueDepth[TargetID], HostAdapter->ActiveCommands[TargetID], TargetStatistics[TargetID].CommandsAttempted, TargetStatistics[TargetID].CommandsCompleted); 3492 " %3d %3u %9u %9u\n", adapter->qdepth[tgt], adapter->active_cmds[tgt], tgt_stats[tgt].cmds_tried, tgt_stats[tgt].cmds_complete);
3241 } 3493 }
3242 seq_printf(m, "\n\ 3494 seq_printf(m, "\n\
3243Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\ 3495Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\
3244====== ============= ============== =================== ===================\n"); 3496====== ============= ============== =================== ===================\n");
3245 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { 3497 for (tgt = 0; tgt < adapter->maxdev; tgt++) {
3246 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; 3498 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
3247 if (!TargetFlags->TargetExists) 3499 if (!tgt_flags->tgt_exists)
3248 continue; 3500 continue;
3249 seq_printf(m, " %2d %9u %9u", TargetID, TargetStatistics[TargetID].ReadCommands, TargetStatistics[TargetID].WriteCommands); 3501 seq_printf(m, " %2d %9u %9u", tgt, tgt_stats[tgt].read_cmds, tgt_stats[tgt].write_cmds);
3250 if (TargetStatistics[TargetID].TotalBytesRead.Billions > 0) 3502 if (tgt_stats[tgt].bytesread.billions > 0)
3251 seq_printf(m, " %9u%09u", TargetStatistics[TargetID].TotalBytesRead.Billions, TargetStatistics[TargetID].TotalBytesRead.Units); 3503 seq_printf(m, " %9u%09u", tgt_stats[tgt].bytesread.billions, tgt_stats[tgt].bytesread.units);
3252 else 3504 else
3253 seq_printf(m, " %9u", TargetStatistics[TargetID].TotalBytesRead.Units); 3505 seq_printf(m, " %9u", tgt_stats[tgt].bytesread.units);
3254 if (TargetStatistics[TargetID].TotalBytesWritten.Billions > 0) 3506 if (tgt_stats[tgt].byteswritten.billions > 0)
3255 seq_printf(m, " %9u%09u\n", TargetStatistics[TargetID].TotalBytesWritten.Billions, TargetStatistics[TargetID].TotalBytesWritten.Units); 3507 seq_printf(m, " %9u%09u\n", tgt_stats[tgt].byteswritten.billions, tgt_stats[tgt].byteswritten.units);
3256 else 3508 else
3257 seq_printf(m, " %9u\n", TargetStatistics[TargetID].TotalBytesWritten.Units); 3509 seq_printf(m, " %9u\n", tgt_stats[tgt].byteswritten.units);
3258 } 3510 }
3259 seq_printf(m, "\n\ 3511 seq_printf(m, "\n\
3260Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\ 3512Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\
3261====== ======= ========= ========= ========= ========= =========\n"); 3513====== ======= ========= ========= ========= ========= =========\n");
3262 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { 3514 for (tgt = 0; tgt < adapter->maxdev; tgt++) {
3263 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; 3515 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
3264 if (!TargetFlags->TargetExists) 3516 if (!tgt_flags->tgt_exists)
3265 continue; 3517 continue;
3266 seq_printf(m, 3518 seq_printf(m,
3267 " %2d Read %9u %9u %9u %9u %9u\n", TargetID, 3519 " %2d Read %9u %9u %9u %9u %9u\n", tgt,
3268 TargetStatistics[TargetID].ReadCommandSizeBuckets[0], 3520 tgt_stats[tgt].read_sz_buckets[0],
3269 TargetStatistics[TargetID].ReadCommandSizeBuckets[1], TargetStatistics[TargetID].ReadCommandSizeBuckets[2], TargetStatistics[TargetID].ReadCommandSizeBuckets[3], TargetStatistics[TargetID].ReadCommandSizeBuckets[4]); 3521 tgt_stats[tgt].read_sz_buckets[1], tgt_stats[tgt].read_sz_buckets[2], tgt_stats[tgt].read_sz_buckets[3], tgt_stats[tgt].read_sz_buckets[4]);
3270 seq_printf(m, 3522 seq_printf(m,
3271 " %2d Write %9u %9u %9u %9u %9u\n", TargetID, 3523 " %2d Write %9u %9u %9u %9u %9u\n", tgt,
3272 TargetStatistics[TargetID].WriteCommandSizeBuckets[0], 3524 tgt_stats[tgt].write_sz_buckets[0],
3273 TargetStatistics[TargetID].WriteCommandSizeBuckets[1], TargetStatistics[TargetID].WriteCommandSizeBuckets[2], TargetStatistics[TargetID].WriteCommandSizeBuckets[3], TargetStatistics[TargetID].WriteCommandSizeBuckets[4]); 3525 tgt_stats[tgt].write_sz_buckets[1], tgt_stats[tgt].write_sz_buckets[2], tgt_stats[tgt].write_sz_buckets[3], tgt_stats[tgt].write_sz_buckets[4]);
3274 } 3526 }
3275 seq_printf(m, "\n\ 3527 seq_printf(m, "\n\
3276Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\ 3528Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\
3277====== ======= ========= ========= ========= ========= =========\n"); 3529====== ======= ========= ========= ========= ========= =========\n");
3278 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { 3530 for (tgt = 0; tgt < adapter->maxdev; tgt++) {
3279 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; 3531 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
3280 if (!TargetFlags->TargetExists) 3532 if (!tgt_flags->tgt_exists)
3281 continue; 3533 continue;
3282 seq_printf(m, 3534 seq_printf(m,
3283 " %2d Read %9u %9u %9u %9u %9u\n", TargetID, 3535 " %2d Read %9u %9u %9u %9u %9u\n", tgt,
3284 TargetStatistics[TargetID].ReadCommandSizeBuckets[5], 3536 tgt_stats[tgt].read_sz_buckets[5],
3285 TargetStatistics[TargetID].ReadCommandSizeBuckets[6], TargetStatistics[TargetID].ReadCommandSizeBuckets[7], TargetStatistics[TargetID].ReadCommandSizeBuckets[8], TargetStatistics[TargetID].ReadCommandSizeBuckets[9]); 3537 tgt_stats[tgt].read_sz_buckets[6], tgt_stats[tgt].read_sz_buckets[7], tgt_stats[tgt].read_sz_buckets[8], tgt_stats[tgt].read_sz_buckets[9]);
3286 seq_printf(m, 3538 seq_printf(m,
3287 " %2d Write %9u %9u %9u %9u %9u\n", TargetID, 3539 " %2d Write %9u %9u %9u %9u %9u\n", tgt,
3288 TargetStatistics[TargetID].WriteCommandSizeBuckets[5], 3540 tgt_stats[tgt].write_sz_buckets[5],
3289 TargetStatistics[TargetID].WriteCommandSizeBuckets[6], TargetStatistics[TargetID].WriteCommandSizeBuckets[7], TargetStatistics[TargetID].WriteCommandSizeBuckets[8], TargetStatistics[TargetID].WriteCommandSizeBuckets[9]); 3541 tgt_stats[tgt].write_sz_buckets[6], tgt_stats[tgt].write_sz_buckets[7], tgt_stats[tgt].write_sz_buckets[8], tgt_stats[tgt].write_sz_buckets[9]);
3290 } 3542 }
3291 seq_printf(m, "\n\n\ 3543 seq_printf(m, "\n\n\
3292 ERROR RECOVERY STATISTICS\n\ 3544 ERROR RECOVERY STATISTICS\n\
@@ -3295,84 +3547,86 @@ Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\
3295Target Requested Completed Requested Completed Requested Completed\n\ 3547Target Requested Completed Requested Completed Requested Completed\n\
3296 ID \\\\\\\\ Attempted //// \\\\\\\\ Attempted //// \\\\\\\\ Attempted ////\n\ 3548 ID \\\\\\\\ Attempted //// \\\\\\\\ Attempted //// \\\\\\\\ Attempted ////\n\
3297====== ===== ===== ===== ===== ===== ===== ===== ===== =====\n"); 3549====== ===== ===== ===== ===== ===== ===== ===== ===== =====\n");
3298 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { 3550 for (tgt = 0; tgt < adapter->maxdev; tgt++) {
3299 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; 3551 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
3300 if (!TargetFlags->TargetExists) 3552 if (!tgt_flags->tgt_exists)
3301 continue; 3553 continue;
3302 seq_printf(m, "\ 3554 seq_printf(m, "\
3303 %2d %5d %5d %5d %5d %5d %5d %5d %5d %5d\n", TargetID, TargetStatistics[TargetID].CommandAbortsRequested, TargetStatistics[TargetID].CommandAbortsAttempted, TargetStatistics[TargetID].CommandAbortsCompleted, TargetStatistics[TargetID].BusDeviceResetsRequested, TargetStatistics[TargetID].BusDeviceResetsAttempted, TargetStatistics[TargetID].BusDeviceResetsCompleted, TargetStatistics[TargetID].HostAdapterResetsRequested, TargetStatistics[TargetID].HostAdapterResetsAttempted, TargetStatistics[TargetID].HostAdapterResetsCompleted); 3555 %2d %5d %5d %5d %5d %5d %5d %5d %5d %5d\n", tgt, tgt_stats[tgt].aborts_request, tgt_stats[tgt].aborts_tried, tgt_stats[tgt].aborts_done, tgt_stats[tgt].bdr_request, tgt_stats[tgt].bdr_tried, tgt_stats[tgt].bdr_done, tgt_stats[tgt].adatper_reset_req, tgt_stats[tgt].adapter_reset_attempt, tgt_stats[tgt].adapter_reset_done);
3304 } 3556 }
3305 seq_printf(m, "\nExternal Host Adapter Resets: %d\n", HostAdapter->ExternalHostAdapterResets); 3557 seq_printf(m, "\nExternal Host Adapter Resets: %d\n", adapter->ext_resets);
3306 seq_printf(m, "Host Adapter Internal Errors: %d\n", HostAdapter->HostAdapterInternalErrors); 3558 seq_printf(m, "Host Adapter Internal Errors: %d\n", adapter->adapter_intern_errors);
3307 return 0; 3559 return 0;
3308} 3560}
3309 3561
3310 3562
3311/* 3563/*
3312 BusLogic_Message prints Driver Messages. 3564 blogic_msg prints Driver Messages.
3313*/ 3565*/
3314 3566
3315static void BusLogic_Message(enum BusLogic_MessageLevel MessageLevel, char *Format, struct BusLogic_HostAdapter *HostAdapter, ...) 3567static void blogic_msg(enum blogic_msglevel msglevel, char *fmt,
3568 struct blogic_adapter *adapter, ...)
3316{ 3569{
3317 static char Buffer[BusLogic_LineBufferSize]; 3570 static char buf[BLOGIC_LINEBUF_SIZE];
3318 static bool BeginningOfLine = true; 3571 static bool begin = true;
3319 va_list Arguments; 3572 va_list args;
3320 int Length = 0; 3573 int len = 0;
3321 va_start(Arguments, HostAdapter); 3574
3322 Length = vsprintf(Buffer, Format, Arguments); 3575 va_start(args, adapter);
3323 va_end(Arguments); 3576 len = vsprintf(buf, fmt, args);
3324 if (MessageLevel == BusLogic_AnnounceLevel) { 3577 va_end(args);
3325 static int AnnouncementLines = 0; 3578 if (msglevel == BLOGIC_ANNOUNCE_LEVEL) {
3326 strcpy(&HostAdapter->MessageBuffer[HostAdapter->MessageBufferLength], Buffer); 3579 static int msglines = 0;
3327 HostAdapter->MessageBufferLength += Length; 3580 strcpy(&adapter->msgbuf[adapter->msgbuflen], buf);
3328 if (++AnnouncementLines <= 2) 3581 adapter->msgbuflen += len;
3329 printk("%sscsi: %s", BusLogic_MessageLevelMap[MessageLevel], Buffer); 3582 if (++msglines <= 2)
3330 } else if (MessageLevel == BusLogic_InfoLevel) { 3583 printk("%sscsi: %s", blogic_msglevelmap[msglevel], buf);
3331 strcpy(&HostAdapter->MessageBuffer[HostAdapter->MessageBufferLength], Buffer); 3584 } else if (msglevel == BLOGIC_INFO_LEVEL) {
3332 HostAdapter->MessageBufferLength += Length; 3585 strcpy(&adapter->msgbuf[adapter->msgbuflen], buf);
3333 if (BeginningOfLine) { 3586 adapter->msgbuflen += len;
3334 if (Buffer[0] != '\n' || Length > 1) 3587 if (begin) {
3335 printk("%sscsi%d: %s", BusLogic_MessageLevelMap[MessageLevel], HostAdapter->HostNumber, Buffer); 3588 if (buf[0] != '\n' || len > 1)
3589 printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf);
3336 } else 3590 } else
3337 printk("%s", Buffer); 3591 printk("%s", buf);
3338 } else { 3592 } else {
3339 if (BeginningOfLine) { 3593 if (begin) {
3340 if (HostAdapter != NULL && HostAdapter->HostAdapterInitialized) 3594 if (adapter != NULL && adapter->adapter_initd)
3341 printk("%sscsi%d: %s", BusLogic_MessageLevelMap[MessageLevel], HostAdapter->HostNumber, Buffer); 3595 printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf);
3342 else 3596 else
3343 printk("%s%s", BusLogic_MessageLevelMap[MessageLevel], Buffer); 3597 printk("%s%s", blogic_msglevelmap[msglevel], buf);
3344 } else 3598 } else
3345 printk("%s", Buffer); 3599 printk("%s", buf);
3346 } 3600 }
3347 BeginningOfLine = (Buffer[Length - 1] == '\n'); 3601 begin = (buf[len - 1] == '\n');
3348} 3602}
3349 3603
3350 3604
3351/* 3605/*
3352 BusLogic_ParseKeyword parses an individual option keyword. It returns true 3606 blogic_parse parses an individual option keyword. It returns true
3353 and updates the pointer if the keyword is recognized and false otherwise. 3607 and updates the pointer if the keyword is recognized and false otherwise.
3354*/ 3608*/
3355 3609
3356static bool __init BusLogic_ParseKeyword(char **StringPointer, char *Keyword) 3610static bool __init blogic_parse(char **str, char *keyword)
3357{ 3611{
3358 char *Pointer = *StringPointer; 3612 char *pointer = *str;
3359 while (*Keyword != '\0') { 3613 while (*keyword != '\0') {
3360 char StringChar = *Pointer++; 3614 char strch = *pointer++;
3361 char KeywordChar = *Keyword++; 3615 char keywordch = *keyword++;
3362 if (StringChar >= 'A' && StringChar <= 'Z') 3616 if (strch >= 'A' && strch <= 'Z')
3363 StringChar += 'a' - 'Z'; 3617 strch += 'a' - 'Z';
3364 if (KeywordChar >= 'A' && KeywordChar <= 'Z') 3618 if (keywordch >= 'A' && keywordch <= 'Z')
3365 KeywordChar += 'a' - 'Z'; 3619 keywordch += 'a' - 'Z';
3366 if (StringChar != KeywordChar) 3620 if (strch != keywordch)
3367 return false; 3621 return false;
3368 } 3622 }
3369 *StringPointer = Pointer; 3623 *str = pointer;
3370 return true; 3624 return true;
3371} 3625}
3372 3626
3373 3627
3374/* 3628/*
3375 BusLogic_ParseDriverOptions handles processing of BusLogic Driver Options 3629 blogic_parseopts handles processing of BusLogic Driver Options
3376 specifications. 3630 specifications.
3377 3631
3378 BusLogic Driver Options may be specified either via the Linux Kernel Command 3632 BusLogic Driver Options may be specified either via the Linux Kernel Command
@@ -3388,164 +3642,177 @@ static bool __init BusLogic_ParseKeyword(char **StringPointer, char *Keyword)
3388 <file:Documentation/scsi/BusLogic.txt>. 3642 <file:Documentation/scsi/BusLogic.txt>.
3389*/ 3643*/
3390 3644
3391static int __init BusLogic_ParseDriverOptions(char *OptionsString) 3645static int __init blogic_parseopts(char *options)
3392{ 3646{
3393 while (true) { 3647 while (true) {
3394 struct BusLogic_DriverOptions *DriverOptions = &BusLogic_DriverOptions[BusLogic_DriverOptionsCount++]; 3648 struct blogic_drvr_options *drvr_opts =
3395 int TargetID; 3649 &blogic_drvr_options[blogic_drvr_options_count++];
3396 memset(DriverOptions, 0, sizeof(struct BusLogic_DriverOptions)); 3650 int tgt_id;
3397 while (*OptionsString != '\0' && *OptionsString != ';') { 3651
3652 memset(drvr_opts, 0, sizeof(struct blogic_drvr_options));
3653 while (*options != '\0' && *options != ';') {
3398 /* Probing Options. */ 3654 /* Probing Options. */
3399 if (BusLogic_ParseKeyword(&OptionsString, "IO:")) { 3655 if (blogic_parse(&options, "IO:")) {
3400 unsigned long IO_Address = simple_strtoul(OptionsString, &OptionsString, 0); 3656 unsigned long io_addr = simple_strtoul(options,
3401 BusLogic_ProbeOptions.LimitedProbeISA = true; 3657 &options, 0);
3402 switch (IO_Address) { 3658 blogic_probe_options.limited_isa = true;
3659 switch (io_addr) {
3403 case 0x330: 3660 case 0x330:
3404 BusLogic_ProbeOptions.Probe330 = true; 3661 blogic_probe_options.probe330 = true;
3405 break; 3662 break;
3406 case 0x334: 3663 case 0x334:
3407 BusLogic_ProbeOptions.Probe334 = true; 3664 blogic_probe_options.probe334 = true;
3408 break; 3665 break;
3409 case 0x230: 3666 case 0x230:
3410 BusLogic_ProbeOptions.Probe230 = true; 3667 blogic_probe_options.probe230 = true;
3411 break; 3668 break;
3412 case 0x234: 3669 case 0x234:
3413 BusLogic_ProbeOptions.Probe234 = true; 3670 blogic_probe_options.probe234 = true;
3414 break; 3671 break;
3415 case 0x130: 3672 case 0x130:
3416 BusLogic_ProbeOptions.Probe130 = true; 3673 blogic_probe_options.probe130 = true;
3417 break; 3674 break;
3418 case 0x134: 3675 case 0x134:
3419 BusLogic_ProbeOptions.Probe134 = true; 3676 blogic_probe_options.probe134 = true;
3420 break; 3677 break;
3421 default: 3678 default:
3422 BusLogic_Error("BusLogic: Invalid Driver Options " "(invalid I/O Address 0x%X)\n", NULL, IO_Address); 3679 blogic_err("BusLogic: Invalid Driver Options " "(invalid I/O Address 0x%X)\n", NULL, io_addr);
3423 return 0; 3680 return 0;
3424 } 3681 }
3425 } else if (BusLogic_ParseKeyword(&OptionsString, "NoProbeISA")) 3682 } else if (blogic_parse(&options, "NoProbeISA"))
3426 BusLogic_ProbeOptions.NoProbeISA = true; 3683 blogic_probe_options.noprobe_isa = true;
3427 else if (BusLogic_ParseKeyword(&OptionsString, "NoProbePCI")) 3684 else if (blogic_parse(&options, "NoProbePCI"))
3428 BusLogic_ProbeOptions.NoProbePCI = true; 3685 blogic_probe_options.noprobe_pci = true;
3429 else if (BusLogic_ParseKeyword(&OptionsString, "NoProbe")) 3686 else if (blogic_parse(&options, "NoProbe"))
3430 BusLogic_ProbeOptions.NoProbe = true; 3687 blogic_probe_options.noprobe = true;
3431 else if (BusLogic_ParseKeyword(&OptionsString, "NoSortPCI")) 3688 else if (blogic_parse(&options, "NoSortPCI"))
3432 BusLogic_ProbeOptions.NoSortPCI = true; 3689 blogic_probe_options.nosort_pci = true;
3433 else if (BusLogic_ParseKeyword(&OptionsString, "MultiMasterFirst")) 3690 else if (blogic_parse(&options, "MultiMasterFirst"))
3434 BusLogic_ProbeOptions.MultiMasterFirst = true; 3691 blogic_probe_options.multimaster_first = true;
3435 else if (BusLogic_ParseKeyword(&OptionsString, "FlashPointFirst")) 3692 else if (blogic_parse(&options, "FlashPointFirst"))
3436 BusLogic_ProbeOptions.FlashPointFirst = true; 3693 blogic_probe_options.flashpoint_first = true;
3437 /* Tagged Queuing Options. */ 3694 /* Tagged Queuing Options. */
3438 else if (BusLogic_ParseKeyword(&OptionsString, "QueueDepth:[") || BusLogic_ParseKeyword(&OptionsString, "QD:[")) { 3695 else if (blogic_parse(&options, "QueueDepth:[") ||
3439 for (TargetID = 0; TargetID < BusLogic_MaxTargetDevices; TargetID++) { 3696 blogic_parse(&options, "QD:[")) {
3440 unsigned short QueueDepth = simple_strtoul(OptionsString, &OptionsString, 0); 3697 for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) {
3441 if (QueueDepth > BusLogic_MaxTaggedQueueDepth) { 3698 unsigned short qdepth = simple_strtoul(options, &options, 0);
3442 BusLogic_Error("BusLogic: Invalid Driver Options " "(invalid Queue Depth %d)\n", NULL, QueueDepth); 3699 if (qdepth > BLOGIC_MAX_TAG_DEPTH) {
3700 blogic_err("BusLogic: Invalid Driver Options " "(invalid Queue Depth %d)\n", NULL, qdepth);
3443 return 0; 3701 return 0;
3444 } 3702 }
3445 DriverOptions->QueueDepth[TargetID] = QueueDepth; 3703 drvr_opts->qdepth[tgt_id] = qdepth;
3446 if (*OptionsString == ',') 3704 if (*options == ',')
3447 OptionsString++; 3705 options++;
3448 else if (*OptionsString == ']') 3706 else if (*options == ']')
3449 break; 3707 break;
3450 else { 3708 else {
3451 BusLogic_Error("BusLogic: Invalid Driver Options " "(',' or ']' expected at '%s')\n", NULL, OptionsString); 3709 blogic_err("BusLogic: Invalid Driver Options " "(',' or ']' expected at '%s')\n", NULL, options);
3452 return 0; 3710 return 0;
3453 } 3711 }
3454 } 3712 }
3455 if (*OptionsString != ']') { 3713 if (*options != ']') {
3456 BusLogic_Error("BusLogic: Invalid Driver Options " "(']' expected at '%s')\n", NULL, OptionsString); 3714 blogic_err("BusLogic: Invalid Driver Options " "(']' expected at '%s')\n", NULL, options);
3457 return 0; 3715 return 0;
3458 } else 3716 } else
3459 OptionsString++; 3717 options++;
3460 } else if (BusLogic_ParseKeyword(&OptionsString, "QueueDepth:") || BusLogic_ParseKeyword(&OptionsString, "QD:")) { 3718 } else if (blogic_parse(&options, "QueueDepth:") || blogic_parse(&options, "QD:")) {
3461 unsigned short QueueDepth = simple_strtoul(OptionsString, &OptionsString, 0); 3719 unsigned short qdepth = simple_strtoul(options, &options, 0);
3462 if (QueueDepth == 0 || QueueDepth > BusLogic_MaxTaggedQueueDepth) { 3720 if (qdepth == 0 ||
3463 BusLogic_Error("BusLogic: Invalid Driver Options " "(invalid Queue Depth %d)\n", NULL, QueueDepth); 3721 qdepth > BLOGIC_MAX_TAG_DEPTH) {
3722 blogic_err("BusLogic: Invalid Driver Options " "(invalid Queue Depth %d)\n", NULL, qdepth);
3464 return 0; 3723 return 0;
3465 } 3724 }
3466 DriverOptions->CommonQueueDepth = QueueDepth; 3725 drvr_opts->common_qdepth = qdepth;
3467 for (TargetID = 0; TargetID < BusLogic_MaxTargetDevices; TargetID++) 3726 for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++)
3468 DriverOptions->QueueDepth[TargetID] = QueueDepth; 3727 drvr_opts->qdepth[tgt_id] = qdepth;
3469 } else if (BusLogic_ParseKeyword(&OptionsString, "TaggedQueuing:") || BusLogic_ParseKeyword(&OptionsString, "TQ:")) { 3728 } else if (blogic_parse(&options, "TaggedQueuing:") ||
3470 if (BusLogic_ParseKeyword(&OptionsString, "Default")) { 3729 blogic_parse(&options, "TQ:")) {
3471 DriverOptions->TaggedQueuingPermitted = 0x0000; 3730 if (blogic_parse(&options, "Default")) {
3472 DriverOptions->TaggedQueuingPermittedMask = 0x0000; 3731 drvr_opts->tagq_ok = 0x0000;
3473 } else if (BusLogic_ParseKeyword(&OptionsString, "Enable")) { 3732 drvr_opts->tagq_ok_mask = 0x0000;
3474 DriverOptions->TaggedQueuingPermitted = 0xFFFF; 3733 } else if (blogic_parse(&options, "Enable")) {
3475 DriverOptions->TaggedQueuingPermittedMask = 0xFFFF; 3734 drvr_opts->tagq_ok = 0xFFFF;
3476 } else if (BusLogic_ParseKeyword(&OptionsString, "Disable")) { 3735 drvr_opts->tagq_ok_mask = 0xFFFF;
3477 DriverOptions->TaggedQueuingPermitted = 0x0000; 3736 } else if (blogic_parse(&options, "Disable")) {
3478 DriverOptions->TaggedQueuingPermittedMask = 0xFFFF; 3737 drvr_opts->tagq_ok = 0x0000;
3738 drvr_opts->tagq_ok_mask = 0xFFFF;
3479 } else { 3739 } else {
3480 unsigned short TargetBit; 3740 unsigned short tgt_bit;
3481 for (TargetID = 0, TargetBit = 1; TargetID < BusLogic_MaxTargetDevices; TargetID++, TargetBit <<= 1) 3741 for (tgt_id = 0, tgt_bit = 1;
3482 switch (*OptionsString++) { 3742 tgt_id < BLOGIC_MAXDEV;
3743 tgt_id++, tgt_bit <<= 1)
3744 switch (*options++) {
3483 case 'Y': 3745 case 'Y':
3484 DriverOptions->TaggedQueuingPermitted |= TargetBit; 3746 drvr_opts->tagq_ok |= tgt_bit;
3485 DriverOptions->TaggedQueuingPermittedMask |= TargetBit; 3747 drvr_opts->tagq_ok_mask |= tgt_bit;
3486 break; 3748 break;
3487 case 'N': 3749 case 'N':
3488 DriverOptions->TaggedQueuingPermitted &= ~TargetBit; 3750 drvr_opts->tagq_ok &= ~tgt_bit;
3489 DriverOptions->TaggedQueuingPermittedMask |= TargetBit; 3751 drvr_opts->tagq_ok_mask |= tgt_bit;
3490 break; 3752 break;
3491 case 'X': 3753 case 'X':
3492 break; 3754 break;
3493 default: 3755 default:
3494 OptionsString--; 3756 options--;
3495 TargetID = BusLogic_MaxTargetDevices; 3757 tgt_id = BLOGIC_MAXDEV;
3496 break; 3758 break;
3497 } 3759 }
3498 } 3760 }
3499 } 3761 }
3500 /* Miscellaneous Options. */ 3762 /* Miscellaneous Options. */
3501 else if (BusLogic_ParseKeyword(&OptionsString, "BusSettleTime:") || BusLogic_ParseKeyword(&OptionsString, "BST:")) { 3763 else if (blogic_parse(&options, "BusSettleTime:") ||
3502 unsigned short BusSettleTime = simple_strtoul(OptionsString, &OptionsString, 0); 3764 blogic_parse(&options, "BST:")) {
3503 if (BusSettleTime > 5 * 60) { 3765 unsigned short bus_settle_time =
3504 BusLogic_Error("BusLogic: Invalid Driver Options " "(invalid Bus Settle Time %d)\n", NULL, BusSettleTime); 3766 simple_strtoul(options, &options, 0);
3767 if (bus_settle_time > 5 * 60) {
3768 blogic_err("BusLogic: Invalid Driver Options " "(invalid Bus Settle Time %d)\n", NULL, bus_settle_time);
3505 return 0; 3769 return 0;
3506 } 3770 }
3507 DriverOptions->BusSettleTime = BusSettleTime; 3771 drvr_opts->bus_settle_time = bus_settle_time;
3508 } else if (BusLogic_ParseKeyword(&OptionsString, "InhibitTargetInquiry")) 3772 } else if (blogic_parse(&options,
3509 DriverOptions->LocalOptions.InhibitTargetInquiry = true; 3773 "InhibitTargetInquiry"))
3774 drvr_opts->stop_tgt_inquiry = true;
3510 /* Debugging Options. */ 3775 /* Debugging Options. */
3511 else if (BusLogic_ParseKeyword(&OptionsString, "TraceProbe")) 3776 else if (blogic_parse(&options, "TraceProbe"))
3512 BusLogic_GlobalOptions.TraceProbe = true; 3777 blogic_global_options.trace_probe = true;
3513 else if (BusLogic_ParseKeyword(&OptionsString, "TraceHardwareReset")) 3778 else if (blogic_parse(&options, "TraceHardwareReset"))
3514 BusLogic_GlobalOptions.TraceHardwareReset = true; 3779 blogic_global_options.trace_hw_reset = true;
3515 else if (BusLogic_ParseKeyword(&OptionsString, "TraceConfiguration")) 3780 else if (blogic_parse(&options, "TraceConfiguration"))
3516 BusLogic_GlobalOptions.TraceConfiguration = true; 3781 blogic_global_options.trace_config = true;
3517 else if (BusLogic_ParseKeyword(&OptionsString, "TraceErrors")) 3782 else if (blogic_parse(&options, "TraceErrors"))
3518 BusLogic_GlobalOptions.TraceErrors = true; 3783 blogic_global_options.trace_err = true;
3519 else if (BusLogic_ParseKeyword(&OptionsString, "Debug")) { 3784 else if (blogic_parse(&options, "Debug")) {
3520 BusLogic_GlobalOptions.TraceProbe = true; 3785 blogic_global_options.trace_probe = true;
3521 BusLogic_GlobalOptions.TraceHardwareReset = true; 3786 blogic_global_options.trace_hw_reset = true;
3522 BusLogic_GlobalOptions.TraceConfiguration = true; 3787 blogic_global_options.trace_config = true;
3523 BusLogic_GlobalOptions.TraceErrors = true; 3788 blogic_global_options.trace_err = true;
3524 } 3789 }
3525 if (*OptionsString == ',') 3790 if (*options == ',')
3526 OptionsString++; 3791 options++;
3527 else if (*OptionsString != ';' && *OptionsString != '\0') { 3792 else if (*options != ';' && *options != '\0') {
3528 BusLogic_Error("BusLogic: Unexpected Driver Option '%s' " "ignored\n", NULL, OptionsString); 3793 blogic_err("BusLogic: Unexpected Driver Option '%s' " "ignored\n", NULL, options);
3529 *OptionsString = '\0'; 3794 *options = '\0';
3530 } 3795 }
3531 } 3796 }
3532 if (!(BusLogic_DriverOptionsCount == 0 || BusLogic_ProbeInfoCount == 0 || BusLogic_DriverOptionsCount == BusLogic_ProbeInfoCount)) { 3797 if (!(blogic_drvr_options_count == 0 ||
3533 BusLogic_Error("BusLogic: Invalid Driver Options " "(all or no I/O Addresses must be specified)\n", NULL); 3798 blogic_probeinfo_count == 0 ||
3799 blogic_drvr_options_count == blogic_probeinfo_count)) {
3800 blogic_err("BusLogic: Invalid Driver Options " "(all or no I/O Addresses must be specified)\n", NULL);
3534 return 0; 3801 return 0;
3535 } 3802 }
3536 /* 3803 /*
3537 Tagged Queuing is disabled when the Queue Depth is 1 since queuing 3804 Tagged Queuing is disabled when the Queue Depth is 1 since queuing
3538 multiple commands is not possible. 3805 multiple commands is not possible.
3539 */ 3806 */
3540 for (TargetID = 0; TargetID < BusLogic_MaxTargetDevices; TargetID++) 3807 for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++)
3541 if (DriverOptions->QueueDepth[TargetID] == 1) { 3808 if (drvr_opts->qdepth[tgt_id] == 1) {
3542 unsigned short TargetBit = 1 << TargetID; 3809 unsigned short tgt_bit = 1 << tgt_id;
3543 DriverOptions->TaggedQueuingPermitted &= ~TargetBit; 3810 drvr_opts->tagq_ok &= ~tgt_bit;
3544 DriverOptions->TaggedQueuingPermittedMask |= TargetBit; 3811 drvr_opts->tagq_ok_mask |= tgt_bit;
3545 } 3812 }
3546 if (*OptionsString == ';') 3813 if (*options == ';')
3547 OptionsString++; 3814 options++;
3548 if (*OptionsString == '\0') 3815 if (*options == '\0')
3549 return 0; 3816 return 0;
3550 } 3817 }
3551 return 1; 3818 return 1;
@@ -3555,19 +3822,19 @@ static int __init BusLogic_ParseDriverOptions(char *OptionsString)
3555 Get it all started 3822 Get it all started
3556*/ 3823*/
3557 3824
3558static struct scsi_host_template Bus_Logic_template = { 3825static struct scsi_host_template blogic_template = {
3559 .module = THIS_MODULE, 3826 .module = THIS_MODULE,
3560 .proc_name = "BusLogic", 3827 .proc_name = "BusLogic",
3561 .write_info = BusLogic_write_info, 3828 .write_info = blogic_write_info,
3562 .show_info = BusLogic_show_info, 3829 .show_info = blogic_show_info,
3563 .name = "BusLogic", 3830 .name = "BusLogic",
3564 .info = BusLogic_DriverInfo, 3831 .info = blogic_drvr_info,
3565 .queuecommand = BusLogic_QueueCommand, 3832 .queuecommand = blogic_qcmd,
3566 .slave_configure = BusLogic_SlaveConfigure, 3833 .slave_configure = blogic_slaveconfig,
3567 .bios_param = BusLogic_BIOSDiskParameters, 3834 .bios_param = blogic_diskparam,
3568 .eh_host_reset_handler = BusLogic_host_reset, 3835 .eh_host_reset_handler = blogic_hostreset,
3569#if 0 3836#if 0
3570 .eh_abort_handler = BusLogic_AbortCommand, 3837 .eh_abort_handler = blogic_abort,
3571#endif 3838#endif
3572 .unchecked_isa_dma = 1, 3839 .unchecked_isa_dma = 1,
3573 .max_sectors = 128, 3840 .max_sectors = 128,
@@ -3575,40 +3842,40 @@ static struct scsi_host_template Bus_Logic_template = {
3575}; 3842};
3576 3843
3577/* 3844/*
3578 BusLogic_Setup handles processing of Kernel Command Line Arguments. 3845 blogic_setup handles processing of Kernel Command Line Arguments.
3579*/ 3846*/
3580 3847
3581static int __init BusLogic_Setup(char *str) 3848static int __init blogic_setup(char *str)
3582{ 3849{
3583 int ints[3]; 3850 int ints[3];
3584 3851
3585 (void) get_options(str, ARRAY_SIZE(ints), ints); 3852 (void) get_options(str, ARRAY_SIZE(ints), ints);
3586 3853
3587 if (ints[0] != 0) { 3854 if (ints[0] != 0) {
3588 BusLogic_Error("BusLogic: Obsolete Command Line Entry " "Format Ignored\n", NULL); 3855 blogic_err("BusLogic: Obsolete Command Line Entry " "Format Ignored\n", NULL);
3589 return 0; 3856 return 0;
3590 } 3857 }
3591 if (str == NULL || *str == '\0') 3858 if (str == NULL || *str == '\0')
3592 return 0; 3859 return 0;
3593 return BusLogic_ParseDriverOptions(str); 3860 return blogic_parseopts(str);
3594} 3861}
3595 3862
3596/* 3863/*
3597 * Exit function. Deletes all hosts associated with this driver. 3864 * Exit function. Deletes all hosts associated with this driver.
3598 */ 3865 */
3599 3866
3600static void __exit BusLogic_exit(void) 3867static void __exit blogic_exit(void)
3601{ 3868{
3602 struct BusLogic_HostAdapter *ha, *next; 3869 struct blogic_adapter *ha, *next;
3603 3870
3604 list_for_each_entry_safe(ha, next, &BusLogic_host_list, host_list) 3871 list_for_each_entry_safe(ha, next, &blogic_host_list, host_list)
3605 BusLogic_ReleaseHostAdapter(ha); 3872 blogic_deladapter(ha);
3606} 3873}
3607 3874
3608__setup("BusLogic=", BusLogic_Setup); 3875__setup("BusLogic=", blogic_setup);
3609 3876
3610#ifdef MODULE 3877#ifdef MODULE
3611static struct pci_device_id BusLogic_pci_tbl[] = { 3878/*static struct pci_device_id blogic_pci_tbl[] = {
3612 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, 3879 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
3613 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 3880 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
3614 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, 3881 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC,
@@ -3616,9 +3883,15 @@ static struct pci_device_id BusLogic_pci_tbl[] = {
3616 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, 3883 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT,
3617 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 3884 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
3618 { } 3885 { }
3886};*/
3887static DEFINE_PCI_DEVICE_TABLE(blogic_pci_tbl) = {
3888 {PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER)},
3889 {PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC)},
3890 {PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT)},
3891 {0, },
3619}; 3892};
3620#endif 3893#endif
3621MODULE_DEVICE_TABLE(pci, BusLogic_pci_tbl); 3894MODULE_DEVICE_TABLE(pci, blogic_pci_tbl);
3622 3895
3623module_init(BusLogic_init); 3896module_init(blogic_init);
3624module_exit(BusLogic_exit); 3897module_exit(blogic_exit);
diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h
index 6c6c13c3be1b..8349c0f1438a 100644
--- a/drivers/scsi/BusLogic.h
+++ b/drivers/scsi/BusLogic.h
@@ -37,14 +37,14 @@
37 Define the maximum number of BusLogic Host Adapters supported by this driver. 37 Define the maximum number of BusLogic Host Adapters supported by this driver.
38*/ 38*/
39 39
40#define BusLogic_MaxHostAdapters 16 40#define BLOGIC_MAX_ADAPTERS 16
41 41
42 42
43/* 43/*
44 Define the maximum number of Target Devices supported by this driver. 44 Define the maximum number of Target Devices supported by this driver.
45*/ 45*/
46 46
47#define BusLogic_MaxTargetDevices 16 47#define BLOGIC_MAXDEV 16
48 48
49 49
50/* 50/*
@@ -53,7 +53,7 @@
53 large as the largest single request generated by the I/O Subsystem. 53 large as the largest single request generated by the I/O Subsystem.
54*/ 54*/
55 55
56#define BusLogic_ScatterGatherLimit 128 56#define BLOGIC_SG_LIMIT 128
57 57
58 58
59/* 59/*
@@ -62,12 +62,12 @@
62 Tagged Queuing and whether or not ISA Bounce Buffers are required. 62 Tagged Queuing and whether or not ISA Bounce Buffers are required.
63*/ 63*/
64 64
65#define BusLogic_MaxTaggedQueueDepth 64 65#define BLOGIC_MAX_TAG_DEPTH 64
66#define BusLogic_MaxAutomaticTaggedQueueDepth 28 66#define BLOGIC_MAX_AUTO_TAG_DEPTH 28
67#define BusLogic_MinAutomaticTaggedQueueDepth 7 67#define BLOGIC_MIN_AUTO_TAG_DEPTH 7
68#define BusLogic_TaggedQueueDepthBB 3 68#define BLOGIC_TAG_DEPTH_BB 3
69#define BusLogic_UntaggedQueueDepth 3 69#define BLOGIC_UNTAG_DEPTH 3
70#define BusLogic_UntaggedQueueDepthBB 2 70#define BLOGIC_UNTAG_DEPTH_BB 2
71 71
72 72
73/* 73/*
@@ -77,7 +77,7 @@
77 a SCSI Bus Reset. 77 a SCSI Bus Reset.
78*/ 78*/
79 79
80#define BusLogic_DefaultBusSettleTime 2 80#define BLOGIC_BUS_SETTLE_TIME 2
81 81
82 82
83/* 83/*
@@ -87,7 +87,7 @@
87 does not cross an allocation block size boundary. 87 does not cross an allocation block size boundary.
88*/ 88*/
89 89
90#define BusLogic_MaxMailboxes 211 90#define BLOGIC_MAX_MAILBOX 211
91 91
92 92
93/* 93/*
@@ -95,50 +95,50 @@
95 Kernel memory allocation. 95 Kernel memory allocation.
96*/ 96*/
97 97
98#define BusLogic_CCB_AllocationGroupSize 7 98#define BLOGIC_CCB_GRP_ALLOCSIZE 7
99 99
100 100
101/* 101/*
102 Define the Host Adapter Line and Message Buffer Sizes. 102 Define the Host Adapter Line and Message Buffer Sizes.
103*/ 103*/
104 104
105#define BusLogic_LineBufferSize 100 105#define BLOGIC_LINEBUF_SIZE 100
106#define BusLogic_MessageBufferSize 9700 106#define BLOGIC_MSGBUF_SIZE 9700
107 107
108 108
109/* 109/*
110 Define the Driver Message Levels. 110 Define the Driver Message Levels.
111*/ 111*/
112 112
113enum BusLogic_MessageLevel { 113enum blogic_msglevel {
114 BusLogic_AnnounceLevel = 0, 114 BLOGIC_ANNOUNCE_LEVEL = 0,
115 BusLogic_InfoLevel = 1, 115 BLOGIC_INFO_LEVEL = 1,
116 BusLogic_NoticeLevel = 2, 116 BLOGIC_NOTICE_LEVEL = 2,
117 BusLogic_WarningLevel = 3, 117 BLOGIC_WARN_LEVEL = 3,
118 BusLogic_ErrorLevel = 4 118 BLOGIC_ERR_LEVEL = 4
119}; 119};
120 120
121static char *BusLogic_MessageLevelMap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR }; 121static char *blogic_msglevelmap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };
122 122
123 123
124/* 124/*
125 Define Driver Message macros. 125 Define Driver Message macros.
126*/ 126*/
127 127
128#define BusLogic_Announce(Format, Arguments...) \ 128#define blogic_announce(format, args...) \
129 BusLogic_Message(BusLogic_AnnounceLevel, Format, ##Arguments) 129 blogic_msg(BLOGIC_ANNOUNCE_LEVEL, format, ##args)
130 130
131#define BusLogic_Info(Format, Arguments...) \ 131#define blogic_info(format, args...) \
132 BusLogic_Message(BusLogic_InfoLevel, Format, ##Arguments) 132 blogic_msg(BLOGIC_INFO_LEVEL, format, ##args)
133 133
134#define BusLogic_Notice(Format, Arguments...) \ 134#define blogic_notice(format, args...) \
135 BusLogic_Message(BusLogic_NoticeLevel, Format, ##Arguments) 135 blogic_msg(BLOGIC_NOTICE_LEVEL, format, ##args)
136 136
137#define BusLogic_Warning(Format, Arguments...) \ 137#define blogic_warn(format, args...) \
138 BusLogic_Message(BusLogic_WarningLevel, Format, ##Arguments) 138 blogic_msg(BLOGIC_WARN_LEVEL, format, ##args)
139 139
140#define BusLogic_Error(Format, Arguments...) \ 140#define blogic_err(format, args...) \
141 BusLogic_Message(BusLogic_ErrorLevel, Format, ##Arguments) 141 blogic_msg(BLOGIC_ERR_LEVEL, format, ##args)
142 142
143 143
144/* 144/*
@@ -146,15 +146,15 @@ static char *BusLogic_MessageLevelMap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTIC
146 of I/O Addresses required by each type. 146 of I/O Addresses required by each type.
147*/ 147*/
148 148
149enum BusLogic_HostAdapterType { 149enum blogic_adapter_type {
150 BusLogic_MultiMaster = 1, 150 BLOGIC_MULTIMASTER = 1,
151 BusLogic_FlashPoint = 2 151 BLOGIC_FLASHPOINT = 2
152} PACKED; 152} PACKED;
153 153
154#define BusLogic_MultiMasterAddressCount 4 154#define BLOGIC_MULTIMASTER_ADDR_COUNT 4
155#define BusLogic_FlashPointAddressCount 256 155#define BLOGIC_FLASHPOINT_ADDR_COUNT 256
156 156
157static int BusLogic_HostAdapterAddressCount[3] = { 0, BusLogic_MultiMasterAddressCount, BusLogic_FlashPointAddressCount }; 157static int blogic_adapter_addr_count[3] = { 0, BLOGIC_MULTIMASTER_ADDR_COUNT, BLOGIC_FLASHPOINT_ADDR_COUNT };
158 158
159 159
160/* 160/*
@@ -163,19 +163,16 @@ static int BusLogic_HostAdapterAddressCount[3] = { 0, BusLogic_MultiMasterAddres
163 163
164#ifdef CONFIG_SCSI_FLASHPOINT 164#ifdef CONFIG_SCSI_FLASHPOINT
165 165
166#define BusLogic_MultiMasterHostAdapterP(HostAdapter) \ 166#define blogic_multimaster_type(adapter) \
167 (HostAdapter->HostAdapterType == BusLogic_MultiMaster) 167 (adapter->adapter_type == BLOGIC_MULTIMASTER)
168 168
169#define BusLogic_FlashPointHostAdapterP(HostAdapter) \ 169#define blogic_flashpoint_type(adapter) \
170 (HostAdapter->HostAdapterType == BusLogic_FlashPoint) 170 (adapter->adapter_type == BLOGIC_FLASHPOINT)
171 171
172#else 172#else
173 173
174#define BusLogic_MultiMasterHostAdapterP(HostAdapter) \ 174#define blogic_multimaster_type(adapter) (true)
175 (true) 175#define blogic_flashpoint_type(adapter) (false)
176
177#define BusLogic_FlashPointHostAdapterP(HostAdapter) \
178 (false)
179 176
180#endif 177#endif
181 178
@@ -184,35 +181,35 @@ static int BusLogic_HostAdapterAddressCount[3] = { 0, BusLogic_MultiMasterAddres
184 Define the possible Host Adapter Bus Types. 181 Define the possible Host Adapter Bus Types.
185*/ 182*/
186 183
187enum BusLogic_HostAdapterBusType { 184enum blogic_adapter_bus_type {
188 BusLogic_Unknown_Bus = 0, 185 BLOGIC_UNKNOWN_BUS = 0,
189 BusLogic_ISA_Bus = 1, 186 BLOGIC_ISA_BUS = 1,
190 BusLogic_EISA_Bus = 2, 187 BLOGIC_EISA_BUS = 2,
191 BusLogic_PCI_Bus = 3, 188 BLOGIC_PCI_BUS = 3,
192 BusLogic_VESA_Bus = 4, 189 BLOGIC_VESA_BUS = 4,
193 BusLogic_MCA_Bus = 5 190 BLOGIC_MCA_BUS = 5
194} PACKED; 191} PACKED;
195 192
196static char *BusLogic_HostAdapterBusNames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" }; 193static char *blogic_adapter_busnames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };
197 194
198static enum BusLogic_HostAdapterBusType BusLogic_HostAdapterBusTypes[] = { 195static enum blogic_adapter_bus_type blogic_adater_bus_types[] = {
199 BusLogic_VESA_Bus, /* BT-4xx */ 196 BLOGIC_VESA_BUS, /* BT-4xx */
200 BusLogic_ISA_Bus, /* BT-5xx */ 197 BLOGIC_ISA_BUS, /* BT-5xx */
201 BusLogic_MCA_Bus, /* BT-6xx */ 198 BLOGIC_MCA_BUS, /* BT-6xx */
202 BusLogic_EISA_Bus, /* BT-7xx */ 199 BLOGIC_EISA_BUS, /* BT-7xx */
203 BusLogic_Unknown_Bus, /* BT-8xx */ 200 BLOGIC_UNKNOWN_BUS, /* BT-8xx */
204 BusLogic_PCI_Bus /* BT-9xx */ 201 BLOGIC_PCI_BUS /* BT-9xx */
205}; 202};
206 203
207/* 204/*
208 Define the possible Host Adapter BIOS Disk Geometry Translations. 205 Define the possible Host Adapter BIOS Disk Geometry Translations.
209*/ 206*/
210 207
211enum BusLogic_BIOS_DiskGeometryTranslation { 208enum blogic_bios_diskgeometry {
212 BusLogic_BIOS_Disk_Not_Installed = 0, 209 BLOGIC_BIOS_NODISK = 0,
213 BusLogic_BIOS_Disk_Installed_64x32 = 1, 210 BLOGIC_BIOS_DISK64x32 = 1,
214 BusLogic_BIOS_Disk_Installed_128x32 = 2, 211 BLOGIC_BIOS_DISK128x32 = 2,
215 BusLogic_BIOS_Disk_Installed_255x63 = 3 212 BLOGIC_BIOS_DISK255x63 = 3
216} PACKED; 213} PACKED;
217 214
218 215
@@ -220,9 +217,9 @@ enum BusLogic_BIOS_DiskGeometryTranslation {
220 Define a 10^18 Statistics Byte Counter data type. 217 Define a 10^18 Statistics Byte Counter data type.
221*/ 218*/
222 219
223struct BusLogic_ByteCounter { 220struct blogic_byte_count {
224 unsigned int Units; 221 unsigned int units;
225 unsigned int Billions; 222 unsigned int billions;
226}; 223};
227 224
228 225
@@ -230,79 +227,71 @@ struct BusLogic_ByteCounter {
230 Define the structure for I/O Address and Bus Probing Information. 227 Define the structure for I/O Address and Bus Probing Information.
231*/ 228*/
232 229
233struct BusLogic_ProbeInfo { 230struct blogic_probeinfo {
234 enum BusLogic_HostAdapterType HostAdapterType; 231 enum blogic_adapter_type adapter_type;
235 enum BusLogic_HostAdapterBusType HostAdapterBusType; 232 enum blogic_adapter_bus_type adapter_bus_type;
236 unsigned long IO_Address; 233 unsigned long io_addr;
237 unsigned long PCI_Address; 234 unsigned long pci_addr;
238 struct pci_dev *PCI_Device; 235 struct pci_dev *pci_device;
239 unsigned char Bus; 236 unsigned char bus;
240 unsigned char Device; 237 unsigned char dev;
241 unsigned char IRQ_Channel; 238 unsigned char irq_ch;
242}; 239};
243 240
244/* 241/*
245 Define the Probe Options. 242 Define the Probe Options.
246*/ 243*/
247 244
248struct BusLogic_ProbeOptions { 245struct blogic_probe_options {
249 bool NoProbe:1; /* Bit 0 */ 246 bool noprobe:1; /* Bit 0 */
250 bool NoProbeISA:1; /* Bit 1 */ 247 bool noprobe_isa:1; /* Bit 1 */
251 bool NoProbePCI:1; /* Bit 2 */ 248 bool noprobe_pci:1; /* Bit 2 */
252 bool NoSortPCI:1; /* Bit 3 */ 249 bool nosort_pci:1; /* Bit 3 */
253 bool MultiMasterFirst:1;/* Bit 4 */ 250 bool multimaster_first:1; /* Bit 4 */
254 bool FlashPointFirst:1; /* Bit 5 */ 251 bool flashpoint_first:1; /* Bit 5 */
255 bool LimitedProbeISA:1; /* Bit 6 */ 252 bool limited_isa:1; /* Bit 6 */
256 bool Probe330:1; /* Bit 7 */ 253 bool probe330:1; /* Bit 7 */
257 bool Probe334:1; /* Bit 8 */ 254 bool probe334:1; /* Bit 8 */
258 bool Probe230:1; /* Bit 9 */ 255 bool probe230:1; /* Bit 9 */
259 bool Probe234:1; /* Bit 10 */ 256 bool probe234:1; /* Bit 10 */
260 bool Probe130:1; /* Bit 11 */ 257 bool probe130:1; /* Bit 11 */
261 bool Probe134:1; /* Bit 12 */ 258 bool probe134:1; /* Bit 12 */
262}; 259};
263 260
264/* 261/*
265 Define the Global Options. 262 Define the Global Options.
266*/ 263*/
267 264
268struct BusLogic_GlobalOptions { 265struct blogic_global_options {
269 bool TraceProbe:1; /* Bit 0 */ 266 bool trace_probe:1; /* Bit 0 */
270 bool TraceHardwareReset:1; /* Bit 1 */ 267 bool trace_hw_reset:1; /* Bit 1 */
271 bool TraceConfiguration:1; /* Bit 2 */ 268 bool trace_config:1; /* Bit 2 */
272 bool TraceErrors:1; /* Bit 3 */ 269 bool trace_err:1; /* Bit 3 */
273};
274
275/*
276 Define the Local Options.
277*/
278
279struct BusLogic_LocalOptions {
280 bool InhibitTargetInquiry:1; /* Bit 0 */
281}; 270};
282 271
283/* 272/*
284 Define the BusLogic SCSI Host Adapter I/O Register Offsets. 273 Define the BusLogic SCSI Host Adapter I/O Register Offsets.
285*/ 274*/
286 275
287#define BusLogic_ControlRegisterOffset 0 /* WO register */ 276#define BLOGIC_CNTRL_REG 0 /* WO register */
288#define BusLogic_StatusRegisterOffset 0 /* RO register */ 277#define BLOGIC_STATUS_REG 0 /* RO register */
289#define BusLogic_CommandParameterRegisterOffset 1 /* WO register */ 278#define BLOGIC_CMD_PARM_REG 1 /* WO register */
290#define BusLogic_DataInRegisterOffset 1 /* RO register */ 279#define BLOGIC_DATAIN_REG 1 /* RO register */
291#define BusLogic_InterruptRegisterOffset 2 /* RO register */ 280#define BLOGIC_INT_REG 2 /* RO register */
292#define BusLogic_GeometryRegisterOffset 3 /* RO register */ 281#define BLOGIC_GEOMETRY_REG 3 /* RO register */
293 282
294/* 283/*
295 Define the structure of the write-only Control Register. 284 Define the structure of the write-only Control Register.
296*/ 285*/
297 286
298union BusLogic_ControlRegister { 287union blogic_cntrl_reg {
299 unsigned char All; 288 unsigned char all;
300 struct { 289 struct {
301 unsigned char:4; /* Bits 0-3 */ 290 unsigned char:4; /* Bits 0-3 */
302 bool SCSIBusReset:1; /* Bit 4 */ 291 bool bus_reset:1; /* Bit 4 */
303 bool InterruptReset:1; /* Bit 5 */ 292 bool int_reset:1; /* Bit 5 */
304 bool SoftReset:1; /* Bit 6 */ 293 bool soft_reset:1; /* Bit 6 */
305 bool HardReset:1; /* Bit 7 */ 294 bool hard_reset:1; /* Bit 7 */
306 } cr; 295 } cr;
307}; 296};
308 297
@@ -310,17 +299,17 @@ union BusLogic_ControlRegister {
310 Define the structure of the read-only Status Register. 299 Define the structure of the read-only Status Register.
311*/ 300*/
312 301
313union BusLogic_StatusRegister { 302union blogic_stat_reg {
314 unsigned char All; 303 unsigned char all;
315 struct { 304 struct {
316 bool CommandInvalid:1; /* Bit 0 */ 305 bool cmd_invalid:1; /* Bit 0 */
317 bool Reserved:1; /* Bit 1 */ 306 bool rsvd:1; /* Bit 1 */
318 bool DataInRegisterReady:1; /* Bit 2 */ 307 bool datain_ready:1; /* Bit 2 */
319 bool CommandParameterRegisterBusy:1; /* Bit 3 */ 308 bool cmd_param_busy:1; /* Bit 3 */
320 bool HostAdapterReady:1; /* Bit 4 */ 309 bool adapter_ready:1; /* Bit 4 */
321 bool InitializationRequired:1; /* Bit 5 */ 310 bool init_reqd:1; /* Bit 5 */
322 bool DiagnosticFailure:1; /* Bit 6 */ 311 bool diag_failed:1; /* Bit 6 */
323 bool DiagnosticActive:1; /* Bit 7 */ 312 bool diag_active:1; /* Bit 7 */
324 } sr; 313 } sr;
325}; 314};
326 315
@@ -328,15 +317,15 @@ union BusLogic_StatusRegister {
328 Define the structure of the read-only Interrupt Register. 317 Define the structure of the read-only Interrupt Register.
329*/ 318*/
330 319
331union BusLogic_InterruptRegister { 320union blogic_int_reg {
332 unsigned char All; 321 unsigned char all;
333 struct { 322 struct {
334 bool IncomingMailboxLoaded:1; /* Bit 0 */ 323 bool mailin_loaded:1; /* Bit 0 */
335 bool OutgoingMailboxAvailable:1;/* Bit 1 */ 324 bool mailout_avail:1; /* Bit 1 */
336 bool CommandComplete:1; /* Bit 2 */ 325 bool cmd_complete:1; /* Bit 2 */
337 bool ExternalBusReset:1; /* Bit 3 */ 326 bool ext_busreset:1; /* Bit 3 */
338 unsigned char Reserved:3; /* Bits 4-6 */ 327 unsigned char rsvd:3; /* Bits 4-6 */
339 bool InterruptValid:1; /* Bit 7 */ 328 bool int_valid:1; /* Bit 7 */
340 } ir; 329 } ir;
341}; 330};
342 331
@@ -344,13 +333,13 @@ union BusLogic_InterruptRegister {
344 Define the structure of the read-only Geometry Register. 333 Define the structure of the read-only Geometry Register.
345*/ 334*/
346 335
347union BusLogic_GeometryRegister { 336union blogic_geo_reg {
348 unsigned char All; 337 unsigned char all;
349 struct { 338 struct {
350 enum BusLogic_BIOS_DiskGeometryTranslation Drive0Geometry:2; /* Bits 0-1 */ 339 enum blogic_bios_diskgeometry d0_geo:2; /* Bits 0-1 */
351 enum BusLogic_BIOS_DiskGeometryTranslation Drive1Geometry:2; /* Bits 2-3 */ 340 enum blogic_bios_diskgeometry d1_geo:2; /* Bits 2-3 */
352 unsigned char:3; /* Bits 4-6 */ 341 unsigned char:3; /* Bits 4-6 */
353 bool ExtendedTranslationEnabled:1; /* Bit 7 */ 342 bool ext_trans_enable:1; /* Bit 7 */
354 } gr; 343 } gr;
355}; 344};
356 345
@@ -358,82 +347,82 @@ union BusLogic_GeometryRegister {
358 Define the BusLogic SCSI Host Adapter Command Register Operation Codes. 347 Define the BusLogic SCSI Host Adapter Command Register Operation Codes.
359*/ 348*/
360 349
361enum BusLogic_OperationCode { 350enum blogic_opcode {
362 BusLogic_TestCommandCompleteInterrupt = 0x00, 351 BLOGIC_TEST_CMP_COMPLETE = 0x00,
363 BusLogic_InitializeMailbox = 0x01, 352 BLOGIC_INIT_MBOX = 0x01,
364 BusLogic_ExecuteMailboxCommand = 0x02, 353 BLOGIC_EXEC_MBOX_CMD = 0x02,
365 BusLogic_ExecuteBIOSCommand = 0x03, 354 BLOGIC_EXEC_BIOS_CMD = 0x03,
366 BusLogic_InquireBoardID = 0x04, 355 BLOGIC_GET_BOARD_ID = 0x04,
367 BusLogic_EnableOutgoingMailboxAvailableInt = 0x05, 356 BLOGIC_ENABLE_OUTBOX_AVAIL_INT = 0x05,
368 BusLogic_SetSCSISelectionTimeout = 0x06, 357 BLOGIC_SET_SELECT_TIMEOUT = 0x06,
369 BusLogic_SetPreemptTimeOnBus = 0x07, 358 BLOGIC_SET_PREEMPT_TIME = 0x07,
370 BusLogic_SetTimeOffBus = 0x08, 359 BLOGIC_SET_TIMEOFF_BUS = 0x08,
371 BusLogic_SetBusTransferRate = 0x09, 360 BLOGIC_SET_TXRATE = 0x09,
372 BusLogic_InquireInstalledDevicesID0to7 = 0x0A, 361 BLOGIC_INQ_DEV0TO7 = 0x0A,
373 BusLogic_InquireConfiguration = 0x0B, 362 BLOGIC_INQ_CONFIG = 0x0B,
374 BusLogic_EnableTargetMode = 0x0C, 363 BLOGIC_TGT_MODE = 0x0C,
375 BusLogic_InquireSetupInformation = 0x0D, 364 BLOGIC_INQ_SETUPINFO = 0x0D,
376 BusLogic_WriteAdapterLocalRAM = 0x1A, 365 BLOGIC_WRITE_LOCALRAM = 0x1A,
377 BusLogic_ReadAdapterLocalRAM = 0x1B, 366 BLOGIC_READ_LOCALRAM = 0x1B,
378 BusLogic_WriteBusMasterChipFIFO = 0x1C, 367 BLOGIC_WRITE_BUSMASTER_FIFO = 0x1C,
379 BusLogic_ReadBusMasterChipFIFO = 0x1D, 368 BLOGIC_READ_BUSMASTER_FIFO = 0x1D,
380 BusLogic_EchoCommandData = 0x1F, 369 BLOGIC_ECHO_CMDDATA = 0x1F,
381 BusLogic_HostAdapterDiagnostic = 0x20, 370 BLOGIC_ADAPTER_DIAG = 0x20,
382 BusLogic_SetAdapterOptions = 0x21, 371 BLOGIC_SET_OPTIONS = 0x21,
383 BusLogic_InquireInstalledDevicesID8to15 = 0x23, 372 BLOGIC_INQ_DEV8TO15 = 0x23,
384 BusLogic_InquireTargetDevices = 0x24, 373 BLOGIC_INQ_DEV = 0x24,
385 BusLogic_DisableHostAdapterInterrupt = 0x25, 374 BLOGIC_DISABLE_INT = 0x25,
386 BusLogic_InitializeExtendedMailbox = 0x81, 375 BLOGIC_INIT_EXT_MBOX = 0x81,
387 BusLogic_ExecuteSCSICommand = 0x83, 376 BLOGIC_EXEC_SCS_CMD = 0x83,
388 BusLogic_InquireFirmwareVersion3rdDigit = 0x84, 377 BLOGIC_INQ_FWVER_D3 = 0x84,
389 BusLogic_InquireFirmwareVersionLetter = 0x85, 378 BLOGIC_INQ_FWVER_LETTER = 0x85,
390 BusLogic_InquirePCIHostAdapterInformation = 0x86, 379 BLOGIC_INQ_PCI_INFO = 0x86,
391 BusLogic_InquireHostAdapterModelNumber = 0x8B, 380 BLOGIC_INQ_MODELNO = 0x8B,
392 BusLogic_InquireSynchronousPeriod = 0x8C, 381 BLOGIC_INQ_SYNC_PERIOD = 0x8C,
393 BusLogic_InquireExtendedSetupInformation = 0x8D, 382 BLOGIC_INQ_EXTSETUP = 0x8D,
394 BusLogic_EnableStrictRoundRobinMode = 0x8F, 383 BLOGIC_STRICT_RR = 0x8F,
395 BusLogic_StoreHostAdapterLocalRAM = 0x90, 384 BLOGIC_STORE_LOCALRAM = 0x90,
396 BusLogic_FetchHostAdapterLocalRAM = 0x91, 385 BLOGIC_FETCH_LOCALRAM = 0x91,
397 BusLogic_StoreLocalDataInEEPROM = 0x92, 386 BLOGIC_STORE_TO_EEPROM = 0x92,
398 BusLogic_UploadAutoSCSICode = 0x94, 387 BLOGIC_LOAD_AUTOSCSICODE = 0x94,
399 BusLogic_ModifyIOAddress = 0x95, 388 BLOGIC_MOD_IOADDR = 0x95,
400 BusLogic_SetCCBFormat = 0x96, 389 BLOGIC_SETCCB_FMT = 0x96,
401 BusLogic_WriteInquiryBuffer = 0x9A, 390 BLOGIC_WRITE_INQBUF = 0x9A,
402 BusLogic_ReadInquiryBuffer = 0x9B, 391 BLOGIC_READ_INQBUF = 0x9B,
403 BusLogic_FlashROMUploadDownload = 0xA7, 392 BLOGIC_FLASH_LOAD = 0xA7,
404 BusLogic_ReadSCAMData = 0xA8, 393 BLOGIC_READ_SCAMDATA = 0xA8,
405 BusLogic_WriteSCAMData = 0xA9 394 BLOGIC_WRITE_SCAMDATA = 0xA9
406}; 395};
407 396
408/* 397/*
409 Define the Inquire Board ID reply structure. 398 Define the Inquire Board ID reply structure.
410*/ 399*/
411 400
412struct BusLogic_BoardID { 401struct blogic_board_id {
413 unsigned char BoardType; /* Byte 0 */ 402 unsigned char type; /* Byte 0 */
414 unsigned char CustomFeatures; /* Byte 1 */ 403 unsigned char custom_features; /* Byte 1 */
415 unsigned char FirmwareVersion1stDigit; /* Byte 2 */ 404 unsigned char fw_ver_digit1; /* Byte 2 */
416 unsigned char FirmwareVersion2ndDigit; /* Byte 3 */ 405 unsigned char fw_ver_digit2; /* Byte 3 */
417}; 406};
418 407
419/* 408/*
420 Define the Inquire Configuration reply structure. 409 Define the Inquire Configuration reply structure.
421*/ 410*/
422 411
423struct BusLogic_Configuration { 412struct blogic_config {
424 unsigned char:5; /* Byte 0 Bits 0-4 */ 413 unsigned char:5; /* Byte 0 Bits 0-4 */
425 bool DMA_Channel5:1; /* Byte 0 Bit 5 */ 414 bool dma_ch5:1; /* Byte 0 Bit 5 */
426 bool DMA_Channel6:1; /* Byte 0 Bit 6 */ 415 bool dma_ch6:1; /* Byte 0 Bit 6 */
427 bool DMA_Channel7:1; /* Byte 0 Bit 7 */ 416 bool dma_ch7:1; /* Byte 0 Bit 7 */
428 bool IRQ_Channel9:1; /* Byte 1 Bit 0 */ 417 bool irq_ch9:1; /* Byte 1 Bit 0 */
429 bool IRQ_Channel10:1; /* Byte 1 Bit 1 */ 418 bool irq_ch10:1; /* Byte 1 Bit 1 */
430 bool IRQ_Channel11:1; /* Byte 1 Bit 2 */ 419 bool irq_ch11:1; /* Byte 1 Bit 2 */
431 bool IRQ_Channel12:1; /* Byte 1 Bit 3 */ 420 bool irq_ch12:1; /* Byte 1 Bit 3 */
432 unsigned char:1; /* Byte 1 Bit 4 */ 421 unsigned char:1; /* Byte 1 Bit 4 */
433 bool IRQ_Channel14:1; /* Byte 1 Bit 5 */ 422 bool irq_ch14:1; /* Byte 1 Bit 5 */
434 bool IRQ_Channel15:1; /* Byte 1 Bit 6 */ 423 bool irq_ch15:1; /* Byte 1 Bit 6 */
435 unsigned char:1; /* Byte 1 Bit 7 */ 424 unsigned char:1; /* Byte 1 Bit 7 */
436 unsigned char HostAdapterID:4; /* Byte 2 Bits 0-3 */ 425 unsigned char id:4; /* Byte 2 Bits 0-3 */
437 unsigned char:4; /* Byte 2 Bits 4-7 */ 426 unsigned char:4; /* Byte 2 Bits 4-7 */
438}; 427};
439 428
@@ -441,42 +430,42 @@ struct BusLogic_Configuration {
441 Define the Inquire Setup Information reply structure. 430 Define the Inquire Setup Information reply structure.
442*/ 431*/
443 432
444struct BusLogic_SynchronousValue { 433struct blogic_syncval {
445 unsigned char Offset:4; /* Bits 0-3 */ 434 unsigned char offset:4; /* Bits 0-3 */
446 unsigned char TransferPeriod:3; /* Bits 4-6 */ 435 unsigned char tx_period:3; /* Bits 4-6 */
447 bool Synchronous:1; /* Bit 7 */ 436 bool sync:1; /* Bit 7 */
448}; 437};
449 438
450struct BusLogic_SetupInformation { 439struct blogic_setup_info {
451 bool SynchronousInitiationEnabled:1; /* Byte 0 Bit 0 */ 440 bool sync:1; /* Byte 0 Bit 0 */
452 bool ParityCheckingEnabled:1; /* Byte 0 Bit 1 */ 441 bool parity:1; /* Byte 0 Bit 1 */
453 unsigned char:6; /* Byte 0 Bits 2-7 */ 442 unsigned char:6; /* Byte 0 Bits 2-7 */
454 unsigned char BusTransferRate; /* Byte 1 */ 443 unsigned char tx_rate; /* Byte 1 */
455 unsigned char PreemptTimeOnBus; /* Byte 2 */ 444 unsigned char preempt_time; /* Byte 2 */
456 unsigned char TimeOffBus; /* Byte 3 */ 445 unsigned char timeoff_bus; /* Byte 3 */
457 unsigned char MailboxCount; /* Byte 4 */ 446 unsigned char mbox_count; /* Byte 4 */
458 unsigned char MailboxAddress[3]; /* Bytes 5-7 */ 447 unsigned char mbox_addr[3]; /* Bytes 5-7 */
459 struct BusLogic_SynchronousValue SynchronousValuesID0to7[8]; /* Bytes 8-15 */ 448 struct blogic_syncval sync0to7[8]; /* Bytes 8-15 */
460 unsigned char DisconnectPermittedID0to7; /* Byte 16 */ 449 unsigned char disconnect_ok0to7; /* Byte 16 */
461 unsigned char Signature; /* Byte 17 */ 450 unsigned char sig; /* Byte 17 */
462 unsigned char CharacterD; /* Byte 18 */ 451 unsigned char char_d; /* Byte 18 */
463 unsigned char HostBusType; /* Byte 19 */ 452 unsigned char bus_type; /* Byte 19 */
464 unsigned char WideTransfersPermittedID0to7; /* Byte 20 */ 453 unsigned char wide_tx_ok0to7; /* Byte 20 */
465 unsigned char WideTransfersActiveID0to7; /* Byte 21 */ 454 unsigned char wide_tx_active0to7; /* Byte 21 */
466 struct BusLogic_SynchronousValue SynchronousValuesID8to15[8]; /* Bytes 22-29 */ 455 struct blogic_syncval sync8to15[8]; /* Bytes 22-29 */
467 unsigned char DisconnectPermittedID8to15; /* Byte 30 */ 456 unsigned char disconnect_ok8to15; /* Byte 30 */
468 unsigned char:8; /* Byte 31 */ 457 unsigned char:8; /* Byte 31 */
469 unsigned char WideTransfersPermittedID8to15; /* Byte 32 */ 458 unsigned char wide_tx_ok8to15; /* Byte 32 */
470 unsigned char WideTransfersActiveID8to15; /* Byte 33 */ 459 unsigned char wide_tx_active8to15; /* Byte 33 */
471}; 460};
472 461
473/* 462/*
474 Define the Initialize Extended Mailbox request structure. 463 Define the Initialize Extended Mailbox request structure.
475*/ 464*/
476 465
477struct BusLogic_ExtendedMailboxRequest { 466struct blogic_extmbox_req {
478 unsigned char MailboxCount; /* Byte 0 */ 467 unsigned char mbox_count; /* Byte 0 */
479 u32 BaseMailboxAddress; /* Bytes 1-4 */ 468 u32 base_mbox_addr; /* Bytes 1-4 */
480} PACKED; 469} PACKED;
481 470
482 471
@@ -486,63 +475,63 @@ struct BusLogic_ExtendedMailboxRequest {
486 the Modify I/O Address command. 475 the Modify I/O Address command.
487*/ 476*/
488 477
489enum BusLogic_ISACompatibleIOPort { 478enum blogic_isa_ioport {
490 BusLogic_IO_330 = 0, 479 BLOGIC_IO_330 = 0,
491 BusLogic_IO_334 = 1, 480 BLOGIC_IO_334 = 1,
492 BusLogic_IO_230 = 2, 481 BLOGIC_IO_230 = 2,
493 BusLogic_IO_234 = 3, 482 BLOGIC_IO_234 = 3,
494 BusLogic_IO_130 = 4, 483 BLOGIC_IO_130 = 4,
495 BusLogic_IO_134 = 5, 484 BLOGIC_IO_134 = 5,
496 BusLogic_IO_Disable = 6, 485 BLOGIC_IO_DISABLE = 6,
497 BusLogic_IO_Disable2 = 7 486 BLOGIC_IO_DISABLE2 = 7
498} PACKED; 487} PACKED;
499 488
500struct BusLogic_PCIHostAdapterInformation { 489struct blogic_adapter_info {
501 enum BusLogic_ISACompatibleIOPort ISACompatibleIOPort; /* Byte 0 */ 490 enum blogic_isa_ioport isa_port; /* Byte 0 */
502 unsigned char PCIAssignedIRQChannel; /* Byte 1 */ 491 unsigned char irq_ch; /* Byte 1 */
503 bool LowByteTerminated:1; /* Byte 2 Bit 0 */ 492 bool low_term:1; /* Byte 2 Bit 0 */
504 bool HighByteTerminated:1; /* Byte 2 Bit 1 */ 493 bool high_term:1; /* Byte 2 Bit 1 */
505 unsigned char:2; /* Byte 2 Bits 2-3 */ 494 unsigned char:2; /* Byte 2 Bits 2-3 */
506 bool JP1:1; /* Byte 2 Bit 4 */ 495 bool JP1:1; /* Byte 2 Bit 4 */
507 bool JP2:1; /* Byte 2 Bit 5 */ 496 bool JP2:1; /* Byte 2 Bit 5 */
508 bool JP3:1; /* Byte 2 Bit 6 */ 497 bool JP3:1; /* Byte 2 Bit 6 */
509 bool GenericInfoValid:1;/* Byte 2 Bit 7 */ 498 bool genericinfo_valid:1; /* Byte 2 Bit 7 */
510 unsigned char:8; /* Byte 3 */ 499 unsigned char:8; /* Byte 3 */
511}; 500};
512 501
513/* 502/*
514 Define the Inquire Extended Setup Information reply structure. 503 Define the Inquire Extended Setup Information reply structure.
515*/ 504*/
516 505
517struct BusLogic_ExtendedSetupInformation { 506struct blogic_ext_setup {
518 unsigned char BusType; /* Byte 0 */ 507 unsigned char bus_type; /* Byte 0 */
519 unsigned char BIOS_Address; /* Byte 1 */ 508 unsigned char bios_addr; /* Byte 1 */
520 unsigned short ScatterGatherLimit; /* Bytes 2-3 */ 509 unsigned short sg_limit; /* Bytes 2-3 */
521 unsigned char MailboxCount; /* Byte 4 */ 510 unsigned char mbox_count; /* Byte 4 */
522 u32 BaseMailboxAddress; /* Bytes 5-8 */ 511 u32 base_mbox_addr; /* Bytes 5-8 */
523 struct { 512 struct {
524 unsigned char:2; /* Byte 9 Bits 0-1 */ 513 unsigned char:2; /* Byte 9 Bits 0-1 */
525 bool FastOnEISA:1; /* Byte 9 Bit 2 */ 514 bool fast_on_eisa:1; /* Byte 9 Bit 2 */
526 unsigned char:3; /* Byte 9 Bits 3-5 */ 515 unsigned char:3; /* Byte 9 Bits 3-5 */
527 bool LevelSensitiveInterrupt:1; /* Byte 9 Bit 6 */ 516 bool level_int:1; /* Byte 9 Bit 6 */
528 unsigned char:1; /* Byte 9 Bit 7 */ 517 unsigned char:1; /* Byte 9 Bit 7 */
529 } Misc; 518 } misc;
530 unsigned char FirmwareRevision[3]; /* Bytes 10-12 */ 519 unsigned char fw_rev[3]; /* Bytes 10-12 */
531 bool HostWideSCSI:1; /* Byte 13 Bit 0 */ 520 bool wide:1; /* Byte 13 Bit 0 */
532 bool HostDifferentialSCSI:1; /* Byte 13 Bit 1 */ 521 bool differential:1; /* Byte 13 Bit 1 */
533 bool HostSupportsSCAM:1; /* Byte 13 Bit 2 */ 522 bool scam:1; /* Byte 13 Bit 2 */
534 bool HostUltraSCSI:1; /* Byte 13 Bit 3 */ 523 bool ultra:1; /* Byte 13 Bit 3 */
535 bool HostSmartTermination:1; /* Byte 13 Bit 4 */ 524 bool smart_term:1; /* Byte 13 Bit 4 */
536 unsigned char:3; /* Byte 13 Bits 5-7 */ 525 unsigned char:3; /* Byte 13 Bits 5-7 */
537} PACKED; 526} PACKED;
538 527
539/* 528/*
540 Define the Enable Strict Round Robin Mode request type. 529 Define the Enable Strict Round Robin Mode request type.
541*/ 530*/
542 531
543enum BusLogic_RoundRobinModeRequest { 532enum blogic_rr_req {
544 BusLogic_AggressiveRoundRobinMode = 0, 533 BLOGIC_AGGRESSIVE_RR = 0,
545 BusLogic_StrictRoundRobinMode = 1 534 BLOGIC_STRICT_RR_MODE = 1
546} PACKED; 535} PACKED;
547 536
548 537
@@ -550,95 +539,95 @@ enum BusLogic_RoundRobinModeRequest {
550 Define the Fetch Host Adapter Local RAM request type. 539 Define the Fetch Host Adapter Local RAM request type.
551*/ 540*/
552 541
553#define BusLogic_BIOS_BaseOffset 0 542#define BLOGIC_BIOS_BASE 0
554#define BusLogic_AutoSCSI_BaseOffset 64 543#define BLOGIC_AUTOSCSI_BASE 64
555 544
556struct BusLogic_FetchHostAdapterLocalRAMRequest { 545struct blogic_fetch_localram {
557 unsigned char ByteOffset; /* Byte 0 */ 546 unsigned char offset; /* Byte 0 */
558 unsigned char ByteCount; /* Byte 1 */ 547 unsigned char count; /* Byte 1 */
559}; 548};
560 549
561/* 550/*
562 Define the Host Adapter Local RAM AutoSCSI structure. 551 Define the Host Adapter Local RAM AutoSCSI structure.
563*/ 552*/
564 553
565struct BusLogic_AutoSCSIData { 554struct blogic_autoscsi {
566 unsigned char InternalFactorySignature[2]; /* Bytes 0-1 */ 555 unsigned char factory_sig[2]; /* Bytes 0-1 */
567 unsigned char InformationByteCount; /* Byte 2 */ 556 unsigned char info_bytes; /* Byte 2 */
568 unsigned char HostAdapterType[6]; /* Bytes 3-8 */ 557 unsigned char adapter_type[6]; /* Bytes 3-8 */
569 unsigned char:8; /* Byte 9 */ 558 unsigned char:8; /* Byte 9 */
570 bool FloppyEnabled:1; /* Byte 10 Bit 0 */ 559 bool floppy:1; /* Byte 10 Bit 0 */
571 bool FloppySecondary:1; /* Byte 10 Bit 1 */ 560 bool floppy_sec:1; /* Byte 10 Bit 1 */
572 bool LevelSensitiveInterrupt:1; /* Byte 10 Bit 2 */ 561 bool level_int:1; /* Byte 10 Bit 2 */
573 unsigned char:2; /* Byte 10 Bits 3-4 */ 562 unsigned char:2; /* Byte 10 Bits 3-4 */
574 unsigned char SystemRAMAreaForBIOS:3; /* Byte 10 Bits 5-7 */ 563 unsigned char systemram_bios:3; /* Byte 10 Bits 5-7 */
575 unsigned char DMA_Channel:7; /* Byte 11 Bits 0-6 */ 564 unsigned char dma_ch:7; /* Byte 11 Bits 0-6 */
576 bool DMA_AutoConfiguration:1; /* Byte 11 Bit 7 */ 565 bool dma_autoconf:1; /* Byte 11 Bit 7 */
577 unsigned char IRQ_Channel:7; /* Byte 12 Bits 0-6 */ 566 unsigned char irq_ch:7; /* Byte 12 Bits 0-6 */
578 bool IRQ_AutoConfiguration:1; /* Byte 12 Bit 7 */ 567 bool irq_autoconf:1; /* Byte 12 Bit 7 */
579 unsigned char DMA_TransferRate; /* Byte 13 */ 568 unsigned char dma_tx_rate; /* Byte 13 */
580 unsigned char SCSI_ID; /* Byte 14 */ 569 unsigned char scsi_id; /* Byte 14 */
581 bool LowByteTerminated:1; /* Byte 15 Bit 0 */ 570 bool low_term:1; /* Byte 15 Bit 0 */
582 bool ParityCheckingEnabled:1; /* Byte 15 Bit 1 */ 571 bool parity:1; /* Byte 15 Bit 1 */
583 bool HighByteTerminated:1; /* Byte 15 Bit 2 */ 572 bool high_term:1; /* Byte 15 Bit 2 */
584 bool NoisyCablingEnvironment:1; /* Byte 15 Bit 3 */ 573 bool noisy_cable:1; /* Byte 15 Bit 3 */
585 bool FastSynchronousNegotiation:1; /* Byte 15 Bit 4 */ 574 bool fast_sync_neg:1; /* Byte 15 Bit 4 */
586 bool BusResetEnabled:1; /* Byte 15 Bit 5 */ 575 bool reset_enabled:1; /* Byte 15 Bit 5 */
587 bool:1; /* Byte 15 Bit 6 */ 576 bool:1; /* Byte 15 Bit 6 */
588 bool ActiveNegationEnabled:1; /* Byte 15 Bit 7 */ 577 bool active_negation:1; /* Byte 15 Bit 7 */
589 unsigned char BusOnDelay; /* Byte 16 */ 578 unsigned char bus_on_delay; /* Byte 16 */
590 unsigned char BusOffDelay; /* Byte 17 */ 579 unsigned char bus_off_delay; /* Byte 17 */
591 bool HostAdapterBIOSEnabled:1; /* Byte 18 Bit 0 */ 580 bool bios_enabled:1; /* Byte 18 Bit 0 */
592 bool BIOSRedirectionOfINT19Enabled:1; /* Byte 18 Bit 1 */ 581 bool int19_redir_enabled:1; /* Byte 18 Bit 1 */
593 bool ExtendedTranslationEnabled:1; /* Byte 18 Bit 2 */ 582 bool ext_trans_enable:1; /* Byte 18 Bit 2 */
594 bool MapRemovableAsFixedEnabled:1; /* Byte 18 Bit 3 */ 583 bool removable_as_fixed:1; /* Byte 18 Bit 3 */
595 bool:1; /* Byte 18 Bit 4 */ 584 bool:1; /* Byte 18 Bit 4 */
596 bool BIOSSupportsMoreThan2DrivesEnabled:1; /* Byte 18 Bit 5 */ 585 bool morethan2_drives:1; /* Byte 18 Bit 5 */
597 bool BIOSInterruptModeEnabled:1; /* Byte 18 Bit 6 */ 586 bool bios_int:1; /* Byte 18 Bit 6 */
598 bool FlopticalSupportEnabled:1; /* Byte 19 Bit 7 */ 587 bool floptical:1; /* Byte 19 Bit 7 */
599 unsigned short DeviceEnabled; /* Bytes 19-20 */ 588 unsigned short dev_enabled; /* Bytes 19-20 */
600 unsigned short WidePermitted; /* Bytes 21-22 */ 589 unsigned short wide_ok; /* Bytes 21-22 */
601 unsigned short FastPermitted; /* Bytes 23-24 */ 590 unsigned short fast_ok; /* Bytes 23-24 */
602 unsigned short SynchronousPermitted; /* Bytes 25-26 */ 591 unsigned short sync_ok; /* Bytes 25-26 */
603 unsigned short DisconnectPermitted; /* Bytes 27-28 */ 592 unsigned short discon_ok; /* Bytes 27-28 */
604 unsigned short SendStartUnitCommand; /* Bytes 29-30 */ 593 unsigned short send_start_unit; /* Bytes 29-30 */
605 unsigned short IgnoreInBIOSScan; /* Bytes 31-32 */ 594 unsigned short ignore_bios_scan; /* Bytes 31-32 */
606 unsigned char PCIInterruptPin:2; /* Byte 33 Bits 0-1 */ 595 unsigned char pci_int_pin:2; /* Byte 33 Bits 0-1 */
607 unsigned char HostAdapterIOPortAddress:2; /* Byte 33 Bits 2-3 */ 596 unsigned char adapter_ioport:2; /* Byte 33 Bits 2-3 */
608 bool StrictRoundRobinModeEnabled:1; /* Byte 33 Bit 4 */ 597 bool strict_rr_enabled:1; /* Byte 33 Bit 4 */
609 bool VESABusSpeedGreaterThan33MHz:1; /* Byte 33 Bit 5 */ 598 bool vesabus_33mhzplus:1; /* Byte 33 Bit 5 */
610 bool VESABurstWriteEnabled:1; /* Byte 33 Bit 6 */ 599 bool vesa_burst_write:1; /* Byte 33 Bit 6 */
611 bool VESABurstReadEnabled:1; /* Byte 33 Bit 7 */ 600 bool vesa_burst_read:1; /* Byte 33 Bit 7 */
612 unsigned short UltraPermitted; /* Bytes 34-35 */ 601 unsigned short ultra_ok; /* Bytes 34-35 */
613 unsigned int:32; /* Bytes 36-39 */ 602 unsigned int:32; /* Bytes 36-39 */
614 unsigned char:8; /* Byte 40 */ 603 unsigned char:8; /* Byte 40 */
615 unsigned char AutoSCSIMaximumLUN; /* Byte 41 */ 604 unsigned char autoscsi_maxlun; /* Byte 41 */
616 bool:1; /* Byte 42 Bit 0 */ 605 bool:1; /* Byte 42 Bit 0 */
617 bool SCAM_Dominant:1; /* Byte 42 Bit 1 */ 606 bool scam_dominant:1; /* Byte 42 Bit 1 */
618 bool SCAM_Enabled:1; /* Byte 42 Bit 2 */ 607 bool scam_enabled:1; /* Byte 42 Bit 2 */
619 bool SCAM_Level2:1; /* Byte 42 Bit 3 */ 608 bool scam_lev2:1; /* Byte 42 Bit 3 */
620 unsigned char:4; /* Byte 42 Bits 4-7 */ 609 unsigned char:4; /* Byte 42 Bits 4-7 */
621 bool INT13ExtensionEnabled:1; /* Byte 43 Bit 0 */ 610 bool int13_exten:1; /* Byte 43 Bit 0 */
622 bool:1; /* Byte 43 Bit 1 */ 611 bool:1; /* Byte 43 Bit 1 */
623 bool CDROMBootEnabled:1; /* Byte 43 Bit 2 */ 612 bool cd_boot:1; /* Byte 43 Bit 2 */
624 unsigned char:5; /* Byte 43 Bits 3-7 */ 613 unsigned char:5; /* Byte 43 Bits 3-7 */
625 unsigned char BootTargetID:4; /* Byte 44 Bits 0-3 */ 614 unsigned char boot_id:4; /* Byte 44 Bits 0-3 */
626 unsigned char BootChannel:4; /* Byte 44 Bits 4-7 */ 615 unsigned char boot_ch:4; /* Byte 44 Bits 4-7 */
627 unsigned char ForceBusDeviceScanningOrder:1; /* Byte 45 Bit 0 */ 616 unsigned char force_scan_order:1; /* Byte 45 Bit 0 */
628 unsigned char:7; /* Byte 45 Bits 1-7 */ 617 unsigned char:7; /* Byte 45 Bits 1-7 */
629 unsigned short NonTaggedToAlternateLUNPermitted; /* Bytes 46-47 */ 618 unsigned short nontagged_to_alt_ok; /* Bytes 46-47 */
630 unsigned short RenegotiateSyncAfterCheckCondition; /* Bytes 48-49 */ 619 unsigned short reneg_sync_on_check; /* Bytes 48-49 */
631 unsigned char Reserved[10]; /* Bytes 50-59 */ 620 unsigned char rsvd[10]; /* Bytes 50-59 */
632 unsigned char ManufacturingDiagnostic[2]; /* Bytes 60-61 */ 621 unsigned char manuf_diag[2]; /* Bytes 60-61 */
633 unsigned short Checksum; /* Bytes 62-63 */ 622 unsigned short cksum; /* Bytes 62-63 */
634} PACKED; 623} PACKED;
635 624
636/* 625/*
637 Define the Host Adapter Local RAM Auto SCSI Byte 45 structure. 626 Define the Host Adapter Local RAM Auto SCSI Byte 45 structure.
638*/ 627*/
639 628
640struct BusLogic_AutoSCSIByte45 { 629struct blogic_autoscsi_byte45 {
641 unsigned char ForceBusDeviceScanningOrder:1; /* Bit 0 */ 630 unsigned char force_scan_order:1; /* Bit 0 */
642 unsigned char:7; /* Bits 1-7 */ 631 unsigned char:7; /* Bits 1-7 */
643}; 632};
644 633
@@ -646,13 +635,13 @@ struct BusLogic_AutoSCSIByte45 {
646 Define the Host Adapter Local RAM BIOS Drive Map Byte structure. 635 Define the Host Adapter Local RAM BIOS Drive Map Byte structure.
647*/ 636*/
648 637
649#define BusLogic_BIOS_DriveMapOffset 17 638#define BLOGIC_BIOS_DRVMAP 17
650 639
651struct BusLogic_BIOSDriveMapByte { 640struct blogic_bios_drvmap {
652 unsigned char TargetIDBit3:1; /* Bit 0 */ 641 unsigned char tgt_idbit3:1; /* Bit 0 */
653 unsigned char:2; /* Bits 1-2 */ 642 unsigned char:2; /* Bits 1-2 */
654 enum BusLogic_BIOS_DiskGeometryTranslation DiskGeometry:2; /* Bits 3-4 */ 643 enum blogic_bios_diskgeometry diskgeom:2; /* Bits 3-4 */
655 unsigned char TargetID:3; /* Bits 5-7 */ 644 unsigned char tgt_id:3; /* Bits 5-7 */
656}; 645};
657 646
658/* 647/*
@@ -660,19 +649,19 @@ struct BusLogic_BIOSDriveMapByte {
660 necessary to support more than 8 Logical Units per Target Device. 649 necessary to support more than 8 Logical Units per Target Device.
661*/ 650*/
662 651
663enum BusLogic_SetCCBFormatRequest { 652enum blogic_setccb_fmt {
664 BusLogic_LegacyLUNFormatCCB = 0, 653 BLOGIC_LEGACY_LUN_CCB = 0,
665 BusLogic_ExtendedLUNFormatCCB = 1 654 BLOGIC_EXT_LUN_CCB = 1
666} PACKED; 655} PACKED;
667 656
668/* 657/*
669 Define the Outgoing Mailbox Action Codes. 658 Define the Outgoing Mailbox Action Codes.
670*/ 659*/
671 660
672enum BusLogic_ActionCode { 661enum blogic_action {
673 BusLogic_OutgoingMailboxFree = 0x00, 662 BLOGIC_OUTBOX_FREE = 0x00,
674 BusLogic_MailboxStartCommand = 0x01, 663 BLOGIC_MBOX_START = 0x01,
675 BusLogic_MailboxAbortCommand = 0x02 664 BLOGIC_MBOX_ABORT = 0x02
676} PACKED; 665} PACKED;
677 666
678 667
@@ -682,26 +671,26 @@ enum BusLogic_ActionCode {
682 completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5. 671 completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5.
683*/ 672*/
684 673
685enum BusLogic_CompletionCode { 674enum blogic_cmplt_code {
686 BusLogic_IncomingMailboxFree = 0x00, 675 BLOGIC_INBOX_FREE = 0x00,
687 BusLogic_CommandCompletedWithoutError = 0x01, 676 BLOGIC_CMD_COMPLETE_GOOD = 0x01,
688 BusLogic_CommandAbortedAtHostRequest = 0x02, 677 BLOGIC_CMD_ABORT_BY_HOST = 0x02,
689 BusLogic_AbortedCommandNotFound = 0x03, 678 BLOGIC_CMD_NOTFOUND = 0x03,
690 BusLogic_CommandCompletedWithError = 0x04, 679 BLOGIC_CMD_COMPLETE_ERROR = 0x04,
691 BusLogic_InvalidCCB = 0x05 680 BLOGIC_INVALID_CCB = 0x05
692} PACKED; 681} PACKED;
693 682
694/* 683/*
695 Define the Command Control Block (CCB) Opcodes. 684 Define the Command Control Block (CCB) Opcodes.
696*/ 685*/
697 686
698enum BusLogic_CCB_Opcode { 687enum blogic_ccb_opcode {
699 BusLogic_InitiatorCCB = 0x00, 688 BLOGIC_INITIATOR_CCB = 0x00,
700 BusLogic_TargetCCB = 0x01, 689 BLOGIC_TGT_CCB = 0x01,
701 BusLogic_InitiatorCCB_ScatterGather = 0x02, 690 BLOGIC_INITIATOR_CCB_SG = 0x02,
702 BusLogic_InitiatorCCB_ResidualDataLength = 0x03, 691 BLOGIC_INITIATOR_CCBB_RESIDUAL = 0x03,
703 BusLogic_InitiatorCCB_ScatterGatherResidual = 0x04, 692 BLOGIC_INITIATOR_CCB_SG_RESIDUAL = 0x04,
704 BusLogic_BusDeviceReset = 0x81 693 BLOGIC_BDR = 0x81
705} PACKED; 694} PACKED;
706 695
707 696
@@ -709,11 +698,11 @@ enum BusLogic_CCB_Opcode {
709 Define the CCB Data Direction Codes. 698 Define the CCB Data Direction Codes.
710*/ 699*/
711 700
712enum BusLogic_DataDirection { 701enum blogic_datadir {
713 BusLogic_UncheckedDataTransfer = 0, 702 BLOGIC_UNCHECKED_TX = 0,
714 BusLogic_DataInLengthChecked = 1, 703 BLOGIC_DATAIN_CHECKED = 1,
715 BusLogic_DataOutLengthChecked = 2, 704 BLOGIC_DATAOUT_CHECKED = 2,
716 BusLogic_NoDataTransfer = 3 705 BLOGIC_NOTX = 3
717}; 706};
718 707
719 708
@@ -722,32 +711,32 @@ enum BusLogic_DataDirection {
722 return status code 0x0C; it uses 0x12 for both overruns and underruns. 711 return status code 0x0C; it uses 0x12 for both overruns and underruns.
723*/ 712*/
724 713
725enum BusLogic_HostAdapterStatus { 714enum blogic_adapter_status {
726 BusLogic_CommandCompletedNormally = 0x00, 715 BLOGIC_CMD_CMPLT_NORMAL = 0x00,
727 BusLogic_LinkedCommandCompleted = 0x0A, 716 BLOGIC_LINK_CMD_CMPLT = 0x0A,
728 BusLogic_LinkedCommandCompletedWithFlag = 0x0B, 717 BLOGIC_LINK_CMD_CMPLT_FLAG = 0x0B,
729 BusLogic_DataUnderRun = 0x0C, 718 BLOGIC_DATA_UNDERRUN = 0x0C,
730 BusLogic_SCSISelectionTimeout = 0x11, 719 BLOGIC_SELECT_TIMEOUT = 0x11,
731 BusLogic_DataOverRun = 0x12, 720 BLOGIC_DATA_OVERRUN = 0x12,
732 BusLogic_UnexpectedBusFree = 0x13, 721 BLOGIC_NOEXPECT_BUSFREE = 0x13,
733 BusLogic_InvalidBusPhaseRequested = 0x14, 722 BLOGIC_INVALID_BUSPHASE = 0x14,
734 BusLogic_InvalidOutgoingMailboxActionCode = 0x15, 723 BLOGIC_INVALID_OUTBOX_CODE = 0x15,
735 BusLogic_InvalidCommandOperationCode = 0x16, 724 BLOGIC_INVALID_CMD_CODE = 0x16,
736 BusLogic_LinkedCCBhasInvalidLUN = 0x17, 725 BLOGIC_LINKCCB_BADLUN = 0x17,
737 BusLogic_InvalidCommandParameter = 0x1A, 726 BLOGIC_BAD_CMD_PARAM = 0x1A,
738 BusLogic_AutoRequestSenseFailed = 0x1B, 727 BLOGIC_AUTOREQSENSE_FAIL = 0x1B,
739 BusLogic_TaggedQueuingMessageRejected = 0x1C, 728 BLOGIC_TAGQUEUE_REJECT = 0x1C,
740 BusLogic_UnsupportedMessageReceived = 0x1D, 729 BLOGIC_BAD_MSG_RCVD = 0x1D,
741 BusLogic_HostAdapterHardwareFailed = 0x20, 730 BLOGIC_HW_FAIL = 0x20,
742 BusLogic_TargetFailedResponseToATN = 0x21, 731 BLOGIC_NORESPONSE_TO_ATN = 0x21,
743 BusLogic_HostAdapterAssertedRST = 0x22, 732 BLOGIC_HW_RESET = 0x22,
744 BusLogic_OtherDeviceAssertedRST = 0x23, 733 BLOGIC_RST_FROM_OTHERDEV = 0x23,
745 BusLogic_TargetDeviceReconnectedImproperly = 0x24, 734 BLOGIC_BAD_RECONNECT = 0x24,
746 BusLogic_HostAdapterAssertedBusDeviceReset = 0x25, 735 BLOGIC_HW_BDR = 0x25,
747 BusLogic_AbortQueueGenerated = 0x26, 736 BLOGIC_ABRT_QUEUE = 0x26,
748 BusLogic_HostAdapterSoftwareError = 0x27, 737 BLOGIC_ADAPTER_SW_ERROR = 0x27,
749 BusLogic_HostAdapterHardwareTimeoutError = 0x30, 738 BLOGIC_HW_TIMEOUT = 0x30,
750 BusLogic_SCSIParityErrorDetected = 0x34 739 BLOGIC_PARITY_ERR = 0x34
751} PACKED; 740} PACKED;
752 741
753 742
@@ -755,30 +744,28 @@ enum BusLogic_HostAdapterStatus {
755 Define the SCSI Target Device Status Codes. 744 Define the SCSI Target Device Status Codes.
756*/ 745*/
757 746
758enum BusLogic_TargetDeviceStatus { 747enum blogic_tgt_status {
759 BusLogic_OperationGood = 0x00, 748 BLOGIC_OP_GOOD = 0x00,
760 BusLogic_CheckCondition = 0x02, 749 BLOGIC_CHECKCONDITION = 0x02,
761 BusLogic_DeviceBusy = 0x08 750 BLOGIC_DEVBUSY = 0x08
762} PACKED; 751} PACKED;
763 752
764/* 753/*
765 Define the Queue Tag Codes. 754 Define the Queue Tag Codes.
766*/ 755*/
767 756
768enum BusLogic_QueueTag { 757enum blogic_queuetag {
769 BusLogic_SimpleQueueTag = 0, 758 BLOGIC_SIMPLETAG = 0,
770 BusLogic_HeadOfQueueTag = 1, 759 BLOGIC_HEADTAG = 1,
771 BusLogic_OrderedQueueTag = 2, 760 BLOGIC_ORDEREDTAG = 2,
772 BusLogic_ReservedQT = 3 761 BLOGIC_RSVDTAG = 3
773}; 762};
774 763
775/* 764/*
776 Define the SCSI Command Descriptor Block (CDB). 765 Define the SCSI Command Descriptor Block (CDB).
777*/ 766*/
778 767
779#define BusLogic_CDB_MaxLength 12 768#define BLOGIC_CDB_MAXLEN 12
780
781typedef unsigned char SCSI_CDB_T[BusLogic_CDB_MaxLength];
782 769
783 770
784/* 771/*
@@ -786,20 +773,20 @@ typedef unsigned char SCSI_CDB_T[BusLogic_CDB_MaxLength];
786 Firmware Interface and the FlashPoint SCCB Manager. 773 Firmware Interface and the FlashPoint SCCB Manager.
787*/ 774*/
788 775
789struct BusLogic_ScatterGatherSegment { 776struct blogic_sg_seg {
790 u32 SegmentByteCount; /* Bytes 0-3 */ 777 u32 segbytes; /* Bytes 0-3 */
791 u32 SegmentDataPointer; /* Bytes 4-7 */ 778 u32 segdata; /* Bytes 4-7 */
792}; 779};
793 780
794/* 781/*
795 Define the Driver CCB Status Codes. 782 Define the Driver CCB Status Codes.
796*/ 783*/
797 784
798enum BusLogic_CCB_Status { 785enum blogic_ccb_status {
799 BusLogic_CCB_Free = 0, 786 BLOGIC_CCB_FREE = 0,
800 BusLogic_CCB_Active = 1, 787 BLOGIC_CCB_ACTIVE = 1,
801 BusLogic_CCB_Completed = 2, 788 BLOGIC_CCB_COMPLETE = 2,
802 BusLogic_CCB_Reset = 3 789 BLOGIC_CCB_RESET = 3
803} PACKED; 790} PACKED;
804 791
805 792
@@ -822,79 +809,78 @@ enum BusLogic_CCB_Status {
822 32 Logical Units per Target Device. 809 32 Logical Units per Target Device.
823*/ 810*/
824 811
825struct BusLogic_CCB { 812struct blogic_ccb {
826 /* 813 /*
827 MultiMaster Firmware and FlashPoint SCCB Manager Common Portion. 814 MultiMaster Firmware and FlashPoint SCCB Manager Common Portion.
828 */ 815 */
829 enum BusLogic_CCB_Opcode Opcode; /* Byte 0 */ 816 enum blogic_ccb_opcode opcode; /* Byte 0 */
830 unsigned char:3; /* Byte 1 Bits 0-2 */ 817 unsigned char:3; /* Byte 1 Bits 0-2 */
831 enum BusLogic_DataDirection DataDirection:2; /* Byte 1 Bits 3-4 */ 818 enum blogic_datadir datadir:2; /* Byte 1 Bits 3-4 */
832 bool TagEnable:1; /* Byte 1 Bit 5 */ 819 bool tag_enable:1; /* Byte 1 Bit 5 */
833 enum BusLogic_QueueTag QueueTag:2; /* Byte 1 Bits 6-7 */ 820 enum blogic_queuetag queuetag:2; /* Byte 1 Bits 6-7 */
834 unsigned char CDB_Length; /* Byte 2 */ 821 unsigned char cdblen; /* Byte 2 */
835 unsigned char SenseDataLength; /* Byte 3 */ 822 unsigned char sense_datalen; /* Byte 3 */
836 u32 DataLength; /* Bytes 4-7 */ 823 u32 datalen; /* Bytes 4-7 */
837 u32 DataPointer; /* Bytes 8-11 */ 824 u32 data; /* Bytes 8-11 */
838 unsigned char:8; /* Byte 12 */ 825 unsigned char:8; /* Byte 12 */
839 unsigned char:8; /* Byte 13 */ 826 unsigned char:8; /* Byte 13 */
840 enum BusLogic_HostAdapterStatus HostAdapterStatus; /* Byte 14 */ 827 enum blogic_adapter_status adapter_status; /* Byte 14 */
841 enum BusLogic_TargetDeviceStatus TargetDeviceStatus; /* Byte 15 */ 828 enum blogic_tgt_status tgt_status; /* Byte 15 */
842 unsigned char TargetID; /* Byte 16 */ 829 unsigned char tgt_id; /* Byte 16 */
843 unsigned char LogicalUnit:5; /* Byte 17 Bits 0-4 */ 830 unsigned char lun:5; /* Byte 17 Bits 0-4 */
844 bool LegacyTagEnable:1; /* Byte 17 Bit 5 */ 831 bool legacytag_enable:1; /* Byte 17 Bit 5 */
845 enum BusLogic_QueueTag LegacyQueueTag:2; /* Byte 17 Bits 6-7 */ 832 enum blogic_queuetag legacy_tag:2; /* Byte 17 Bits 6-7 */
846 SCSI_CDB_T CDB; /* Bytes 18-29 */ 833 unsigned char cdb[BLOGIC_CDB_MAXLEN]; /* Bytes 18-29 */
847 unsigned char:8; /* Byte 30 */ 834 unsigned char:8; /* Byte 30 */
848 unsigned char:8; /* Byte 31 */ 835 unsigned char:8; /* Byte 31 */
849 unsigned int:32; /* Bytes 32-35 */ 836 unsigned int:32; /* Bytes 32-35 */
850 u32 SenseDataPointer; /* Bytes 36-39 */ 837 u32 sensedata; /* Bytes 36-39 */
851 /* 838 /*
852 FlashPoint SCCB Manager Defined Portion. 839 FlashPoint SCCB Manager Defined Portion.
853 */ 840 */
854 void (*CallbackFunction) (struct BusLogic_CCB *); /* Bytes 40-43 */ 841 void (*callback) (struct blogic_ccb *); /* Bytes 40-43 */
855 u32 BaseAddress; /* Bytes 44-47 */ 842 u32 base_addr; /* Bytes 44-47 */
856 enum BusLogic_CompletionCode CompletionCode; /* Byte 48 */ 843 enum blogic_cmplt_code comp_code; /* Byte 48 */
857#ifdef CONFIG_SCSI_FLASHPOINT 844#ifdef CONFIG_SCSI_FLASHPOINT
858 unsigned char:8; /* Byte 49 */ 845 unsigned char:8; /* Byte 49 */
859 unsigned short OS_Flags; /* Bytes 50-51 */ 846 unsigned short os_flags; /* Bytes 50-51 */
860 unsigned char Private[48]; /* Bytes 52-99 */ 847 unsigned char private[48]; /* Bytes 52-99 */
861#endif 848#endif
862 /* 849 /*
863 BusLogic Linux Driver Defined Portion. 850 BusLogic Linux Driver Defined Portion.
864 */ 851 */
865 dma_addr_t AllocationGroupHead; 852 dma_addr_t allocgrp_head;
866 unsigned int AllocationGroupSize; 853 unsigned int allocgrp_size;
867 u32 DMA_Handle; 854 u32 dma_handle;
868 enum BusLogic_CCB_Status Status; 855 enum blogic_ccb_status status;
869 unsigned long SerialNumber; 856 unsigned long serial;
870 struct scsi_cmnd *Command; 857 struct scsi_cmnd *command;
871 struct BusLogic_HostAdapter *HostAdapter; 858 struct blogic_adapter *adapter;
872 struct BusLogic_CCB *Next; 859 struct blogic_ccb *next;
873 struct BusLogic_CCB *NextAll; 860 struct blogic_ccb *next_all;
874 struct BusLogic_ScatterGatherSegment 861 struct blogic_sg_seg sglist[BLOGIC_SG_LIMIT];
875 ScatterGatherList[BusLogic_ScatterGatherLimit];
876}; 862};
877 863
878/* 864/*
879 Define the 32 Bit Mode Outgoing Mailbox structure. 865 Define the 32 Bit Mode Outgoing Mailbox structure.
880*/ 866*/
881 867
882struct BusLogic_OutgoingMailbox { 868struct blogic_outbox {
883 u32 CCB; /* Bytes 0-3 */ 869 u32 ccb; /* Bytes 0-3 */
884 unsigned int:24; /* Bytes 4-6 */ 870 unsigned int:24; /* Bytes 4-6 */
885 enum BusLogic_ActionCode ActionCode; /* Byte 7 */ 871 enum blogic_action action; /* Byte 7 */
886}; 872};
887 873
888/* 874/*
889 Define the 32 Bit Mode Incoming Mailbox structure. 875 Define the 32 Bit Mode Incoming Mailbox structure.
890*/ 876*/
891 877
892struct BusLogic_IncomingMailbox { 878struct blogic_inbox {
893 u32 CCB; /* Bytes 0-3 */ 879 u32 ccb; /* Bytes 0-3 */
894 enum BusLogic_HostAdapterStatus HostAdapterStatus; /* Byte 4 */ 880 enum blogic_adapter_status adapter_status; /* Byte 4 */
895 enum BusLogic_TargetDeviceStatus TargetDeviceStatus; /* Byte 5 */ 881 enum blogic_tgt_status tgt_status; /* Byte 5 */
896 unsigned char:8; /* Byte 6 */ 882 unsigned char:8; /* Byte 6 */
897 enum BusLogic_CompletionCode CompletionCode; /* Byte 7 */ 883 enum blogic_cmplt_code comp_code; /* Byte 7 */
898}; 884};
899 885
900 886
@@ -902,64 +888,60 @@ struct BusLogic_IncomingMailbox {
902 Define the BusLogic Driver Options structure. 888 Define the BusLogic Driver Options structure.
903*/ 889*/
904 890
905struct BusLogic_DriverOptions { 891struct blogic_drvr_options {
906 unsigned short TaggedQueuingPermitted; 892 unsigned short tagq_ok;
907 unsigned short TaggedQueuingPermittedMask; 893 unsigned short tagq_ok_mask;
908 unsigned short BusSettleTime; 894 unsigned short bus_settle_time;
909 struct BusLogic_LocalOptions LocalOptions; 895 unsigned short stop_tgt_inquiry;
910 unsigned char CommonQueueDepth; 896 unsigned char common_qdepth;
911 unsigned char QueueDepth[BusLogic_MaxTargetDevices]; 897 unsigned char qdepth[BLOGIC_MAXDEV];
912}; 898};
913 899
914/* 900/*
915 Define the Host Adapter Target Flags structure. 901 Define the Host Adapter Target Flags structure.
916*/ 902*/
917 903
918struct BusLogic_TargetFlags { 904struct blogic_tgt_flags {
919 bool TargetExists:1; 905 bool tgt_exists:1;
920 bool TaggedQueuingSupported:1; 906 bool tagq_ok:1;
921 bool WideTransfersSupported:1; 907 bool wide_ok:1;
922 bool TaggedQueuingActive:1; 908 bool tagq_active:1;
923 bool WideTransfersActive:1; 909 bool wide_active:1;
924 bool CommandSuccessfulFlag:1; 910 bool cmd_good:1;
925 bool TargetInfoReported:1; 911 bool tgt_info_in:1;
926}; 912};
927 913
928/* 914/*
929 Define the Host Adapter Target Statistics structure. 915 Define the Host Adapter Target Statistics structure.
930*/ 916*/
931 917
932#define BusLogic_SizeBuckets 10 918#define BLOGIC_SZ_BUCKETS 10
933 919
934typedef unsigned int BusLogic_CommandSizeBuckets_T[BusLogic_SizeBuckets]; 920struct blogic_tgt_stats {
935 921 unsigned int cmds_tried;
936struct BusLogic_TargetStatistics { 922 unsigned int cmds_complete;
937 unsigned int CommandsAttempted; 923 unsigned int read_cmds;
938 unsigned int CommandsCompleted; 924 unsigned int write_cmds;
939 unsigned int ReadCommands; 925 struct blogic_byte_count bytesread;
940 unsigned int WriteCommands; 926 struct blogic_byte_count byteswritten;
941 struct BusLogic_ByteCounter TotalBytesRead; 927 unsigned int read_sz_buckets[BLOGIC_SZ_BUCKETS];
942 struct BusLogic_ByteCounter TotalBytesWritten; 928 unsigned int write_sz_buckets[BLOGIC_SZ_BUCKETS];
943 BusLogic_CommandSizeBuckets_T ReadCommandSizeBuckets; 929 unsigned short aborts_request;
944 BusLogic_CommandSizeBuckets_T WriteCommandSizeBuckets; 930 unsigned short aborts_tried;
945 unsigned short CommandAbortsRequested; 931 unsigned short aborts_done;
946 unsigned short CommandAbortsAttempted; 932 unsigned short bdr_request;
947 unsigned short CommandAbortsCompleted; 933 unsigned short bdr_tried;
948 unsigned short BusDeviceResetsRequested; 934 unsigned short bdr_done;
949 unsigned short BusDeviceResetsAttempted; 935 unsigned short adatper_reset_req;
950 unsigned short BusDeviceResetsCompleted; 936 unsigned short adapter_reset_attempt;
951 unsigned short HostAdapterResetsRequested; 937 unsigned short adapter_reset_done;
952 unsigned short HostAdapterResetsAttempted;
953 unsigned short HostAdapterResetsCompleted;
954}; 938};
955 939
956/* 940/*
957 Define the FlashPoint Card Handle data type. 941 Define the FlashPoint Card Handle data type.
958*/ 942*/
959 943
960#define FlashPoint_BadCardHandle 0xFFFFFFFF 944#define FPOINT_BADCARD_HANDLE 0xFFFFFFFF
961
962typedef unsigned int FlashPoint_CardHandle_T;
963 945
964 946
965/* 947/*
@@ -967,179 +949,179 @@ typedef unsigned int FlashPoint_CardHandle_T;
967 by the FlashPoint SCCB Manager. 949 by the FlashPoint SCCB Manager.
968*/ 950*/
969 951
970struct FlashPoint_Info { 952struct fpoint_info {
971 u32 BaseAddress; /* Bytes 0-3 */ 953 u32 base_addr; /* Bytes 0-3 */
972 bool Present; /* Byte 4 */ 954 bool present; /* Byte 4 */
973 unsigned char IRQ_Channel; /* Byte 5 */ 955 unsigned char irq_ch; /* Byte 5 */
974 unsigned char SCSI_ID; /* Byte 6 */ 956 unsigned char scsi_id; /* Byte 6 */
975 unsigned char SCSI_LUN; /* Byte 7 */ 957 unsigned char scsi_lun; /* Byte 7 */
976 unsigned short FirmwareRevision; /* Bytes 8-9 */ 958 unsigned short fw_rev; /* Bytes 8-9 */
977 unsigned short SynchronousPermitted; /* Bytes 10-11 */ 959 unsigned short sync_ok; /* Bytes 10-11 */
978 unsigned short FastPermitted; /* Bytes 12-13 */ 960 unsigned short fast_ok; /* Bytes 12-13 */
979 unsigned short UltraPermitted; /* Bytes 14-15 */ 961 unsigned short ultra_ok; /* Bytes 14-15 */
980 unsigned short DisconnectPermitted; /* Bytes 16-17 */ 962 unsigned short discon_ok; /* Bytes 16-17 */
981 unsigned short WidePermitted; /* Bytes 18-19 */ 963 unsigned short wide_ok; /* Bytes 18-19 */
982 bool ParityCheckingEnabled:1; /* Byte 20 Bit 0 */ 964 bool parity:1; /* Byte 20 Bit 0 */
983 bool HostWideSCSI:1; /* Byte 20 Bit 1 */ 965 bool wide:1; /* Byte 20 Bit 1 */
984 bool HostSoftReset:1; /* Byte 20 Bit 2 */ 966 bool softreset:1; /* Byte 20 Bit 2 */
985 bool ExtendedTranslationEnabled:1; /* Byte 20 Bit 3 */ 967 bool ext_trans_enable:1; /* Byte 20 Bit 3 */
986 bool LowByteTerminated:1; /* Byte 20 Bit 4 */ 968 bool low_term:1; /* Byte 20 Bit 4 */
987 bool HighByteTerminated:1; /* Byte 20 Bit 5 */ 969 bool high_term:1; /* Byte 20 Bit 5 */
988 bool ReportDataUnderrun:1; /* Byte 20 Bit 6 */ 970 bool report_underrun:1; /* Byte 20 Bit 6 */
989 bool SCAM_Enabled:1; /* Byte 20 Bit 7 */ 971 bool scam_enabled:1; /* Byte 20 Bit 7 */
990 bool SCAM_Level2:1; /* Byte 21 Bit 0 */ 972 bool scam_lev2:1; /* Byte 21 Bit 0 */
991 unsigned char:7; /* Byte 21 Bits 1-7 */ 973 unsigned char:7; /* Byte 21 Bits 1-7 */
992 unsigned char Family; /* Byte 22 */ 974 unsigned char family; /* Byte 22 */
993 unsigned char BusType; /* Byte 23 */ 975 unsigned char bus_type; /* Byte 23 */
994 unsigned char ModelNumber[3]; /* Bytes 24-26 */ 976 unsigned char model[3]; /* Bytes 24-26 */
995 unsigned char RelativeCardNumber; /* Byte 27 */ 977 unsigned char relative_cardnum; /* Byte 27 */
996 unsigned char Reserved[4]; /* Bytes 28-31 */ 978 unsigned char rsvd[4]; /* Bytes 28-31 */
997 unsigned int OS_Reserved; /* Bytes 32-35 */ 979 unsigned int os_rsvd; /* Bytes 32-35 */
998 unsigned char TranslationInfo[4]; /* Bytes 36-39 */ 980 unsigned char translation_info[4]; /* Bytes 36-39 */
999 unsigned int Reserved2[5]; /* Bytes 40-59 */ 981 unsigned int rsvd2[5]; /* Bytes 40-59 */
1000 unsigned int SecondaryRange; /* Bytes 60-63 */ 982 unsigned int sec_range; /* Bytes 60-63 */
1001}; 983};
1002 984
1003/* 985/*
1004 Define the BusLogic Driver Host Adapter structure. 986 Define the BusLogic Driver Host Adapter structure.
1005*/ 987*/
1006 988
1007struct BusLogic_HostAdapter { 989struct blogic_adapter {
1008 struct Scsi_Host *SCSI_Host; 990 struct Scsi_Host *scsi_host;
1009 struct pci_dev *PCI_Device; 991 struct pci_dev *pci_device;
1010 enum BusLogic_HostAdapterType HostAdapterType; 992 enum blogic_adapter_type adapter_type;
1011 enum BusLogic_HostAdapterBusType HostAdapterBusType; 993 enum blogic_adapter_bus_type adapter_bus_type;
1012 unsigned long IO_Address; 994 unsigned long io_addr;
1013 unsigned long PCI_Address; 995 unsigned long pci_addr;
1014 unsigned short AddressCount; 996 unsigned short addr_count;
1015 unsigned char HostNumber; 997 unsigned char host_no;
1016 unsigned char ModelName[9]; 998 unsigned char model[9];
1017 unsigned char FirmwareVersion[6]; 999 unsigned char fw_ver[6];
1018 unsigned char FullModelName[18]; 1000 unsigned char full_model[18];
1019 unsigned char Bus; 1001 unsigned char bus;
1020 unsigned char Device; 1002 unsigned char dev;
1021 unsigned char IRQ_Channel; 1003 unsigned char irq_ch;
1022 unsigned char DMA_Channel; 1004 unsigned char dma_ch;
1023 unsigned char SCSI_ID; 1005 unsigned char scsi_id;
1024 bool IRQ_ChannelAcquired:1; 1006 bool irq_acquired:1;
1025 bool DMA_ChannelAcquired:1; 1007 bool dma_chan_acquired:1;
1026 bool ExtendedTranslationEnabled:1; 1008 bool ext_trans_enable:1;
1027 bool ParityCheckingEnabled:1; 1009 bool parity:1;
1028 bool BusResetEnabled:1; 1010 bool reset_enabled:1;
1029 bool LevelSensitiveInterrupt:1; 1011 bool level_int:1;
1030 bool HostWideSCSI:1; 1012 bool wide:1;
1031 bool HostDifferentialSCSI:1; 1013 bool differential:1;
1032 bool HostSupportsSCAM:1; 1014 bool scam:1;
1033 bool HostUltraSCSI:1; 1015 bool ultra:1;
1034 bool ExtendedLUNSupport:1; 1016 bool ext_lun:1;
1035 bool TerminationInfoValid:1; 1017 bool terminfo_valid:1;
1036 bool LowByteTerminated:1; 1018 bool low_term:1;
1037 bool HighByteTerminated:1; 1019 bool high_term:1;
1038 bool BounceBuffersRequired:1; 1020 bool need_bouncebuf:1;
1039 bool StrictRoundRobinModeSupport:1; 1021 bool strict_rr:1;
1040 bool SCAM_Enabled:1; 1022 bool scam_enabled:1;
1041 bool SCAM_Level2:1; 1023 bool scam_lev2:1;
1042 bool HostAdapterInitialized:1; 1024 bool adapter_initd:1;
1043 bool HostAdapterExternalReset:1; 1025 bool adapter_extreset:1;
1044 bool HostAdapterInternalError:1; 1026 bool adapter_intern_err:1;
1045 bool ProcessCompletedCCBsActive; 1027 bool processing_ccbs;
1046 volatile bool HostAdapterCommandCompleted; 1028 volatile bool adapter_cmd_complete;
1047 unsigned short HostAdapterScatterGatherLimit; 1029 unsigned short adapter_sglimit;
1048 unsigned short DriverScatterGatherLimit; 1030 unsigned short drvr_sglimit;
1049 unsigned short MaxTargetDevices; 1031 unsigned short maxdev;
1050 unsigned short MaxLogicalUnits; 1032 unsigned short maxlun;
1051 unsigned short MailboxCount; 1033 unsigned short mbox_count;
1052 unsigned short InitialCCBs; 1034 unsigned short initccbs;
1053 unsigned short IncrementalCCBs; 1035 unsigned short inc_ccbs;
1054 unsigned short AllocatedCCBs; 1036 unsigned short alloc_ccbs;
1055 unsigned short DriverQueueDepth; 1037 unsigned short drvr_qdepth;
1056 unsigned short HostAdapterQueueDepth; 1038 unsigned short adapter_qdepth;
1057 unsigned short UntaggedQueueDepth; 1039 unsigned short untag_qdepth;
1058 unsigned short CommonQueueDepth; 1040 unsigned short common_qdepth;
1059 unsigned short BusSettleTime; 1041 unsigned short bus_settle_time;
1060 unsigned short SynchronousPermitted; 1042 unsigned short sync_ok;
1061 unsigned short FastPermitted; 1043 unsigned short fast_ok;
1062 unsigned short UltraPermitted; 1044 unsigned short ultra_ok;
1063 unsigned short WidePermitted; 1045 unsigned short wide_ok;
1064 unsigned short DisconnectPermitted; 1046 unsigned short discon_ok;
1065 unsigned short TaggedQueuingPermitted; 1047 unsigned short tagq_ok;
1066 unsigned short ExternalHostAdapterResets; 1048 unsigned short ext_resets;
1067 unsigned short HostAdapterInternalErrors; 1049 unsigned short adapter_intern_errors;
1068 unsigned short TargetDeviceCount; 1050 unsigned short tgt_count;
1069 unsigned short MessageBufferLength; 1051 unsigned short msgbuflen;
1070 u32 BIOS_Address; 1052 u32 bios_addr;
1071 struct BusLogic_DriverOptions *DriverOptions; 1053 struct blogic_drvr_options *drvr_opts;
1072 struct FlashPoint_Info FlashPointInfo; 1054 struct fpoint_info fpinfo;
1073 FlashPoint_CardHandle_T CardHandle; 1055 unsigned int cardhandle;
1074 struct list_head host_list; 1056 struct list_head host_list;
1075 struct BusLogic_CCB *All_CCBs; 1057 struct blogic_ccb *all_ccbs;
1076 struct BusLogic_CCB *Free_CCBs; 1058 struct blogic_ccb *free_ccbs;
1077 struct BusLogic_CCB *FirstCompletedCCB; 1059 struct blogic_ccb *firstccb;
1078 struct BusLogic_CCB *LastCompletedCCB; 1060 struct blogic_ccb *lastccb;
1079 struct BusLogic_CCB *BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices]; 1061 struct blogic_ccb *bdr_pend[BLOGIC_MAXDEV];
1080 struct BusLogic_TargetFlags TargetFlags[BusLogic_MaxTargetDevices]; 1062 struct blogic_tgt_flags tgt_flags[BLOGIC_MAXDEV];
1081 unsigned char QueueDepth[BusLogic_MaxTargetDevices]; 1063 unsigned char qdepth[BLOGIC_MAXDEV];
1082 unsigned char SynchronousPeriod[BusLogic_MaxTargetDevices]; 1064 unsigned char sync_period[BLOGIC_MAXDEV];
1083 unsigned char SynchronousOffset[BusLogic_MaxTargetDevices]; 1065 unsigned char sync_offset[BLOGIC_MAXDEV];
1084 unsigned char ActiveCommands[BusLogic_MaxTargetDevices]; 1066 unsigned char active_cmds[BLOGIC_MAXDEV];
1085 unsigned int CommandsSinceReset[BusLogic_MaxTargetDevices]; 1067 unsigned int cmds_since_rst[BLOGIC_MAXDEV];
1086 unsigned long LastSequencePoint[BusLogic_MaxTargetDevices]; 1068 unsigned long last_seqpoint[BLOGIC_MAXDEV];
1087 unsigned long LastResetAttempted[BusLogic_MaxTargetDevices]; 1069 unsigned long last_resettried[BLOGIC_MAXDEV];
1088 unsigned long LastResetCompleted[BusLogic_MaxTargetDevices]; 1070 unsigned long last_resetdone[BLOGIC_MAXDEV];
1089 struct BusLogic_OutgoingMailbox *FirstOutgoingMailbox; 1071 struct blogic_outbox *first_outbox;
1090 struct BusLogic_OutgoingMailbox *LastOutgoingMailbox; 1072 struct blogic_outbox *last_outbox;
1091 struct BusLogic_OutgoingMailbox *NextOutgoingMailbox; 1073 struct blogic_outbox *next_outbox;
1092 struct BusLogic_IncomingMailbox *FirstIncomingMailbox; 1074 struct blogic_inbox *first_inbox;
1093 struct BusLogic_IncomingMailbox *LastIncomingMailbox; 1075 struct blogic_inbox *last_inbox;
1094 struct BusLogic_IncomingMailbox *NextIncomingMailbox; 1076 struct blogic_inbox *next_inbox;
1095 struct BusLogic_TargetStatistics TargetStatistics[BusLogic_MaxTargetDevices]; 1077 struct blogic_tgt_stats tgt_stats[BLOGIC_MAXDEV];
1096 unsigned char *MailboxSpace; 1078 unsigned char *mbox_space;
1097 dma_addr_t MailboxSpaceHandle; 1079 dma_addr_t mbox_space_handle;
1098 unsigned int MailboxSize; 1080 unsigned int mbox_sz;
1099 unsigned long CCB_Offset; 1081 unsigned long ccb_offset;
1100 char MessageBuffer[BusLogic_MessageBufferSize]; 1082 char msgbuf[BLOGIC_MSGBUF_SIZE];
1101}; 1083};
1102 1084
1103/* 1085/*
1104 Define a structure for the BIOS Disk Parameters. 1086 Define a structure for the BIOS Disk Parameters.
1105*/ 1087*/
1106 1088
1107struct BIOS_DiskParameters { 1089struct bios_diskparam {
1108 int Heads; 1090 int heads;
1109 int Sectors; 1091 int sectors;
1110 int Cylinders; 1092 int cylinders;
1111}; 1093};
1112 1094
1113/* 1095/*
1114 Define a structure for the SCSI Inquiry command results. 1096 Define a structure for the SCSI Inquiry command results.
1115*/ 1097*/
1116 1098
1117struct SCSI_Inquiry { 1099struct scsi_inquiry {
1118 unsigned char PeripheralDeviceType:5; /* Byte 0 Bits 0-4 */ 1100 unsigned char devtype:5; /* Byte 0 Bits 0-4 */
1119 unsigned char PeripheralQualifier:3; /* Byte 0 Bits 5-7 */ 1101 unsigned char dev_qual:3; /* Byte 0 Bits 5-7 */
1120 unsigned char DeviceTypeModifier:7; /* Byte 1 Bits 0-6 */ 1102 unsigned char dev_modifier:7; /* Byte 1 Bits 0-6 */
1121 bool RMB:1; /* Byte 1 Bit 7 */ 1103 bool rmb:1; /* Byte 1 Bit 7 */
1122 unsigned char ANSI_ApprovedVersion:3; /* Byte 2 Bits 0-2 */ 1104 unsigned char ansi_ver:3; /* Byte 2 Bits 0-2 */
1123 unsigned char ECMA_Version:3; /* Byte 2 Bits 3-5 */ 1105 unsigned char ecma_ver:3; /* Byte 2 Bits 3-5 */
1124 unsigned char ISO_Version:2; /* Byte 2 Bits 6-7 */ 1106 unsigned char iso_ver:2; /* Byte 2 Bits 6-7 */
1125 unsigned char ResponseDataFormat:4; /* Byte 3 Bits 0-3 */ 1107 unsigned char resp_fmt:4; /* Byte 3 Bits 0-3 */
1126 unsigned char:2; /* Byte 3 Bits 4-5 */ 1108 unsigned char:2; /* Byte 3 Bits 4-5 */
1127 bool TrmIOP:1; /* Byte 3 Bit 6 */ 1109 bool TrmIOP:1; /* Byte 3 Bit 6 */
1128 bool AENC:1; /* Byte 3 Bit 7 */ 1110 bool AENC:1; /* Byte 3 Bit 7 */
1129 unsigned char AdditionalLength; /* Byte 4 */ 1111 unsigned char addl_len; /* Byte 4 */
1130 unsigned char:8; /* Byte 5 */ 1112 unsigned char:8; /* Byte 5 */
1131 unsigned char:8; /* Byte 6 */ 1113 unsigned char:8; /* Byte 6 */
1132 bool SftRe:1; /* Byte 7 Bit 0 */ 1114 bool SftRe:1; /* Byte 7 Bit 0 */
1133 bool CmdQue:1; /* Byte 7 Bit 1 */ 1115 bool CmdQue:1; /* Byte 7 Bit 1 */
1134 bool:1; /* Byte 7 Bit 2 */ 1116 bool:1; /* Byte 7 Bit 2 */
1135 bool Linked:1; /* Byte 7 Bit 3 */ 1117 bool linked:1; /* Byte 7 Bit 3 */
1136 bool Sync:1; /* Byte 7 Bit 4 */ 1118 bool sync:1; /* Byte 7 Bit 4 */
1137 bool WBus16:1; /* Byte 7 Bit 5 */ 1119 bool WBus16:1; /* Byte 7 Bit 5 */
1138 bool WBus32:1; /* Byte 7 Bit 6 */ 1120 bool WBus32:1; /* Byte 7 Bit 6 */
1139 bool RelAdr:1; /* Byte 7 Bit 7 */ 1121 bool RelAdr:1; /* Byte 7 Bit 7 */
1140 unsigned char VendorIdentification[8]; /* Bytes 8-15 */ 1122 unsigned char vendor[8]; /* Bytes 8-15 */
1141 unsigned char ProductIdentification[16]; /* Bytes 16-31 */ 1123 unsigned char product[16]; /* Bytes 16-31 */
1142 unsigned char ProductRevisionLevel[4]; /* Bytes 32-35 */ 1124 unsigned char product_rev[4]; /* Bytes 32-35 */
1143}; 1125};
1144 1126
1145 1127
@@ -1148,184 +1130,170 @@ struct SCSI_Inquiry {
1148 Host Adapter I/O Registers. 1130 Host Adapter I/O Registers.
1149*/ 1131*/
1150 1132
1151static inline void BusLogic_SCSIBusReset(struct BusLogic_HostAdapter *HostAdapter) 1133static inline void blogic_busreset(struct blogic_adapter *adapter)
1152{ 1134{
1153 union BusLogic_ControlRegister ControlRegister; 1135 union blogic_cntrl_reg cr;
1154 ControlRegister.All = 0; 1136 cr.all = 0;
1155 ControlRegister.cr.SCSIBusReset = true; 1137 cr.cr.bus_reset = true;
1156 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset); 1138 outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
1157} 1139}
1158 1140
1159static inline void BusLogic_InterruptReset(struct BusLogic_HostAdapter *HostAdapter) 1141static inline void blogic_intreset(struct blogic_adapter *adapter)
1160{ 1142{
1161 union BusLogic_ControlRegister ControlRegister; 1143 union blogic_cntrl_reg cr;
1162 ControlRegister.All = 0; 1144 cr.all = 0;
1163 ControlRegister.cr.InterruptReset = true; 1145 cr.cr.int_reset = true;
1164 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset); 1146 outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
1165} 1147}
1166 1148
1167static inline void BusLogic_SoftReset(struct BusLogic_HostAdapter *HostAdapter) 1149static inline void blogic_softreset(struct blogic_adapter *adapter)
1168{ 1150{
1169 union BusLogic_ControlRegister ControlRegister; 1151 union blogic_cntrl_reg cr;
1170 ControlRegister.All = 0; 1152 cr.all = 0;
1171 ControlRegister.cr.SoftReset = true; 1153 cr.cr.soft_reset = true;
1172 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset); 1154 outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
1173} 1155}
1174 1156
1175static inline void BusLogic_HardReset(struct BusLogic_HostAdapter *HostAdapter) 1157static inline void blogic_hardreset(struct blogic_adapter *adapter)
1176{ 1158{
1177 union BusLogic_ControlRegister ControlRegister; 1159 union blogic_cntrl_reg cr;
1178 ControlRegister.All = 0; 1160 cr.all = 0;
1179 ControlRegister.cr.HardReset = true; 1161 cr.cr.hard_reset = true;
1180 outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset); 1162 outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
1181} 1163}
1182 1164
1183static inline unsigned char BusLogic_ReadStatusRegister(struct BusLogic_HostAdapter *HostAdapter) 1165static inline unsigned char blogic_rdstatus(struct blogic_adapter *adapter)
1184{ 1166{
1185 return inb(HostAdapter->IO_Address + BusLogic_StatusRegisterOffset); 1167 return inb(adapter->io_addr + BLOGIC_STATUS_REG);
1186} 1168}
1187 1169
1188static inline void BusLogic_WriteCommandParameterRegister(struct BusLogic_HostAdapter 1170static inline void blogic_setcmdparam(struct blogic_adapter *adapter,
1189 *HostAdapter, unsigned char Value) 1171 unsigned char value)
1190{ 1172{
1191 outb(Value, HostAdapter->IO_Address + BusLogic_CommandParameterRegisterOffset); 1173 outb(value, adapter->io_addr + BLOGIC_CMD_PARM_REG);
1192} 1174}
1193 1175
1194static inline unsigned char BusLogic_ReadDataInRegister(struct BusLogic_HostAdapter *HostAdapter) 1176static inline unsigned char blogic_rddatain(struct blogic_adapter *adapter)
1195{ 1177{
1196 return inb(HostAdapter->IO_Address + BusLogic_DataInRegisterOffset); 1178 return inb(adapter->io_addr + BLOGIC_DATAIN_REG);
1197} 1179}
1198 1180
1199static inline unsigned char BusLogic_ReadInterruptRegister(struct BusLogic_HostAdapter *HostAdapter) 1181static inline unsigned char blogic_rdint(struct blogic_adapter *adapter)
1200{ 1182{
1201 return inb(HostAdapter->IO_Address + BusLogic_InterruptRegisterOffset); 1183 return inb(adapter->io_addr + BLOGIC_INT_REG);
1202} 1184}
1203 1185
1204static inline unsigned char BusLogic_ReadGeometryRegister(struct BusLogic_HostAdapter *HostAdapter) 1186static inline unsigned char blogic_rdgeom(struct blogic_adapter *adapter)
1205{ 1187{
1206 return inb(HostAdapter->IO_Address + BusLogic_GeometryRegisterOffset); 1188 return inb(adapter->io_addr + BLOGIC_GEOMETRY_REG);
1207} 1189}
1208 1190
1209/* 1191/*
1210 BusLogic_StartMailboxCommand issues an Execute Mailbox Command, which 1192 blogic_execmbox issues an Execute Mailbox Command, which
1211 notifies the Host Adapter that an entry has been made in an Outgoing 1193 notifies the Host Adapter that an entry has been made in an Outgoing
1212 Mailbox. 1194 Mailbox.
1213*/ 1195*/
1214 1196
1215static inline void BusLogic_StartMailboxCommand(struct BusLogic_HostAdapter *HostAdapter) 1197static inline void blogic_execmbox(struct blogic_adapter *adapter)
1216{ 1198{
1217 BusLogic_WriteCommandParameterRegister(HostAdapter, BusLogic_ExecuteMailboxCommand); 1199 blogic_setcmdparam(adapter, BLOGIC_EXEC_MBOX_CMD);
1218} 1200}
1219 1201
1220/* 1202/*
1221 BusLogic_Delay waits for Seconds to elapse. 1203 blogic_delay waits for Seconds to elapse.
1222*/ 1204*/
1223 1205
1224static inline void BusLogic_Delay(int Seconds) 1206static inline void blogic_delay(int seconds)
1225{
1226 mdelay(1000 * Seconds);
1227}
1228
1229/*
1230 Virtual_to_Bus and Bus_to_Virtual map between Kernel Virtual Addresses
1231 and PCI/VLB/EISA/ISA Bus Addresses.
1232*/
1233
1234static inline u32 Virtual_to_Bus(void *VirtualAddress)
1235{
1236 return (u32) virt_to_bus(VirtualAddress);
1237}
1238
1239static inline void *Bus_to_Virtual(u32 BusAddress)
1240{ 1207{
1241 return (void *) bus_to_virt(BusAddress); 1208 mdelay(1000 * seconds);
1242} 1209}
1243 1210
1244/* 1211/*
1245 Virtual_to_32Bit_Virtual maps between Kernel Virtual Addresses and 1212 virt_to_32bit_virt maps between Kernel Virtual Addresses and
1246 32 bit Kernel Virtual Addresses. This avoids compilation warnings 1213 32 bit Kernel Virtual Addresses. This avoids compilation warnings
1247 on 64 bit architectures. 1214 on 64 bit architectures.
1248*/ 1215*/
1249 1216
1250static inline u32 Virtual_to_32Bit_Virtual(void *VirtualAddress) 1217static inline u32 virt_to_32bit_virt(void *virt_addr)
1251{ 1218{
1252 return (u32) (unsigned long) VirtualAddress; 1219 return (u32) (unsigned long) virt_addr;
1253} 1220}
1254 1221
1255/* 1222/*
1256 BusLogic_IncrementErrorCounter increments Error Counter by 1, stopping at 1223 blogic_inc_count increments counter by 1, stopping at
1257 65535 rather than wrapping around to 0. 1224 65535 rather than wrapping around to 0.
1258*/ 1225*/
1259 1226
1260static inline void BusLogic_IncrementErrorCounter(unsigned short *ErrorCounter) 1227static inline void blogic_inc_count(unsigned short *count)
1261{ 1228{
1262 if (*ErrorCounter < 65535) 1229 if (*count < 65535)
1263 (*ErrorCounter)++; 1230 (*count)++;
1264} 1231}
1265 1232
1266/* 1233/*
1267 BusLogic_IncrementByteCounter increments Byte Counter by Amount. 1234 blogic_addcount increments Byte Counter by Amount.
1268*/ 1235*/
1269 1236
1270static inline void BusLogic_IncrementByteCounter(struct BusLogic_ByteCounter 1237static inline void blogic_addcount(struct blogic_byte_count *bytecount,
1271 *ByteCounter, unsigned int Amount) 1238 unsigned int amount)
1272{ 1239{
1273 ByteCounter->Units += Amount; 1240 bytecount->units += amount;
1274 if (ByteCounter->Units > 999999999) { 1241 if (bytecount->units > 999999999) {
1275 ByteCounter->Units -= 1000000000; 1242 bytecount->units -= 1000000000;
1276 ByteCounter->Billions++; 1243 bytecount->billions++;
1277 } 1244 }
1278} 1245}
1279 1246
1280/* 1247/*
1281 BusLogic_IncrementSizeBucket increments the Bucket for Amount. 1248 blogic_incszbucket increments the Bucket for Amount.
1282*/ 1249*/
1283 1250
1284static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T CommandSizeBuckets, unsigned int Amount) 1251static inline void blogic_incszbucket(unsigned int *cmdsz_buckets,
1252 unsigned int amount)
1285{ 1253{
1286 int Index = 0; 1254 int index = 0;
1287 if (Amount < 8 * 1024) { 1255 if (amount < 8 * 1024) {
1288 if (Amount < 2 * 1024) 1256 if (amount < 2 * 1024)
1289 Index = (Amount < 1 * 1024 ? 0 : 1); 1257 index = (amount < 1 * 1024 ? 0 : 1);
1290 else 1258 else
1291 Index = (Amount < 4 * 1024 ? 2 : 3); 1259 index = (amount < 4 * 1024 ? 2 : 3);
1292 } else if (Amount < 128 * 1024) { 1260 } else if (amount < 128 * 1024) {
1293 if (Amount < 32 * 1024) 1261 if (amount < 32 * 1024)
1294 Index = (Amount < 16 * 1024 ? 4 : 5); 1262 index = (amount < 16 * 1024 ? 4 : 5);
1295 else 1263 else
1296 Index = (Amount < 64 * 1024 ? 6 : 7); 1264 index = (amount < 64 * 1024 ? 6 : 7);
1297 } else 1265 } else
1298 Index = (Amount < 256 * 1024 ? 8 : 9); 1266 index = (amount < 256 * 1024 ? 8 : 9);
1299 CommandSizeBuckets[Index]++; 1267 cmdsz_buckets[index]++;
1300} 1268}
1301 1269
1302/* 1270/*
1303 Define the version number of the FlashPoint Firmware (SCCB Manager). 1271 Define the version number of the FlashPoint Firmware (SCCB Manager).
1304*/ 1272*/
1305 1273
1306#define FlashPoint_FirmwareVersion "5.02" 1274#define FLASHPOINT_FW_VER "5.02"
1307 1275
1308/* 1276/*
1309 Define the possible return values from FlashPoint_HandleInterrupt. 1277 Define the possible return values from FlashPoint_HandleInterrupt.
1310*/ 1278*/
1311 1279
1312#define FlashPoint_NormalInterrupt 0x00 1280#define FPOINT_NORMAL_INT 0x00
1313#define FlashPoint_InternalError 0xFE 1281#define FPOINT_INTERN_ERR 0xFE
1314#define FlashPoint_ExternalBusReset 0xFF 1282#define FPOINT_EXT_RESET 0xFF
1315 1283
1316/* 1284/*
1317 Define prototypes for the forward referenced BusLogic Driver 1285 Define prototypes for the forward referenced BusLogic Driver
1318 Internal Functions. 1286 Internal Functions.
1319*/ 1287*/
1320 1288
1321static const char *BusLogic_DriverInfo(struct Scsi_Host *); 1289static const char *blogic_drvr_info(struct Scsi_Host *);
1322static int BusLogic_QueueCommand(struct Scsi_Host *h, struct scsi_cmnd *); 1290static int blogic_qcmd(struct Scsi_Host *h, struct scsi_cmnd *);
1323static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *); 1291static int blogic_diskparam(struct scsi_device *, struct block_device *, sector_t, int *);
1324static int BusLogic_SlaveConfigure(struct scsi_device *); 1292static int blogic_slaveconfig(struct scsi_device *);
1325static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *); 1293static void blogic_qcompleted_ccb(struct blogic_ccb *);
1326static irqreturn_t BusLogic_InterruptHandler(int, void *); 1294static irqreturn_t blogic_inthandler(int, void *);
1327static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *, bool HardReset); 1295static int blogic_resetadapter(struct blogic_adapter *, bool hard_reset);
1328static void BusLogic_Message(enum BusLogic_MessageLevel, char *, struct BusLogic_HostAdapter *, ...); 1296static void blogic_msg(enum blogic_msglevel, char *, struct blogic_adapter *, ...);
1329static int __init BusLogic_Setup(char *); 1297static int __init blogic_setup(char *);
1330 1298
1331#endif /* _BUSLOGIC_H */ 1299#endif /* _BUSLOGIC_H */
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
index dcd716d68600..902972050063 100644
--- a/drivers/scsi/FlashPoint.c
+++ b/drivers/scsi/FlashPoint.c
@@ -7573,47 +7573,47 @@ static unsigned char FPT_CalcLrc(unsigned char buffer[])
7573*/ 7573*/
7574 7574
7575static inline unsigned char 7575static inline unsigned char
7576FlashPoint__ProbeHostAdapter(struct FlashPoint_Info *FlashPointInfo) 7576FlashPoint__ProbeHostAdapter(struct fpoint_info *FlashPointInfo)
7577{ 7577{
7578 return FlashPoint_ProbeHostAdapter((struct sccb_mgr_info *) 7578 return FlashPoint_ProbeHostAdapter((struct sccb_mgr_info *)
7579 FlashPointInfo); 7579 FlashPointInfo);
7580} 7580}
7581 7581
7582static inline FlashPoint_CardHandle_T 7582static inline unsigned int
7583FlashPoint__HardwareResetHostAdapter(struct FlashPoint_Info *FlashPointInfo) 7583FlashPoint__HardwareResetHostAdapter(struct fpoint_info *FlashPointInfo)
7584{ 7584{
7585 return FlashPoint_HardwareResetHostAdapter((struct sccb_mgr_info *) 7585 return FlashPoint_HardwareResetHostAdapter((struct sccb_mgr_info *)
7586 FlashPointInfo); 7586 FlashPointInfo);
7587} 7587}
7588 7588
7589static inline void 7589static inline void
7590FlashPoint__ReleaseHostAdapter(FlashPoint_CardHandle_T CardHandle) 7590FlashPoint__ReleaseHostAdapter(unsigned int CardHandle)
7591{ 7591{
7592 FlashPoint_ReleaseHostAdapter(CardHandle); 7592 FlashPoint_ReleaseHostAdapter(CardHandle);
7593} 7593}
7594 7594
7595static inline void 7595static inline void
7596FlashPoint__StartCCB(FlashPoint_CardHandle_T CardHandle, 7596FlashPoint__StartCCB(unsigned int CardHandle,
7597 struct BusLogic_CCB *CCB) 7597 struct blogic_ccb *CCB)
7598{ 7598{
7599 FlashPoint_StartCCB(CardHandle, (struct sccb *)CCB); 7599 FlashPoint_StartCCB(CardHandle, (struct sccb *)CCB);
7600} 7600}
7601 7601
7602static inline void 7602static inline void
7603FlashPoint__AbortCCB(FlashPoint_CardHandle_T CardHandle, 7603FlashPoint__AbortCCB(unsigned int CardHandle,
7604 struct BusLogic_CCB *CCB) 7604 struct blogic_ccb *CCB)
7605{ 7605{
7606 FlashPoint_AbortCCB(CardHandle, (struct sccb *)CCB); 7606 FlashPoint_AbortCCB(CardHandle, (struct sccb *)CCB);
7607} 7607}
7608 7608
7609static inline bool 7609static inline bool
7610FlashPoint__InterruptPending(FlashPoint_CardHandle_T CardHandle) 7610FlashPoint__InterruptPending(unsigned int CardHandle)
7611{ 7611{
7612 return FlashPoint_InterruptPending(CardHandle); 7612 return FlashPoint_InterruptPending(CardHandle);
7613} 7613}
7614 7614
7615static inline int 7615static inline int
7616FlashPoint__HandleInterrupt(FlashPoint_CardHandle_T CardHandle) 7616FlashPoint__HandleInterrupt(unsigned int CardHandle)
7617{ 7617{
7618 return FlashPoint_HandleInterrupt(CardHandle); 7618 return FlashPoint_HandleInterrupt(CardHandle);
7619} 7619}
@@ -7632,13 +7632,12 @@ FlashPoint__HandleInterrupt(FlashPoint_CardHandle_T CardHandle)
7632 Define prototypes for the FlashPoint SCCB Manager Functions. 7632 Define prototypes for the FlashPoint SCCB Manager Functions.
7633*/ 7633*/
7634 7634
7635extern unsigned char FlashPoint_ProbeHostAdapter(struct FlashPoint_Info *); 7635extern unsigned char FlashPoint_ProbeHostAdapter(struct fpoint_info *);
7636extern FlashPoint_CardHandle_T 7636extern unsigned int FlashPoint_HardwareResetHostAdapter(struct fpoint_info *);
7637FlashPoint_HardwareResetHostAdapter(struct FlashPoint_Info *); 7637extern void FlashPoint_StartCCB(unsigned int, struct blogic_ccb *);
7638extern void FlashPoint_StartCCB(FlashPoint_CardHandle_T, struct BusLogic_CCB *); 7638extern int FlashPoint_AbortCCB(unsigned int, struct blogic_ccb *);
7639extern int FlashPoint_AbortCCB(FlashPoint_CardHandle_T, struct BusLogic_CCB *); 7639extern bool FlashPoint_InterruptPending(unsigned int);
7640extern bool FlashPoint_InterruptPending(FlashPoint_CardHandle_T); 7640extern int FlashPoint_HandleInterrupt(unsigned int);
7641extern int FlashPoint_HandleInterrupt(FlashPoint_CardHandle_T); 7641extern void FlashPoint_ReleaseHostAdapter(unsigned int);
7642extern void FlashPoint_ReleaseHostAdapter(FlashPoint_CardHandle_T);
7643 7642
7644#endif /* CONFIG_SCSI_FLASHPOINT */ 7643#endif /* CONFIG_SCSI_FLASHPOINT */