arcmsr.c (255718) | arcmsr.c (257381) |
---|---|
1/* 2******************************************************************************** 3** OS : FreeBSD 4** FILE NAME : arcmsr.c 5** BY : Erich Chen, Ching Huang 6** Description: SCSI RAID Device Driver for 7** ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x) 8** SATA/SAS RAID HOST Adapter --- 65 unchanged lines hidden (view full) --- 74** 1.20.00.25 08/17/2012 Ching Huang Fixed hotplug device no function on type A adapter 75** 1.20.00.26 12/14/2012 Ching Huang Added support ARC1214,1224,1264,1284 76** 1.20.00.27 05/06/2013 Ching Huang Fixed out standing cmd full on ARC-12x4 77** 1.20.00.28 09/13/2013 Ching Huang Removed recursive mutex in arcmsr_abort_dr_ccbs 78****************************************************************************************** 79*/ 80 81#include <sys/cdefs.h> | 1/* 2******************************************************************************** 3** OS : FreeBSD 4** FILE NAME : arcmsr.c 5** BY : Erich Chen, Ching Huang 6** Description: SCSI RAID Device Driver for 7** ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x) 8** SATA/SAS RAID HOST Adapter --- 65 unchanged lines hidden (view full) --- 74** 1.20.00.25 08/17/2012 Ching Huang Fixed hotplug device no function on type A adapter 75** 1.20.00.26 12/14/2012 Ching Huang Added support ARC1214,1224,1264,1284 76** 1.20.00.27 05/06/2013 Ching Huang Fixed out standing cmd full on ARC-12x4 77** 1.20.00.28 09/13/2013 Ching Huang Removed recursive mutex in arcmsr_abort_dr_ccbs 78****************************************************************************************** 79*/ 80 81#include <sys/cdefs.h> |
82__FBSDID("$FreeBSD: head/sys/dev/arcmsr/arcmsr.c 255718 2013-09-19 20:30:35Z delphij $"); | 82__FBSDID("$FreeBSD: head/sys/dev/arcmsr/arcmsr.c 257381 2013-10-30 14:04:47Z nwhitehorn $"); |
83 84#if 0 85#define ARCMSR_DEBUG1 1 86#endif 87#include <sys/param.h> 88#include <sys/systm.h> 89#include <sys/malloc.h> 90#include <sys/kernel.h> --- 861 unchanged lines hidden (view full) --- 952 /* talk to iop 331 outstanding command aborted*/ 953 arcmsr_abort_allcmd(acb); 954 for(i=0; i < ARCMSR_MAX_FREESRB_NUM; i++) { 955 srb = acb->psrb_pool[i]; 956 if(srb->srb_state == ARCMSR_SRB_START) { 957 srb->srb_state = ARCMSR_SRB_ABORTED; 958 srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; 959 arcmsr_srb_complete(srb, 1); | 83 84#if 0 85#define ARCMSR_DEBUG1 1 86#endif 87#include <sys/param.h> 88#include <sys/systm.h> 89#include <sys/malloc.h> 90#include <sys/kernel.h> --- 861 unchanged lines hidden (view full) --- 952 /* talk to iop 331 outstanding command aborted*/ 953 arcmsr_abort_allcmd(acb); 954 for(i=0; i < ARCMSR_MAX_FREESRB_NUM; i++) { 955 srb = acb->psrb_pool[i]; 956 if(srb->srb_state == ARCMSR_SRB_START) { 957 srb->srb_state = ARCMSR_SRB_ABORTED; 958 srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; 959 arcmsr_srb_complete(srb, 1); |
960 printf("arcmsr%d: scsi id=%d lun=%d srb='%p' aborted\n" | 960 printf("arcmsr%d: scsi id=%d lun=%jx srb='%p' aborted\n" |
961 , acb->pci_unit, srb->pccb->ccb_h.target_id | 961 , acb->pci_unit, srb->pccb->ccb_h.target_id |
962 , srb->pccb->ccb_h.target_lun, srb); | 962 , (uintmax_t)srb->pccb->ccb_h.target_lun, srb); |
963 } 964 } 965 /* enable all outbound interrupt */ 966 arcmsr_enable_allintr(acb, intmask_org); 967 } 968 acb->srboutstandingcount = 0; 969 acb->workingsrb_doneindex = 0; 970 acb->workingsrb_startindex = 0; --- 1760 unchanged lines hidden (view full) --- 2731 if(acb->srboutstandingcount != 0) { 2732 /* disable all outbound interrupt */ 2733 intmask_org = arcmsr_disable_allintr(acb); 2734 for(i=0; i < ARCMSR_MAX_FREESRB_NUM; i++) { 2735 srb = acb->psrb_pool[i]; 2736 if(srb->srb_state == ARCMSR_SRB_START) { 2737 if(srb->pccb == abortccb) { 2738 srb->srb_state = ARCMSR_SRB_ABORTED; | 963 } 964 } 965 /* enable all outbound interrupt */ 966 arcmsr_enable_allintr(acb, intmask_org); 967 } 968 acb->srboutstandingcount = 0; 969 acb->workingsrb_doneindex = 0; 970 acb->workingsrb_startindex = 0; --- 1760 unchanged lines hidden (view full) --- 2731 if(acb->srboutstandingcount != 0) { 2732 /* disable all outbound interrupt */ 2733 intmask_org = arcmsr_disable_allintr(acb); 2734 for(i=0; i < ARCMSR_MAX_FREESRB_NUM; i++) { 2735 srb = acb->psrb_pool[i]; 2736 if(srb->srb_state == ARCMSR_SRB_START) { 2737 if(srb->pccb == abortccb) { 2738 srb->srb_state = ARCMSR_SRB_ABORTED; |
2739 printf("arcmsr%d:scsi id=%d lun=%d abort srb '%p'" | 2739 printf("arcmsr%d:scsi id=%d lun=%jx abort srb '%p'" |
2740 "outstanding command \n" 2741 , acb->pci_unit, abortccb->ccb_h.target_id | 2740 "outstanding command \n" 2741 , acb->pci_unit, abortccb->ccb_h.target_id |
2742 , abortccb->ccb_h.target_lun, srb); | 2742 , (uintmax_t)abortccb->ccb_h.target_lun, srb); |
2743 arcmsr_polling_srbdone(acb, srb); 2744 /* enable outbound Post Queue, outbound doorbell Interrupt */ 2745 arcmsr_enable_allintr(acb, intmask_org); 2746 return (TRUE); 2747 } 2748 } 2749 } 2750 /* enable outbound Post Queue, outbound doorbell Interrupt */ --- 420 unchanged lines hidden (view full) --- 3171 } 3172 /* check if command done with no error*/ 3173 srb = (struct CommandControlBlock *) 3174 (acb->vir2phy_offset+(flag_srb << 5));/*frame must be 32 bytes aligned*/ 3175 error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; 3176 poll_srb_done = (srb == poll_srb) ? 1:0; 3177 if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) { 3178 if(srb->srb_state == ARCMSR_SRB_ABORTED) { | 2743 arcmsr_polling_srbdone(acb, srb); 2744 /* enable outbound Post Queue, outbound doorbell Interrupt */ 2745 arcmsr_enable_allintr(acb, intmask_org); 2746 return (TRUE); 2747 } 2748 } 2749 } 2750 /* enable outbound Post Queue, outbound doorbell Interrupt */ --- 420 unchanged lines hidden (view full) --- 3171 } 3172 /* check if command done with no error*/ 3173 srb = (struct CommandControlBlock *) 3174 (acb->vir2phy_offset+(flag_srb << 5));/*frame must be 32 bytes aligned*/ 3175 error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; 3176 poll_srb_done = (srb == poll_srb) ? 1:0; 3177 if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) { 3178 if(srb->srb_state == ARCMSR_SRB_ABORTED) { |
3179 printf("arcmsr%d: scsi id=%d lun=%d srb='%p'" | 3179 printf("arcmsr%d: scsi id=%d lun=%jx srb='%p'" |
3180 "poll command abort successfully \n" 3181 , acb->pci_unit 3182 , srb->pccb->ccb_h.target_id | 3180 "poll command abort successfully \n" 3181 , acb->pci_unit 3182 , srb->pccb->ccb_h.target_id |
3183 , srb->pccb->ccb_h.target_lun, srb); | 3183 , (uintmax_t)srb->pccb->ccb_h.target_lun, srb); |
3184 srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; 3185 arcmsr_srb_complete(srb, 1); 3186 continue; 3187 } 3188 printf("arcmsr%d: polling get an illegal srb command done srb='%p'" 3189 "srboutstandingcount=%d \n" 3190 , acb->pci_unit 3191 , srb, acb->srboutstandingcount); --- 39 unchanged lines hidden (view full) --- 3231 phbbmu->doneq_index = index; 3232 /* check if command done with no error*/ 3233 srb = (struct CommandControlBlock *) 3234 (acb->vir2phy_offset+(flag_srb << 5));/*frame must be 32 bytes aligned*/ 3235 error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; 3236 poll_srb_done = (srb == poll_srb) ? 1:0; 3237 if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) { 3238 if(srb->srb_state == ARCMSR_SRB_ABORTED) { | 3184 srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; 3185 arcmsr_srb_complete(srb, 1); 3186 continue; 3187 } 3188 printf("arcmsr%d: polling get an illegal srb command done srb='%p'" 3189 "srboutstandingcount=%d \n" 3190 , acb->pci_unit 3191 , srb, acb->srboutstandingcount); --- 39 unchanged lines hidden (view full) --- 3231 phbbmu->doneq_index = index; 3232 /* check if command done with no error*/ 3233 srb = (struct CommandControlBlock *) 3234 (acb->vir2phy_offset+(flag_srb << 5));/*frame must be 32 bytes aligned*/ 3235 error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; 3236 poll_srb_done = (srb == poll_srb) ? 1:0; 3237 if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) { 3238 if(srb->srb_state == ARCMSR_SRB_ABORTED) { |
3239 printf("arcmsr%d: scsi id=%d lun=%d srb='%p'" | 3239 printf("arcmsr%d: scsi id=%d lun=%jx srb='%p'" |
3240 "poll command abort successfully \n" 3241 , acb->pci_unit 3242 , srb->pccb->ccb_h.target_id | 3240 "poll command abort successfully \n" 3241 , acb->pci_unit 3242 , srb->pccb->ccb_h.target_id |
3243 , srb->pccb->ccb_h.target_lun, srb); | 3243 , (uintmax_t)srb->pccb->ccb_h.target_lun, srb); |
3244 srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; 3245 arcmsr_srb_complete(srb, 1); 3246 continue; 3247 } 3248 printf("arcmsr%d: polling get an illegal srb command done srb='%p'" 3249 "srboutstandingcount=%d \n" 3250 , acb->pci_unit 3251 , srb, acb->srboutstandingcount); --- 34 unchanged lines hidden (view full) --- 3286 flag_srb = CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_queueport_low); 3287 /* check if command done with no error*/ 3288 srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb & 0xFFFFFFE0));/*frame must be 32 bytes aligned*/ 3289 error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1)?TRUE:FALSE; 3290 if (poll_srb != NULL) 3291 poll_srb_done = (srb == poll_srb) ? 1:0; 3292 if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) { 3293 if(srb->srb_state == ARCMSR_SRB_ABORTED) { | 3244 srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; 3245 arcmsr_srb_complete(srb, 1); 3246 continue; 3247 } 3248 printf("arcmsr%d: polling get an illegal srb command done srb='%p'" 3249 "srboutstandingcount=%d \n" 3250 , acb->pci_unit 3251 , srb, acb->srboutstandingcount); --- 34 unchanged lines hidden (view full) --- 3286 flag_srb = CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_queueport_low); 3287 /* check if command done with no error*/ 3288 srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb & 0xFFFFFFE0));/*frame must be 32 bytes aligned*/ 3289 error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1)?TRUE:FALSE; 3290 if (poll_srb != NULL) 3291 poll_srb_done = (srb == poll_srb) ? 1:0; 3292 if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) { 3293 if(srb->srb_state == ARCMSR_SRB_ABORTED) { |
3294 printf("arcmsr%d: scsi id=%d lun=%d srb='%p'poll command abort successfully \n" 3295 , acb->pci_unit, srb->pccb->ccb_h.target_id, srb->pccb->ccb_h.target_lun, srb); | 3294 printf("arcmsr%d: scsi id=%d lun=%jx srb='%p'poll command abort successfully \n" 3295 , acb->pci_unit, srb->pccb->ccb_h.target_id, (uintmax_t)srb->pccb->ccb_h.target_lun, srb); |
3296 srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; 3297 arcmsr_srb_complete(srb, 1); 3298 continue; 3299 } 3300 printf("arcmsr%d: polling get an illegal srb command done srb='%p'srboutstandingcount=%d \n" 3301 , acb->pci_unit, srb, acb->srboutstandingcount); 3302 continue; 3303 } --- 38 unchanged lines hidden (view full) --- 3342 /* check if command done with no error*/ 3343 srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb & 0xFFFFFFE0));/*frame must be 32 bytes aligned*/ 3344 error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1) ? TRUE : FALSE; 3345 CHIP_REG_WRITE32(HBD_MessageUnit, 0, outboundlist_read_pointer, doneq_index); 3346 if (poll_srb != NULL) 3347 poll_srb_done = (srb == poll_srb) ? 1:0; 3348 if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) { 3349 if(srb->srb_state == ARCMSR_SRB_ABORTED) { | 3296 srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; 3297 arcmsr_srb_complete(srb, 1); 3298 continue; 3299 } 3300 printf("arcmsr%d: polling get an illegal srb command done srb='%p'srboutstandingcount=%d \n" 3301 , acb->pci_unit, srb, acb->srboutstandingcount); 3302 continue; 3303 } --- 38 unchanged lines hidden (view full) --- 3342 /* check if command done with no error*/ 3343 srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb & 0xFFFFFFE0));/*frame must be 32 bytes aligned*/ 3344 error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1) ? TRUE : FALSE; 3345 CHIP_REG_WRITE32(HBD_MessageUnit, 0, outboundlist_read_pointer, doneq_index); 3346 if (poll_srb != NULL) 3347 poll_srb_done = (srb == poll_srb) ? 1:0; 3348 if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) { 3349 if(srb->srb_state == ARCMSR_SRB_ABORTED) { |
3350 printf("arcmsr%d: scsi id=%d lun=%d srb='%p'poll command abort successfully \n" 3351 , acb->pci_unit, srb->pccb->ccb_h.target_id, srb->pccb->ccb_h.target_lun, srb); | 3350 printf("arcmsr%d: scsi id=%d lun=%jx srb='%p'poll command abort successfully \n" 3351 , acb->pci_unit, srb->pccb->ccb_h.target_id, (uintmax_t)srb->pccb->ccb_h.target_lun, srb); |
3352 srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; 3353 arcmsr_srb_complete(srb, 1); 3354 continue; 3355 } 3356 printf("arcmsr%d: polling get an illegal srb command done srb='%p'srboutstandingcount=%d \n" 3357 , acb->pci_unit, srb, acb->srboutstandingcount); 3358 continue; 3359 } --- 1141 unchanged lines hidden --- | 3352 srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; 3353 arcmsr_srb_complete(srb, 1); 3354 continue; 3355 } 3356 printf("arcmsr%d: polling get an illegal srb command done srb='%p'srboutstandingcount=%d \n" 3357 , acb->pci_unit, srb, acb->srboutstandingcount); 3358 continue; 3359 } --- 1141 unchanged lines hidden --- |