aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid/megaraid_mbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_mbox.c')
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c160
1 files changed, 46 insertions, 114 deletions
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 138fa4815833..cbe430246276 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -10,7 +10,7 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 * 11 *
12 * FILE : megaraid_mbox.c 12 * FILE : megaraid_mbox.c
13 * Version : v2.20.4.5 (Feb 03 2005) 13 * Version : v2.20.4.6 (Mar 07 2005)
14 * 14 *
15 * Authors: 15 * Authors:
16 * Atul Mukker <Atul.Mukker@lsil.com> 16 * Atul Mukker <Atul.Mukker@lsil.com>
@@ -124,7 +124,7 @@ static irqreturn_t megaraid_isr(int, void *, struct pt_regs *);
124static void megaraid_mbox_dpc(unsigned long); 124static void megaraid_mbox_dpc(unsigned long);
125 125
126static ssize_t megaraid_sysfs_show_app_hndl(struct class_device *, char *); 126static ssize_t megaraid_sysfs_show_app_hndl(struct class_device *, char *);
127static ssize_t megaraid_sysfs_show_ldnum(struct device *, char *); 127static ssize_t megaraid_sysfs_show_ldnum(struct device *, struct device_attribute *attr, char *);
128 128
129static int megaraid_cmm_register(adapter_t *); 129static int megaraid_cmm_register(adapter_t *);
130static int megaraid_cmm_unregister(adapter_t *); 130static int megaraid_cmm_unregister(adapter_t *);
@@ -202,7 +202,7 @@ MODULE_PARM_DESC(debug_level, "Debug level for driver (default=0)");
202 * ### global data ### 202 * ### global data ###
203 */ 203 */
204static uint8_t megaraid_mbox_version[8] = 204static uint8_t megaraid_mbox_version[8] =
205 { 0x02, 0x20, 0x04, 0x05, 2, 3, 20, 5 }; 205 { 0x02, 0x20, 0x04, 0x06, 3, 7, 20, 5 };
206 206
207 207
208/* 208/*
@@ -229,9 +229,9 @@ static struct pci_device_id pci_id_table_g[] = {
229 }, 229 },
230 { 230 {
231 PCI_VENDOR_ID_LSI_LOGIC, 231 PCI_VENDOR_ID_LSI_LOGIC,
232 PCI_DEVICE_ID_PERC4_QC, 232 PCI_DEVICE_ID_VERDE,
233 PCI_VENDOR_ID_DELL, 233 PCI_ANY_ID,
234 PCI_SUBSYS_ID_PERC4_QC, 234 PCI_ANY_ID,
235 }, 235 },
236 { 236 {
237 PCI_VENDOR_ID_DELL, 237 PCI_VENDOR_ID_DELL,
@@ -271,15 +271,9 @@ static struct pci_device_id pci_id_table_g[] = {
271 }, 271 },
272 { 272 {
273 PCI_VENDOR_ID_LSI_LOGIC, 273 PCI_VENDOR_ID_LSI_LOGIC,
274 PCI_DEVICE_ID_PERC4E_DC_320_2E, 274 PCI_DEVICE_ID_DOBSON,
275 PCI_VENDOR_ID_DELL, 275 PCI_ANY_ID,
276 PCI_SUBSYS_ID_PERC4E_DC_320_2E, 276 PCI_ANY_ID,
277 },
278 {
279 PCI_VENDOR_ID_LSI_LOGIC,
280 PCI_DEVICE_ID_PERC4E_SC_320_1E,
281 PCI_VENDOR_ID_DELL,
282 PCI_SUBSYS_ID_PERC4E_SC_320_1E,
283 }, 277 },
284 { 278 {
285 PCI_VENDOR_ID_AMI, 279 PCI_VENDOR_ID_AMI,
@@ -331,36 +325,6 @@ static struct pci_device_id pci_id_table_g[] = {
331 }, 325 },
332 { 326 {
333 PCI_VENDOR_ID_LSI_LOGIC, 327 PCI_VENDOR_ID_LSI_LOGIC,
334 PCI_DEVICE_ID_MEGARAID_SCSI_320_0x,
335 PCI_VENDOR_ID_LSI_LOGIC,
336 PCI_SUBSYS_ID_MEGARAID_SCSI_320_0x,
337 },
338 {
339 PCI_VENDOR_ID_LSI_LOGIC,
340 PCI_DEVICE_ID_MEGARAID_SCSI_320_2x,
341 PCI_VENDOR_ID_LSI_LOGIC,
342 PCI_SUBSYS_ID_MEGARAID_SCSI_320_2x,
343 },
344 {
345 PCI_VENDOR_ID_LSI_LOGIC,
346 PCI_DEVICE_ID_MEGARAID_SCSI_320_4x,
347 PCI_VENDOR_ID_LSI_LOGIC,
348 PCI_SUBSYS_ID_MEGARAID_SCSI_320_4x,
349 },
350 {
351 PCI_VENDOR_ID_LSI_LOGIC,
352 PCI_DEVICE_ID_MEGARAID_SCSI_320_1E,
353 PCI_VENDOR_ID_LSI_LOGIC,
354 PCI_SUBSYS_ID_MEGARAID_SCSI_320_1E,
355 },
356 {
357 PCI_VENDOR_ID_LSI_LOGIC,
358 PCI_DEVICE_ID_MEGARAID_SCSI_320_2E,
359 PCI_VENDOR_ID_LSI_LOGIC,
360 PCI_SUBSYS_ID_MEGARAID_SCSI_320_2E,
361 },
362 {
363 PCI_VENDOR_ID_LSI_LOGIC,
364 PCI_DEVICE_ID_MEGARAID_I4_133_RAID, 328 PCI_DEVICE_ID_MEGARAID_I4_133_RAID,
365 PCI_VENDOR_ID_LSI_LOGIC, 329 PCI_VENDOR_ID_LSI_LOGIC,
366 PCI_SUBSYS_ID_MEGARAID_I4_133_RAID, 330 PCI_SUBSYS_ID_MEGARAID_I4_133_RAID,
@@ -379,21 +343,9 @@ static struct pci_device_id pci_id_table_g[] = {
379 }, 343 },
380 { 344 {
381 PCI_VENDOR_ID_LSI_LOGIC, 345 PCI_VENDOR_ID_LSI_LOGIC,
382 PCI_DEVICE_ID_MEGARAID_SATA_300_4x, 346 PCI_DEVICE_ID_LINDSAY,
383 PCI_VENDOR_ID_LSI_LOGIC, 347 PCI_ANY_ID,
384 PCI_SUBSYS_ID_MEGARAID_SATA_300_4x, 348 PCI_ANY_ID,
385 },
386 {
387 PCI_VENDOR_ID_LSI_LOGIC,
388 PCI_DEVICE_ID_MEGARAID_SATA_300_8x,
389 PCI_VENDOR_ID_LSI_LOGIC,
390 PCI_SUBSYS_ID_MEGARAID_SATA_300_8x,
391 },
392 {
393 PCI_VENDOR_ID_LSI_LOGIC,
394 PCI_DEVICE_ID_INTEL_RAID_SRCU42X,
395 PCI_VENDOR_ID_INTEL,
396 PCI_SUBSYS_ID_INTEL_RAID_SRCU42X,
397 }, 349 },
398 { 350 {
399 PCI_VENDOR_ID_LSI_LOGIC, 351 PCI_VENDOR_ID_LSI_LOGIC,
@@ -403,58 +355,10 @@ static struct pci_device_id pci_id_table_g[] = {
403 }, 355 },
404 { 356 {
405 PCI_VENDOR_ID_LSI_LOGIC, 357 PCI_VENDOR_ID_LSI_LOGIC,
406 PCI_DEVICE_ID_INTEL_RAID_SRCU42E,
407 PCI_VENDOR_ID_INTEL,
408 PCI_SUBSYS_ID_INTEL_RAID_SRCU42E,
409 },
410 {
411 PCI_VENDOR_ID_LSI_LOGIC,
412 PCI_DEVICE_ID_INTEL_RAID_SRCZCRX,
413 PCI_VENDOR_ID_INTEL,
414 PCI_SUBSYS_ID_INTEL_RAID_SRCZCRX,
415 },
416 {
417 PCI_VENDOR_ID_LSI_LOGIC,
418 PCI_DEVICE_ID_INTEL_RAID_SRCS28X,
419 PCI_VENDOR_ID_INTEL,
420 PCI_SUBSYS_ID_INTEL_RAID_SRCS28X,
421 },
422 {
423 PCI_VENDOR_ID_LSI_LOGIC,
424 PCI_DEVICE_ID_INTEL_RAID_SROMBU42E_ALIEF,
425 PCI_VENDOR_ID_INTEL,
426 PCI_SUBSYS_ID_INTEL_RAID_SROMBU42E_ALIEF,
427 },
428 {
429 PCI_VENDOR_ID_LSI_LOGIC,
430 PCI_DEVICE_ID_INTEL_RAID_SROMBU42E_HARWICH,
431 PCI_VENDOR_ID_INTEL,
432 PCI_SUBSYS_ID_INTEL_RAID_SROMBU42E_HARWICH,
433 },
434 {
435 PCI_VENDOR_ID_LSI_LOGIC,
436 PCI_DEVICE_ID_INTEL_RAID_SRCU41L_LAKE_SHETEK, 358 PCI_DEVICE_ID_INTEL_RAID_SRCU41L_LAKE_SHETEK,
437 PCI_VENDOR_ID_INTEL, 359 PCI_VENDOR_ID_INTEL,
438 PCI_SUBSYS_ID_INTEL_RAID_SRCU41L_LAKE_SHETEK, 360 PCI_SUBSYS_ID_INTEL_RAID_SRCU41L_LAKE_SHETEK,
439 }, 361 },
440 {
441 PCI_VENDOR_ID_LSI_LOGIC,
442 PCI_DEVICE_ID_FSC_MEGARAID_PCI_EXPRESS_ROMB,
443 PCI_SUBSYS_ID_FSC,
444 PCI_SUBSYS_ID_FSC_MEGARAID_PCI_EXPRESS_ROMB,
445 },
446 {
447 PCI_VENDOR_ID_LSI_LOGIC,
448 PCI_DEVICE_ID_MEGARAID_ACER_ROMB_2E,
449 PCI_VENDOR_ID_AI,
450 PCI_SUBSYS_ID_MEGARAID_ACER_ROMB_2E,
451 },
452 {
453 PCI_VENDOR_ID_LSI_LOGIC,
454 PCI_DEVICE_ID_MEGARAID_NEC_ROMB_2E,
455 PCI_VENDOR_ID_NEC,
456 PCI_SUBSYS_ID_MEGARAID_NEC_ROMB_2E,
457 },
458 {0} /* Terminating entry */ 362 {0} /* Terminating entry */
459}; 363};
460MODULE_DEVICE_TABLE(pci, pci_id_table_g); 364MODULE_DEVICE_TABLE(pci, pci_id_table_g);
@@ -539,7 +443,8 @@ megaraid_init(void)
539 443
540 444
541 // register as a PCI hot-plug driver module 445 // register as a PCI hot-plug driver module
542 if ((rval = pci_module_init(&megaraid_pci_driver_g))) { 446 rval = pci_register_driver(&megaraid_pci_driver_g);
447 if (rval < 0) {
543 con_log(CL_ANN, (KERN_WARNING 448 con_log(CL_ANN, (KERN_WARNING
544 "megaraid: could not register hotplug support.\n")); 449 "megaraid: could not register hotplug support.\n"));
545 } 450 }
@@ -619,7 +524,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
619 524
620 // Setup the default DMA mask. This would be changed later on 525 // Setup the default DMA mask. This would be changed later on
621 // depending on hardware capabilities 526 // depending on hardware capabilities
622 if (pci_set_dma_mask(adapter->pdev, 0xFFFFFFFF) != 0) { 527 if (pci_set_dma_mask(adapter->pdev, DMA_32BIT_MASK) != 0) {
623 528
624 con_log(CL_ANN, (KERN_WARNING 529 con_log(CL_ANN, (KERN_WARNING
625 "megaraid: pci_set_dma_mask failed:%d\n", __LINE__)); 530 "megaraid: pci_set_dma_mask failed:%d\n", __LINE__));
@@ -1031,7 +936,7 @@ megaraid_init_mbox(adapter_t *adapter)
1031 936
1032 // Set the DMA mask to 64-bit. All supported controllers as capable of 937 // Set the DMA mask to 64-bit. All supported controllers as capable of
1033 // DMA in this range 938 // DMA in this range
1034 if (pci_set_dma_mask(adapter->pdev, 0xFFFFFFFFFFFFFFFFULL) != 0) { 939 if (pci_set_dma_mask(adapter->pdev, DMA_64BIT_MASK) != 0) {
1035 940
1036 con_log(CL_ANN, (KERN_WARNING 941 con_log(CL_ANN, (KERN_WARNING
1037 "megaraid: could not set DMA mask for 64-bit.\n")); 942 "megaraid: could not set DMA mask for 64-bit.\n"));
@@ -2661,7 +2566,7 @@ megaraid_mbox_dpc(unsigned long devp)
2661 * aborted. All the commands issued to the F/W must complete. 2566 * aborted. All the commands issued to the F/W must complete.
2662 **/ 2567 **/
2663static int 2568static int
2664megaraid_abort_handler(struct scsi_cmnd *scp) 2569__megaraid_abort_handler(struct scsi_cmnd *scp)
2665{ 2570{
2666 adapter_t *adapter; 2571 adapter_t *adapter;
2667 mraid_device_t *raid_dev; 2572 mraid_device_t *raid_dev;
@@ -2794,6 +2699,21 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
2794 return FAILED; 2699 return FAILED;
2795} 2700}
2796 2701
2702static int
2703megaraid_abort_handler(struct scsi_cmnd *scp)
2704{
2705 adapter_t *adapter;
2706 int rc;
2707
2708 adapter = SCP2ADAPTER(scp);
2709
2710 spin_lock_irq(adapter->host_lock);
2711 rc = __megaraid_abort_handler(scp);
2712 spin_unlock_irq(adapter->host_lock);
2713
2714 return rc;
2715}
2716
2797 2717
2798/** 2718/**
2799 * megaraid_reset_handler - device reset hadler for mailbox based driver 2719 * megaraid_reset_handler - device reset hadler for mailbox based driver
@@ -2806,7 +2726,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
2806 * host 2726 * host
2807 **/ 2727 **/
2808static int 2728static int
2809megaraid_reset_handler(struct scsi_cmnd *scp) 2729__megaraid_reset_handler(struct scsi_cmnd *scp)
2810{ 2730{
2811 adapter_t *adapter; 2731 adapter_t *adapter;
2812 scb_t *scb; 2732 scb_t *scb;
@@ -2927,6 +2847,18 @@ megaraid_reset_handler(struct scsi_cmnd *scp)
2927 return rval; 2847 return rval;
2928} 2848}
2929 2849
2850static int
2851megaraid_reset_handler(struct scsi_cmnd *cmd)
2852{
2853 int rc;
2854
2855 spin_lock_irq(cmd->device->host->host_lock);
2856 rc = __megaraid_reset_handler(cmd);
2857 spin_unlock_irq(cmd->device->host->host_lock);
2858
2859 return rc;
2860}
2861
2930 2862
2931/* 2863/*
2932 * START: internal commands library 2864 * START: internal commands library
@@ -4213,7 +4145,7 @@ megaraid_sysfs_show_app_hndl(struct class_device *cdev, char *buf)
4213 * @param buf : buffer to send data to 4145 * @param buf : buffer to send data to
4214 */ 4146 */
4215static ssize_t 4147static ssize_t
4216megaraid_sysfs_show_ldnum(struct device *dev, char *buf) 4148megaraid_sysfs_show_ldnum(struct device *dev, struct device_attribute *attr, char *buf)
4217{ 4149{
4218 struct scsi_device *sdev = to_scsi_device(dev); 4150 struct scsi_device *sdev = to_scsi_device(dev);
4219 adapter_t *adapter = (adapter_t *)SCSIHOST2ADAP(sdev->host); 4151 adapter_t *adapter = (adapter_t *)SCSIHOST2ADAP(sdev->host);