arcmsr.c (531c2d7af3cd2e64eec94aa1b19c4b2f16fce515) arcmsr.c (fc5ef1ca4f293be626e3d021aed0be976a79fcab)
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

--- 64 unchanged lines hidden (view full) ---

73** 1.20.00.24 06/11/2012 Ching Huang Fixed return sense data condition
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** 1.20.00.29 12/18/2013 Ching Huang Change simq allocation number, support ARC1883
79** 1.30.00.00 11/30/2015 Ching Huang Added support ARC1203
80** 1.40.00.00 07/11/2017 Ching Huang Added support ARC1884
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

--- 64 unchanged lines hidden (view full) ---

73** 1.20.00.24 06/11/2012 Ching Huang Fixed return sense data condition
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** 1.20.00.29 12/18/2013 Ching Huang Change simq allocation number, support ARC1883
79** 1.30.00.00 11/30/2015 Ching Huang Added support ARC1203
80** 1.40.00.00 07/11/2017 Ching Huang Added support ARC1884
81** 1.40.00.01 10/30/2017 Ching Huang Fixed release memory resource
81******************************************************************************************
82*/
83
84#include <sys/cdefs.h>
85__FBSDID("$FreeBSD$");
86
87#if 0
88#define ARCMSR_DEBUG1 1

--- 55 unchanged lines hidden (view full) ---

144#endif
145
146#if __FreeBSD_version > 500000
147#define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1);
148#else
149#define arcmsr_callout_init(a) callout_init(a);
150#endif
151
82******************************************************************************************
83*/
84
85#include <sys/cdefs.h>
86__FBSDID("$FreeBSD$");
87
88#if 0
89#define ARCMSR_DEBUG1 1

--- 55 unchanged lines hidden (view full) ---

145#endif
146
147#if __FreeBSD_version > 500000
148#define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1);
149#else
150#define arcmsr_callout_init(a) callout_init(a);
151#endif
152
152#define ARCMSR_DRIVER_VERSION "arcmsr version 1.40.00.00 2017-07-11"
153#define ARCMSR_DRIVER_VERSION "arcmsr version 1.40.00.01 2017-10-30"
153#include <dev/arcmsr/arcmsr.h>
154/*
155**************************************************************************
156**************************************************************************
157*/
158static void arcmsr_free_srb(struct CommandControlBlock *srb);
159static struct CommandControlBlock *arcmsr_get_freesrb(struct AdapterControlBlock *acb);
160static u_int8_t arcmsr_seek_cmd2abort(union ccb *abortccb);

--- 21 unchanged lines hidden (view full) ---

182static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, union ccb *pccb);
183static int arcmsr_resume(device_t dev);
184static int arcmsr_suspend(device_t dev);
185static void arcmsr_rescanLun_cb(struct cam_periph *periph, union ccb *ccb);
186static void arcmsr_polling_devmap(void *arg);
187static void arcmsr_srb_timeout(void *arg);
188static void arcmsr_hbd_postqueue_isr(struct AdapterControlBlock *acb);
189static void arcmsr_hbe_postqueue_isr(struct AdapterControlBlock *acb);
154#include <dev/arcmsr/arcmsr.h>
155/*
156**************************************************************************
157**************************************************************************
158*/
159static void arcmsr_free_srb(struct CommandControlBlock *srb);
160static struct CommandControlBlock *arcmsr_get_freesrb(struct AdapterControlBlock *acb);
161static u_int8_t arcmsr_seek_cmd2abort(union ccb *abortccb);

--- 21 unchanged lines hidden (view full) ---

183static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, union ccb *pccb);
184static int arcmsr_resume(device_t dev);
185static int arcmsr_suspend(device_t dev);
186static void arcmsr_rescanLun_cb(struct cam_periph *periph, union ccb *ccb);
187static void arcmsr_polling_devmap(void *arg);
188static void arcmsr_srb_timeout(void *arg);
189static void arcmsr_hbd_postqueue_isr(struct AdapterControlBlock *acb);
190static void arcmsr_hbe_postqueue_isr(struct AdapterControlBlock *acb);
190void arcmsr_teardown_intr(device_t dev, struct AdapterControlBlock *acb);
191static void arcmsr_teardown_intr(device_t dev, struct AdapterControlBlock *acb);
191#ifdef ARCMSR_DEBUG1
192static void arcmsr_dump_data(struct AdapterControlBlock *acb);
193#endif
194/*
195**************************************************************************
196**************************************************************************
197*/
198static void UDELAY(u_int32_t us) { DELAY(us); }

--- 706 unchanged lines hidden (view full) ---

905**************************************************************************
906*/
907static void arcmsr_drain_donequeue(struct AdapterControlBlock *acb, u_int32_t flag_srb, u_int16_t error)
908{
909 struct CommandControlBlock *srb;
910
911 /* check if command done with no error*/
912 switch (acb->adapter_type) {
192#ifdef ARCMSR_DEBUG1
193static void arcmsr_dump_data(struct AdapterControlBlock *acb);
194#endif
195/*
196**************************************************************************
197**************************************************************************
198*/
199static void UDELAY(u_int32_t us) { DELAY(us); }

--- 706 unchanged lines hidden (view full) ---

906**************************************************************************
907*/
908static void arcmsr_drain_donequeue(struct AdapterControlBlock *acb, u_int32_t flag_srb, u_int16_t error)
909{
910 struct CommandControlBlock *srb;
911
912 /* check if command done with no error*/
913 switch (acb->adapter_type) {
914 case ACB_ADAPTER_TYPE_A:
915 case ACB_ADAPTER_TYPE_B:
916 srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb << 5));/*frame must be 32 bytes aligned*/
917 break;
913 case ACB_ADAPTER_TYPE_C:
914 case ACB_ADAPTER_TYPE_D:
915 srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb & 0xFFFFFFE0)); /*frame must be 32 bytes aligned*/
916 break;
917 case ACB_ADAPTER_TYPE_E:
918 srb = acb->psrb_pool[flag_srb];
919 break;
918 case ACB_ADAPTER_TYPE_C:
919 case ACB_ADAPTER_TYPE_D:
920 srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb & 0xFFFFFFE0)); /*frame must be 32 bytes aligned*/
921 break;
922 case ACB_ADAPTER_TYPE_E:
923 srb = acb->psrb_pool[flag_srb];
924 break;
920 case ACB_ADAPTER_TYPE_A:
921 case ACB_ADAPTER_TYPE_B:
922 default:
923 srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb << 5));/*frame must be 32 bytes aligned*/
924 break;
925 }
926 if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) {
927 if(srb->srb_state == ARCMSR_SRB_TIMEOUT) {
928 arcmsr_free_srb(srb);
929 printf("arcmsr%d: srb='%p' return srb has been timeouted\n", acb->pci_unit, srb);

--- 650 unchanged lines hidden (view full) ---

1580*/
1581static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb,
1582 struct QBUFFER *prbuffer) {
1583
1584 u_int8_t *pQbuffer;
1585 u_int8_t *iop_data;
1586 u_int32_t iop_len;
1587
925 default:
926 srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb << 5));/*frame must be 32 bytes aligned*/
927 break;
928 }
929 if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) {
930 if(srb->srb_state == ARCMSR_SRB_TIMEOUT) {
931 arcmsr_free_srb(srb);
932 printf("arcmsr%d: srb='%p' return srb has been timeouted\n", acb->pci_unit, srb);

--- 650 unchanged lines hidden (view full) ---

1583*/
1584static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb,
1585 struct QBUFFER *prbuffer) {
1586
1587 u_int8_t *pQbuffer;
1588 u_int8_t *iop_data;
1589 u_int32_t iop_len;
1590
1588 if((acb->adapter_type == ACB_ADAPTER_TYPE_C) || (acb->adapter_type == ACB_ADAPTER_TYPE_D) ||
1589 (acb->adapter_type == ACB_ADAPTER_TYPE_E)) {
1591 if(acb->adapter_type >= ACB_ADAPTER_TYPE_B) {
1590 return(arcmsr_Read_iop_rqbuffer_data_D(acb, prbuffer));
1591 }
1592 iop_data = (u_int8_t *)prbuffer->data;
1593 iop_len = (u_int32_t)prbuffer->data_len;
1594 while (iop_len > 0) {
1595 pQbuffer = &acb->rqbuffer[acb->rqbuf_lastindex];
1596 *pQbuffer = *iop_data;
1597 acb->rqbuf_lastindex++;

--- 78 unchanged lines hidden (view full) ---

1676*/
1677static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb)
1678{
1679 u_int8_t *pQbuffer;
1680 struct QBUFFER *pwbuffer;
1681 u_int8_t *iop_data;
1682 int32_t allxfer_len=0;
1683
1592 return(arcmsr_Read_iop_rqbuffer_data_D(acb, prbuffer));
1593 }
1594 iop_data = (u_int8_t *)prbuffer->data;
1595 iop_len = (u_int32_t)prbuffer->data_len;
1596 while (iop_len > 0) {
1597 pQbuffer = &acb->rqbuffer[acb->rqbuf_lastindex];
1598 *pQbuffer = *iop_data;
1599 acb->rqbuf_lastindex++;

--- 78 unchanged lines hidden (view full) ---

1678*/
1679static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb)
1680{
1681 u_int8_t *pQbuffer;
1682 struct QBUFFER *pwbuffer;
1683 u_int8_t *iop_data;
1684 int32_t allxfer_len=0;
1685
1684 if((acb->adapter_type == ACB_ADAPTER_TYPE_C) || (acb->adapter_type == ACB_ADAPTER_TYPE_D) ||
1685 (acb->adapter_type == ACB_ADAPTER_TYPE_E)) {
1686 if(acb->adapter_type >= ACB_ADAPTER_TYPE_B) {
1686 arcmsr_Write_data_2iop_wqbuffer_D(acb);
1687 return;
1688 }
1689 if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) {
1690 acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ);
1691 pwbuffer = arcmsr_get_iop_wqbuffer(acb);
1692 iop_data = (u_int8_t *)pwbuffer->data;
1693 while((acb->wqbuf_firstindex != acb->wqbuf_lastindex)

--- 796 unchanged lines hidden (view full) ---

2490 }
2491 }
2492}
2493/*
2494***********************************************************************
2495**
2496************************************************************************
2497*/
1687 arcmsr_Write_data_2iop_wqbuffer_D(acb);
1688 return;
1689 }
1690 if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) {
1691 acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ);
1692 pwbuffer = arcmsr_get_iop_wqbuffer(acb);
1693 iop_data = (u_int8_t *)pwbuffer->data;
1694 while((acb->wqbuf_firstindex != acb->wqbuf_lastindex)

--- 796 unchanged lines hidden (view full) ---

2491 }
2492 }
2493}
2494/*
2495***********************************************************************
2496**
2497************************************************************************
2498*/
2498u_int32_t arcmsr_iop_ioctlcmd(struct AdapterControlBlock *acb, u_int32_t ioctl_cmd, caddr_t arg)
2499static u_int32_t arcmsr_iop_ioctlcmd(struct AdapterControlBlock *acb, u_int32_t ioctl_cmd, caddr_t arg)
2499{
2500 struct CMD_MESSAGE_FIELD *pcmdmessagefld;
2501 u_int32_t retvalue = EINVAL;
2502
2503 pcmdmessagefld = (struct CMD_MESSAGE_FIELD *) arg;
2504 if(memcmp(pcmdmessagefld->cmdmessage.Signature, "ARCMSR", 6)!=0) {
2505 return retvalue;
2506 }

--- 171 unchanged lines hidden (view full) ---

2678 acb->workingsrb_doneindex++;
2679 acb->workingsrb_doneindex %= ARCMSR_MAX_FREESRB_NUM;
2680 ARCMSR_LOCK_RELEASE(&acb->srb_lock);
2681}
2682/*
2683**************************************************************************
2684**************************************************************************
2685*/
2500{
2501 struct CMD_MESSAGE_FIELD *pcmdmessagefld;
2502 u_int32_t retvalue = EINVAL;
2503
2504 pcmdmessagefld = (struct CMD_MESSAGE_FIELD *) arg;
2505 if(memcmp(pcmdmessagefld->cmdmessage.Signature, "ARCMSR", 6)!=0) {
2506 return retvalue;
2507 }

--- 171 unchanged lines hidden (view full) ---

2679 acb->workingsrb_doneindex++;
2680 acb->workingsrb_doneindex %= ARCMSR_MAX_FREESRB_NUM;
2681 ARCMSR_LOCK_RELEASE(&acb->srb_lock);
2682}
2683/*
2684**************************************************************************
2685**************************************************************************
2686*/
2686struct CommandControlBlock *arcmsr_get_freesrb(struct AdapterControlBlock *acb)
2687static struct CommandControlBlock *arcmsr_get_freesrb(struct AdapterControlBlock *acb)
2687{
2688 struct CommandControlBlock *srb = NULL;
2689 u_int32_t workingsrb_startindex, workingsrb_doneindex;
2690
2691 ARCMSR_LOCK_ACQUIRE(&acb->srb_lock);
2692 workingsrb_doneindex = acb->workingsrb_doneindex;
2693 workingsrb_startindex = acb->workingsrb_startindex;
2694 srb = acb->srbworkingQ[workingsrb_startindex];

--- 1415 unchanged lines hidden (view full) ---

4110 u_int32_t outbound_doorbell;
4111
4112 switch (acb->adapter_type) {
4113 case ACB_ADAPTER_TYPE_A: {
4114 /* empty doorbell Qbuffer if door bell ringed */
4115 outbound_doorbell = CHIP_REG_READ32(HBA_MessageUnit, 0, outbound_doorbell);
4116 CHIP_REG_WRITE32(HBA_MessageUnit, 0, outbound_doorbell, outbound_doorbell); /*clear doorbell interrupt */
4117 CHIP_REG_WRITE32(HBA_MessageUnit, 0, inbound_doorbell, ARCMSR_INBOUND_DRIVER_DATA_READ_OK);
2688{
2689 struct CommandControlBlock *srb = NULL;
2690 u_int32_t workingsrb_startindex, workingsrb_doneindex;
2691
2692 ARCMSR_LOCK_ACQUIRE(&acb->srb_lock);
2693 workingsrb_doneindex = acb->workingsrb_doneindex;
2694 workingsrb_startindex = acb->workingsrb_startindex;
2695 srb = acb->srbworkingQ[workingsrb_startindex];

--- 1415 unchanged lines hidden (view full) ---

4111 u_int32_t outbound_doorbell;
4112
4113 switch (acb->adapter_type) {
4114 case ACB_ADAPTER_TYPE_A: {
4115 /* empty doorbell Qbuffer if door bell ringed */
4116 outbound_doorbell = CHIP_REG_READ32(HBA_MessageUnit, 0, outbound_doorbell);
4117 CHIP_REG_WRITE32(HBA_MessageUnit, 0, outbound_doorbell, outbound_doorbell); /*clear doorbell interrupt */
4118 CHIP_REG_WRITE32(HBA_MessageUnit, 0, inbound_doorbell, ARCMSR_INBOUND_DRIVER_DATA_READ_OK);
4118
4119 }
4120 break;
4121 case ACB_ADAPTER_TYPE_B: {
4122 struct HBB_MessageUnit *phbbmu = (struct HBB_MessageUnit *)acb->pmu;
4119 }
4120 break;
4121 case ACB_ADAPTER_TYPE_B: {
4122 struct HBB_MessageUnit *phbbmu = (struct HBB_MessageUnit *)acb->pmu;
4123 WRITE_CHIP_REG32(0, phbbmu->iop2drv_doorbell, ARCMSR_MESSAGE_INT_CLEAR_PATTERN);/*clear interrupt and message state*/
4123 WRITE_CHIP_REG32(0, phbbmu->iop2drv_doorbell, ARCMSR_DOORBELL_INT_CLEAR_PATTERN);/*clear interrupt and message state*/
4124 WRITE_CHIP_REG32(0, phbbmu->drv2iop_doorbell, ARCMSR_DRV2IOP_DATA_READ_OK);
4125 /* let IOP know data has been read */
4126 }
4127 break;
4128 case ACB_ADAPTER_TYPE_C: {
4129 /* empty doorbell Qbuffer if door bell ringed */
4130 outbound_doorbell = CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_doorbell);
4131 CHIP_REG_WRITE32(HBC_MessageUnit, 0, outbound_doorbell_clear, outbound_doorbell); /*clear doorbell interrupt */
4132 CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_doorbell, ARCMSR_HBCMU_DRV2IOP_DATA_READ_OK);
4133 CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_doorbell_clear); /* Dummy read to force pci flush */
4134 CHIP_REG_READ32(HBC_MessageUnit, 0, inbound_doorbell); /* Dummy read to force pci flush */
4135 }
4136 break;
4137 case ACB_ADAPTER_TYPE_D: {
4138 /* empty doorbell Qbuffer if door bell ringed */
4139 outbound_doorbell = CHIP_REG_READ32(HBD_MessageUnit, 0, outbound_doorbell);
4140 CHIP_REG_WRITE32(HBD_MessageUnit, 0, outbound_doorbell, outbound_doorbell); /*clear doorbell interrupt */
4141 CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_doorbell, ARCMSR_HBDMU_DRV2IOP_DATA_OUT_READ);
4124 WRITE_CHIP_REG32(0, phbbmu->drv2iop_doorbell, ARCMSR_DRV2IOP_DATA_READ_OK);
4125 /* let IOP know data has been read */
4126 }
4127 break;
4128 case ACB_ADAPTER_TYPE_C: {
4129 /* empty doorbell Qbuffer if door bell ringed */
4130 outbound_doorbell = CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_doorbell);
4131 CHIP_REG_WRITE32(HBC_MessageUnit, 0, outbound_doorbell_clear, outbound_doorbell); /*clear doorbell interrupt */
4132 CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_doorbell, ARCMSR_HBCMU_DRV2IOP_DATA_READ_OK);
4133 CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_doorbell_clear); /* Dummy read to force pci flush */
4134 CHIP_REG_READ32(HBC_MessageUnit, 0, inbound_doorbell); /* Dummy read to force pci flush */
4135 }
4136 break;
4137 case ACB_ADAPTER_TYPE_D: {
4138 /* empty doorbell Qbuffer if door bell ringed */
4139 outbound_doorbell = CHIP_REG_READ32(HBD_MessageUnit, 0, outbound_doorbell);
4140 CHIP_REG_WRITE32(HBD_MessageUnit, 0, outbound_doorbell, outbound_doorbell); /*clear doorbell interrupt */
4141 CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_doorbell, ARCMSR_HBDMU_DRV2IOP_DATA_OUT_READ);
4142
4143 }
4144 break;
4145 case ACB_ADAPTER_TYPE_E: {
4146 /* empty doorbell Qbuffer if door bell ringed */
4147 acb->in_doorbell = CHIP_REG_READ32(HBE_MessageUnit, 0, iobound_doorbell);
4148 CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); /*clear doorbell interrupt */
4149 acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_DATA_READ_OK;
4150 CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell);

--- 197 unchanged lines hidden (view full) ---

4348 else
4349 srb_tmp->cdb_phyaddr_low = srb_phyaddr >> 5;
4350 srb_tmp->acb = acb;
4351 srb_tmp->smid = i << 16;
4352 acb->srbworkingQ[i] = acb->psrb_pool[i] = srb_tmp;
4353 srb_phyaddr = srb_phyaddr + SRB_SIZE;
4354 srb_tmp = (struct CommandControlBlock *)((unsigned long)srb_tmp + SRB_SIZE);
4355 }
4142 }
4143 break;
4144 case ACB_ADAPTER_TYPE_E: {
4145 /* empty doorbell Qbuffer if door bell ringed */
4146 acb->in_doorbell = CHIP_REG_READ32(HBE_MessageUnit, 0, iobound_doorbell);
4147 CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); /*clear doorbell interrupt */
4148 acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_DATA_READ_OK;
4149 CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell);

--- 197 unchanged lines hidden (view full) ---

4347 else
4348 srb_tmp->cdb_phyaddr_low = srb_phyaddr >> 5;
4349 srb_tmp->acb = acb;
4350 srb_tmp->smid = i << 16;
4351 acb->srbworkingQ[i] = acb->psrb_pool[i] = srb_tmp;
4352 srb_phyaddr = srb_phyaddr + SRB_SIZE;
4353 srb_tmp = (struct CommandControlBlock *)((unsigned long)srb_tmp + SRB_SIZE);
4354 }
4356 acb->pCompletionQ = (pCompletion_Q)srb_tmp;
4355 if (acb->adapter_type == ACB_ADAPTER_TYPE_E)
4356 acb->pCompletionQ = (pCompletion_Q)srb_tmp;
4357 acb->vir2phy_offset = (unsigned long)srb_tmp - (unsigned long)srb_phyaddr;
4358}
4359/*
4360************************************************************************
4361************************************************************************
4362*/
4363static void arcmsr_free_resource(struct AdapterControlBlock *acb)
4364{

--- 44 unchanged lines hidden (view full) ---

4409 acb->vendor_device_id = vendor_dev_id;
4410 acb->sub_device_id = pci_read_config(dev, PCIR_SUBDEV_0, 2);
4411 switch (vendor_dev_id) {
4412 case PCIDevVenIDARC1880:
4413 case PCIDevVenIDARC1882:
4414 case PCIDevVenIDARC1213:
4415 case PCIDevVenIDARC1223: {
4416 acb->adapter_type = ACB_ADAPTER_TYPE_C;
4357 acb->vir2phy_offset = (unsigned long)srb_tmp - (unsigned long)srb_phyaddr;
4358}
4359/*
4360************************************************************************
4361************************************************************************
4362*/
4363static void arcmsr_free_resource(struct AdapterControlBlock *acb)
4364{

--- 44 unchanged lines hidden (view full) ---

4409 acb->vendor_device_id = vendor_dev_id;
4410 acb->sub_device_id = pci_read_config(dev, PCIR_SUBDEV_0, 2);
4411 switch (vendor_dev_id) {
4412 case PCIDevVenIDARC1880:
4413 case PCIDevVenIDARC1882:
4414 case PCIDevVenIDARC1213:
4415 case PCIDevVenIDARC1223: {
4416 acb->adapter_type = ACB_ADAPTER_TYPE_C;
4417 if (acb->sub_device_id == ARECA_SUB_DEV_ID_1883)
4417 if ((acb->sub_device_id == ARECA_SUB_DEV_ID_1883) ||
4418 (acb->sub_device_id == ARECA_SUB_DEV_ID_1216) ||
4419 (acb->sub_device_id == ARECA_SUB_DEV_ID_1226))
4418 acb->adapter_bus_speed = ACB_BUS_SPEED_12G;
4419 else
4420 acb->adapter_bus_speed = ACB_BUS_SPEED_6G;
4421 max_coherent_size = ARCMSR_SRBS_POOL_SIZE;
4422 }
4423 break;
4424 case PCIDevVenIDARC1884:
4425 acb->adapter_type = ACB_ADAPTER_TYPE_E;

--- 167 unchanged lines hidden (view full) ---

4593 if(mem_base0 == 0) {
4594 arcmsr_free_resource(acb);
4595 printf("arcmsr%d: rman_get_virtual failure!\n", device_get_unit(dev));
4596 return ENXIO;
4597 }
4598 acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]);
4599 acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]);
4600 acb->pmu = (struct MessageUnit_UNION *)mem_base0;
4420 acb->adapter_bus_speed = ACB_BUS_SPEED_12G;
4421 else
4422 acb->adapter_bus_speed = ACB_BUS_SPEED_6G;
4423 max_coherent_size = ARCMSR_SRBS_POOL_SIZE;
4424 }
4425 break;
4426 case PCIDevVenIDARC1884:
4427 acb->adapter_type = ACB_ADAPTER_TYPE_E;

--- 167 unchanged lines hidden (view full) ---

4595 if(mem_base0 == 0) {
4596 arcmsr_free_resource(acb);
4597 printf("arcmsr%d: rman_get_virtual failure!\n", device_get_unit(dev));
4598 return ENXIO;
4599 }
4600 acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]);
4601 acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]);
4602 acb->pmu = (struct MessageUnit_UNION *)mem_base0;
4601 acb->rid = 0;
4603 acb->rid[0] = rid0;
4602 }
4603 break;
4604 case ACB_ADAPTER_TYPE_B: {
4605 struct HBB_MessageUnit *phbbmu;
4606 struct CommandControlBlock *freesrb;
4607 u_int32_t rid[]={ PCIR_BAR(0), PCIR_BAR(2) };
4608 vm_offset_t mem_base[]={0,0};
4604 }
4605 break;
4606 case ACB_ADAPTER_TYPE_B: {
4607 struct HBB_MessageUnit *phbbmu;
4608 struct CommandControlBlock *freesrb;
4609 u_int32_t rid[]={ PCIR_BAR(0), PCIR_BAR(2) };
4610 vm_offset_t mem_base[]={0,0};
4609 u_long size;
4610 if (vendor_dev_id == PCIDevVenIDARC1203)
4611 size = sizeof(struct HBB_DOORBELL_1203);
4612 else
4613 size = sizeof(struct HBB_DOORBELL);
4614 for(i=0; i < 2; i++) {
4611 for(i=0; i < 2; i++) {
4615 if(i == 0) {
4616 acb->sys_res_arcmsr[i] = bus_alloc_resource_any(dev,SYS_RES_MEMORY, &rid[i],
4617 RF_ACTIVE);
4618 } else {
4619 acb->sys_res_arcmsr[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid[i],
4620 RF_ACTIVE);
4621 }
4612 acb->sys_res_arcmsr[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid[i], RF_ACTIVE);
4622 if(acb->sys_res_arcmsr[i] == NULL) {
4623 arcmsr_free_resource(acb);
4624 printf("arcmsr%d: bus_alloc_resource %d failure!\n", device_get_unit(dev), i);
4625 return ENOMEM;
4626 }
4627 if(rman_get_start(acb->sys_res_arcmsr[i]) <= 0) {
4628 arcmsr_free_resource(acb);
4629 printf("arcmsr%d: rman_get_start %d failure!\n", device_get_unit(dev), i);

--- 19 unchanged lines hidden (view full) ---

4649 phbbmu->iop2drv_doorbell = offsetof(struct HBB_DOORBELL_1203, iop2drv_doorbell);
4650 phbbmu->iop2drv_doorbell_mask = offsetof(struct HBB_DOORBELL_1203, iop2drv_doorbell_mask);
4651 } else {
4652 phbbmu->drv2iop_doorbell = offsetof(struct HBB_DOORBELL, drv2iop_doorbell);
4653 phbbmu->drv2iop_doorbell_mask = offsetof(struct HBB_DOORBELL, drv2iop_doorbell_mask);
4654 phbbmu->iop2drv_doorbell = offsetof(struct HBB_DOORBELL, iop2drv_doorbell);
4655 phbbmu->iop2drv_doorbell_mask = offsetof(struct HBB_DOORBELL, iop2drv_doorbell_mask);
4656 }
4613 if(acb->sys_res_arcmsr[i] == NULL) {
4614 arcmsr_free_resource(acb);
4615 printf("arcmsr%d: bus_alloc_resource %d failure!\n", device_get_unit(dev), i);
4616 return ENOMEM;
4617 }
4618 if(rman_get_start(acb->sys_res_arcmsr[i]) <= 0) {
4619 arcmsr_free_resource(acb);
4620 printf("arcmsr%d: rman_get_start %d failure!\n", device_get_unit(dev), i);

--- 19 unchanged lines hidden (view full) ---

4640 phbbmu->iop2drv_doorbell = offsetof(struct HBB_DOORBELL_1203, iop2drv_doorbell);
4641 phbbmu->iop2drv_doorbell_mask = offsetof(struct HBB_DOORBELL_1203, iop2drv_doorbell_mask);
4642 } else {
4643 phbbmu->drv2iop_doorbell = offsetof(struct HBB_DOORBELL, drv2iop_doorbell);
4644 phbbmu->drv2iop_doorbell_mask = offsetof(struct HBB_DOORBELL, drv2iop_doorbell_mask);
4645 phbbmu->iop2drv_doorbell = offsetof(struct HBB_DOORBELL, iop2drv_doorbell);
4646 phbbmu->iop2drv_doorbell_mask = offsetof(struct HBB_DOORBELL, iop2drv_doorbell_mask);
4647 }
4657 acb->rid = 0;
4648 acb->rid[0] = rid[0];
4649 acb->rid[1] = rid[1];
4658 }
4659 break;
4660 case ACB_ADAPTER_TYPE_C: {
4661 u_int32_t rid0 = PCIR_BAR(1);
4662 vm_offset_t mem_base0;
4663
4664 acb->sys_res_arcmsr[0] = bus_alloc_resource_any(dev,SYS_RES_MEMORY, &rid0, RF_ACTIVE);
4665 if(acb->sys_res_arcmsr[0] == NULL) {

--- 10 unchanged lines hidden (view full) ---

4676 if(mem_base0 == 0) {
4677 arcmsr_free_resource(acb);
4678 printf("arcmsr%d: rman_get_virtual failure!\n", device_get_unit(dev));
4679 return ENXIO;
4680 }
4681 acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]);
4682 acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]);
4683 acb->pmu = (struct MessageUnit_UNION *)mem_base0;
4650 }
4651 break;
4652 case ACB_ADAPTER_TYPE_C: {
4653 u_int32_t rid0 = PCIR_BAR(1);
4654 vm_offset_t mem_base0;
4655
4656 acb->sys_res_arcmsr[0] = bus_alloc_resource_any(dev,SYS_RES_MEMORY, &rid0, RF_ACTIVE);
4657 if(acb->sys_res_arcmsr[0] == NULL) {

--- 10 unchanged lines hidden (view full) ---

4668 if(mem_base0 == 0) {
4669 arcmsr_free_resource(acb);
4670 printf("arcmsr%d: rman_get_virtual failure!\n", device_get_unit(dev));
4671 return ENXIO;
4672 }
4673 acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]);
4674 acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]);
4675 acb->pmu = (struct MessageUnit_UNION *)mem_base0;
4684 acb->rid = 1;
4676 acb->rid[0] = rid0;
4685 }
4686 break;
4687 case ACB_ADAPTER_TYPE_D: {
4688 struct HBD_MessageUnit0 *phbdmu;
4689 u_int32_t rid0 = PCIR_BAR(0);
4690 vm_offset_t mem_base0;
4691
4692 acb->sys_res_arcmsr[0] = bus_alloc_resource_any(dev,SYS_RES_MEMORY, &rid0, RF_ACTIVE);

--- 13 unchanged lines hidden (view full) ---

4706 printf("arcmsr%d: rman_get_virtual failure!\n", device_get_unit(dev));
4707 return ENXIO;
4708 }
4709 acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]);
4710 acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]);
4711 acb->pmu = (struct MessageUnit_UNION *)((unsigned long)acb->uncacheptr+ARCMSR_SRBS_POOL_SIZE);
4712 phbdmu = (struct HBD_MessageUnit0 *)acb->pmu;
4713 phbdmu->phbdmu = (struct HBD_MessageUnit *)mem_base0;
4677 }
4678 break;
4679 case ACB_ADAPTER_TYPE_D: {
4680 struct HBD_MessageUnit0 *phbdmu;
4681 u_int32_t rid0 = PCIR_BAR(0);
4682 vm_offset_t mem_base0;
4683
4684 acb->sys_res_arcmsr[0] = bus_alloc_resource_any(dev,SYS_RES_MEMORY, &rid0, RF_ACTIVE);

--- 13 unchanged lines hidden (view full) ---

4698 printf("arcmsr%d: rman_get_virtual failure!\n", device_get_unit(dev));
4699 return ENXIO;
4700 }
4701 acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]);
4702 acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]);
4703 acb->pmu = (struct MessageUnit_UNION *)((unsigned long)acb->uncacheptr+ARCMSR_SRBS_POOL_SIZE);
4704 phbdmu = (struct HBD_MessageUnit0 *)acb->pmu;
4705 phbdmu->phbdmu = (struct HBD_MessageUnit *)mem_base0;
4714 acb->rid = 0;
4706 acb->rid[0] = rid0;
4715 }
4716 break;
4717 case ACB_ADAPTER_TYPE_E: {
4718 u_int32_t rid0 = PCIR_BAR(1);
4719 vm_offset_t mem_base0;
4720
4707 }
4708 break;
4709 case ACB_ADAPTER_TYPE_E: {
4710 u_int32_t rid0 = PCIR_BAR(1);
4711 vm_offset_t mem_base0;
4712
4721 acb->sys_res_arcmsr[0] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid0, 0ul, ~0ul, sizeof(struct HBE_MessageUnit), RF_ACTIVE);
4713 acb->sys_res_arcmsr[0] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid0, RF_ACTIVE);
4722 if(acb->sys_res_arcmsr[0] == NULL) {
4723 arcmsr_free_resource(acb);
4724 printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev));
4725 return ENOMEM;
4726 }
4727 if(rman_get_start(acb->sys_res_arcmsr[0]) <= 0) {
4728 arcmsr_free_resource(acb);
4729 printf("arcmsr%d: rman_get_start failure!\n", device_get_unit(dev));

--- 6 unchanged lines hidden (view full) ---

4736 return ENXIO;
4737 }
4738 acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]);
4739 acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]);
4740 acb->pmu = (struct MessageUnit_UNION *)mem_base0;
4741 acb->doneq_index = 0;
4742 acb->in_doorbell = 0;
4743 acb->out_doorbell = 0;
4714 if(acb->sys_res_arcmsr[0] == NULL) {
4715 arcmsr_free_resource(acb);
4716 printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev));
4717 return ENOMEM;
4718 }
4719 if(rman_get_start(acb->sys_res_arcmsr[0]) <= 0) {
4720 arcmsr_free_resource(acb);
4721 printf("arcmsr%d: rman_get_start failure!\n", device_get_unit(dev));

--- 6 unchanged lines hidden (view full) ---

4728 return ENXIO;
4729 }
4730 acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]);
4731 acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]);
4732 acb->pmu = (struct MessageUnit_UNION *)mem_base0;
4733 acb->doneq_index = 0;
4734 acb->in_doorbell = 0;
4735 acb->out_doorbell = 0;
4744 acb->rid = 1;
4736 acb->rid[0] = rid0;
4745 CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); /*clear interrupt*/
4746 CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, ARCMSR_HBEMU_DOORBELL_SYNC); /* synchronize doorbell to 0 */
4747 }
4748 break;
4749 }
4750 if(acb->acb_flags & ACB_F_MAPFREESRB_FAILD) {
4751 arcmsr_free_resource(acb);
4752 printf("arcmsr%d: map free srb failure!\n", device_get_unit(dev));

--- 15 unchanged lines hidden (view full) ---

4768 return(0);
4769}
4770
4771static int arcmsr_setup_msix(struct AdapterControlBlock *acb)
4772{
4773 int i;
4774
4775 for (i = 0; i < acb->msix_vectors; i++) {
4737 CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); /*clear interrupt*/
4738 CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, ARCMSR_HBEMU_DOORBELL_SYNC); /* synchronize doorbell to 0 */
4739 }
4740 break;
4741 }
4742 if(acb->acb_flags & ACB_F_MAPFREESRB_FAILD) {
4743 arcmsr_free_resource(acb);
4744 printf("arcmsr%d: map free srb failure!\n", device_get_unit(dev));

--- 15 unchanged lines hidden (view full) ---

4760 return(0);
4761}
4762
4763static int arcmsr_setup_msix(struct AdapterControlBlock *acb)
4764{
4765 int i;
4766
4767 for (i = 0; i < acb->msix_vectors; i++) {
4776 acb->irq_id[i] = acb->rid + i;
4768 acb->irq_id[i] = 1 + i;
4777 acb->irqres[i] = bus_alloc_resource_any(acb->pci_dev,
4778 SYS_RES_IRQ, &acb->irq_id[i], RF_ACTIVE);
4779 if (acb->irqres[i] == NULL) {
4780 printf("arcmsr: Can't allocate MSI-X resource\n");
4781 goto irq_alloc_failed;
4782 }
4783 if (bus_setup_intr(acb->pci_dev, acb->irqres[i],
4784 INTR_MPSAFE | INTR_TYPE_CAM, NULL, arcmsr_intr_handler,

--- 35 unchanged lines hidden (view full) ---

4820 goto initialize_failed;
4821 }
4822 /* After setting up the adapter, map our interrupt */
4823 acb->msix_vectors = ARCMSR_NUM_MSIX_VECTORS;
4824 if (pci_alloc_msix(dev, &acb->msix_vectors) == 0) {
4825 if (arcmsr_setup_msix(acb) == TRUE)
4826 goto irqx;
4827 }
4769 acb->irqres[i] = bus_alloc_resource_any(acb->pci_dev,
4770 SYS_RES_IRQ, &acb->irq_id[i], RF_ACTIVE);
4771 if (acb->irqres[i] == NULL) {
4772 printf("arcmsr: Can't allocate MSI-X resource\n");
4773 goto irq_alloc_failed;
4774 }
4775 if (bus_setup_intr(acb->pci_dev, acb->irqres[i],
4776 INTR_MPSAFE | INTR_TYPE_CAM, NULL, arcmsr_intr_handler,

--- 35 unchanged lines hidden (view full) ---

4812 goto initialize_failed;
4813 }
4814 /* After setting up the adapter, map our interrupt */
4815 acb->msix_vectors = ARCMSR_NUM_MSIX_VECTORS;
4816 if (pci_alloc_msix(dev, &acb->msix_vectors) == 0) {
4817 if (arcmsr_setup_msix(acb) == TRUE)
4818 goto irqx;
4819 }
4828 acb->irq_id[0] = acb->rid;
4820 acb->irq_id[0] = 0;
4829 irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &acb->irq_id[0], RF_SHAREABLE | RF_ACTIVE);
4830 if(irqres == NULL ||
4831#if __FreeBSD_version >= 700025
4832 bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY|INTR_MPSAFE, NULL, arcmsr_intr_handler, acb, &acb->ih[0])) {
4833#else
4834 bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY|INTR_MPSAFE, arcmsr_intr_handler, acb, &acb->ih[0])) {
4835#endif
4836 printf("arcmsr%d: unable to register interrupt handler!\n", unit);

--- 115 unchanged lines hidden (view full) ---

4952 case PCIDevVenIDARC1680:
4953 case PCIDevVenIDARC1681:
4954 type = "SAS 3G";
4955 break;
4956 case PCIDevVenIDARC1880:
4957 case PCIDevVenIDARC1882:
4958 case PCIDevVenIDARC1213:
4959 case PCIDevVenIDARC1223:
4821 irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &acb->irq_id[0], RF_SHAREABLE | RF_ACTIVE);
4822 if(irqres == NULL ||
4823#if __FreeBSD_version >= 700025
4824 bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY|INTR_MPSAFE, NULL, arcmsr_intr_handler, acb, &acb->ih[0])) {
4825#else
4826 bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY|INTR_MPSAFE, arcmsr_intr_handler, acb, &acb->ih[0])) {
4827#endif
4828 printf("arcmsr%d: unable to register interrupt handler!\n", unit);

--- 115 unchanged lines hidden (view full) ---

4944 case PCIDevVenIDARC1680:
4945 case PCIDevVenIDARC1681:
4946 type = "SAS 3G";
4947 break;
4948 case PCIDevVenIDARC1880:
4949 case PCIDevVenIDARC1882:
4950 case PCIDevVenIDARC1213:
4951 case PCIDevVenIDARC1223:
4960 if (sub_device_id == ARECA_SUB_DEV_ID_1883)
4952 if ((sub_device_id == ARECA_SUB_DEV_ID_1883) ||
4953 (sub_device_id == ARECA_SUB_DEV_ID_1216) ||
4954 (sub_device_id == ARECA_SUB_DEV_ID_1226))
4961 type = "SAS 12G";
4962 else
4963 type = "SAS 6G";
4964 break;
4965 case PCIDevVenIDARC1884:
4966 type = "SAS 12G";
4967 break;
4968 case PCIDevVenIDARC1214:

--- 53 unchanged lines hidden (view full) ---

5022 acb->pktReturnCount = 0;
5023 ARCMSR_LOCK_RELEASE(&acb->isr_lock);
5024 return (0);
5025}
5026/*
5027************************************************************************
5028************************************************************************
5029*/
4955 type = "SAS 12G";
4956 else
4957 type = "SAS 6G";
4958 break;
4959 case PCIDevVenIDARC1884:
4960 type = "SAS 12G";
4961 break;
4962 case PCIDevVenIDARC1214:

--- 53 unchanged lines hidden (view full) ---

5016 acb->pktReturnCount = 0;
5017 ARCMSR_LOCK_RELEASE(&acb->isr_lock);
5018 return (0);
5019}
5020/*
5021************************************************************************
5022************************************************************************
5023*/
5030void arcmsr_teardown_intr(device_t dev, struct AdapterControlBlock *acb)
5024static void arcmsr_teardown_intr(device_t dev, struct AdapterControlBlock *acb)
5031{
5032 int i;
5033
5034 if (acb->acb_flags & ACB_F_MSIX_ENABLED) {
5035 for (i = 0; i < acb->msix_vectors; i++) {
5036 if (acb->ih[i])
5037 bus_teardown_intr(dev, acb->irqres[i], acb->ih[i]);
5038 if (acb->irqres[i] != NULL)

--- 22 unchanged lines hidden (view full) ---

5061 struct AdapterControlBlock *acb=(struct AdapterControlBlock *)device_get_softc(dev);
5062 int i;
5063
5064 callout_stop(&acb->devmap_callout);
5065 arcmsr_teardown_intr(dev, acb);
5066 arcmsr_shutdown(dev);
5067 arcmsr_free_resource(acb);
5068 for(i=0; (acb->sys_res_arcmsr[i]!=NULL) && (i<2); i++) {
5025{
5026 int i;
5027
5028 if (acb->acb_flags & ACB_F_MSIX_ENABLED) {
5029 for (i = 0; i < acb->msix_vectors; i++) {
5030 if (acb->ih[i])
5031 bus_teardown_intr(dev, acb->irqres[i], acb->ih[i]);
5032 if (acb->irqres[i] != NULL)

--- 22 unchanged lines hidden (view full) ---

5055 struct AdapterControlBlock *acb=(struct AdapterControlBlock *)device_get_softc(dev);
5056 int i;
5057
5058 callout_stop(&acb->devmap_callout);
5059 arcmsr_teardown_intr(dev, acb);
5060 arcmsr_shutdown(dev);
5061 arcmsr_free_resource(acb);
5062 for(i=0; (acb->sys_res_arcmsr[i]!=NULL) && (i<2); i++) {
5069 bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(i), acb->sys_res_arcmsr[i]);
5063 bus_release_resource(dev, SYS_RES_MEMORY, acb->rid[i], acb->sys_res_arcmsr[i]);
5070 }
5071 ARCMSR_LOCK_ACQUIRE(&acb->isr_lock);
5072 xpt_async(AC_LOST_DEVICE, acb->ppath, NULL);
5073 xpt_free_path(acb->ppath);
5074 xpt_bus_deregister(cam_sim_path(acb->psim));
5075 cam_sim_free(acb->psim, TRUE);
5076 ARCMSR_LOCK_RELEASE(&acb->isr_lock);
5077 arcmsr_mutex_destroy(acb);

--- 6 unchanged lines hidden (view full) ---

5084 if((acb->pktRequestCount - acb->pktReturnCount) == 0)
5085 return;
5086 printf("Command Request Count =0x%x\n",acb->pktRequestCount);
5087 printf("Command Return Count =0x%x\n",acb->pktReturnCount);
5088 printf("Command (Req-Rtn) Count =0x%x\n",(acb->pktRequestCount - acb->pktReturnCount));
5089 printf("Queued Command Count =0x%x\n",acb->srboutstandingcount);
5090}
5091#endif
5064 }
5065 ARCMSR_LOCK_ACQUIRE(&acb->isr_lock);
5066 xpt_async(AC_LOST_DEVICE, acb->ppath, NULL);
5067 xpt_free_path(acb->ppath);
5068 xpt_bus_deregister(cam_sim_path(acb->psim));
5069 cam_sim_free(acb->psim, TRUE);
5070 ARCMSR_LOCK_RELEASE(&acb->isr_lock);
5071 arcmsr_mutex_destroy(acb);

--- 6 unchanged lines hidden (view full) ---

5078 if((acb->pktRequestCount - acb->pktReturnCount) == 0)
5079 return;
5080 printf("Command Request Count =0x%x\n",acb->pktRequestCount);
5081 printf("Command Return Count =0x%x\n",acb->pktReturnCount);
5082 printf("Command (Req-Rtn) Count =0x%x\n",(acb->pktRequestCount - acb->pktReturnCount));
5083 printf("Queued Command Count =0x%x\n",acb->srboutstandingcount);
5084}
5085#endif
5092