diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-12-07 16:35:17 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-12-07 16:35:17 -0500 |
commit | 21b4e736922f546e0f1aa7b9d6c442f309a2444a (patch) | |
tree | e1be8645297f8ebe87445251743ebcc52081a20d /drivers/block/cciss.c | |
parent | 34161db6b14d984fb9b06c735b7b42f8803f6851 (diff) | |
parent | 68380b581383c028830f79ec2670f4a193854aa6 (diff) |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/ into merge_linus
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 332 |
1 files changed, 167 insertions, 165 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 4105c3bf3476..892e092afe9a 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -47,14 +47,15 @@ | |||
47 | #include <linux/completion.h> | 47 | #include <linux/completion.h> |
48 | 48 | ||
49 | #define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) | 49 | #define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) |
50 | #define DRIVER_NAME "HP CISS Driver (v 3.6.10)" | 50 | #define DRIVER_NAME "HP CISS Driver (v 3.6.14)" |
51 | #define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,10) | 51 | #define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,14) |
52 | 52 | ||
53 | /* Embedded module documentation macros - see modules.h */ | 53 | /* Embedded module documentation macros - see modules.h */ |
54 | MODULE_AUTHOR("Hewlett-Packard Company"); | 54 | MODULE_AUTHOR("Hewlett-Packard Company"); |
55 | MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 3.6.10"); | 55 | MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 3.6.14"); |
56 | MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400" | 56 | MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400" |
57 | " SA6i P600 P800 P400 P400i E200 E200i E500"); | 57 | " SA6i P600 P800 P400 P400i E200 E200i E500"); |
58 | MODULE_VERSION("3.6.14"); | ||
58 | MODULE_LICENSE("GPL"); | 59 | MODULE_LICENSE("GPL"); |
59 | 60 | ||
60 | #include "cciss_cmd.h" | 61 | #include "cciss_cmd.h" |
@@ -81,7 +82,9 @@ static const struct pci_device_id cciss_pci_device_id[] = { | |||
81 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3213}, | 82 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3213}, |
82 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3214}, | 83 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3214}, |
83 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215}, | 84 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215}, |
84 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3233}, | 85 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3237}, |
86 | {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | ||
87 | PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, | ||
85 | {0,} | 88 | {0,} |
86 | }; | 89 | }; |
87 | 90 | ||
@@ -90,27 +93,29 @@ MODULE_DEVICE_TABLE(pci, cciss_pci_device_id); | |||
90 | /* board_id = Subsystem Device ID & Vendor ID | 93 | /* board_id = Subsystem Device ID & Vendor ID |
91 | * product = Marketing Name for the board | 94 | * product = Marketing Name for the board |
92 | * access = Address of the struct of function pointers | 95 | * access = Address of the struct of function pointers |
96 | * nr_cmds = Number of commands supported by controller | ||
93 | */ | 97 | */ |
94 | static struct board_type products[] = { | 98 | static struct board_type products[] = { |
95 | {0x40700E11, "Smart Array 5300", &SA5_access}, | 99 | {0x40700E11, "Smart Array 5300", &SA5_access, 512}, |
96 | {0x40800E11, "Smart Array 5i", &SA5B_access}, | 100 | {0x40800E11, "Smart Array 5i", &SA5B_access, 512}, |
97 | {0x40820E11, "Smart Array 532", &SA5B_access}, | 101 | {0x40820E11, "Smart Array 532", &SA5B_access, 512}, |
98 | {0x40830E11, "Smart Array 5312", &SA5B_access}, | 102 | {0x40830E11, "Smart Array 5312", &SA5B_access, 512}, |
99 | {0x409A0E11, "Smart Array 641", &SA5_access}, | 103 | {0x409A0E11, "Smart Array 641", &SA5_access, 512}, |
100 | {0x409B0E11, "Smart Array 642", &SA5_access}, | 104 | {0x409B0E11, "Smart Array 642", &SA5_access, 512}, |
101 | {0x409C0E11, "Smart Array 6400", &SA5_access}, | 105 | {0x409C0E11, "Smart Array 6400", &SA5_access, 512}, |
102 | {0x409D0E11, "Smart Array 6400 EM", &SA5_access}, | 106 | {0x409D0E11, "Smart Array 6400 EM", &SA5_access, 512}, |
103 | {0x40910E11, "Smart Array 6i", &SA5_access}, | 107 | {0x40910E11, "Smart Array 6i", &SA5_access, 512}, |
104 | {0x3225103C, "Smart Array P600", &SA5_access}, | 108 | {0x3225103C, "Smart Array P600", &SA5_access, 512}, |
105 | {0x3223103C, "Smart Array P800", &SA5_access}, | 109 | {0x3223103C, "Smart Array P800", &SA5_access, 512}, |
106 | {0x3234103C, "Smart Array P400", &SA5_access}, | 110 | {0x3234103C, "Smart Array P400", &SA5_access, 512}, |
107 | {0x3235103C, "Smart Array P400i", &SA5_access}, | 111 | {0x3235103C, "Smart Array P400i", &SA5_access, 512}, |
108 | {0x3211103C, "Smart Array E200i", &SA5_access}, | 112 | {0x3211103C, "Smart Array E200i", &SA5_access, 120}, |
109 | {0x3212103C, "Smart Array E200", &SA5_access}, | 113 | {0x3212103C, "Smart Array E200", &SA5_access, 120}, |
110 | {0x3213103C, "Smart Array E200i", &SA5_access}, | 114 | {0x3213103C, "Smart Array E200i", &SA5_access, 120}, |
111 | {0x3214103C, "Smart Array E200i", &SA5_access}, | 115 | {0x3214103C, "Smart Array E200i", &SA5_access, 120}, |
112 | {0x3215103C, "Smart Array E200i", &SA5_access}, | 116 | {0x3215103C, "Smart Array E200i", &SA5_access, 120}, |
113 | {0x3233103C, "Smart Array E500", &SA5_access}, | 117 | {0x3237103C, "Smart Array E500", &SA5_access, 512}, |
118 | {0xFFFF103C, "Unknown Smart Array", &SA5_access, 120}, | ||
114 | }; | 119 | }; |
115 | 120 | ||
116 | /* How long to wait (in milliseconds) for board to go into simple mode */ | 121 | /* How long to wait (in milliseconds) for board to go into simple mode */ |
@@ -121,7 +126,6 @@ static struct board_type products[] = { | |||
121 | #define MAX_CMD_RETRIES 3 | 126 | #define MAX_CMD_RETRIES 3 |
122 | 127 | ||
123 | #define READ_AHEAD 1024 | 128 | #define READ_AHEAD 1024 |
124 | #define NR_CMDS 384 /* #commands that can be outstanding */ | ||
125 | #define MAX_CTLR 32 | 129 | #define MAX_CTLR 32 |
126 | 130 | ||
127 | /* Originally cciss driver only supports 8 major numbers */ | 131 | /* Originally cciss driver only supports 8 major numbers */ |
@@ -137,7 +141,6 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, | |||
137 | unsigned int cmd, unsigned long arg); | 141 | unsigned int cmd, unsigned long arg); |
138 | static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); | 142 | static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); |
139 | 143 | ||
140 | static int revalidate_allvol(ctlr_info_t *host); | ||
141 | static int cciss_revalidate(struct gendisk *disk); | 144 | static int cciss_revalidate(struct gendisk *disk); |
142 | static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk); | 145 | static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk); |
143 | static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | 146 | static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, |
@@ -265,6 +268,7 @@ static int cciss_proc_get_info(char *buffer, char **start, off_t offset, | |||
265 | "Firmware Version: %c%c%c%c\n" | 268 | "Firmware Version: %c%c%c%c\n" |
266 | "IRQ: %d\n" | 269 | "IRQ: %d\n" |
267 | "Logical drives: %d\n" | 270 | "Logical drives: %d\n" |
271 | "Max sectors: %d\n" | ||
268 | "Current Q depth: %d\n" | 272 | "Current Q depth: %d\n" |
269 | "Current # commands on controller: %d\n" | 273 | "Current # commands on controller: %d\n" |
270 | "Max Q depth since init: %d\n" | 274 | "Max Q depth since init: %d\n" |
@@ -275,7 +279,9 @@ static int cciss_proc_get_info(char *buffer, char **start, off_t offset, | |||
275 | (unsigned long)h->board_id, | 279 | (unsigned long)h->board_id, |
276 | h->firm_ver[0], h->firm_ver[1], h->firm_ver[2], | 280 | h->firm_ver[0], h->firm_ver[1], h->firm_ver[2], |
277 | h->firm_ver[3], (unsigned int)h->intr[SIMPLE_MODE_INT], | 281 | h->firm_ver[3], (unsigned int)h->intr[SIMPLE_MODE_INT], |
278 | h->num_luns, h->Qdepth, h->commands_outstanding, | 282 | h->num_luns, |
283 | h->cciss_max_sectors, | ||
284 | h->Qdepth, h->commands_outstanding, | ||
279 | h->maxQsinceinit, h->max_outstanding, h->maxSG); | 285 | h->maxQsinceinit, h->max_outstanding, h->maxSG); |
280 | 286 | ||
281 | pos += size; | 287 | pos += size; |
@@ -400,8 +406,8 @@ static CommandList_struct *cmd_alloc(ctlr_info_t *h, int get_from_pool) | |||
400 | } else { /* get it out of the controllers pool */ | 406 | } else { /* get it out of the controllers pool */ |
401 | 407 | ||
402 | do { | 408 | do { |
403 | i = find_first_zero_bit(h->cmd_pool_bits, NR_CMDS); | 409 | i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds); |
404 | if (i == NR_CMDS) | 410 | if (i == h->nr_cmds) |
405 | return NULL; | 411 | return NULL; |
406 | } while (test_and_set_bit | 412 | } while (test_and_set_bit |
407 | (i & (BITS_PER_LONG - 1), | 413 | (i & (BITS_PER_LONG - 1), |
@@ -487,7 +493,7 @@ static int cciss_open(struct inode *inode, struct file *filep) | |||
487 | * but I'm already using way to many device nodes to claim another one | 493 | * but I'm already using way to many device nodes to claim another one |
488 | * for "raw controller". | 494 | * for "raw controller". |
489 | */ | 495 | */ |
490 | if (drv->nr_blocks == 0) { | 496 | if (drv->heads == 0) { |
491 | if (iminor(inode) != 0) { /* not node 0? */ | 497 | if (iminor(inode) != 0) { /* not node 0? */ |
492 | /* if not node 0 make sure it is a partition = 0 */ | 498 | /* if not node 0 make sure it is a partition = 0 */ |
493 | if (iminor(inode) & 0x0f) { | 499 | if (iminor(inode) & 0x0f) { |
@@ -850,9 +856,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, | |||
850 | } | 856 | } |
851 | 857 | ||
852 | case CCISS_REVALIDVOLS: | 858 | case CCISS_REVALIDVOLS: |
853 | if (bdev != bdev->bd_contains || drv != host->drv) | 859 | return rebuild_lun_table(host, NULL); |
854 | return -ENXIO; | ||
855 | return revalidate_allvol(host); | ||
856 | 860 | ||
857 | case CCISS_GETLUNINFO:{ | 861 | case CCISS_GETLUNINFO:{ |
858 | LogvolInfo_struct luninfo; | 862 | LogvolInfo_struct luninfo; |
@@ -1152,75 +1156,6 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, | |||
1152 | } | 1156 | } |
1153 | } | 1157 | } |
1154 | 1158 | ||
1155 | /* | ||
1156 | * revalidate_allvol is for online array config utilities. After a | ||
1157 | * utility reconfigures the drives in the array, it can use this function | ||
1158 | * (through an ioctl) to make the driver zap any previous disk structs for | ||
1159 | * that controller and get new ones. | ||
1160 | * | ||
1161 | * Right now I'm using the getgeometry() function to do this, but this | ||
1162 | * function should probably be finer grained and allow you to revalidate one | ||
1163 | * particular logical volume (instead of all of them on a particular | ||
1164 | * controller). | ||
1165 | */ | ||
1166 | static int revalidate_allvol(ctlr_info_t *host) | ||
1167 | { | ||
1168 | int ctlr = host->ctlr, i; | ||
1169 | unsigned long flags; | ||
1170 | |||
1171 | spin_lock_irqsave(CCISS_LOCK(ctlr), flags); | ||
1172 | if (host->usage_count > 1) { | ||
1173 | spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); | ||
1174 | printk(KERN_WARNING "cciss: Device busy for volume" | ||
1175 | " revalidation (usage=%d)\n", host->usage_count); | ||
1176 | return -EBUSY; | ||
1177 | } | ||
1178 | host->usage_count++; | ||
1179 | spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); | ||
1180 | |||
1181 | for (i = 0; i < NWD; i++) { | ||
1182 | struct gendisk *disk = host->gendisk[i]; | ||
1183 | if (disk) { | ||
1184 | request_queue_t *q = disk->queue; | ||
1185 | |||
1186 | if (disk->flags & GENHD_FL_UP) | ||
1187 | del_gendisk(disk); | ||
1188 | if (q) | ||
1189 | blk_cleanup_queue(q); | ||
1190 | } | ||
1191 | } | ||
1192 | |||
1193 | /* | ||
1194 | * Set the partition and block size structures for all volumes | ||
1195 | * on this controller to zero. We will reread all of this data | ||
1196 | */ | ||
1197 | memset(host->drv, 0, sizeof(drive_info_struct) | ||
1198 | * CISS_MAX_LUN); | ||
1199 | /* | ||
1200 | * Tell the array controller not to give us any interrupts while | ||
1201 | * we check the new geometry. Then turn interrupts back on when | ||
1202 | * we're done. | ||
1203 | */ | ||
1204 | host->access.set_intr_mask(host, CCISS_INTR_OFF); | ||
1205 | cciss_getgeometry(ctlr); | ||
1206 | host->access.set_intr_mask(host, CCISS_INTR_ON); | ||
1207 | |||
1208 | /* Loop through each real device */ | ||
1209 | for (i = 0; i < NWD; i++) { | ||
1210 | struct gendisk *disk = host->gendisk[i]; | ||
1211 | drive_info_struct *drv = &(host->drv[i]); | ||
1212 | /* we must register the controller even if no disks exist */ | ||
1213 | /* this is for the online array utilities */ | ||
1214 | if (!drv->heads && i) | ||
1215 | continue; | ||
1216 | blk_queue_hardsect_size(drv->queue, drv->block_size); | ||
1217 | set_capacity(disk, drv->nr_blocks); | ||
1218 | add_disk(disk); | ||
1219 | } | ||
1220 | host->usage_count--; | ||
1221 | return 0; | ||
1222 | } | ||
1223 | |||
1224 | static inline void complete_buffers(struct bio *bio, int status) | 1159 | static inline void complete_buffers(struct bio *bio, int status) |
1225 | { | 1160 | { |
1226 | while (bio) { | 1161 | while (bio) { |
@@ -1243,7 +1178,7 @@ static void cciss_check_queues(ctlr_info_t *h) | |||
1243 | * in case the interrupt we serviced was from an ioctl and did not | 1178 | * in case the interrupt we serviced was from an ioctl and did not |
1244 | * free any new commands. | 1179 | * free any new commands. |
1245 | */ | 1180 | */ |
1246 | if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) | 1181 | if ((find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds)) == h->nr_cmds) |
1247 | return; | 1182 | return; |
1248 | 1183 | ||
1249 | /* We have room on the queue for more commands. Now we need to queue | 1184 | /* We have room on the queue for more commands. Now we need to queue |
@@ -1262,7 +1197,7 @@ static void cciss_check_queues(ctlr_info_t *h) | |||
1262 | /* check to see if we have maxed out the number of commands | 1197 | /* check to see if we have maxed out the number of commands |
1263 | * that can be placed on the queue. | 1198 | * that can be placed on the queue. |
1264 | */ | 1199 | */ |
1265 | if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) { | 1200 | if ((find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds)) == h->nr_cmds) { |
1266 | if (curr_queue == start_queue) { | 1201 | if (curr_queue == start_queue) { |
1267 | h->next_to_run = | 1202 | h->next_to_run = |
1268 | (start_queue + 1) % (h->highest_lun + 1); | 1203 | (start_queue + 1) % (h->highest_lun + 1); |
@@ -1380,6 +1315,11 @@ static void cciss_update_drive_info(int ctlr, int drv_index) | |||
1380 | /* if it's the controller it's already added */ | 1315 | /* if it's the controller it's already added */ |
1381 | if (drv_index) { | 1316 | if (drv_index) { |
1382 | disk->queue = blk_init_queue(do_cciss_request, &h->lock); | 1317 | disk->queue = blk_init_queue(do_cciss_request, &h->lock); |
1318 | sprintf(disk->disk_name, "cciss/c%dd%d", ctlr, drv_index); | ||
1319 | disk->major = h->major; | ||
1320 | disk->first_minor = drv_index << NWD_SHIFT; | ||
1321 | disk->fops = &cciss_fops; | ||
1322 | disk->private_data = &h->drv[drv_index]; | ||
1383 | 1323 | ||
1384 | /* Set up queue information */ | 1324 | /* Set up queue information */ |
1385 | disk->queue->backing_dev_info.ra_pages = READ_AHEAD; | 1325 | disk->queue->backing_dev_info.ra_pages = READ_AHEAD; |
@@ -1391,7 +1331,7 @@ static void cciss_update_drive_info(int ctlr, int drv_index) | |||
1391 | /* This is a limit in the driver and could be eliminated. */ | 1331 | /* This is a limit in the driver and could be eliminated. */ |
1392 | blk_queue_max_phys_segments(disk->queue, MAXSGENTRIES); | 1332 | blk_queue_max_phys_segments(disk->queue, MAXSGENTRIES); |
1393 | 1333 | ||
1394 | blk_queue_max_sectors(disk->queue, 512); | 1334 | blk_queue_max_sectors(disk->queue, h->cciss_max_sectors); |
1395 | 1335 | ||
1396 | blk_queue_softirq_done(disk->queue, cciss_softirq_done); | 1336 | blk_queue_softirq_done(disk->queue, cciss_softirq_done); |
1397 | 1337 | ||
@@ -1458,11 +1398,6 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk) | |||
1458 | 1398 | ||
1459 | /* Set busy_configuring flag for this operation */ | 1399 | /* Set busy_configuring flag for this operation */ |
1460 | spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); | 1400 | spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); |
1461 | if (h->num_luns >= CISS_MAX_LUN) { | ||
1462 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | ||
1463 | return -EINVAL; | ||
1464 | } | ||
1465 | |||
1466 | if (h->busy_configuring) { | 1401 | if (h->busy_configuring) { |
1467 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | 1402 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); |
1468 | return -EBUSY; | 1403 | return -EBUSY; |
@@ -1495,17 +1430,8 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk) | |||
1495 | 0, 0, TYPE_CMD); | 1430 | 0, 0, TYPE_CMD); |
1496 | 1431 | ||
1497 | if (return_code == IO_OK) { | 1432 | if (return_code == IO_OK) { |
1498 | listlength |= | 1433 | listlength = |
1499 | (0xff & (unsigned int)(ld_buff->LUNListLength[0])) | 1434 | be32_to_cpu(*(__u32 *) ld_buff->LUNListLength); |
1500 | << 24; | ||
1501 | listlength |= | ||
1502 | (0xff & (unsigned int)(ld_buff->LUNListLength[1])) | ||
1503 | << 16; | ||
1504 | listlength |= | ||
1505 | (0xff & (unsigned int)(ld_buff->LUNListLength[2])) | ||
1506 | << 8; | ||
1507 | listlength |= | ||
1508 | 0xff & (unsigned int)(ld_buff->LUNListLength[3]); | ||
1509 | } else { /* reading number of logical volumes failed */ | 1435 | } else { /* reading number of logical volumes failed */ |
1510 | printk(KERN_WARNING "cciss: report logical volume" | 1436 | printk(KERN_WARNING "cciss: report logical volume" |
1511 | " command failed\n"); | 1437 | " command failed\n"); |
@@ -1556,6 +1482,14 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk) | |||
1556 | if (drv_index == -1) | 1482 | if (drv_index == -1) |
1557 | goto freeret; | 1483 | goto freeret; |
1558 | 1484 | ||
1485 | /*Check if the gendisk needs to be allocated */ | ||
1486 | if (!h->gendisk[drv_index]){ | ||
1487 | h->gendisk[drv_index] = alloc_disk(1 << NWD_SHIFT); | ||
1488 | if (!h->gendisk[drv_index]){ | ||
1489 | printk(KERN_ERR "cciss: could not allocate new disk %d\n", drv_index); | ||
1490 | goto mem_msg; | ||
1491 | } | ||
1492 | } | ||
1559 | } | 1493 | } |
1560 | h->drv[drv_index].LunID = lunid; | 1494 | h->drv[drv_index].LunID = lunid; |
1561 | cciss_update_drive_info(ctlr, drv_index); | 1495 | cciss_update_drive_info(ctlr, drv_index); |
@@ -1593,6 +1527,7 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk) | |||
1593 | static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | 1527 | static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, |
1594 | int clear_all) | 1528 | int clear_all) |
1595 | { | 1529 | { |
1530 | int i; | ||
1596 | ctlr_info_t *h = get_host(disk); | 1531 | ctlr_info_t *h = get_host(disk); |
1597 | 1532 | ||
1598 | if (!capable(CAP_SYS_RAWIO)) | 1533 | if (!capable(CAP_SYS_RAWIO)) |
@@ -1616,9 +1551,35 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | |||
1616 | del_gendisk(disk); | 1551 | del_gendisk(disk); |
1617 | if (q) { | 1552 | if (q) { |
1618 | blk_cleanup_queue(q); | 1553 | blk_cleanup_queue(q); |
1554 | /* Set drv->queue to NULL so that we do not try | ||
1555 | * to call blk_start_queue on this queue in the | ||
1556 | * interrupt handler | ||
1557 | */ | ||
1619 | drv->queue = NULL; | 1558 | drv->queue = NULL; |
1620 | } | 1559 | } |
1560 | /* If clear_all is set then we are deleting the logical | ||
1561 | * drive, not just refreshing its info. For drives | ||
1562 | * other than disk 0 we will call put_disk. We do not | ||
1563 | * do this for disk 0 as we need it to be able to | ||
1564 | * configure the controller. | ||
1565 | */ | ||
1566 | if (clear_all){ | ||
1567 | /* This isn't pretty, but we need to find the | ||
1568 | * disk in our array and NULL our the pointer. | ||
1569 | * This is so that we will call alloc_disk if | ||
1570 | * this index is used again later. | ||
1571 | */ | ||
1572 | for (i=0; i < CISS_MAX_LUN; i++){ | ||
1573 | if(h->gendisk[i] == disk){ | ||
1574 | h->gendisk[i] = NULL; | ||
1575 | break; | ||
1576 | } | ||
1577 | } | ||
1578 | put_disk(disk); | ||
1579 | } | ||
1621 | } | 1580 | } |
1581 | } else { | ||
1582 | set_capacity(disk, 0); | ||
1622 | } | 1583 | } |
1623 | 1584 | ||
1624 | --h->num_luns; | 1585 | --h->num_luns; |
@@ -2136,7 +2097,7 @@ static int add_sendcmd_reject(__u8 cmd, int ctlr, unsigned long complete) | |||
2136 | 2097 | ||
2137 | /* We've sent down an abort or reset, but something else | 2098 | /* We've sent down an abort or reset, but something else |
2138 | has completed */ | 2099 | has completed */ |
2139 | if (srl->ncompletions >= (NR_CMDS + 2)) { | 2100 | if (srl->ncompletions >= (hba[ctlr]->nr_cmds + 2)) { |
2140 | /* Uh oh. No room to save it for later... */ | 2101 | /* Uh oh. No room to save it for later... */ |
2141 | printk(KERN_WARNING "cciss%d: Sendcmd: Invalid command addr, " | 2102 | printk(KERN_WARNING "cciss%d: Sendcmd: Invalid command addr, " |
2142 | "reject list overflow, command lost!\n", ctlr); | 2103 | "reject list overflow, command lost!\n", ctlr); |
@@ -2673,7 +2634,7 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id) | |||
2673 | a1 = a; | 2634 | a1 = a; |
2674 | if ((a & 0x04)) { | 2635 | if ((a & 0x04)) { |
2675 | a2 = (a >> 3); | 2636 | a2 = (a >> 3); |
2676 | if (a2 >= NR_CMDS) { | 2637 | if (a2 >= h->nr_cmds) { |
2677 | printk(KERN_WARNING | 2638 | printk(KERN_WARNING |
2678 | "cciss: controller cciss%d failed, stopping.\n", | 2639 | "cciss: controller cciss%d failed, stopping.\n", |
2679 | h->ctlr); | 2640 | h->ctlr); |
@@ -2827,23 +2788,21 @@ static void __devinit cciss_interrupt_mode(ctlr_info_t *c, | |||
2827 | if (err > 0) { | 2788 | if (err > 0) { |
2828 | printk(KERN_WARNING "cciss: only %d MSI-X vectors " | 2789 | printk(KERN_WARNING "cciss: only %d MSI-X vectors " |
2829 | "available\n", err); | 2790 | "available\n", err); |
2791 | goto default_int_mode; | ||
2830 | } else { | 2792 | } else { |
2831 | printk(KERN_WARNING "cciss: MSI-X init failed %d\n", | 2793 | printk(KERN_WARNING "cciss: MSI-X init failed %d\n", |
2832 | err); | 2794 | err); |
2795 | goto default_int_mode; | ||
2833 | } | 2796 | } |
2834 | } | 2797 | } |
2835 | if (pci_find_capability(pdev, PCI_CAP_ID_MSI)) { | 2798 | if (pci_find_capability(pdev, PCI_CAP_ID_MSI)) { |
2836 | if (!pci_enable_msi(pdev)) { | 2799 | if (!pci_enable_msi(pdev)) { |
2837 | c->intr[SIMPLE_MODE_INT] = pdev->irq; | ||
2838 | c->msi_vector = 1; | 2800 | c->msi_vector = 1; |
2839 | return; | ||
2840 | } else { | 2801 | } else { |
2841 | printk(KERN_WARNING "cciss: MSI init failed\n"); | 2802 | printk(KERN_WARNING "cciss: MSI init failed\n"); |
2842 | c->intr[SIMPLE_MODE_INT] = pdev->irq; | ||
2843 | return; | ||
2844 | } | 2803 | } |
2845 | } | 2804 | } |
2846 | default_int_mode: | 2805 | default_int_mode: |
2847 | #endif /* CONFIG_PCI_MSI */ | 2806 | #endif /* CONFIG_PCI_MSI */ |
2848 | /* if we get here we're going to use the default interrupt mode */ | 2807 | /* if we get here we're going to use the default interrupt mode */ |
2849 | c->intr[SIMPLE_MODE_INT] = pdev->irq; | 2808 | c->intr[SIMPLE_MODE_INT] = pdev->irq; |
@@ -2956,16 +2915,10 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
2956 | if (board_id == products[i].board_id) { | 2915 | if (board_id == products[i].board_id) { |
2957 | c->product_name = products[i].product_name; | 2916 | c->product_name = products[i].product_name; |
2958 | c->access = *(products[i].access); | 2917 | c->access = *(products[i].access); |
2918 | c->nr_cmds = products[i].nr_cmds; | ||
2959 | break; | 2919 | break; |
2960 | } | 2920 | } |
2961 | } | 2921 | } |
2962 | if (i == ARRAY_SIZE(products)) { | ||
2963 | printk(KERN_WARNING "cciss: Sorry, I don't know how" | ||
2964 | " to access the Smart Array controller %08lx\n", | ||
2965 | (unsigned long)board_id); | ||
2966 | err = -ENODEV; | ||
2967 | goto err_out_free_res; | ||
2968 | } | ||
2969 | if ((readb(&c->cfgtable->Signature[0]) != 'C') || | 2922 | if ((readb(&c->cfgtable->Signature[0]) != 'C') || |
2970 | (readb(&c->cfgtable->Signature[1]) != 'I') || | 2923 | (readb(&c->cfgtable->Signature[1]) != 'I') || |
2971 | (readb(&c->cfgtable->Signature[2]) != 'S') || | 2924 | (readb(&c->cfgtable->Signature[2]) != 'S') || |
@@ -2974,6 +2927,27 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
2974 | err = -ENODEV; | 2927 | err = -ENODEV; |
2975 | goto err_out_free_res; | 2928 | goto err_out_free_res; |
2976 | } | 2929 | } |
2930 | /* We didn't find the controller in our list. We know the | ||
2931 | * signature is valid. If it's an HP device let's try to | ||
2932 | * bind to the device and fire it up. Otherwise we bail. | ||
2933 | */ | ||
2934 | if (i == ARRAY_SIZE(products)) { | ||
2935 | if (subsystem_vendor_id == PCI_VENDOR_ID_HP) { | ||
2936 | c->product_name = products[i-1].product_name; | ||
2937 | c->access = *(products[i-1].access); | ||
2938 | c->nr_cmds = products[i-1].nr_cmds; | ||
2939 | printk(KERN_WARNING "cciss: This is an unknown " | ||
2940 | "Smart Array controller.\n" | ||
2941 | "cciss: Please update to the latest driver " | ||
2942 | "available from www.hp.com.\n"); | ||
2943 | } else { | ||
2944 | printk(KERN_WARNING "cciss: Sorry, I don't know how" | ||
2945 | " to access the Smart Array controller %08lx\n" | ||
2946 | , (unsigned long)board_id); | ||
2947 | err = -ENODEV; | ||
2948 | goto err_out_free_res; | ||
2949 | } | ||
2950 | } | ||
2977 | #ifdef CONFIG_X86 | 2951 | #ifdef CONFIG_X86 |
2978 | { | 2952 | { |
2979 | /* Need to enable prefetch in the SCSI core for 6400 in x86 */ | 2953 | /* Need to enable prefetch in the SCSI core for 6400 in x86 */ |
@@ -2984,6 +2958,17 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
2984 | } | 2958 | } |
2985 | #endif | 2959 | #endif |
2986 | 2960 | ||
2961 | /* Disabling DMA prefetch for the P600 | ||
2962 | * An ASIC bug may result in a prefetch beyond | ||
2963 | * physical memory. | ||
2964 | */ | ||
2965 | if(board_id == 0x3225103C) { | ||
2966 | __u32 dma_prefetch; | ||
2967 | dma_prefetch = readl(c->vaddr + I2O_DMA1_CFG); | ||
2968 | dma_prefetch |= 0x8000; | ||
2969 | writel(dma_prefetch, c->vaddr + I2O_DMA1_CFG); | ||
2970 | } | ||
2971 | |||
2987 | #ifdef CCISS_DEBUG | 2972 | #ifdef CCISS_DEBUG |
2988 | printk("Trying to put board into Simple mode\n"); | 2973 | printk("Trying to put board into Simple mode\n"); |
2989 | #endif /* CCISS_DEBUG */ | 2974 | #endif /* CCISS_DEBUG */ |
@@ -3158,13 +3143,7 @@ geo_inq: | |||
3158 | /* Returns -1 if no free entries are left. */ | 3143 | /* Returns -1 if no free entries are left. */ |
3159 | static int alloc_cciss_hba(void) | 3144 | static int alloc_cciss_hba(void) |
3160 | { | 3145 | { |
3161 | struct gendisk *disk[NWD]; | 3146 | int i; |
3162 | int i, n; | ||
3163 | for (n = 0; n < NWD; n++) { | ||
3164 | disk[n] = alloc_disk(1 << NWD_SHIFT); | ||
3165 | if (!disk[n]) | ||
3166 | goto out; | ||
3167 | } | ||
3168 | 3147 | ||
3169 | for (i = 0; i < MAX_CTLR; i++) { | 3148 | for (i = 0; i < MAX_CTLR; i++) { |
3170 | if (!hba[i]) { | 3149 | if (!hba[i]) { |
@@ -3172,20 +3151,18 @@ static int alloc_cciss_hba(void) | |||
3172 | p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL); | 3151 | p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL); |
3173 | if (!p) | 3152 | if (!p) |
3174 | goto Enomem; | 3153 | goto Enomem; |
3175 | for (n = 0; n < NWD; n++) | 3154 | p->gendisk[0] = alloc_disk(1 << NWD_SHIFT); |
3176 | p->gendisk[n] = disk[n]; | 3155 | if (!p->gendisk[0]) |
3156 | goto Enomem; | ||
3177 | hba[i] = p; | 3157 | hba[i] = p; |
3178 | return i; | 3158 | return i; |
3179 | } | 3159 | } |
3180 | } | 3160 | } |
3181 | printk(KERN_WARNING "cciss: This driver supports a maximum" | 3161 | printk(KERN_WARNING "cciss: This driver supports a maximum" |
3182 | " of %d controllers.\n", MAX_CTLR); | 3162 | " of %d controllers.\n", MAX_CTLR); |
3183 | goto out; | 3163 | return -1; |
3184 | Enomem: | 3164 | Enomem: |
3185 | printk(KERN_ERR "cciss: out of memory.\n"); | 3165 | printk(KERN_ERR "cciss: out of memory.\n"); |
3186 | out: | ||
3187 | while (n--) | ||
3188 | put_disk(disk[n]); | ||
3189 | return -1; | 3166 | return -1; |
3190 | } | 3167 | } |
3191 | 3168 | ||
@@ -3195,7 +3172,7 @@ static void free_hba(int i) | |||
3195 | int n; | 3172 | int n; |
3196 | 3173 | ||
3197 | hba[i] = NULL; | 3174 | hba[i] = NULL; |
3198 | for (n = 0; n < NWD; n++) | 3175 | for (n = 0; n < CISS_MAX_LUN; n++) |
3199 | put_disk(p->gendisk[n]); | 3176 | put_disk(p->gendisk[n]); |
3200 | kfree(p); | 3177 | kfree(p); |
3201 | } | 3178 | } |
@@ -3208,9 +3185,8 @@ static void free_hba(int i) | |||
3208 | static int __devinit cciss_init_one(struct pci_dev *pdev, | 3185 | static int __devinit cciss_init_one(struct pci_dev *pdev, |
3209 | const struct pci_device_id *ent) | 3186 | const struct pci_device_id *ent) |
3210 | { | 3187 | { |
3211 | request_queue_t *q; | ||
3212 | int i; | 3188 | int i; |
3213 | int j; | 3189 | int j = 0; |
3214 | int rc; | 3190 | int rc; |
3215 | int dac; | 3191 | int dac; |
3216 | 3192 | ||
@@ -3269,15 +3245,15 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3269 | hba[i]->intr[SIMPLE_MODE_INT], dac ? "" : " not"); | 3245 | hba[i]->intr[SIMPLE_MODE_INT], dac ? "" : " not"); |
3270 | 3246 | ||
3271 | hba[i]->cmd_pool_bits = | 3247 | hba[i]->cmd_pool_bits = |
3272 | kmalloc(((NR_CMDS + BITS_PER_LONG - | 3248 | kmalloc(((hba[i]->nr_cmds + BITS_PER_LONG - |
3273 | 1) / BITS_PER_LONG) * sizeof(unsigned long), GFP_KERNEL); | 3249 | 1) / BITS_PER_LONG) * sizeof(unsigned long), GFP_KERNEL); |
3274 | hba[i]->cmd_pool = (CommandList_struct *) | 3250 | hba[i]->cmd_pool = (CommandList_struct *) |
3275 | pci_alloc_consistent(hba[i]->pdev, | 3251 | pci_alloc_consistent(hba[i]->pdev, |
3276 | NR_CMDS * sizeof(CommandList_struct), | 3252 | hba[i]->nr_cmds * sizeof(CommandList_struct), |
3277 | &(hba[i]->cmd_pool_dhandle)); | 3253 | &(hba[i]->cmd_pool_dhandle)); |
3278 | hba[i]->errinfo_pool = (ErrorInfo_struct *) | 3254 | hba[i]->errinfo_pool = (ErrorInfo_struct *) |
3279 | pci_alloc_consistent(hba[i]->pdev, | 3255 | pci_alloc_consistent(hba[i]->pdev, |
3280 | NR_CMDS * sizeof(ErrorInfo_struct), | 3256 | hba[i]->nr_cmds * sizeof(ErrorInfo_struct), |
3281 | &(hba[i]->errinfo_pool_dhandle)); | 3257 | &(hba[i]->errinfo_pool_dhandle)); |
3282 | if ((hba[i]->cmd_pool_bits == NULL) | 3258 | if ((hba[i]->cmd_pool_bits == NULL) |
3283 | || (hba[i]->cmd_pool == NULL) | 3259 | || (hba[i]->cmd_pool == NULL) |
@@ -3288,7 +3264,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3288 | #ifdef CONFIG_CISS_SCSI_TAPE | 3264 | #ifdef CONFIG_CISS_SCSI_TAPE |
3289 | hba[i]->scsi_rejects.complete = | 3265 | hba[i]->scsi_rejects.complete = |
3290 | kmalloc(sizeof(hba[i]->scsi_rejects.complete[0]) * | 3266 | kmalloc(sizeof(hba[i]->scsi_rejects.complete[0]) * |
3291 | (NR_CMDS + 5), GFP_KERNEL); | 3267 | (hba[i]->nr_cmds + 5), GFP_KERNEL); |
3292 | if (hba[i]->scsi_rejects.complete == NULL) { | 3268 | if (hba[i]->scsi_rejects.complete == NULL) { |
3293 | printk(KERN_ERR "cciss: out of memory"); | 3269 | printk(KERN_ERR "cciss: out of memory"); |
3294 | goto clean4; | 3270 | goto clean4; |
@@ -3302,7 +3278,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3302 | /* command and error info recs zeroed out before | 3278 | /* command and error info recs zeroed out before |
3303 | they are used */ | 3279 | they are used */ |
3304 | memset(hba[i]->cmd_pool_bits, 0, | 3280 | memset(hba[i]->cmd_pool_bits, 0, |
3305 | ((NR_CMDS + BITS_PER_LONG - | 3281 | ((hba[i]->nr_cmds + BITS_PER_LONG - |
3306 | 1) / BITS_PER_LONG) * sizeof(unsigned long)); | 3282 | 1) / BITS_PER_LONG) * sizeof(unsigned long)); |
3307 | 3283 | ||
3308 | #ifdef CCISS_DEBUG | 3284 | #ifdef CCISS_DEBUG |
@@ -3317,18 +3293,34 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3317 | hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON); | 3293 | hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON); |
3318 | 3294 | ||
3319 | cciss_procinit(i); | 3295 | cciss_procinit(i); |
3296 | |||
3297 | hba[i]->cciss_max_sectors = 2048; | ||
3298 | |||
3320 | hba[i]->busy_initializing = 0; | 3299 | hba[i]->busy_initializing = 0; |
3321 | 3300 | ||
3322 | for (j = 0; j < NWD; j++) { /* mfm */ | 3301 | do { |
3323 | drive_info_struct *drv = &(hba[i]->drv[j]); | 3302 | drive_info_struct *drv = &(hba[i]->drv[j]); |
3324 | struct gendisk *disk = hba[i]->gendisk[j]; | 3303 | struct gendisk *disk = hba[i]->gendisk[j]; |
3304 | request_queue_t *q; | ||
3305 | |||
3306 | /* Check if the disk was allocated already */ | ||
3307 | if (!disk){ | ||
3308 | hba[i]->gendisk[j] = alloc_disk(1 << NWD_SHIFT); | ||
3309 | disk = hba[i]->gendisk[j]; | ||
3310 | } | ||
3311 | |||
3312 | /* Check that the disk was able to be allocated */ | ||
3313 | if (!disk) { | ||
3314 | printk(KERN_ERR "cciss: unable to allocate memory for disk %d\n", j); | ||
3315 | goto clean4; | ||
3316 | } | ||
3325 | 3317 | ||
3326 | q = blk_init_queue(do_cciss_request, &hba[i]->lock); | 3318 | q = blk_init_queue(do_cciss_request, &hba[i]->lock); |
3327 | if (!q) { | 3319 | if (!q) { |
3328 | printk(KERN_ERR | 3320 | printk(KERN_ERR |
3329 | "cciss: unable to allocate queue for disk %d\n", | 3321 | "cciss: unable to allocate queue for disk %d\n", |
3330 | j); | 3322 | j); |
3331 | break; | 3323 | goto clean4; |
3332 | } | 3324 | } |
3333 | drv->queue = q; | 3325 | drv->queue = q; |
3334 | 3326 | ||
@@ -3341,7 +3333,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3341 | /* This is a limit in the driver and could be eliminated. */ | 3333 | /* This is a limit in the driver and could be eliminated. */ |
3342 | blk_queue_max_phys_segments(q, MAXSGENTRIES); | 3334 | blk_queue_max_phys_segments(q, MAXSGENTRIES); |
3343 | 3335 | ||
3344 | blk_queue_max_sectors(q, 512); | 3336 | blk_queue_max_sectors(q, hba[i]->cciss_max_sectors); |
3345 | 3337 | ||
3346 | blk_queue_softirq_done(q, cciss_softirq_done); | 3338 | blk_queue_softirq_done(q, cciss_softirq_done); |
3347 | 3339 | ||
@@ -3360,7 +3352,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3360 | blk_queue_hardsect_size(q, drv->block_size); | 3352 | blk_queue_hardsect_size(q, drv->block_size); |
3361 | set_capacity(disk, drv->nr_blocks); | 3353 | set_capacity(disk, drv->nr_blocks); |
3362 | add_disk(disk); | 3354 | add_disk(disk); |
3363 | } | 3355 | j++; |
3356 | } while (j <= hba[i]->highest_lun); | ||
3364 | 3357 | ||
3365 | return 1; | 3358 | return 1; |
3366 | 3359 | ||
@@ -3371,11 +3364,11 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3371 | kfree(hba[i]->cmd_pool_bits); | 3364 | kfree(hba[i]->cmd_pool_bits); |
3372 | if (hba[i]->cmd_pool) | 3365 | if (hba[i]->cmd_pool) |
3373 | pci_free_consistent(hba[i]->pdev, | 3366 | pci_free_consistent(hba[i]->pdev, |
3374 | NR_CMDS * sizeof(CommandList_struct), | 3367 | hba[i]->nr_cmds * sizeof(CommandList_struct), |
3375 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); | 3368 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); |
3376 | if (hba[i]->errinfo_pool) | 3369 | if (hba[i]->errinfo_pool) |
3377 | pci_free_consistent(hba[i]->pdev, | 3370 | pci_free_consistent(hba[i]->pdev, |
3378 | NR_CMDS * sizeof(ErrorInfo_struct), | 3371 | hba[i]->nr_cmds * sizeof(ErrorInfo_struct), |
3379 | hba[i]->errinfo_pool, | 3372 | hba[i]->errinfo_pool, |
3380 | hba[i]->errinfo_pool_dhandle); | 3373 | hba[i]->errinfo_pool_dhandle); |
3381 | free_irq(hba[i]->intr[SIMPLE_MODE_INT], hba[i]); | 3374 | free_irq(hba[i]->intr[SIMPLE_MODE_INT], hba[i]); |
@@ -3383,6 +3376,15 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3383 | unregister_blkdev(hba[i]->major, hba[i]->devname); | 3376 | unregister_blkdev(hba[i]->major, hba[i]->devname); |
3384 | clean1: | 3377 | clean1: |
3385 | hba[i]->busy_initializing = 0; | 3378 | hba[i]->busy_initializing = 0; |
3379 | /* cleanup any queues that may have been initialized */ | ||
3380 | for (j=0; j <= hba[i]->highest_lun; j++){ | ||
3381 | drive_info_struct *drv = &(hba[i]->drv[j]); | ||
3382 | if (drv->queue) | ||
3383 | blk_cleanup_queue(drv->queue); | ||
3384 | } | ||
3385 | pci_release_regions(pdev); | ||
3386 | pci_disable_device(pdev); | ||
3387 | pci_set_drvdata(pdev, NULL); | ||
3386 | free_hba(i); | 3388 | free_hba(i); |
3387 | return -1; | 3389 | return -1; |
3388 | } | 3390 | } |
@@ -3430,7 +3432,7 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev) | |||
3430 | remove_proc_entry(hba[i]->devname, proc_cciss); | 3432 | remove_proc_entry(hba[i]->devname, proc_cciss); |
3431 | 3433 | ||
3432 | /* remove it from the disk list */ | 3434 | /* remove it from the disk list */ |
3433 | for (j = 0; j < NWD; j++) { | 3435 | for (j = 0; j < CISS_MAX_LUN; j++) { |
3434 | struct gendisk *disk = hba[i]->gendisk[j]; | 3436 | struct gendisk *disk = hba[i]->gendisk[j]; |
3435 | if (disk) { | 3437 | if (disk) { |
3436 | request_queue_t *q = disk->queue; | 3438 | request_queue_t *q = disk->queue; |
@@ -3442,9 +3444,9 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev) | |||
3442 | } | 3444 | } |
3443 | } | 3445 | } |
3444 | 3446 | ||
3445 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct), | 3447 | pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(CommandList_struct), |
3446 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); | 3448 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); |
3447 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(ErrorInfo_struct), | 3449 | pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(ErrorInfo_struct), |
3448 | hba[i]->errinfo_pool, hba[i]->errinfo_pool_dhandle); | 3450 | hba[i]->errinfo_pool, hba[i]->errinfo_pool_dhandle); |
3449 | kfree(hba[i]->cmd_pool_bits); | 3451 | kfree(hba[i]->cmd_pool_bits); |
3450 | #ifdef CONFIG_CISS_SCSI_TAPE | 3452 | #ifdef CONFIG_CISS_SCSI_TAPE |