Author: delphij Date: Wed Sep 19 23:03:54 2012 New Revision: 240715 URL: http://svn.freebsd.org/changeset/base/240715
Log: MFC r240079,215837: Update arcmsr(4) to vendor version 1.20.00.25. Many thanks to Areca for continuing to support FreeBSD. Submitted by: Ching-Lung Huang <ching2048 areca com tw> Modified: stable/8/share/man/man4/arcmsr.4 stable/8/sys/dev/arcmsr/arcmsr.c stable/8/sys/dev/arcmsr/arcmsr.h Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/arcmsr/ (props changed) Modified: stable/8/share/man/man4/arcmsr.4 ============================================================================== --- stable/8/share/man/man4/arcmsr.4 Wed Sep 19 22:26:05 2012 (r240714) +++ stable/8/share/man/man4/arcmsr.4 Wed Sep 19 23:03:54 2012 (r240715) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd March 28, 2008 +.Dd September 3, 2012 .Dt ARCMSR 4 .Os .Sh NAME .Nm arcmsr -.Nd Areca SATA II RAID Controller driver +.Nd Areca RAID Controller driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -50,11 +50,11 @@ arcmsr_load="YES" .Sh DESCRIPTION The .Nm -driver provides support for the Areca ARC-11xx and ARC-12xx series of SATA II -RAID controllers. +driver provides support for the Areca ARC-11xx, ARC-12xx, ARC-13xx, +ARC-16xx and ARC-18xx series of SAS and SATA RAID controllers. These controllers feature RAID-0, 1, 3, 5, 6, and 10 and JBOD acceleration for up to 16 SATA drives. -Raid level and stripe level +RAID level and stripe level migration, online capacity expansion, hot insertion/removal, automatic failover and rebuild, and SMART are also supported. Access to the arrays is provided @@ -82,8 +82,6 @@ ARC-1160 .It ARC-1170 .It -ARC-1180 -.It ARC-1110ML .It ARC-1120ML @@ -92,14 +90,32 @@ ARC-1130ML .It ARC-1160ML .It +ARC-1200 +.It +ARC-1201 +.It ARC-1210 .It +ARC-1212 +.It +ARC-1213 +.It ARC-1220 .It +ARC-1222 +.It +ARC-1223 +.It ARC-1230 .It +ARC-1231 +.It ARC-1260 .It +ARC-1261 +.It +ARC-1270 +.It ARC-1280 .It ARC-1210ML @@ -111,6 +127,18 @@ ARC-1231ML ARC-1261ML .It ARC-1280ML +.It +ARC-1380 +.It +ARC-1381 +.It +ARC-1680 +.It +ARC-1681 +.It +ARC-1880 +.It +ARC-1882 .El .Sh FILES .Bl -tag -width ".Pa /dev/arcmsr?" -compact Modified: stable/8/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/8/sys/dev/arcmsr/arcmsr.c Wed Sep 19 22:26:05 2012 (r240714) +++ stable/8/sys/dev/arcmsr/arcmsr.c Wed Sep 19 23:03:54 2012 (r240715) @@ -37,38 +37,43 @@ ************************************************************************** ** History ** -** REV# DATE NAME DESCRIPTION -** 1.00.00.00 03/31/2004 Erich Chen First release -** 1.20.00.02 11/29/2004 Erich Chen bug fix with arcmsr_bus_reset when PHY error -** 1.20.00.03 04/19/2005 Erich Chen add SATA 24 Ports adapter type support +** REV# DATE NAME DESCRIPTION +** 1.00.00.00 03/31/2004 Erich Chen First release +** 1.20.00.02 11/29/2004 Erich Chen bug fix with arcmsr_bus_reset when PHY error +** 1.20.00.03 04/19/2005 Erich Chen add SATA 24 Ports adapter type support ** clean unused function -** 1.20.00.12 09/12/2005 Erich Chen bug fix with abort command handling, +** 1.20.00.12 09/12/2005 Erich Chen bug fix with abort command handling, ** firmware version check ** and firmware update notify for hardware bug fix ** handling if none zero high part physical address ** of srb resource -** 1.20.00.13 08/18/2006 Erich Chen remove pending srb and report busy +** 1.20.00.13 08/18/2006 Erich Chen remove pending srb and report busy ** add iop message xfer ** with scsi pass-through command ** add new device id of sas raid adapters ** code fit for SPARC64 & PPC -** 1.20.00.14 02/05/2007 Erich Chen bug fix for incorrect ccb_h.status report +** 1.20.00.14 02/05/2007 Erich Chen bug fix for incorrect ccb_h.status report ** and cause g_vfs_done() read write error -** 1.20.00.15 10/10/2007 Erich Chen support new RAID adapter type ARC120x -** 1.20.00.16 10/10/2009 Erich Chen Bug fix for RAID adapter type ARC120x +** 1.20.00.15 10/10/2007 Erich Chen support new RAID adapter type ARC120x +** 1.20.00.16 10/10/2009 Erich Chen Bug fix for RAID adapter type ARC120x ** bus_dmamem_alloc() with BUS_DMA_ZERO -** 1.20.00.17 07/15/2010 Ching Huang Added support ARC1880 -** report CAM_DEV_NOT_THERE instead of CAM_SEL_TIMEOUT when device failed, -** prevent cam_periph_error removing all LUN devices of one Target id -** for any one LUN device failed -** 1.20.00.18 10/14/2010 Ching Huang Fixed "inquiry data fails comparion at DV1 step" -** 10/25/2010 Ching Huang Fixed bad range input in bus_alloc_resource for ADAPTER_TYPE_B -** 1.20.00.19 11/11/2010 Ching Huang Fixed arcmsr driver prevent arcsas support for Areca SAS HBA ARC13x0 -** 1.20.00.20 12/08/2010 Ching Huang Avoid calling atomic_set_int function -** 1.20.00.21 02/08/2011 Ching Huang Implement I/O request timeout -** 02/14/2011 Ching Huang Modified pktRequestCount -** 1.20.00.21 03/03/2011 Ching Huang if a command timeout, then wait its ccb back before free it -** 1.20.00.22 07/04/2011 Ching Huang Fixed multiple MTX panic +** 1.20.00.17 07/15/2010 Ching Huang Added support ARC1880 +** report CAM_DEV_NOT_THERE instead of CAM_SEL_TIMEOUT when device failed, +** prevent cam_periph_error removing all LUN devices of one Target id +** for any one LUN device failed +** 1.20.00.18 10/14/2010 Ching Huang Fixed "inquiry data fails comparion at DV1 step" +** 10/25/2010 Ching Huang Fixed bad range input in bus_alloc_resource for ADAPTER_TYPE_B +** 1.20.00.19 11/11/2010 Ching Huang Fixed arcmsr driver prevent arcsas support for Areca SAS HBA ARC13x0 +** 1.20.00.20 12/08/2010 Ching Huang Avoid calling atomic_set_int function +** 1.20.00.21 02/08/2011 Ching Huang Implement I/O request timeout +** 02/14/2011 Ching Huang Modified pktRequestCount +** 1.20.00.21 03/03/2011 Ching Huang if a command timeout, then wait its ccb back before free it +** 1.20.00.22 07/04/2011 Ching Huang Fixed multiple MTX panic +** 1.20.00.23 10/28/2011 Ching Huang Added TIMEOUT_DELAY in case of too many HDDs need to start +** 1.20.00.23 11/08/2011 Ching Huang Added report device transfer speed +** 1.20.00.23 01/30/2012 Ching Huang Fixed Request requeued and Retrying command +** 1.20.00.24 06/11/2012 Ching Huang Fixed return sense data condition +** 1.20.00.25 08/17/2012 Ching Huang Fixed hotplug device no function on type A adapter ****************************************************************************************** */ @@ -154,7 +159,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a); #endif -#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.22 2011-07-04" +#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.25 2012-08-17" #include <dev/arcmsr/arcmsr.h> #define SRB_SIZE ((sizeof(struct CommandControlBlock)+0x1f) & 0xffe0) #define ARCMSR_SRBS_POOL_SIZE (SRB_SIZE * ARCMSR_MAX_FREESRB_NUM) @@ -296,7 +301,7 @@ static struct cdevsw arcmsr_cdevsw = { if(acb==NULL) { return ENXIO; } - return 0; + return (0); } /* ************************************************************************** @@ -347,7 +352,7 @@ static struct cdevsw arcmsr_cdevsw = { if(acb==NULL) { return ENXIO; } - return(arcmsr_iop_ioctlcmd(acb, ioctl_cmd, arg)); + return (arcmsr_iop_ioctlcmd(acb, ioctl_cmd, arg)); } /* ********************************************************************** @@ -378,7 +383,7 @@ static u_int32_t arcmsr_disable_allintr( } break; } - return(intmask_org); + return (intmask_org); } /* ********************************************************************** @@ -411,7 +416,6 @@ static void arcmsr_enable_allintr( struc } break; } - return; } /* ********************************************************************** @@ -431,7 +435,7 @@ static u_int8_t arcmsr_hba_wait_msgint_r UDELAY(10000); }/*max 1 seconds*/ }while(Retries++ < 20);/*max 20 sec*/ - return FALSE; + return (FALSE); } /* ********************************************************************** @@ -452,7 +456,7 @@ static u_int8_t arcmsr_hbb_wait_msgint_r UDELAY(10000); }/*max 1 seconds*/ }while(Retries++ < 20);/*max 20 sec*/ - return FALSE; + return (FALSE); } /* ********************************************************************** @@ -472,7 +476,7 @@ static u_int8_t arcmsr_hbc_wait_msgint_r UDELAY(10000); }/*max 1 seconds*/ }while(Retries++ < 20);/*max 20 sec*/ - return FALSE; + return (FALSE); } /* ************************************************************************ @@ -490,7 +494,6 @@ static void arcmsr_flush_hba_cache(struc retry_count--; } }while(retry_count!=0); - return; } /* ************************************************************************ @@ -509,7 +512,6 @@ static void arcmsr_flush_hbb_cache(struc retry_count--; } }while(retry_count!=0); - return; } /* ************************************************************************ @@ -528,7 +530,6 @@ static void arcmsr_flush_hbc_cache(struc retry_count--; } }while(retry_count!=0); - return; } /* ************************************************************************ @@ -550,7 +551,6 @@ static void arcmsr_flush_adapter_cache(s } break; } - return; } /* ******************************************************************************* @@ -596,7 +596,7 @@ static void arcmsr_async(void *cb_arg, u if((target_id > ARCMSR_MAX_TARGETID) || (target_lun > ARCMSR_MAX_TARGETLUN)) { break; } - printf("%s:scsi id=%d lun=%d device lost \n", device_get_name(acb->pci_dev), target_id, target_lun); + // printf("%s:scsi id=%d lun=%d device lost \n", device_get_name(acb->pci_dev), target_id, target_lun); break; default: break; @@ -612,14 +612,13 @@ static void arcmsr_report_sense_info(str pccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR; pccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; - if(&pccb->csio.sense_data) { + if(pccb->csio.sense_len) { memset(&pccb->csio.sense_data, 0, sizeof(pccb->csio.sense_data)); memcpy(&pccb->csio.sense_data, srb->arcmsr_cdb.SenseData, get_min(sizeof(struct SENSE_DATA), sizeof(pccb->csio.sense_data))); ((u_int8_t *)&pccb->csio.sense_data)[0] = (0x1 << 7 | 0x70); /* Valid,ErrorCode */ pccb->ccb_h.status |= CAM_AUTOSNS_VALID; } - return; } /* ********************************************************************* @@ -631,7 +630,6 @@ static void arcmsr_abort_hba_allcmd(stru if(!arcmsr_hba_wait_msgint_ready(acb)) { printf("arcmsr%d: wait 'abort all outstanding command' timeout \n", acb->pci_unit); } - return; } /* ********************************************************************* @@ -643,7 +641,6 @@ static void arcmsr_abort_hbb_allcmd(stru if(!arcmsr_hbb_wait_msgint_ready(acb)) { printf("arcmsr%d: wait 'abort all outstanding command' timeout \n", acb->pci_unit); } - return; } /* ********************************************************************* @@ -656,7 +653,6 @@ static void arcmsr_abort_hbc_allcmd(stru if(!arcmsr_hbc_wait_msgint_ready(acb)) { printf("arcmsr%d: wait 'abort all outstanding command' timeout \n", acb->pci_unit); } - return; } /* ********************************************************************* @@ -678,7 +674,6 @@ static void arcmsr_abort_allcmd(struct A } break; } - return; } /* ********************************************************************** @@ -716,7 +711,6 @@ static void arcmsr_srb_complete(struct C acb->pktReturnCount++; #endif xpt_done(pccb); - return; } /* ************************************************************************** @@ -768,7 +762,6 @@ static void arcmsr_report_srb_state(stru break; } } - return; } /* ************************************************************************** @@ -801,7 +794,6 @@ static void arcmsr_drain_donequeue(struc return; } arcmsr_report_srb_state(acb, srb, error); - return; } /* ************************************************************************** @@ -883,7 +875,6 @@ static void arcmsr_done4abort_postqueue( } break; } - return; } /* **************************************************************************** @@ -923,7 +914,6 @@ static void arcmsr_iop_reset(struct Adap acb->pktRequestCount = 0; acb->pktReturnCount = 0; #endif - return; } /* ********************************************************************** @@ -1011,7 +1001,6 @@ static void arcmsr_build_srb(struct Comm arcmsr_cdb->DataLength = 0; } srb->arc_cdb_size=arccdbsize; - return; } /* ************************************************************************** @@ -1072,7 +1061,6 @@ static void arcmsr_post_srb(struct Adapt } break; } - return; } /* ************************************************************************ @@ -1156,7 +1144,6 @@ static void arcmsr_iop_message_read(stru CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_doorbell, ARCMSR_HBCMU_DRV2IOP_DATA_READ_OK); } } - return; } /* ************************************************************************** @@ -1221,7 +1208,6 @@ static void arcmsr_post_ioctldata2iop(st */ arcmsr_iop_message_wrote(acb); } - return; } /* ************************************************************************ @@ -1236,7 +1222,6 @@ static void arcmsr_stop_hba_bgrb(struct printf("arcmsr%d: wait 'stop adapter background rebulid' timeout \n" , acb->pci_unit); } - return; } /* ************************************************************************ @@ -1251,7 +1236,6 @@ static void arcmsr_stop_hbb_bgrb(struct printf( "arcmsr%d: wait 'stop adapter background rebulid' timeout \n" , acb->pci_unit); } - return; } /* ************************************************************************ @@ -1265,7 +1249,6 @@ static void arcmsr_stop_hbc_bgrb(struct if(!arcmsr_hbc_wait_msgint_ready(acb)) { printf("arcmsr%d: wait 'stop adapter background rebulid' timeout \n", acb->pci_unit); } - return; } /* ************************************************************************ @@ -1287,7 +1270,6 @@ static void arcmsr_stop_adapter_bgrb(str } break; } - return; } /* ************************************************************************ @@ -1305,7 +1287,6 @@ static void arcmsr_poll(struct cam_sim * arcmsr_interrupt(acb); if( mutex == 0 ) ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); - return; } /* ************************************************************************** @@ -1340,7 +1321,6 @@ static void arcmsr_iop2drv_data_wrote_ha } else { acb->acb_flags|=ACB_F_IOPDATA_OVERFLOW; } - return; } /* ************************************************************************** @@ -1383,7 +1363,6 @@ static void arcmsr_iop2drv_data_read_han if(acb->wqbuf_firstindex==acb->wqbuf_lastindex) { acb->acb_flags |= ACB_F_MESSAGE_WQBUFFER_CLEARED; } - return; } static void arcmsr_rescanLun_cb(struct cam_periph *periph, union ccb *ccb) @@ -1417,7 +1396,6 @@ static void arcmsr_rescan_lun(struct Ada ccb->ccb_h.cbfcnp = arcmsr_rescanLun_cb; ccb->crcn.flags = CAM_FLAG_NONE; xpt_action(ccb); - return; } @@ -1488,6 +1466,7 @@ static void arcmsr_dr_handle(struct Adap } break; } + if(acb->acb_flags & ACB_F_BUS_HANG_ON) { acb->acb_flags &= ~ACB_F_BUS_HANG_ON; @@ -1592,7 +1571,6 @@ static void arcmsr_hba_doorbell_isr(stru if(outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_READ_OK) { arcmsr_iop2drv_data_read_handle(acb); } - return; } /* ************************************************************************** @@ -1620,7 +1598,6 @@ static void arcmsr_hbc_doorbell_isr(stru if(outbound_doorbell & ARCMSR_HBCMU_IOP2DRV_MESSAGE_CMD_DONE) { arcmsr_hbc_message_isr(acb); /* messenger of "driver to iop commands" */ } - return; } /* ************************************************************************** @@ -1644,7 +1621,6 @@ static void arcmsr_hba_postqueue_isr(str error=(flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; arcmsr_drain_donequeue(acb, flag_srb, error); } /*drain reply FIFO*/ - return; } /* ************************************************************************** @@ -1674,7 +1650,6 @@ static void arcmsr_hbb_postqueue_isr(str error=(flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; arcmsr_drain_donequeue(acb, flag_srb, error); } /*drain reply FIFO*/ - return; } /* ************************************************************************** @@ -1704,7 +1679,6 @@ static void arcmsr_hbc_postqueue_isr(str } throttling++; } /*drain reply FIFO*/ - return; } /* ********************************************************************** @@ -1712,30 +1686,29 @@ static void arcmsr_hbc_postqueue_isr(str */ static void arcmsr_handle_hba_isr( struct AdapterControlBlock *acb) { - u_int32_t outbound_intstatus; + u_int32_t outbound_intStatus; /* ********************************************* ** check outbound intstatus ********************************************* */ - outbound_intstatus=CHIP_REG_READ32(HBA_MessageUnit, 0, outbound_intstatus) & acb->outbound_int_enable; - if(!outbound_intstatus) { + outbound_intStatus=CHIP_REG_READ32(HBA_MessageUnit, 0, outbound_intstatus) & acb->outbound_int_enable; + if(!outbound_intStatus) { /*it must be share irq*/ return; } - CHIP_REG_WRITE32(HBA_MessageUnit, 0, outbound_intstatus, outbound_intstatus);/*clear interrupt*/ + CHIP_REG_WRITE32(HBA_MessageUnit, 0, outbound_intstatus, outbound_intStatus);/*clear interrupt*/ /* MU doorbell interrupts*/ - if(outbound_intstatus & ARCMSR_MU_OUTBOUND_DOORBELL_INT) { + if(outbound_intStatus & ARCMSR_MU_OUTBOUND_DOORBELL_INT) { arcmsr_hba_doorbell_isr(acb); } /* MU post queue interrupts*/ - if(outbound_intstatus & ARCMSR_MU_OUTBOUND_POSTQUEUE_INT) { + if(outbound_intStatus & ARCMSR_MU_OUTBOUND_POSTQUEUE_INT) { arcmsr_hba_postqueue_isr(acb); } - if(outbound_intstatus & ARCMSR_MU_OUTBOUND_MESSAGE0_INT) { + if(outbound_intStatus & ARCMSR_MU_OUTBOUND_MESSAGE0_INT) { arcmsr_hba_message_isr(acb); } - return; } /* ********************************************************************** @@ -1771,7 +1744,6 @@ static void arcmsr_handle_hbb_isr( struc if(outbound_doorbell & ARCMSR_IOP2DRV_MESSAGE_CMD_DONE) { arcmsr_hbb_message_isr(acb); } - return; } /* ********************************************************************** @@ -1798,7 +1770,6 @@ static void arcmsr_handle_hbc_isr( struc if(host_interrupt_status & ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR) { arcmsr_hbc_postqueue_isr(acb); } - return; } /* ****************************************************************************** @@ -1821,7 +1792,6 @@ static void arcmsr_interrupt(struct Adap " unknow adapter type =%d\n", acb->pci_unit, acb->adapter_type); break; } - return; } /* ********************************************************************** @@ -1844,7 +1814,7 @@ static void arcmsr_polling_devmap(void* struct AdapterControlBlock *acb = (struct AdapterControlBlock *)arg; switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_A: - CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); + CHIP_REG_WRITE32(HBA_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); break; case ACB_ADAPTER_TYPE_B: @@ -2065,7 +2035,7 @@ u_int32_t arcmsr_iop_ioctlcmd(struct Ada break; } ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); - return retvalue; + return (retvalue); } /* ************************************************************************** @@ -2191,7 +2161,7 @@ static int arcmsr_iop_message_xfer(struc if (wqbuf_lastindex != wqbuf_firstindex) { arcmsr_post_ioctldata2iop(acb); /* has error report sensedata */ - if(&pccb->csio.sense_data) { + if(pccb->csio.sense_len) { ((u_int8_t *)&pccb->csio.sense_data)[0] = (0x1 << 7 | 0x70); /* Valid,ErrorCode */ ((u_int8_t *)&pccb->csio.sense_data)[2] = 0x05; @@ -2221,7 +2191,7 @@ static int arcmsr_iop_message_xfer(struc } } else { /* has error report sensedata */ - if(&pccb->csio.sense_data) { + if(pccb->csio.sense_len) { ((u_int8_t *)&pccb->csio.sense_data)[0] = (0x1 << 7 | 0x70); /* Valid,ErrorCode */ ((u_int8_t *)&pccb->csio.sense_data)[2] = 0x05; @@ -2312,7 +2282,7 @@ static int arcmsr_iop_message_xfer(struc retvalue = ARCMSR_MESSAGE_FAIL; } message_out: - return retvalue; + return (retvalue); } /* ********************************************************************* @@ -2375,7 +2345,7 @@ static void arcmsr_execute_srb(void *arg arcmsr_srb_complete(srb, 0); return; } - if(acb->srboutstandingcount >= ARCMSR_MAX_OUTSTANDING_CMD) { + if(acb->srboutstandingcount > ARCMSR_MAX_OUTSTANDING_CMD) { xpt_freeze_simq(acb->psim, 1); pccb->ccb_h.status = CAM_REQUEUE_REQ; acb->acb_flags |= ACB_F_CAM_DEV_QFRZN; @@ -2388,10 +2358,9 @@ static void arcmsr_execute_srb(void *arg if (pccb->ccb_h.timeout != CAM_TIME_INFINITY) { arcmsr_callout_init(&srb->ccb_callout); - callout_reset(&srb->ccb_callout, (pccb->ccb_h.timeout * hz ) / 1000, arcmsr_srb_timeout, srb); + callout_reset(&srb->ccb_callout, ((pccb->ccb_h.timeout + (ARCMSR_TIMEOUT_DELAY * 1000)) * hz) / 1000, arcmsr_srb_timeout, srb); srb->srb_flags |= SRB_FLAG_TIMER_START; } - return; } /* ***************************************************************************************** @@ -2455,7 +2424,6 @@ static void arcmsr_bus_reset(struct Adap } arcmsr_iop_reset(acb); acb->acb_flags &= ~ACB_F_BUS_RESET; - return; } /* ************************************************************************** @@ -2607,10 +2575,24 @@ static void arcmsr_action(struct cam_sim strncpy(cpi->dev_name, cam_sim_name(psim), DEV_IDLEN); cpi->unit_number=cam_sim_unit(psim); #ifdef CAM_NEW_TRAN_CODE - cpi->transport = XPORT_SPI; - cpi->transport_version = 2; + if(acb->adapter_bus_speed == ACB_BUS_SPEED_6G) + cpi->base_transfer_speed = 600000; + else + cpi->base_transfer_speed = 300000; + if((acb->vendor_device_id == PCIDevVenIDARC1880) || + (acb->vendor_device_id == PCIDevVenIDARC1680)) + { + cpi->transport = XPORT_SAS; + cpi->transport_version = 0; + cpi->protocol_version = SCSI_REV_SPC2; + } + else + { + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->protocol_version = SCSI_REV_2; + } cpi->protocol = PROTO_SCSI; - cpi->protocol_version = SCSI_REV_2; #endif cpi->ccb_h.status |= CAM_REQ_CMP; xpt_done(pccb); @@ -2674,28 +2656,46 @@ static void arcmsr_action(struct cam_sim { struct ccb_trans_settings_scsi *scsi; struct ccb_trans_settings_spi *spi; + struct ccb_trans_settings_sas *sas; scsi = &cts->proto_specific.scsi; - spi = &cts->xport_specific.spi; - cts->protocol = PROTO_SCSI; - cts->protocol_version = SCSI_REV_2; - cts->transport = XPORT_SPI; - cts->transport_version = 2; - spi->flags = CTS_SPI_FLAGS_DISC_ENB; - spi->sync_period=3; - spi->sync_offset=32; - spi->bus_width=MSG_EXT_WDTR_BUS_16_BIT; scsi->flags = CTS_SCSI_FLAGS_TAG_ENB; - spi->valid = CTS_SPI_VALID_DISC - | CTS_SPI_VALID_SYNC_RATE - | CTS_SPI_VALID_SYNC_OFFSET - | CTS_SPI_VALID_BUS_WIDTH; scsi->valid = CTS_SCSI_VALID_TQ; + cts->protocol = PROTO_SCSI; + + if((acb->vendor_device_id == PCIDevVenIDARC1880) || + (acb->vendor_device_id == PCIDevVenIDARC1680)) + { + cts->protocol_version = SCSI_REV_SPC2; + cts->transport_version = 0; + cts->transport = XPORT_SAS; + sas = &cts->xport_specific.sas; + sas->valid = CTS_SAS_VALID_SPEED; + if(acb->vendor_device_id == PCIDevVenIDARC1880) + sas->bitrate = 600000; + else if(acb->vendor_device_id == PCIDevVenIDARC1680) + sas->bitrate = 300000; + } + else + { + cts->protocol_version = SCSI_REV_2; + cts->transport_version = 2; + cts->transport = XPORT_SPI; + spi = &cts->xport_specific.spi; + spi->flags = CTS_SPI_FLAGS_DISC_ENB; + spi->sync_period=2; + spi->sync_offset=32; + spi->bus_width=MSG_EXT_WDTR_BUS_16_BIT; + spi->valid = CTS_SPI_VALID_DISC + | CTS_SPI_VALID_SYNC_RATE + | CTS_SPI_VALID_SYNC_OFFSET + | CTS_SPI_VALID_BUS_WIDTH; + } } #else { cts->flags=(CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB); - cts->sync_period=3; + cts->sync_period=2; cts->sync_offset=32; cts->bus_width=MSG_EXT_WDTR_BUS_16_BIT; cts->valid=CCB_TRANS_SYNC_RATE_VALID | @@ -2759,7 +2759,6 @@ static void arcmsr_action(struct cam_sim xpt_done(pccb); break; } - return; } /* ********************************************************************** @@ -2772,7 +2771,6 @@ static void arcmsr_start_hba_bgrb(struct if(!arcmsr_hba_wait_msgint_ready(acb)) { printf("arcmsr%d: wait 'start adapter background rebulid' timeout \n", acb->pci_unit); } - return; } /* ********************************************************************** @@ -2785,7 +2783,6 @@ static void arcmsr_start_hbb_bgrb(struct if(!arcmsr_hbb_wait_msgint_ready(acb)) { printf( "arcmsr%d: wait 'start adapter background rebulid' timeout \n", acb->pci_unit); } - return; } /* ********************************************************************** @@ -2799,7 +2796,6 @@ static void arcmsr_start_hbc_bgrb(struct if(!arcmsr_hbc_wait_msgint_ready(acb)) { printf("arcmsr%d: wait 'start adapter background rebulid' timeout \n", acb->pci_unit); } - return; } /* ********************************************************************** @@ -2818,7 +2814,6 @@ static void arcmsr_start_adapter_bgrb(st arcmsr_start_hbc_bgrb(acb); break; } - return; } /* ********************************************************************** @@ -2873,7 +2868,6 @@ polling_ccb_retry: } arcmsr_report_srb_state(acb, srb, error); } /*drain reply FIFO*/ - return; } /* ********************************************************************** @@ -2934,7 +2928,6 @@ polling_ccb_retry: } arcmsr_report_srb_state(acb, srb, error); } /*drain reply FIFO*/ - return; } /* ********************************************************************** @@ -2985,7 +2978,6 @@ polling_ccb_retry: } arcmsr_report_srb_state(acb, srb, error); } /*drain reply FIFO*/ - return; } /* ********************************************************************** @@ -3053,7 +3045,6 @@ static void arcmsr_get_hba_config(struct acb->firm_sdram_size=CHIP_REG_READ32(HBA_MessageUnit, 0, msgcode_rwbuffer[3]); /*firm_sdram_size, 3, 12-15*/ acb->firm_ide_channels=CHIP_REG_READ32(HBA_MessageUnit, 0, msgcode_rwbuffer[4]); /*firm_ide_channels, 4, 16-19*/ acb->firm_cfg_version=CHIP_REG_READ32(HBA_MessageUnit, 0, msgcode_rwbuffer[ARCMSR_FW_CFGVER_OFFSET]); /*firm_cfg_version, 25, */ - return; } /* ********************************************************************** @@ -3100,7 +3091,6 @@ static void arcmsr_get_hbb_config(struct acb->firm_sdram_size=CHIP_REG_READ32(HBB_RWBUFFER, 1, msgcode_rwbuffer[3]); /*firm_sdram_size, 3, 12-15*/ acb->firm_ide_channels=CHIP_REG_READ32(HBB_RWBUFFER, 1, msgcode_rwbuffer[4]); /*firm_ide_channels, 4, 16-19*/ acb->firm_cfg_version=CHIP_REG_READ32(HBB_RWBUFFER, 1, msgcode_rwbuffer[ARCMSR_FW_CFGVER_OFFSET]); /*firm_cfg_version, 25, */ - return; } /* ********************************************************************** @@ -3148,7 +3138,6 @@ static void arcmsr_get_hbc_config(struct acb->firm_sdram_size =CHIP_REG_READ32(HBC_MessageUnit, 0, msgcode_rwbuffer[3]); /*firm_sdram_size, 3, 12-15*/ acb->firm_ide_channels =CHIP_REG_READ32(HBC_MessageUnit, 0, msgcode_rwbuffer[4]); /*firm_ide_channels, 4, 16-19*/ acb->firm_cfg_version =CHIP_REG_READ32(HBC_MessageUnit, 0, msgcode_rwbuffer[ARCMSR_FW_CFGVER_OFFSET]); /*firm_cfg_version, 25, */ - return; } /* ********************************************************************** @@ -3170,7 +3159,6 @@ static void arcmsr_get_firmware_spec(str } break; } - return; } /* ********************************************************************** @@ -3219,7 +3207,6 @@ static void arcmsr_wait_firmware_ready( } break; } - return; } /* ********************************************************************** @@ -3253,7 +3240,6 @@ static void arcmsr_clear_doorbell_queue_ } break; } - return; } /* ************************************************************************ @@ -3336,7 +3322,7 @@ static u_int32_t arcmsr_iop_confirm(stru } break; } - return TRUE; + return (TRUE); } /* ************************************************************************ @@ -3359,7 +3345,6 @@ static void arcmsr_enable_eoi_mode(struc } break; } - return; } /* ********************************************************************** @@ -3382,7 +3367,6 @@ static void arcmsr_iop_init(struct Adapt /* enable outbound Post Queue, outbound doorbell Interrupt */ arcmsr_enable_allintr(acb, intmask_org); acb->acb_flags |=ACB_F_IOP_INITED; - return; } /* ********************************************************************** @@ -3414,7 +3398,6 @@ static void arcmsr_map_free_srb(void *ar srb_tmp = (struct CommandControlBlock *)((unsigned long)srb_tmp+SRB_SIZE); } acb->vir2phy_offset=(unsigned long)srb_tmp-(unsigned long)srb_phyaddr; - return; } /* ************************************************************************ @@ -3433,7 +3416,6 @@ static void arcmsr_free_resource(struct bus_dma_tag_destroy(acb->srb_dmat); bus_dma_tag_destroy(acb->dm_segs_dmat); bus_dma_tag_destroy(acb->parent_dmat); - return; } /* ************************************************************************ @@ -3444,16 +3426,24 @@ static u_int32_t arcmsr_initialize(devic struct AdapterControlBlock *acb=device_get_softc(dev); u_int16_t pci_command; int i, j,max_coherent_size; - - switch (pci_get_devid(dev)) { - case PCIDevVenIDARC1880: { + u_int32_t vendor_dev_id; + + vendor_dev_id = pci_get_devid(dev); + acb->vendor_device_id = vendor_dev_id; + switch (vendor_dev_id) { + case PCIDevVenIDARC1880: + case PCIDevVenIDARC1882: + case PCIDevVenIDARC1213: + case PCIDevVenIDARC1223: { acb->adapter_type=ACB_ADAPTER_TYPE_C; + acb->adapter_bus_speed = ACB_BUS_SPEED_6G; max_coherent_size=ARCMSR_SRBS_POOL_SIZE; } break; case PCIDevVenIDARC1200: case PCIDevVenIDARC1201: { acb->adapter_type=ACB_ADAPTER_TYPE_B; + acb->adapter_bus_speed = ACB_BUS_SPEED_3G; max_coherent_size=ARCMSR_SRBS_POOL_SIZE+(sizeof(struct HBB_MessageUnit)); } break; @@ -3477,6 +3467,7 @@ static u_int32_t arcmsr_initialize(devic case PCIDevVenIDARC1680: case PCIDevVenIDARC1681: { acb->adapter_type=ACB_ADAPTER_TYPE_A; + acb->adapter_bus_speed = ACB_BUS_SPEED_3G; max_coherent_size=ARCMSR_SRBS_POOL_SIZE; } break; @@ -3804,7 +3795,7 @@ static int arcmsr_attach(device_t dev) #endif arcmsr_callout_init(&acb->devmap_callout); callout_reset(&acb->devmap_callout, 60 * hz, arcmsr_polling_devmap, acb); - return 0; + return (0); } /* @@ -3851,6 +3842,9 @@ static int arcmsr_probe(device_t dev) type = "SAS 3G"; break; case PCIDevVenIDARC1880: + case PCIDevVenIDARC1882: + case PCIDevVenIDARC1213: + case PCIDevVenIDARC1223: type = "SAS 6G"; break; default: Modified: stable/8/sys/dev/arcmsr/arcmsr.h ============================================================================== --- stable/8/sys/dev/arcmsr/arcmsr.h Wed Sep 19 22:26:05 2012 (r240714) +++ stable/8/sys/dev/arcmsr/arcmsr.h Wed Sep 19 23:03:54 2012 (r240715) @@ -52,6 +52,7 @@ #define ARCMSR_MAX_ADAPTER 4 #define ARCMSR_RELEASE_SIMQ_LEVEL 230 #define ARCMSR_MAX_HBB_POSTQUEUE 264 /* (ARCMSR_MAX_OUTSTANDING_CMD+8) */ +#define ARCMSR_TIMEOUT_DELAY 60 /* in sec */ /* ********************************************************************* */ @@ -97,6 +98,13 @@ #define PCI_DEVICE_ID_ARECA_1681 0x1681 /* Device ID */ #define PCI_DEVICE_ID_ARECA_1880 0x1880 /* Device ID */ +#define ARECA_SUB_DEV_ID_1880 0x1880 /* Subsystem Device ID */ +#define ARECA_SUB_DEV_ID_1882 0x1882 /* Subsystem Device ID */ +#define ARECA_SUB_DEV_ID_1212 0x1212 /* Subsystem Device ID */ +#define ARECA_SUB_DEV_ID_1213 0x1213 /* Subsystem Device ID */ +#define ARECA_SUB_DEV_ID_1222 0x1222 /* Subsystem Device ID */ +#define ARECA_SUB_DEV_ID_1223 0x1223 /* Subsystem Device ID */ + #define PCIDevVenIDARC1110 0x111017D3 /* Vendor Device ID */ #define PCIDevVenIDARC1120 0x112017D3 /* Vendor Device ID */ #define PCIDevVenIDARC1130 0x113017D3 /* Vendor Device ID */ @@ -106,8 +114,10 @@ #define PCIDevVenIDARC1201 0x120117D3 /* Vendor Device ID */ #define PCIDevVenIDARC1210 0x121017D3 /* Vendor Device ID */ #define PCIDevVenIDARC1212 0x121217D3 /* Vendor Device ID */ +#define PCIDevVenIDARC1213 0x121317D3 /* Vendor Device ID */ #define PCIDevVenIDARC1220 0x122017D3 /* Vendor Device ID */ #define PCIDevVenIDARC1222 0x122217D3 /* Vendor Device ID */ +#define PCIDevVenIDARC1223 0x122317D3 /* Vendor Device ID */ #define PCIDevVenIDARC1230 0x123017D3 /* Vendor Device ID */ #define PCIDevVenIDARC1231 0x123117D3 /* Vendor Device ID */ #define PCIDevVenIDARC1260 0x126017D3 /* Vendor Device ID */ @@ -119,6 +129,7 @@ #define PCIDevVenIDARC1680 0x168017D3 /* Vendor Device ID */ #define PCIDevVenIDARC1681 0x168117D3 /* Vendor Device ID */ #define PCIDevVenIDARC1880 0x188017D3 /* Vendor Device ID */ +#define PCIDevVenIDARC1882 0x188217D3 /* Vendor Device ID */ #ifndef PCIR_BARS #define PCIR_BARS 0x10 @@ -830,6 +841,8 @@ struct AdapterControlBlock { u_int32_t pktRequestCount; u_int32_t pktReturnCount; #endif + u_int32_t vendor_device_id; + u_int32_t adapter_bus_speed; };/* HW_DEVICE_EXTENSION */ /* acb_flags */ #define ACB_F_SCSISTOPADAPTER 0x0001 @@ -848,6 +861,10 @@ struct AdapterControlBlock { /* devstate */ #define ARECA_RAID_GONE 0x55 #define ARECA_RAID_GOOD 0xaa +/* adapter_bus_speed */ +#define ACB_BUS_SPEED_3G 0 +#define ACB_BUS_SPEED_6G 1 +#define ACB_BUS_SPEED_12G 2 /* ********************************************************************* ** Message Unit structure *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"