aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/cciss.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r--drivers/block/cciss.c96
1 files changed, 51 insertions, 45 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 1c4df22dfd2a..2cd3391ff878 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -48,14 +48,14 @@
48#include <linux/completion.h> 48#include <linux/completion.h>
49 49
50#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) 50#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin))
51#define DRIVER_NAME "HP CISS Driver (v 2.6.10)" 51#define DRIVER_NAME "HP CISS Driver (v 3.6.10)"
52#define DRIVER_VERSION CCISS_DRIVER_VERSION(2,6,10) 52#define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,10)
53 53
54/* Embedded module documentation macros - see modules.h */ 54/* Embedded module documentation macros - see modules.h */
55MODULE_AUTHOR("Hewlett-Packard Company"); 55MODULE_AUTHOR("Hewlett-Packard Company");
56MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 2.6.10"); 56MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 3.6.10");
57MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400" 57MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400"
58 " SA6i P600 P800 P400 P400i E200 E200i"); 58 " SA6i P600 P800 P400 P400i E200 E200i E500");
59MODULE_LICENSE("GPL"); 59MODULE_LICENSE("GPL");
60 60
61#include "cciss_cmd.h" 61#include "cciss_cmd.h"
@@ -82,6 +82,7 @@ static const struct pci_device_id cciss_pci_device_id[] = {
82 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3213}, 82 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3213},
83 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3214}, 83 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3214},
84 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215}, 84 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215},
85 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3233},
85 {0,} 86 {0,}
86}; 87};
87 88
@@ -110,6 +111,7 @@ static struct board_type products[] = {
110 {0x3213103C, "Smart Array E200i", &SA5_access}, 111 {0x3213103C, "Smart Array E200i", &SA5_access},
111 {0x3214103C, "Smart Array E200i", &SA5_access}, 112 {0x3214103C, "Smart Array E200i", &SA5_access},
112 {0x3215103C, "Smart Array E200i", &SA5_access}, 113 {0x3215103C, "Smart Array E200i", &SA5_access},
114 {0x3233103C, "Smart Array E500", &SA5_access},
113}; 115};
114 116
115/* How long to wait (in milliseconds) for board to go into simple mode */ 117/* How long to wait (in milliseconds) for board to go into simple mode */
@@ -1233,6 +1235,50 @@ static inline void complete_buffers(struct bio *bio, int status)
1233 } 1235 }
1234} 1236}
1235 1237
1238static void cciss_check_queues(ctlr_info_t *h)
1239{
1240 int start_queue = h->next_to_run;
1241 int i;
1242
1243 /* check to see if we have maxed out the number of commands that can
1244 * be placed on the queue. If so then exit. We do this check here
1245 * in case the interrupt we serviced was from an ioctl and did not
1246 * free any new commands.
1247 */
1248 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS)
1249 return;
1250
1251 /* We have room on the queue for more commands. Now we need to queue
1252 * them up. We will also keep track of the next queue to run so
1253 * that every queue gets a chance to be started first.
1254 */
1255 for (i = 0; i < h->highest_lun + 1; i++) {
1256 int curr_queue = (start_queue + i) % (h->highest_lun + 1);
1257 /* make sure the disk has been added and the drive is real
1258 * because this can be called from the middle of init_one.
1259 */
1260 if (!(h->drv[curr_queue].queue) || !(h->drv[curr_queue].heads))
1261 continue;
1262 blk_start_queue(h->gendisk[curr_queue]->queue);
1263
1264 /* check to see if we have maxed out the number of commands
1265 * that can be placed on the queue.
1266 */
1267 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) {
1268 if (curr_queue == start_queue) {
1269 h->next_to_run =
1270 (start_queue + 1) % (h->highest_lun + 1);
1271 break;
1272 } else {
1273 h->next_to_run = curr_queue;
1274 break;
1275 }
1276 } else {
1277 curr_queue = (curr_queue + 1) % (h->highest_lun + 1);
1278 }
1279 }
1280}
1281
1236static void cciss_softirq_done(struct request *rq) 1282static void cciss_softirq_done(struct request *rq)
1237{ 1283{
1238 CommandList_struct *cmd = rq->completion_data; 1284 CommandList_struct *cmd = rq->completion_data;
@@ -1264,6 +1310,7 @@ static void cciss_softirq_done(struct request *rq)
1264 spin_lock_irqsave(&h->lock, flags); 1310 spin_lock_irqsave(&h->lock, flags);
1265 end_that_request_last(rq, rq->errors); 1311 end_that_request_last(rq, rq->errors);
1266 cmd_free(h, cmd, 1); 1312 cmd_free(h, cmd, 1);
1313 cciss_check_queues(h);
1267 spin_unlock_irqrestore(&h->lock, flags); 1314 spin_unlock_irqrestore(&h->lock, flags);
1268} 1315}
1269 1316
@@ -2528,8 +2575,6 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
2528 CommandList_struct *c; 2575 CommandList_struct *c;
2529 unsigned long flags; 2576 unsigned long flags;
2530 __u32 a, a1, a2; 2577 __u32 a, a1, a2;
2531 int j;
2532 int start_queue = h->next_to_run;
2533 2578
2534 if (interrupt_not_for_us(h)) 2579 if (interrupt_not_for_us(h))
2535 return IRQ_NONE; 2580 return IRQ_NONE;
@@ -2588,45 +2633,6 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
2588 } 2633 }
2589 } 2634 }
2590 2635
2591 /* check to see if we have maxed out the number of commands that can
2592 * be placed on the queue. If so then exit. We do this check here
2593 * in case the interrupt we serviced was from an ioctl and did not
2594 * free any new commands.
2595 */
2596 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS)
2597 goto cleanup;
2598
2599 /* We have room on the queue for more commands. Now we need to queue
2600 * them up. We will also keep track of the next queue to run so
2601 * that every queue gets a chance to be started first.
2602 */
2603 for (j = 0; j < h->highest_lun + 1; j++) {
2604 int curr_queue = (start_queue + j) % (h->highest_lun + 1);
2605 /* make sure the disk has been added and the drive is real
2606 * because this can be called from the middle of init_one.
2607 */
2608 if (!(h->drv[curr_queue].queue) || !(h->drv[curr_queue].heads))
2609 continue;
2610 blk_start_queue(h->gendisk[curr_queue]->queue);
2611
2612 /* check to see if we have maxed out the number of commands
2613 * that can be placed on the queue.
2614 */
2615 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) {
2616 if (curr_queue == start_queue) {
2617 h->next_to_run =
2618 (start_queue + 1) % (h->highest_lun + 1);
2619 goto cleanup;
2620 } else {
2621 h->next_to_run = curr_queue;
2622 goto cleanup;
2623 }
2624 } else {
2625 curr_queue = (curr_queue + 1) % (h->highest_lun + 1);
2626 }
2627 }
2628
2629 cleanup:
2630 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); 2636 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
2631 return IRQ_HANDLED; 2637 return IRQ_HANDLED;
2632} 2638}