aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid/commsup.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aacraid/commsup.c')
-rw-r--r--drivers/scsi/aacraid/commsup.c54
1 files changed, 25 insertions, 29 deletions
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 55bf6f395e92..e67ff13eb359 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -94,7 +94,7 @@ void aac_fib_map_free(struct aac_dev *dev)
94int aac_fib_setup(struct aac_dev * dev) 94int aac_fib_setup(struct aac_dev * dev)
95{ 95{
96 struct fib *fibptr; 96 struct fib *fibptr;
97 struct hw_fib *hw_fib_va; 97 struct hw_fib *hw_fib;
98 dma_addr_t hw_fib_pa; 98 dma_addr_t hw_fib_pa;
99 int i; 99 int i;
100 100
@@ -106,24 +106,24 @@ int aac_fib_setup(struct aac_dev * dev)
106 if (i<0) 106 if (i<0)
107 return -ENOMEM; 107 return -ENOMEM;
108 108
109 hw_fib_va = dev->hw_fib_va; 109 hw_fib = dev->hw_fib_va;
110 hw_fib_pa = dev->hw_fib_pa; 110 hw_fib_pa = dev->hw_fib_pa;
111 memset(hw_fib_va, 0, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)); 111 memset(hw_fib, 0, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB));
112 /* 112 /*
113 * Initialise the fibs 113 * Initialise the fibs
114 */ 114 */
115 for (i = 0, fibptr = &dev->fibs[i]; i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++, fibptr++) 115 for (i = 0, fibptr = &dev->fibs[i]; i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++, fibptr++)
116 { 116 {
117 fibptr->dev = dev; 117 fibptr->dev = dev;
118 fibptr->hw_fib = hw_fib_va; 118 fibptr->hw_fib_va = hw_fib;
119 fibptr->data = (void *) fibptr->hw_fib->data; 119 fibptr->data = (void *) fibptr->hw_fib_va->data;
120 fibptr->next = fibptr+1; /* Forward chain the fibs */ 120 fibptr->next = fibptr+1; /* Forward chain the fibs */
121 init_MUTEX_LOCKED(&fibptr->event_wait); 121 init_MUTEX_LOCKED(&fibptr->event_wait);
122 spin_lock_init(&fibptr->event_lock); 122 spin_lock_init(&fibptr->event_lock);
123 hw_fib_va->header.XferState = cpu_to_le32(0xffffffff); 123 hw_fib->header.XferState = cpu_to_le32(0xffffffff);
124 hw_fib_va->header.SenderSize = cpu_to_le16(dev->max_fib_size); 124 hw_fib->header.SenderSize = cpu_to_le16(dev->max_fib_size);
125 fibptr->hw_fib_pa = hw_fib_pa; 125 fibptr->hw_fib_pa = hw_fib_pa;
126 hw_fib_va = (struct hw_fib *)((unsigned char *)hw_fib_va + dev->max_fib_size); 126 hw_fib = (struct hw_fib *)((unsigned char *)hw_fib + dev->max_fib_size);
127 hw_fib_pa = hw_fib_pa + dev->max_fib_size; 127 hw_fib_pa = hw_fib_pa + dev->max_fib_size;
128 } 128 }
129 /* 129 /*
@@ -166,7 +166,7 @@ struct fib *aac_fib_alloc(struct aac_dev *dev)
166 * Null out fields that depend on being zero at the start of 166 * Null out fields that depend on being zero at the start of
167 * each I/O 167 * each I/O
168 */ 168 */
169 fibptr->hw_fib->header.XferState = 0; 169 fibptr->hw_fib_va->header.XferState = 0;
170 fibptr->callback = NULL; 170 fibptr->callback = NULL;
171 fibptr->callback_data = NULL; 171 fibptr->callback_data = NULL;
172 172
@@ -191,10 +191,10 @@ void aac_fib_free(struct fib *fibptr)
191 fibptr->next = fibptr->dev->timeout_fib; 191 fibptr->next = fibptr->dev->timeout_fib;
192 fibptr->dev->timeout_fib = fibptr; 192 fibptr->dev->timeout_fib = fibptr;
193 } else { 193 } else {
194 if (fibptr->hw_fib->header.XferState != 0) { 194 if (fibptr->hw_fib_va->header.XferState != 0) {
195 printk(KERN_WARNING "aac_fib_free, XferState != 0, fibptr = 0x%p, XferState = 0x%x\n", 195 printk(KERN_WARNING "aac_fib_free, XferState != 0, fibptr = 0x%p, XferState = 0x%x\n",
196 (void*)fibptr, 196 (void*)fibptr,
197 le32_to_cpu(fibptr->hw_fib->header.XferState)); 197 le32_to_cpu(fibptr->hw_fib_va->header.XferState));
198 } 198 }
199 fibptr->next = fibptr->dev->free_fib; 199 fibptr->next = fibptr->dev->free_fib;
200 fibptr->dev->free_fib = fibptr; 200 fibptr->dev->free_fib = fibptr;
@@ -211,7 +211,7 @@ void aac_fib_free(struct fib *fibptr)
211 211
212void aac_fib_init(struct fib *fibptr) 212void aac_fib_init(struct fib *fibptr)
213{ 213{
214 struct hw_fib *hw_fib = fibptr->hw_fib; 214 struct hw_fib *hw_fib = fibptr->hw_fib_va;
215 215
216 hw_fib->header.StructType = FIB_MAGIC; 216 hw_fib->header.StructType = FIB_MAGIC;
217 hw_fib->header.Size = cpu_to_le16(fibptr->dev->max_fib_size); 217 hw_fib->header.Size = cpu_to_le16(fibptr->dev->max_fib_size);
@@ -231,7 +231,7 @@ void aac_fib_init(struct fib *fibptr)
231 231
232static void fib_dealloc(struct fib * fibptr) 232static void fib_dealloc(struct fib * fibptr)
233{ 233{
234 struct hw_fib *hw_fib = fibptr->hw_fib; 234 struct hw_fib *hw_fib = fibptr->hw_fib_va;
235 BUG_ON(hw_fib->header.StructType != FIB_MAGIC); 235 BUG_ON(hw_fib->header.StructType != FIB_MAGIC);
236 hw_fib->header.XferState = 0; 236 hw_fib->header.XferState = 0;
237} 237}
@@ -386,7 +386,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
386 void *callback_data) 386 void *callback_data)
387{ 387{
388 struct aac_dev * dev = fibptr->dev; 388 struct aac_dev * dev = fibptr->dev;
389 struct hw_fib * hw_fib = fibptr->hw_fib; 389 struct hw_fib * hw_fib = fibptr->hw_fib_va;
390 unsigned long flags = 0; 390 unsigned long flags = 0;
391 unsigned long qflags; 391 unsigned long qflags;
392 392
@@ -430,7 +430,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
430 */ 430 */
431 hw_fib->header.Command = cpu_to_le16(command); 431 hw_fib->header.Command = cpu_to_le16(command);
432 hw_fib->header.XferState |= cpu_to_le32(SentFromHost); 432 hw_fib->header.XferState |= cpu_to_le32(SentFromHost);
433 fibptr->hw_fib->header.Flags = 0; /* 0 the flags field - internal only*/ 433 fibptr->hw_fib_va->header.Flags = 0; /* 0 the flags field - internal only*/
434 /* 434 /*
435 * Set the size of the Fib we want to send to the adapter 435 * Set the size of the Fib we want to send to the adapter
436 */ 436 */
@@ -462,7 +462,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
462 dprintk((KERN_DEBUG " Command = %d.\n", le32_to_cpu(hw_fib->header.Command))); 462 dprintk((KERN_DEBUG " Command = %d.\n", le32_to_cpu(hw_fib->header.Command)));
463 dprintk((KERN_DEBUG " SubCommand = %d.\n", le32_to_cpu(((struct aac_query_mount *)fib_data(fibptr))->command))); 463 dprintk((KERN_DEBUG " SubCommand = %d.\n", le32_to_cpu(((struct aac_query_mount *)fib_data(fibptr))->command)));
464 dprintk((KERN_DEBUG " XferState = %x.\n", le32_to_cpu(hw_fib->header.XferState))); 464 dprintk((KERN_DEBUG " XferState = %x.\n", le32_to_cpu(hw_fib->header.XferState)));
465 dprintk((KERN_DEBUG " hw_fib va being sent=%p\n",fibptr->hw_fib)); 465 dprintk((KERN_DEBUG " hw_fib va being sent=%p\n",fibptr->hw_fib_va));
466 dprintk((KERN_DEBUG " hw_fib pa being sent=%lx\n",(ulong)fibptr->hw_fib_pa)); 466 dprintk((KERN_DEBUG " hw_fib pa being sent=%lx\n",(ulong)fibptr->hw_fib_pa));
467 dprintk((KERN_DEBUG " fib being sent=%p\n",fibptr)); 467 dprintk((KERN_DEBUG " fib being sent=%p\n",fibptr));
468 468
@@ -624,7 +624,7 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid)
624 624
625int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) 625int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
626{ 626{
627 struct hw_fib * hw_fib = fibptr->hw_fib; 627 struct hw_fib * hw_fib = fibptr->hw_fib_va;
628 struct aac_dev * dev = fibptr->dev; 628 struct aac_dev * dev = fibptr->dev;
629 struct aac_queue * q; 629 struct aac_queue * q;
630 unsigned long nointr = 0; 630 unsigned long nointr = 0;
@@ -688,7 +688,7 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
688 688
689int aac_fib_complete(struct fib *fibptr) 689int aac_fib_complete(struct fib *fibptr)
690{ 690{
691 struct hw_fib * hw_fib = fibptr->hw_fib; 691 struct hw_fib * hw_fib = fibptr->hw_fib_va;
692 692
693 /* 693 /*
694 * Check for a fib which has already been completed 694 * Check for a fib which has already been completed
@@ -774,9 +774,8 @@ void aac_printf(struct aac_dev *dev, u32 val)
774#define AIF_SNIFF_TIMEOUT (30*HZ) 774#define AIF_SNIFF_TIMEOUT (30*HZ)
775static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) 775static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
776{ 776{
777 struct hw_fib * hw_fib = fibptr->hw_fib; 777 struct hw_fib * hw_fib = fibptr->hw_fib_va;
778 struct aac_aifcmd * aifcmd = (struct aac_aifcmd *)hw_fib->data; 778 struct aac_aifcmd * aifcmd = (struct aac_aifcmd *)hw_fib->data;
779 int busy;
780 u32 container; 779 u32 container;
781 struct scsi_device *device; 780 struct scsi_device *device;
782 enum { 781 enum {
@@ -988,9 +987,6 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
988 * behind you. 987 * behind you.
989 */ 988 */
990 989
991 busy = 0;
992
993
994 /* 990 /*
995 * Find the scsi_device associated with the SCSI address, 991 * Find the scsi_device associated with the SCSI address,
996 * and mark it as changed, invalidating the cache. This deals 992 * and mark it as changed, invalidating the cache. This deals
@@ -1068,8 +1064,8 @@ static int _aac_reset_adapter(struct aac_dev *aac)
1068 */ 1064 */
1069 for (index = 0; index < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); index++) { 1065 for (index = 0; index < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); index++) {
1070 struct fib *fib = &aac->fibs[index]; 1066 struct fib *fib = &aac->fibs[index];
1071 if (!(fib->hw_fib->header.XferState & cpu_to_le32(NoResponseExpected | Async)) && 1067 if (!(fib->hw_fib_va->header.XferState & cpu_to_le32(NoResponseExpected | Async)) &&
1072 (fib->hw_fib->header.XferState & cpu_to_le32(ResponseExpected))) { 1068 (fib->hw_fib_va->header.XferState & cpu_to_le32(ResponseExpected))) {
1073 unsigned long flagv; 1069 unsigned long flagv;
1074 spin_lock_irqsave(&fib->event_lock, flagv); 1070 spin_lock_irqsave(&fib->event_lock, flagv);
1075 up(&fib->event_wait); 1071 up(&fib->event_wait);
@@ -1237,7 +1233,7 @@ int aac_check_health(struct aac_dev * aac)
1237 1233
1238 memset(hw_fib, 0, sizeof(struct hw_fib)); 1234 memset(hw_fib, 0, sizeof(struct hw_fib));
1239 memset(fib, 0, sizeof(struct fib)); 1235 memset(fib, 0, sizeof(struct fib));
1240 fib->hw_fib = hw_fib; 1236 fib->hw_fib_va = hw_fib;
1241 fib->dev = aac; 1237 fib->dev = aac;
1242 aac_fib_init(fib); 1238 aac_fib_init(fib);
1243 fib->type = FSAFS_NTC_FIB_CONTEXT; 1239 fib->type = FSAFS_NTC_FIB_CONTEXT;
@@ -1343,11 +1339,11 @@ int aac_command_thread(void *data)
1343 * do anything at this point since we don't have 1339 * do anything at this point since we don't have
1344 * anything defined for this thread to do. 1340 * anything defined for this thread to do.
1345 */ 1341 */
1346 hw_fib = fib->hw_fib; 1342 hw_fib = fib->hw_fib_va;
1347 memset(fib, 0, sizeof(struct fib)); 1343 memset(fib, 0, sizeof(struct fib));
1348 fib->type = FSAFS_NTC_FIB_CONTEXT; 1344 fib->type = FSAFS_NTC_FIB_CONTEXT;
1349 fib->size = sizeof( struct fib ); 1345 fib->size = sizeof( struct fib );
1350 fib->hw_fib = hw_fib; 1346 fib->hw_fib_va = hw_fib;
1351 fib->data = hw_fib->data; 1347 fib->data = hw_fib->data;
1352 fib->dev = dev; 1348 fib->dev = dev;
1353 /* 1349 /*
@@ -1474,7 +1470,7 @@ int aac_command_thread(void *data)
1474 */ 1470 */
1475 memcpy(hw_newfib, hw_fib, sizeof(struct hw_fib)); 1471 memcpy(hw_newfib, hw_fib, sizeof(struct hw_fib));
1476 memcpy(newfib, fib, sizeof(struct fib)); 1472 memcpy(newfib, fib, sizeof(struct fib));
1477 newfib->hw_fib = hw_newfib; 1473 newfib->hw_fib_va = hw_newfib;
1478 /* 1474 /*
1479 * Put the FIB onto the 1475 * Put the FIB onto the
1480 * fibctx's fibs 1476 * fibctx's fibs