Lines Matching refs:fibptr
103 struct fib *fibptr; in aac_fib_setup() local
135 for (i = 0, fibptr = &dev->fibs[i]; in aac_fib_setup()
137 i++, fibptr++) in aac_fib_setup()
139 fibptr->dev = dev; in aac_fib_setup()
140 fibptr->hw_fib_va = hw_fib; in aac_fib_setup()
141 fibptr->data = (void *) fibptr->hw_fib_va->data; in aac_fib_setup()
142 fibptr->next = fibptr+1; /* Forward chain the fibs */ in aac_fib_setup()
143 sema_init(&fibptr->event_wait, 0); in aac_fib_setup()
144 spin_lock_init(&fibptr->event_lock); in aac_fib_setup()
147 fibptr->hw_fib_pa = hw_fib_pa; in aac_fib_setup()
174 struct fib * fibptr; in aac_fib_alloc() local
177 fibptr = dev->free_fib; in aac_fib_alloc()
178 if(!fibptr){ in aac_fib_alloc()
180 return fibptr; in aac_fib_alloc()
182 dev->free_fib = fibptr->next; in aac_fib_alloc()
187 fibptr->type = FSAFS_NTC_FIB_CONTEXT; in aac_fib_alloc()
188 fibptr->size = sizeof(struct fib); in aac_fib_alloc()
193 fibptr->hw_fib_va->header.XferState = 0; in aac_fib_alloc()
194 fibptr->flags = 0; in aac_fib_alloc()
195 fibptr->callback = NULL; in aac_fib_alloc()
196 fibptr->callback_data = NULL; in aac_fib_alloc()
198 return fibptr; in aac_fib_alloc()
208 void aac_fib_free(struct fib *fibptr) in aac_fib_free() argument
212 spin_lock_irqsave(&fibptr->event_lock, flagsv); in aac_fib_free()
213 if (fibptr->done == 2) { in aac_fib_free()
214 spin_unlock_irqrestore(&fibptr->event_lock, flagsv); in aac_fib_free()
217 spin_unlock_irqrestore(&fibptr->event_lock, flagsv); in aac_fib_free()
219 spin_lock_irqsave(&fibptr->dev->fib_lock, flags); in aac_fib_free()
220 if (unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)) in aac_fib_free()
222 if (fibptr->hw_fib_va->header.XferState != 0) { in aac_fib_free()
224 (void*)fibptr, in aac_fib_free()
225 le32_to_cpu(fibptr->hw_fib_va->header.XferState)); in aac_fib_free()
227 fibptr->next = fibptr->dev->free_fib; in aac_fib_free()
228 fibptr->dev->free_fib = fibptr; in aac_fib_free()
229 spin_unlock_irqrestore(&fibptr->dev->fib_lock, flags); in aac_fib_free()
239 void aac_fib_init(struct fib *fibptr) in aac_fib_init() argument
241 struct hw_fib *hw_fib = fibptr->hw_fib_va; in aac_fib_init()
244 hw_fib->header.Size = cpu_to_le16(fibptr->dev->max_fib_size); in aac_fib_init()
247 hw_fib->header.ReceiverFibAddress = cpu_to_le32(fibptr->hw_fib_pa); in aac_fib_init()
248 hw_fib->header.SenderSize = cpu_to_le16(fibptr->dev->max_fib_size); in aac_fib_init()
259 static void fib_dealloc(struct fib * fibptr) in fib_dealloc() argument
261 struct hw_fib *hw_fib = fibptr->hw_fib_va; in fib_dealloc()
348 …ev, u32 * index, u32 qid, struct hw_fib * hw_fib, int wait, struct fib * fibptr, unsigned long *no… in aac_queue_get() argument
381 entry->addr = cpu_to_le32(fibptr->hw_fib_pa); in aac_queue_get()
410 int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, in aac_fib_send() argument
414 struct aac_dev * dev = fibptr->dev; in aac_fib_send()
415 struct hw_fib * hw_fib = fibptr->hw_fib_va; in aac_fib_send()
434 fibptr->flags = 0; in aac_fib_send()
451 hw_fib->header.SenderFibAddress = cpu_to_le32(((u32)(fibptr - dev->fibs)) << 2); in aac_fib_send()
452 hw_fib->header.SenderData = (u32)(fibptr - dev->fibs); in aac_fib_send()
462 fibptr->hw_fib_va->header.Flags = 0; /* 0 the flags field - internal only*/ in aac_fib_send()
481 fibptr->callback = callback; in aac_fib_send()
482 fibptr->callback_data = callback_data; in aac_fib_send()
483 fibptr->flags = FIB_CONTEXT_FLAG; in aac_fib_send()
486 fibptr->done = 0; in aac_fib_send()
492 …bCommand = %d.\n", le32_to_cpu(((struct aac_query_mount *)fib_data(fibptr))->command))); in aac_fib_send()
494 dprintk((KERN_DEBUG " hw_fib va being sent=%p\n",fibptr->hw_fib_va)); in aac_fib_send()
495 dprintk((KERN_DEBUG " hw_fib pa being sent=%lx\n",(ulong)fibptr->hw_fib_pa)); in aac_fib_send()
496 dprintk((KERN_DEBUG " fib being sent=%p\n",fibptr)); in aac_fib_send()
512 spin_lock_irqsave(&fibptr->event_lock, flags); in aac_fib_send()
515 if (aac_adapter_deliver(fibptr) != 0) { in aac_fib_send()
518 spin_unlock_irqrestore(&fibptr->event_lock, flags); in aac_fib_send()
532 spin_unlock_irqrestore(&fibptr->event_lock, flags); in aac_fib_send()
542 while (down_trylock(&fibptr->event_wait)) { in aac_fib_send()
567 } else if (down_interruptible(&fibptr->event_wait)) { in aac_fib_send()
572 spin_lock_irqsave(&fibptr->event_lock, flags); in aac_fib_send()
573 if (fibptr->done == 0) { in aac_fib_send()
574 fibptr->done = 2; /* Tell interrupt we aborted */ in aac_fib_send()
575 spin_unlock_irqrestore(&fibptr->event_lock, flags); in aac_fib_send()
578 spin_unlock_irqrestore(&fibptr->event_lock, flags); in aac_fib_send()
579 BUG_ON(fibptr->done == 0); in aac_fib_send()
581 if(unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)) in aac_fib_send()
677 int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) in aac_fib_adapter_complete() argument
679 struct hw_fib * hw_fib = fibptr->hw_fib_va; in aac_fib_adapter_complete()
680 struct aac_dev * dev = fibptr->dev; in aac_fib_adapter_complete()
745 int aac_fib_complete(struct fib *fibptr) in aac_fib_complete() argument
748 struct hw_fib * hw_fib = fibptr->hw_fib_va; in aac_fib_complete()
768 spin_lock_irqsave(&fibptr->event_lock, flags); in aac_fib_complete()
769 if (fibptr->done == 2) { in aac_fib_complete()
770 spin_unlock_irqrestore(&fibptr->event_lock, flags); in aac_fib_complete()
773 spin_unlock_irqrestore(&fibptr->event_lock, flags); in aac_fib_complete()
778 fib_dealloc(fibptr); in aac_fib_complete()
786 fib_dealloc(fibptr); in aac_fib_complete()
788 fib_dealloc(fibptr); in aac_fib_complete()
839 static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) in aac_handle_aif() argument
841 struct hw_fib * hw_fib = fibptr->hw_fib_va; in aac_handle_aif()
1843 struct fib *fibptr; in aac_command_thread() local
1845 if ((fibptr = aac_fib_alloc(dev))) { in aac_command_thread()
1849 aac_fib_init(fibptr); in aac_command_thread()
1851 info = (__le32 *) fib_data(fibptr); in aac_command_thread()
1858 fibptr, in aac_command_thread()
1867 aac_fib_complete(fibptr); in aac_command_thread()
1871 aac_fib_free(fibptr); in aac_command_thread()