diff options
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r-- | drivers/scsi/hpsa.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index ba3deaddf150..82987e1850a1 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -2723,6 +2723,24 @@ static inline void finish_cmd(struct CommandList *c, u32 raw_tag) | |||
2723 | complete(c->waiting); | 2723 | complete(c->waiting); |
2724 | } | 2724 | } |
2725 | 2725 | ||
2726 | static inline u32 hpsa_tag_contains_index(u32 tag) | ||
2727 | { | ||
2728 | #define DIRECT_LOOKUP_BIT 0x04 | ||
2729 | return tag & DIRECT_LOOKUP_BIT; | ||
2730 | } | ||
2731 | |||
2732 | static inline u32 hpsa_tag_to_index(u32 tag) | ||
2733 | { | ||
2734 | #define DIRECT_LOOKUP_SHIFT 3 | ||
2735 | return tag >> DIRECT_LOOKUP_SHIFT; | ||
2736 | } | ||
2737 | |||
2738 | static inline u32 hpsa_tag_discard_error_bits(u32 tag) | ||
2739 | { | ||
2740 | #define HPSA_ERROR_BITS 0x03 | ||
2741 | return tag & ~HPSA_ERROR_BITS; | ||
2742 | } | ||
2743 | |||
2726 | static irqreturn_t do_hpsa_intr(int irq, void *dev_id) | 2744 | static irqreturn_t do_hpsa_intr(int irq, void *dev_id) |
2727 | { | 2745 | { |
2728 | struct ctlr_info *h = dev_id; | 2746 | struct ctlr_info *h = dev_id; |
@@ -2736,15 +2754,15 @@ static irqreturn_t do_hpsa_intr(int irq, void *dev_id) | |||
2736 | spin_lock_irqsave(&h->lock, flags); | 2754 | spin_lock_irqsave(&h->lock, flags); |
2737 | while (interrupt_pending(h)) { | 2755 | while (interrupt_pending(h)) { |
2738 | while ((raw_tag = get_next_completion(h)) != FIFO_EMPTY) { | 2756 | while ((raw_tag = get_next_completion(h)) != FIFO_EMPTY) { |
2739 | if (likely(HPSA_TAG_CONTAINS_INDEX(raw_tag))) { | 2757 | if (likely(hpsa_tag_contains_index(raw_tag))) { |
2740 | tag_index = HPSA_TAG_TO_INDEX(raw_tag); | 2758 | tag_index = hpsa_tag_to_index(raw_tag); |
2741 | if (bad_tag(h, tag_index, raw_tag)) | 2759 | if (bad_tag(h, tag_index, raw_tag)) |
2742 | return IRQ_HANDLED; | 2760 | return IRQ_HANDLED; |
2743 | c = h->cmd_pool + tag_index; | 2761 | c = h->cmd_pool + tag_index; |
2744 | finish_cmd(c, raw_tag); | 2762 | finish_cmd(c, raw_tag); |
2745 | continue; | 2763 | continue; |
2746 | } | 2764 | } |
2747 | tag = HPSA_TAG_DISCARD_ERROR_BITS(raw_tag); | 2765 | tag = hpsa_tag_discard_error_bits(raw_tag); |
2748 | c = NULL; | 2766 | c = NULL; |
2749 | hlist_for_each_entry(c, tmp, &h->cmpQ, list) { | 2767 | hlist_for_each_entry(c, tmp, &h->cmpQ, list) { |
2750 | if (c->busaddr == tag) { | 2768 | if (c->busaddr == tag) { |
@@ -2824,7 +2842,7 @@ static __devinit int hpsa_message(struct pci_dev *pdev, unsigned char opcode, | |||
2824 | 2842 | ||
2825 | for (i = 0; i < HPSA_MSG_SEND_RETRY_LIMIT; i++) { | 2843 | for (i = 0; i < HPSA_MSG_SEND_RETRY_LIMIT; i++) { |
2826 | tag = readl(vaddr + SA5_REPLY_PORT_OFFSET); | 2844 | tag = readl(vaddr + SA5_REPLY_PORT_OFFSET); |
2827 | if (HPSA_TAG_DISCARD_ERROR_BITS(tag) == paddr32) | 2845 | if (hpsa_tag_discard_error_bits(tag) == paddr32) |
2828 | break; | 2846 | break; |
2829 | msleep(HPSA_MSG_SEND_RETRY_INTERVAL_MSECS); | 2847 | msleep(HPSA_MSG_SEND_RETRY_INTERVAL_MSECS); |
2830 | } | 2848 | } |