diff options
Diffstat (limited to 'drivers/message/fusion/mptscsih.c')
-rw-r--r-- | drivers/message/fusion/mptscsih.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 93a16fa3c4ba..cdac5578fdf2 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -893,6 +893,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd) | |||
893 | * when a lun is disable by mid-layer. | 893 | * when a lun is disable by mid-layer. |
894 | * Do NOT access the referenced scsi_cmnd structure or | 894 | * Do NOT access the referenced scsi_cmnd structure or |
895 | * members. Will cause either a paging or NULL ptr error. | 895 | * members. Will cause either a paging or NULL ptr error. |
896 | * (BUT, BUT, BUT, the code does reference it! - mdr) | ||
896 | * @hd: Pointer to a SCSI HOST structure | 897 | * @hd: Pointer to a SCSI HOST structure |
897 | * @vdevice: per device private data | 898 | * @vdevice: per device private data |
898 | * | 899 | * |
@@ -2162,10 +2163,9 @@ mptscsih_target_alloc(struct scsi_target *starget) | |||
2162 | { | 2163 | { |
2163 | VirtTarget *vtarget; | 2164 | VirtTarget *vtarget; |
2164 | 2165 | ||
2165 | vtarget = kmalloc(sizeof(VirtTarget), GFP_KERNEL); | 2166 | vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); |
2166 | if (!vtarget) | 2167 | if (!vtarget) |
2167 | return -ENOMEM; | 2168 | return -ENOMEM; |
2168 | memset(vtarget, 0, sizeof(VirtTarget)); | ||
2169 | starget->hostdata = vtarget; | 2169 | starget->hostdata = vtarget; |
2170 | return 0; | 2170 | return 0; |
2171 | } | 2171 | } |
@@ -2185,14 +2185,13 @@ mptscsih_slave_alloc(struct scsi_device *sdev) | |||
2185 | VirtDevice *vdev; | 2185 | VirtDevice *vdev; |
2186 | struct scsi_target *starget; | 2186 | struct scsi_target *starget; |
2187 | 2187 | ||
2188 | vdev = kmalloc(sizeof(VirtDevice), GFP_KERNEL); | 2188 | vdev = kzalloc(sizeof(VirtDevice), GFP_KERNEL); |
2189 | if (!vdev) { | 2189 | if (!vdev) { |
2190 | printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", | 2190 | printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", |
2191 | hd->ioc->name, sizeof(VirtDevice)); | 2191 | hd->ioc->name, sizeof(VirtDevice)); |
2192 | return -ENOMEM; | 2192 | return -ENOMEM; |
2193 | } | 2193 | } |
2194 | 2194 | ||
2195 | memset(vdev, 0, sizeof(VirtDevice)); | ||
2196 | vdev->ioc_id = hd->ioc->id; | 2195 | vdev->ioc_id = hd->ioc->id; |
2197 | vdev->target_id = sdev->id; | 2196 | vdev->target_id = sdev->id; |
2198 | vdev->bus_id = sdev->channel; | 2197 | vdev->bus_id = sdev->channel; |
@@ -2559,13 +2558,25 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
2559 | hd->cmdPtr = NULL; | 2558 | hd->cmdPtr = NULL; |
2560 | } | 2559 | } |
2561 | 2560 | ||
2562 | /* 7. Set flag to force DV and re-read IOC Page 3 | 2561 | /* 7. SPI: Set flag to force DV and re-read IOC Page 3 |
2563 | */ | 2562 | */ |
2564 | if (ioc->bus_type == SPI) { | 2563 | if (ioc->bus_type == SPI) { |
2565 | ioc->spi_data.forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3; | 2564 | ioc->spi_data.forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3; |
2566 | ddvtprintk(("Set reload IOC Pg3 Flag\n")); | 2565 | ddvtprintk(("Set reload IOC Pg3 Flag\n")); |
2567 | } | 2566 | } |
2568 | 2567 | ||
2568 | /* 7. FC: Rescan for blocked rports which might have returned. | ||
2569 | */ | ||
2570 | else if (ioc->bus_type == FC) { | ||
2571 | int work_count; | ||
2572 | unsigned long flags; | ||
2573 | |||
2574 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); | ||
2575 | work_count = ++ioc->fc_rescan_work_count; | ||
2576 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); | ||
2577 | if (work_count == 1) | ||
2578 | schedule_work(&ioc->fc_rescan_work); | ||
2579 | } | ||
2569 | dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name)); | 2580 | dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name)); |
2570 | 2581 | ||
2571 | } | 2582 | } |
@@ -2589,6 +2600,8 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | |||
2589 | { | 2600 | { |
2590 | MPT_SCSI_HOST *hd; | 2601 | MPT_SCSI_HOST *hd; |
2591 | u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; | 2602 | u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; |
2603 | int work_count; | ||
2604 | unsigned long flags; | ||
2592 | 2605 | ||
2593 | devtprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n", | 2606 | devtprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n", |
2594 | ioc->name, event)); | 2607 | ioc->name, event)); |
@@ -2610,11 +2623,18 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | |||
2610 | /* FIXME! */ | 2623 | /* FIXME! */ |
2611 | break; | 2624 | break; |
2612 | 2625 | ||
2626 | case MPI_EVENT_RESCAN: /* 06 */ | ||
2627 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); | ||
2628 | work_count = ++ioc->fc_rescan_work_count; | ||
2629 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); | ||
2630 | if (work_count == 1) | ||
2631 | schedule_work(&ioc->fc_rescan_work); | ||
2632 | break; | ||
2633 | |||
2613 | /* | 2634 | /* |
2614 | * CHECKME! Don't think we need to do | 2635 | * CHECKME! Don't think we need to do |
2615 | * anything for these, but... | 2636 | * anything for these, but... |
2616 | */ | 2637 | */ |
2617 | case MPI_EVENT_RESCAN: /* 06 */ | ||
2618 | case MPI_EVENT_LINK_STATUS_CHANGE: /* 07 */ | 2638 | case MPI_EVENT_LINK_STATUS_CHANGE: /* 07 */ |
2619 | case MPI_EVENT_LOOP_STATE_CHANGE: /* 08 */ | 2639 | case MPI_EVENT_LOOP_STATE_CHANGE: /* 08 */ |
2620 | /* | 2640 | /* |
@@ -3954,8 +3974,6 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice) | |||
3954 | 3974 | ||
3955 | /* Search IOC page 3 to determine if this is hidden physical disk | 3975 | /* Search IOC page 3 to determine if this is hidden physical disk |
3956 | */ | 3976 | */ |
3957 | /* Search IOC page 3 to determine if this is hidden physical disk | ||
3958 | */ | ||
3959 | static int | 3977 | static int |
3960 | mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id) | 3978 | mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id) |
3961 | { | 3979 | { |