490
491
492 unsigned long count = 36000000L;
493 while (down_trylock(&fibptr->event_wait)) {
494 int blink;
495 if (--count == 0) {
496 struct aac_queue * q = &dev->queues->queue[AdapNormCmdQueue];
497 spin_lock_irqsave(q->lock, qflags);
498 q->numpending--;
499 spin_unlock_irqrestore(q->lock, qflags);
500 if (wait == -1) {
501 printk(KERN_ERR "aacraid: aac_fib_send: first asynchronous command timed out.\n"
502 "Usually a result of a PCI interrupt routing problem;\n"
503 "update mother board BIOS or consider utilizing one of\n"
504 "the SAFE mode kernel options (acpi, apic etc)\n");
505 }
506 return -ETIMEDOUT;
507 }
508 if ((blink = aac_adapter_check_health(dev)) > 0) {
509 if (wait == -1) {
510 printk(KERN_ERR "aacraid: aac_fib_send: adapter blinkLED 0x%x.\n"
511 "Usually a result of a serious unrecoverable hardware problem\n",
512 blink);
513 }
514 return -EFAULT;
515 }
516 udelay(5);
517 }
518 } else if (down_interruptible(&fibptr->event_wait)) {
519 fibptr->done = 2;
520 up(&fibptr->event_wait);
521 }
522 spin_lock_irqsave(&fibptr->event_lock, flags);
523 if ((fibptr->done == 0) || (fibptr->done == 2)) {
524 fibptr->done = 2;
525 spin_unlock_irqrestore(&fibptr->event_lock, flags);
526 return -EINTR;
527 }
528 spin_unlock_irqrestore(&fibptr->event_lock, flags);
529 BUG_ON(fibptr->done == 0);
530