diff options
author | Moore, Eric Dean <Eric.Moore@lsil.com> | 2005-11-16 20:54:23 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-12-13 20:40:52 -0500 |
commit | f2ea8671a8376e09cf759aa8cb3de8b8d3bced9e (patch) | |
tree | 82181e022ccecfa0f1b8b3cef673630df917209d /drivers/message | |
parent | a9b2937a1eab2939d0eed3830ead88664ed7445d (diff) |
[SCSI] mptfusion - prep for removing domain validation
This moves some functions around from within the #define
MPTSCSIH_ENABLE_DOMAIN_VALIDATION area, in preperation for generic
domain validation.
Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message')
-rw-r--r-- | drivers/message/fusion/mptscsih.c | 225 |
1 files changed, 114 insertions, 111 deletions
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 2d014248b799..a5ca7494c8c1 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -152,7 +152,6 @@ int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply | |||
152 | 152 | ||
153 | static void mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *data, int dlen); | 153 | static void mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *data, int dlen); |
154 | static void mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56); | 154 | static void mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56); |
155 | static void mptscsih_set_dvflags(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq); | ||
156 | static void mptscsih_setDevicePage1Flags (u8 width, u8 factor, u8 offset, int *requestedPtr, int *configurationPtr, u8 flags); | 155 | static void mptscsih_setDevicePage1Flags (u8 width, u8 factor, u8 offset, int *requestedPtr, int *configurationPtr, u8 flags); |
157 | static void mptscsih_no_negotiate(MPT_SCSI_HOST *hd, int target_id); | 156 | static void mptscsih_no_negotiate(MPT_SCSI_HOST *hd, int target_id); |
158 | static int mptscsih_writeSDP1(MPT_SCSI_HOST *hd, int portnum, int target, int flags); | 157 | static int mptscsih_writeSDP1(MPT_SCSI_HOST *hd, int portnum, int target, int flags); |
@@ -160,18 +159,19 @@ static int mptscsih_writeIOCPage4(MPT_SCSI_HOST *hd, int target_id, int bus); | |||
160 | int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); | 159 | int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); |
161 | static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd); | 160 | static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd); |
162 | static int mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum); | 161 | static int mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum); |
162 | static int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id); | ||
163 | 163 | ||
164 | static struct work_struct mptscsih_persistTask; | 164 | static struct work_struct mptscsih_persistTask; |
165 | 165 | ||
166 | #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION | 166 | #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION |
167 | static int mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io); | 167 | static int mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io); |
168 | static void mptscsih_domainValidation(void *hd); | 168 | static void mptscsih_domainValidation(void *hd); |
169 | static int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id); | ||
170 | static void mptscsih_qas_check(MPT_SCSI_HOST *hd, int id); | 169 | static void mptscsih_qas_check(MPT_SCSI_HOST *hd, int id); |
171 | static int mptscsih_doDv(MPT_SCSI_HOST *hd, int channel, int target); | 170 | static int mptscsih_doDv(MPT_SCSI_HOST *hd, int channel, int target); |
172 | static void mptscsih_dv_parms(MPT_SCSI_HOST *hd, DVPARAMETERS *dv,void *pPage); | 171 | static void mptscsih_dv_parms(MPT_SCSI_HOST *hd, DVPARAMETERS *dv,void *pPage); |
173 | static void mptscsih_fillbuf(char *buffer, int size, int index, int width); | 172 | static void mptscsih_fillbuf(char *buffer, int size, int index, int width); |
174 | static void mptscsih_set_dvflags_raid(MPT_SCSI_HOST *hd, int id); | 173 | static void mptscsih_set_dvflags_raid(MPT_SCSI_HOST *hd, int id); |
174 | static void mptscsih_set_dvflags(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq); | ||
175 | #endif | 175 | #endif |
176 | 176 | ||
177 | void mptscsih_remove(struct pci_dev *); | 177 | void mptscsih_remove(struct pci_dev *); |
@@ -993,8 +993,10 @@ mptscsih_remove(struct pci_dev *pdev) | |||
993 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | 993 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
994 | struct Scsi_Host *host = ioc->sh; | 994 | struct Scsi_Host *host = ioc->sh; |
995 | MPT_SCSI_HOST *hd; | 995 | MPT_SCSI_HOST *hd; |
996 | #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION | ||
996 | int count; | 997 | int count; |
997 | unsigned long flags; | 998 | unsigned long flags; |
999 | #endif | ||
998 | int sz1; | 1000 | int sz1; |
999 | 1001 | ||
1000 | if(!host) { | 1002 | if(!host) { |
@@ -2597,9 +2599,9 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | |||
2597 | 2599 | ||
2598 | case MPI_EVENT_INTEGRATED_RAID: /* 0B */ | 2600 | case MPI_EVENT_INTEGRATED_RAID: /* 0B */ |
2599 | { | 2601 | { |
2602 | #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION | ||
2600 | pMpiEventDataRaid_t pRaidEventData = | 2603 | pMpiEventDataRaid_t pRaidEventData = |
2601 | (pMpiEventDataRaid_t) pEvReply->Data; | 2604 | (pMpiEventDataRaid_t) pEvReply->Data; |
2602 | #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION | ||
2603 | /* Domain Validation Needed */ | 2605 | /* Domain Validation Needed */ |
2604 | if (ioc->bus_type == SPI && | 2606 | if (ioc->bus_type == SPI && |
2605 | pRaidEventData->ReasonCode == | 2607 | pRaidEventData->ReasonCode == |
@@ -2926,94 +2928,6 @@ mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56) | |||
2926 | } | 2928 | } |
2927 | 2929 | ||
2928 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2930 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2929 | /* If DV disabled (negoNvram set to USE_NVARM) or if not LUN 0, return. | ||
2930 | * Else set the NEED_DV flag after Read Capacity Issued (disks) | ||
2931 | * or Mode Sense (cdroms). | ||
2932 | * | ||
2933 | * Tapes, initTarget will set this flag on completion of Inquiry command. | ||
2934 | * Called only if DV_NOT_DONE flag is set | ||
2935 | */ | ||
2936 | static void | ||
2937 | mptscsih_set_dvflags(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq) | ||
2938 | { | ||
2939 | MPT_ADAPTER *ioc = hd->ioc; | ||
2940 | u8 cmd; | ||
2941 | SpiCfgData *pSpi; | ||
2942 | |||
2943 | ddvtprintk((MYIOC_s_NOTE_FMT | ||
2944 | " set_dvflags: id=%d lun=%d negoNvram=%x cmd=%x\n", | ||
2945 | hd->ioc->name, pReq->TargetID, pReq->LUN[1], hd->negoNvram, pReq->CDB[0])); | ||
2946 | |||
2947 | if ((pReq->LUN[1] != 0) || (hd->negoNvram != 0)) | ||
2948 | return; | ||
2949 | |||
2950 | cmd = pReq->CDB[0]; | ||
2951 | |||
2952 | if ((cmd == READ_CAPACITY) || (cmd == MODE_SENSE)) { | ||
2953 | pSpi = &ioc->spi_data; | ||
2954 | if ((ioc->raid_data.isRaid & (1 << pReq->TargetID)) && ioc->raid_data.pIocPg3) { | ||
2955 | /* Set NEED_DV for all hidden disks | ||
2956 | */ | ||
2957 | Ioc3PhysDisk_t *pPDisk = ioc->raid_data.pIocPg3->PhysDisk; | ||
2958 | int numPDisk = ioc->raid_data.pIocPg3->NumPhysDisks; | ||
2959 | |||
2960 | while (numPDisk) { | ||
2961 | pSpi->dvStatus[pPDisk->PhysDiskID] |= MPT_SCSICFG_NEED_DV; | ||
2962 | ddvtprintk(("NEED_DV set for phys disk id %d\n", pPDisk->PhysDiskID)); | ||
2963 | pPDisk++; | ||
2964 | numPDisk--; | ||
2965 | } | ||
2966 | } | ||
2967 | pSpi->dvStatus[pReq->TargetID] |= MPT_SCSICFG_NEED_DV; | ||
2968 | ddvtprintk(("NEED_DV set for visible disk id %d\n", pReq->TargetID)); | ||
2969 | } | ||
2970 | } | ||
2971 | |||
2972 | /* mptscsih_raid_set_dv_flags() | ||
2973 | * | ||
2974 | * New or replaced disk. Set DV flag and schedule DV. | ||
2975 | */ | ||
2976 | static void | ||
2977 | mptscsih_set_dvflags_raid(MPT_SCSI_HOST *hd, int id) | ||
2978 | { | ||
2979 | MPT_ADAPTER *ioc = hd->ioc; | ||
2980 | SpiCfgData *pSpi = &ioc->spi_data; | ||
2981 | Ioc3PhysDisk_t *pPDisk; | ||
2982 | int numPDisk; | ||
2983 | |||
2984 | if (hd->negoNvram != 0) | ||
2985 | return; | ||
2986 | |||
2987 | ddvtprintk(("DV requested for phys disk id %d\n", id)); | ||
2988 | if (ioc->raid_data.pIocPg3) { | ||
2989 | pPDisk = ioc->raid_data.pIocPg3->PhysDisk; | ||
2990 | numPDisk = ioc->raid_data.pIocPg3->NumPhysDisks; | ||
2991 | while (numPDisk) { | ||
2992 | if (id == pPDisk->PhysDiskNum) { | ||
2993 | pSpi->dvStatus[pPDisk->PhysDiskID] = | ||
2994 | (MPT_SCSICFG_NEED_DV | MPT_SCSICFG_DV_NOT_DONE); | ||
2995 | pSpi->forceDv = MPT_SCSICFG_NEED_DV; | ||
2996 | ddvtprintk(("NEED_DV set for phys disk id %d\n", | ||
2997 | pPDisk->PhysDiskID)); | ||
2998 | break; | ||
2999 | } | ||
3000 | pPDisk++; | ||
3001 | numPDisk--; | ||
3002 | } | ||
3003 | |||
3004 | if (numPDisk == 0) { | ||
3005 | /* The physical disk that needs DV was not found | ||
3006 | * in the stored IOC Page 3. The driver must reload | ||
3007 | * this page. DV routine will set the NEED_DV flag for | ||
3008 | * all phys disks that have DV_NOT_DONE set. | ||
3009 | */ | ||
3010 | pSpi->forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3; | ||
3011 | ddvtprintk(("phys disk %d not found. Setting reload IOC Pg3 Flag\n",id)); | ||
3012 | } | ||
3013 | } | ||
3014 | } | ||
3015 | |||
3016 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
3017 | /* | 2931 | /* |
3018 | * If no Target, bus reset on 1st I/O. Set the flag to | 2932 | * If no Target, bus reset on 1st I/O. Set the flag to |
3019 | * prevent any future negotiations to this device. | 2933 | * prevent any future negotiations to this device. |
@@ -4052,6 +3966,26 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum) | |||
4052 | return 0; | 3966 | return 0; |
4053 | } | 3967 | } |
4054 | 3968 | ||
3969 | /* Search IOC page 3 to determine if this is hidden physical disk | ||
3970 | */ | ||
3971 | /* Search IOC page 3 to determine if this is hidden physical disk | ||
3972 | */ | ||
3973 | static int | ||
3974 | mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id) | ||
3975 | { | ||
3976 | int i; | ||
3977 | |||
3978 | if (!ioc->raid_data.isRaid || !ioc->raid_data.pIocPg3) | ||
3979 | return 0; | ||
3980 | |||
3981 | for (i = 0; i < ioc->raid_data.pIocPg3->NumPhysDisks; i++) { | ||
3982 | if (id == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskID) | ||
3983 | return 1; | ||
3984 | } | ||
3985 | |||
3986 | return 0; | ||
3987 | } | ||
3988 | |||
4055 | #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION | 3989 | #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION |
4056 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 3990 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
4057 | /** | 3991 | /** |
@@ -4205,26 +4139,6 @@ mptscsih_domainValidation(void *arg) | |||
4205 | return; | 4139 | return; |
4206 | } | 4140 | } |
4207 | 4141 | ||
4208 | /* Search IOC page 3 to determine if this is hidden physical disk | ||
4209 | */ | ||
4210 | /* Search IOC page 3 to determine if this is hidden physical disk | ||
4211 | */ | ||
4212 | static int | ||
4213 | mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id) | ||
4214 | { | ||
4215 | int i; | ||
4216 | |||
4217 | if (!ioc->raid_data.isRaid || !ioc->raid_data.pIocPg3) | ||
4218 | return 0; | ||
4219 | |||
4220 | for (i = 0; i < ioc->raid_data.pIocPg3->NumPhysDisks; i++) { | ||
4221 | if (id == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskID) | ||
4222 | return 1; | ||
4223 | } | ||
4224 | |||
4225 | return 0; | ||
4226 | } | ||
4227 | |||
4228 | /* Write SDP1 if no QAS has been enabled | 4142 | /* Write SDP1 if no QAS has been enabled |
4229 | */ | 4143 | */ |
4230 | static void | 4144 | static void |
@@ -5588,6 +5502,95 @@ mptscsih_fillbuf(char *buffer, int size, int index, int width) | |||
5588 | break; | 5502 | break; |
5589 | } | 5503 | } |
5590 | } | 5504 | } |
5505 | |||
5506 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
5507 | /* If DV disabled (negoNvram set to USE_NVARM) or if not LUN 0, return. | ||
5508 | * Else set the NEED_DV flag after Read Capacity Issued (disks) | ||
5509 | * or Mode Sense (cdroms). | ||
5510 | * | ||
5511 | * Tapes, initTarget will set this flag on completion of Inquiry command. | ||
5512 | * Called only if DV_NOT_DONE flag is set | ||
5513 | */ | ||
5514 | static void | ||
5515 | mptscsih_set_dvflags(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq) | ||
5516 | { | ||
5517 | MPT_ADAPTER *ioc = hd->ioc; | ||
5518 | u8 cmd; | ||
5519 | SpiCfgData *pSpi; | ||
5520 | |||
5521 | ddvtprintk((MYIOC_s_NOTE_FMT | ||
5522 | " set_dvflags: id=%d lun=%d negoNvram=%x cmd=%x\n", | ||
5523 | hd->ioc->name, pReq->TargetID, pReq->LUN[1], hd->negoNvram, pReq->CDB[0])); | ||
5524 | |||
5525 | if ((pReq->LUN[1] != 0) || (hd->negoNvram != 0)) | ||
5526 | return; | ||
5527 | |||
5528 | cmd = pReq->CDB[0]; | ||
5529 | |||
5530 | if ((cmd == READ_CAPACITY) || (cmd == MODE_SENSE)) { | ||
5531 | pSpi = &ioc->spi_data; | ||
5532 | if ((ioc->raid_data.isRaid & (1 << pReq->TargetID)) && ioc->raid_data.pIocPg3) { | ||
5533 | /* Set NEED_DV for all hidden disks | ||
5534 | */ | ||
5535 | Ioc3PhysDisk_t *pPDisk = ioc->raid_data.pIocPg3->PhysDisk; | ||
5536 | int numPDisk = ioc->raid_data.pIocPg3->NumPhysDisks; | ||
5537 | |||
5538 | while (numPDisk) { | ||
5539 | pSpi->dvStatus[pPDisk->PhysDiskID] |= MPT_SCSICFG_NEED_DV; | ||
5540 | ddvtprintk(("NEED_DV set for phys disk id %d\n", pPDisk->PhysDiskID)); | ||
5541 | pPDisk++; | ||
5542 | numPDisk--; | ||
5543 | } | ||
5544 | } | ||
5545 | pSpi->dvStatus[pReq->TargetID] |= MPT_SCSICFG_NEED_DV; | ||
5546 | ddvtprintk(("NEED_DV set for visible disk id %d\n", pReq->TargetID)); | ||
5547 | } | ||
5548 | } | ||
5549 | |||
5550 | /* mptscsih_raid_set_dv_flags() | ||
5551 | * | ||
5552 | * New or replaced disk. Set DV flag and schedule DV. | ||
5553 | */ | ||
5554 | static void | ||
5555 | mptscsih_set_dvflags_raid(MPT_SCSI_HOST *hd, int id) | ||
5556 | { | ||
5557 | MPT_ADAPTER *ioc = hd->ioc; | ||
5558 | SpiCfgData *pSpi = &ioc->spi_data; | ||
5559 | Ioc3PhysDisk_t *pPDisk; | ||
5560 | int numPDisk; | ||
5561 | |||
5562 | if (hd->negoNvram != 0) | ||
5563 | return; | ||
5564 | |||
5565 | ddvtprintk(("DV requested for phys disk id %d\n", id)); | ||
5566 | if (ioc->raid_data.pIocPg3) { | ||
5567 | pPDisk = ioc->raid_data.pIocPg3->PhysDisk; | ||
5568 | numPDisk = ioc->raid_data.pIocPg3->NumPhysDisks; | ||
5569 | while (numPDisk) { | ||
5570 | if (id == pPDisk->PhysDiskNum) { | ||
5571 | pSpi->dvStatus[pPDisk->PhysDiskID] = | ||
5572 | (MPT_SCSICFG_NEED_DV | MPT_SCSICFG_DV_NOT_DONE); | ||
5573 | pSpi->forceDv = MPT_SCSICFG_NEED_DV; | ||
5574 | ddvtprintk(("NEED_DV set for phys disk id %d\n", | ||
5575 | pPDisk->PhysDiskID)); | ||
5576 | break; | ||
5577 | } | ||
5578 | pPDisk++; | ||
5579 | numPDisk--; | ||
5580 | } | ||
5581 | |||
5582 | if (numPDisk == 0) { | ||
5583 | /* The physical disk that needs DV was not found | ||
5584 | * in the stored IOC Page 3. The driver must reload | ||
5585 | * this page. DV routine will set the NEED_DV flag for | ||
5586 | * all phys disks that have DV_NOT_DONE set. | ||
5587 | */ | ||
5588 | pSpi->forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3; | ||
5589 | ddvtprintk(("phys disk %d not found. Setting reload IOC Pg3 Flag\n",id)); | ||
5590 | } | ||
5591 | } | ||
5592 | } | ||
5593 | |||
5591 | #endif /* ~MPTSCSIH_ENABLE_DOMAIN_VALIDATION */ | 5594 | #endif /* ~MPTSCSIH_ENABLE_DOMAIN_VALIDATION */ |
5592 | 5595 | ||
5593 | EXPORT_SYMBOL(mptscsih_remove); | 5596 | EXPORT_SYMBOL(mptscsih_remove); |