View | Details | Raw Unified | Return to bug 209468 | Differences between
and this patch

Collapse All | Expand All

(-)new/aacraid/aacraid.c (-61 / +93 lines)
Lines 261-267 Link Here
261
	/*
261
	/*
262
	 * Check that the firmware on the card is supported.
262
	 * Check that the firmware on the card is supported.
263
	 */
263
	 */
264
	sc->msi_enabled = FALSE;
264
	sc->msi_enabled = sc->msi_tupelo = FALSE;
265
	if ((error = aac_check_firmware(sc)) != 0)
265
	if ((error = aac_check_firmware(sc)) != 0)
266
		return(error);
266
		return(error);
267
267
Lines 281-288 Link Here
281
	 */
281
	 */
282
	if ((error = aac_alloc(sc)) != 0)
282
	if ((error = aac_alloc(sc)) != 0)
283
		return(error);
283
		return(error);
284
	aac_define_int_mode(sc);
284
	if (!(sc->flags & AAC_FLAGS_SYNC_MODE)) {
285
	if (!(sc->flags & AAC_FLAGS_SYNC_MODE)) {
285
		aac_define_int_mode(sc);
286
		if ((error = aac_init(sc)) != 0)
286
		if ((error = aac_init(sc)) != 0)
287
			return(error);
287
			return(error);
288
	}
288
	}
Lines 725-731 Link Here
725
		else
725
		else
726
			break;
726
			break;
727
	}
727
	}
728
	if (sc->msi_enabled)
728
	if (sc->msi_enabled || sc->msi_tupelo)
729
		pci_release_msi(sc->aac_dev);
729
		pci_release_msi(sc->aac_dev);
730
730
731
	/* destroy data-transfer DMA tag */
731
	/* destroy data-transfer DMA tag */
Lines 1313-1318 Link Here
1313
	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "nseg %d", nseg);
1313
	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "nseg %d", nseg);
1314
	mtx_assert(&sc->aac_io_lock, MA_OWNED);
1314
	mtx_assert(&sc->aac_io_lock, MA_OWNED);
1315
1315
1316
	if ((sc->flags & AAC_FLAGS_SYNC_MODE) && sc->aac_sync_cm)
1317
		return;
1318
1316
	/* copy into the FIB */
1319
	/* copy into the FIB */
1317
	if (cm->cm_sgtable != NULL) {
1320
	if (cm->cm_sgtable != NULL) {
1318
		if (fib->Header.Command == RawIo2) {
1321
		if (fib->Header.Command == RawIo2) {
Lines 1430-1440 Link Here
1430
1433
1431
	cm->cm_flags |= AAC_CMD_MAPPED;
1434
	cm->cm_flags |= AAC_CMD_MAPPED;
1432
1435
1433
	if (sc->flags & AAC_FLAGS_SYNC_MODE) {
1436
	if (cm->cm_flags & AAC_CMD_WAIT) {
1437
		aacraid_sync_command(sc, AAC_MONKER_SYNCFIB,
1438
			cm->cm_fibphys, 0, 0, 0, NULL, NULL);
1439
	} else if (sc->flags & AAC_FLAGS_SYNC_MODE) {
1434
		u_int32_t wait = 0;
1440
		u_int32_t wait = 0;
1435
		aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, cm->cm_fibphys, 0, 0, 0, &wait, NULL);
1441
		sc->aac_sync_cm = cm;
1436
	} else if (cm->cm_flags & AAC_CMD_WAIT) {
1442
		aacraid_sync_command(sc, AAC_MONKER_SYNCFIB,
1437
		aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, cm->cm_fibphys, 0, 0, 0, NULL, NULL);
1443
			cm->cm_fibphys, 0, 0, 0, &wait, NULL);
1438
	} else {
1444
	} else {
1439
		int count = 10000000L;
1445
		int count = 10000000L;
1440
		while (AAC_SEND_COMMAND(sc, cm) != 0) {
1446
		while (AAC_SEND_COMMAND(sc, cm) != 0) {
Lines 1614-1619 Link Here
1614
		options = AAC_GET_MAILBOX(sc, 1);
1620
		options = AAC_GET_MAILBOX(sc, 1);
1615
		atu_size = AAC_GET_MAILBOX(sc, 2);
1621
		atu_size = AAC_GET_MAILBOX(sc, 2);
1616
		sc->supported_options = options;
1622
		sc->supported_options = options;
1623
		sc->doorbell_mask = AAC_GET_MAILBOX(sc, 3);
1617
1624
1618
		if ((options & AAC_SUPPORTED_4GB_WINDOW) != 0 &&
1625
		if ((options & AAC_SUPPORTED_4GB_WINDOW) != 0 &&
1619
		    (sc->flags & AAC_FLAGS_NO4GB) == 0)
1626
		    (sc->flags & AAC_FLAGS_NO4GB) == 0)
Lines 1628-1640 Link Here
1628
			sc->flags |= AAC_FLAGS_SG_64BIT;
1635
			sc->flags |= AAC_FLAGS_SG_64BIT;
1629
		}
1636
		}
1630
		if (sc->aac_if.aif_send_command) {
1637
		if (sc->aac_if.aif_send_command) {
1631
			if ((options & AAC_SUPPORTED_NEW_COMM_TYPE3) ||
1638
			if (options & AAC_SUPPORTED_NEW_COMM_TYPE2)
1632
				(options & AAC_SUPPORTED_NEW_COMM_TYPE4))
1639
				sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE2;
1633
				sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE34;
1634
			else if (options & AAC_SUPPORTED_NEW_COMM_TYPE1)
1640
			else if (options & AAC_SUPPORTED_NEW_COMM_TYPE1)
1635
				sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE1;
1641
				sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE1;
1636
			else if (options & AAC_SUPPORTED_NEW_COMM_TYPE2)
1642
			else if ((options & AAC_SUPPORTED_NEW_COMM_TYPE3) ||
1637
				sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE2;
1643
				(options & AAC_SUPPORTED_NEW_COMM_TYPE4))
1644
				sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE34;
1638
		}
1645
		}
1639
		if (options & AAC_SUPPORTED_64BIT_ARRAYSIZE)
1646
		if (options & AAC_SUPPORTED_64BIT_ARRAYSIZE)
1640
			sc->flags |= AAC_FLAGS_ARRAY_64BIT;
1647
			sc->flags |= AAC_FLAGS_ARRAY_64BIT;
Lines 1848-1855 Link Here
1848
	
1855
	
1849
	dev = sc->aac_dev;
1856
	dev = sc->aac_dev;
1850
1857
1858
	if (sc->flags & AAC_FLAGS_SYNC_MODE) {
1859
		device_printf(dev, "using line interrupts\n");
1860
		sc->aac_max_msix = 1;
1861
		sc->aac_vector_cap = sc->aac_max_fibs;
1862
		return;
1863
	}
1864
1851
	/* max. vectors from AAC_MONKER_GETCOMMPREF */
1865
	/* max. vectors from AAC_MONKER_GETCOMMPREF */
1852
	if (sc->aac_max_msix == 0) {
1866
	if (sc->aac_max_msix == 0) {
1867
		if (sc->aac_hwif == AAC_HWIF_SRC) {
1868
			msi_count = 1;
1869
			if ((error = pci_alloc_msi(dev, &msi_count)) != 0) {
1870
					device_printf(dev, "alloc msi failed - err=%d; "
1871
				           "will use INTx\n", error);
1872
					pci_release_msi(dev);
1873
				} else {
1874
					sc->msi_tupelo = TRUE;
1875
				}
1876
		}
1877
		if (sc->msi_tupelo)
1878
			device_printf(dev, "using MSI interrupts\n");
1879
		else
1880
			device_printf(dev, "using line interrupts\n");
1881
			
1853
		sc->aac_max_msix = 1;
1882
		sc->aac_max_msix = 1;
1854
		sc->aac_vector_cap = sc->aac_max_fibs;
1883
		sc->aac_vector_cap = sc->aac_max_fibs;
1855
		return;
1884
		return;
Lines 1955-1961 Link Here
1955
	void *tag;
1984
	void *tag;
1956
1985
1957
	msi_count = sc->aac_max_msix;
1986
	msi_count = sc->aac_max_msix;
1958
	rid = (sc->msi_enabled ? 1:0);
1987
	rid = ((sc->msi_enabled || sc->msi_tupelo)? 1:0);
1959
1988
1960
	for (i = 0; i < msi_count; i++, rid++) {
1989
	for (i = 0; i < msi_count; i++, rid++) {
1961
		if ((res = bus_alloc_resource_any(sc->aac_dev,SYS_RES_IRQ, &rid,
1990
		if ((res = bus_alloc_resource_any(sc->aac_dev,SYS_RES_IRQ, &rid,
Lines 2852-2864 Link Here
2852
	fib = cm->cm_fib;
2881
	fib = cm->cm_fib;
2853
	srbcmd = (struct aac_srb *)fib->data;
2882
	srbcmd = (struct aac_srb *)fib->data;
2854
	if ((error = copyin((void *)&user_srb->data_len, &fibsize, 
2883
	if ((error = copyin((void *)&user_srb->data_len, &fibsize, 
2855
		sizeof (u_int32_t)) != 0)) 
2884
		sizeof (u_int32_t))) != 0) 
2856
		goto out;
2885
		goto out;
2857
	if (fibsize > (sc->aac_max_fib_size-sizeof(struct aac_fib_header))) {
2886
	if (fibsize > (sc->aac_max_fib_size-sizeof(struct aac_fib_header))) {
2858
		error = EINVAL;
2887
		error = EINVAL;
2859
		goto out;
2888
		goto out;
2860
	}
2889
	}
2861
	if ((error = copyin((void *)user_srb, srbcmd, fibsize) != 0)) 
2890
	if ((error = copyin((void *)user_srb, srbcmd, fibsize)) != 0)
2862
		goto out;
2891
		goto out;
2863
2892
2864
	srbcmd->function = 0;		/* SRBF_ExecuteScsi */
2893
	srbcmd->function = 0;		/* SRBF_ExecuteScsi */
Lines 2882-2894 Link Here
2882
			(struct aac_sg_entry64 *)srbcmd->sg_map.SgEntry;
2911
			(struct aac_sg_entry64 *)srbcmd->sg_map.SgEntry;
2883
		srb_sg_bytecount = sgp->SgByteCount;
2912
		srb_sg_bytecount = sgp->SgByteCount;
2884
		srb_sg_address = sgp->SgAddress;
2913
		srb_sg_address = sgp->SgAddress;
2885
		if (srb_sg_address > 0xffffffffull && 
2914
#else	
2886
			!(sc->flags & AAC_FLAGS_SG_64BIT))
2915
		error = EINVAL;
2887
#endif	
2916
		goto out;
2888
		{
2917
#endif
2889
			error = EINVAL;
2890
			goto out;
2891
		}
2892
	} else {
2918
	} else {
2893
		error = EINVAL;
2919
		error = EINVAL;
2894
		goto out;
2920
		goto out;
Lines 3676-3682 Link Here
3676
		caminf->TargetsPerBus = businfo.TargetsPerBus;
3702
		caminf->TargetsPerBus = businfo.TargetsPerBus;
3677
		caminf->BusNumber = i+1;
3703
		caminf->BusNumber = i+1;
3678
		caminf->BusType = PASSTHROUGH_BUS;
3704
		caminf->BusType = PASSTHROUGH_BUS;
3679
		caminf->InitiatorBusId = businfo.InitiatorBusId[i];
3705
		caminf->InitiatorBusId = -1;
3680
		caminf->aac_sc = sc;
3706
		caminf->aac_sc = sc;
3681
		caminf->sim_dev = child;
3707
		caminf->sim_dev = child;
3682
		caminf->aac_cam = NULL;
3708
		caminf->aac_cam = NULL;
Lines 3720-3726 Link Here
3720
	struct aac_fib *fib;
3746
	struct aac_fib *fib;
3721
	struct aac_pause_command *pc;
3747
	struct aac_pause_command *pc;
3722
	u_int32_t status, reset_mask, waitCount, max_msix_orig;
3748
	u_int32_t status, reset_mask, waitCount, max_msix_orig;
3723
	int msi_enabled_orig;
3749
	int ret, msi_enabled_orig;
3724
3750
3725
	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
3751
	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
3726
	mtx_assert(&sc->aac_io_lock, MA_OWNED);
3752
	mtx_assert(&sc->aac_io_lock, MA_OWNED);
Lines 3786-3828 Link Here
3786
			DELAY(100);			/* delay 100 microseconds */
3812
			DELAY(100);			/* delay 100 microseconds */
3787
			waitCount--;
3813
			waitCount--;
3788
		}
3814
		}
3789
	} else if ((aacraid_sync_command(sc, 
3815
	} else {
3790
		AAC_IOP_RESET_ALWAYS, 0, 0, 0, 0, &status, &reset_mask)) != 0) {
3816
		ret = aacraid_sync_command(sc, AAC_IOP_RESET_ALWAYS,
3791
		/* call IOP_RESET for older firmware */
3817
			0, 0, 0, 0, &status, &reset_mask);
3792
		if ((aacraid_sync_command(sc,
3818
		if (ret && !sc->doorbell_mask) {	
3793
			AAC_IOP_RESET, 0, 0, 0, 0, &status, NULL)) != 0) {
3819
			/* call IOP_RESET for older firmware */
3794
3820
			if ((aacraid_sync_command(sc, 
3795
			if (status == AAC_SRB_STS_INVALID_REQUEST)
3821
				AAC_IOP_RESET, 0,0,0,0, &status, NULL)) != 0) {
3796
				device_printf(sc->aac_dev, "IOP_RESET not supported\n");
3822
3797
			else
3823
				if (status == AAC_SRB_STS_INVALID_REQUEST)
3798
				/* probably timeout */
3824
					device_printf(sc->aac_dev, "IOP_RESET not supported\n");
3799
				device_printf(sc->aac_dev, "IOP_RESET failed\n");
3825
				else
3800
3826
					/* probably timeout */
3801
			/* unwind aac_shutdown() */
3827
					device_printf(sc->aac_dev, "IOP_RESET failed\n");
3802
			aac_alloc_sync_fib(sc, &fib);
3828
3803
			pc = (struct aac_pause_command *)&fib->data[0];
3829
				/* unwind aac_shutdown() */
3804
			pc->Command = VM_ContainerConfig;
3830
				aac_alloc_sync_fib(sc, &fib);
3805
			pc->Type = CT_PAUSE_IO;
3831
				pc = (struct aac_pause_command *)&fib->data[0];
3806
			pc->Timeout = 1;
3832
				pc->Command = VM_ContainerConfig;
3807
			pc->Min = 1;
3833
				pc->Type = CT_PAUSE_IO;
3808
			pc->NoRescan = 1;
3834
				pc->Timeout = 1;
3809
3835
				pc->Min = 1;
3810
			(void) aac_sync_fib(sc, ContainerCommand, 0, fib,
3836
				pc->NoRescan = 1;
3811
				sizeof (struct aac_pause_command));
3837
3812
			aac_release_sync_fib(sc);
3838
				(void) aac_sync_fib(sc, ContainerCommand, 0, fib,
3813
3839
					sizeof (struct aac_pause_command));
3814
			goto finish;
3840
				aac_release_sync_fib(sc);
3815
		}
3841
3816
	} else if (sc->aac_support_opt2 & AAC_SUPPORTED_DOORBELL_RESET) {
3842
				goto finish;
3817
		AAC_MEM0_SETREG4(sc, AAC_SRC_IDBR, reset_mask);
3843
			}		
3818
		/* 
3844
		} else if (sc->doorbell_mask) {
3819
		 * We need to wait for 5 seconds before accessing the doorbell
3845
			ret = 0;
3820
		 * again, 10000 * 100us = 1000,000us = 1000ms = 1s  
3846
			reset_mask = sc->doorbell_mask;
3821
		 */
3847
		}			
3822
		waitCount = 5 * 10000;
3848
		if (!ret && (sc->aac_support_opt2 & AAC_SUPPORTED_DOORBELL_RESET)) {
3823
		while (waitCount) {
3849
			AAC_MEM0_SETREG4(sc, AAC_SRC_IDBR, reset_mask);
3824
			DELAY(100);		/* delay 100 microseconds */
3850
			/* We need to wait for 5 seconds before accessing the doorbell again
3825
			waitCount--;
3851
			 * 10000 * 100us = 1000,000us = 1000ms = 1s  
3852
			 */
3853
			waitCount = 5 * 10000;
3854
			while (waitCount) {
3855
				DELAY(100);			/* delay 100 microseconds */
3856
				waitCount--;
3857
			}
3826
		}
3858
		}
3827
	}
3859
	}
3828
3860
(-)new/aacraid/aacraid_cam.c (-11 / +5 lines)
Lines 1015-1022 Link Here
1015
		cpi->version_num = 1;
1015
		cpi->version_num = 1;
1016
		cpi->target_sprt = 0;
1016
		cpi->target_sprt = 0;
1017
		cpi->hba_eng_cnt = 0;
1017
		cpi->hba_eng_cnt = 0;
1018
		cpi->max_target = camsc->inf->TargetsPerBus;
1018
		cpi->max_target = camsc->inf->TargetsPerBus - 1;
1019
		cpi->max_lun = 8;	/* Per the controller spec */
1019
		cpi->max_lun = 7;	/* Per the controller spec */
1020
		cpi->initiator_id = camsc->inf->InitiatorBusId;
1020
		cpi->initiator_id = camsc->inf->InitiatorBusId;
1021
		cpi->bus_id = camsc->inf->BusNumber;
1021
		cpi->bus_id = camsc->inf->BusNumber;
1022
#if __FreeBSD_version >= 800000
1022
#if __FreeBSD_version >= 800000
Lines 1389-1403 Link Here
1389
		 * Try to get a command that's been put off for lack of
1389
		 * Try to get a command that's been put off for lack of
1390
		 * resources
1390
		 * resources
1391
		 */
1391
		 */
1392
		if (sc->flags & AAC_FLAGS_SYNC_MODE) {
1392
		if ((sc->flags & AAC_FLAGS_SYNC_MODE) && sc->aac_sync_cm)
1393
			/* sync. transfer mode */
1393
			break;
1394
			if (sc->aac_sync_cm) 
1394
		cm = aac_dequeue_ready(sc);
1395
				break;
1396
			cm = aac_dequeue_ready(sc);
1397
			sc->aac_sync_cm = cm;
1398
		} else {
1399
			cm = aac_dequeue_ready(sc);
1400
		}
1401
1395
1402
		/* nothing to do? */
1396
		/* nothing to do? */
1403
		if (cm == NULL)
1397
		if (cm == NULL)
(-)new/aacraid/aacraid_pci.c (-3 / +1 lines)
Lines 111-122 Link Here
111
aac_find_ident(device_t dev)
111
aac_find_ident(device_t dev)
112
{
112
{
113
	struct aac_ident *m;
113
	struct aac_ident *m;
114
	u_int16_t vendid, devid, sub_vendid, sub_devid;
114
	u_int16_t vendid, devid;
115
115
116
	vendid = pci_get_vendor(dev);
116
	vendid = pci_get_vendor(dev);
117
	devid = pci_get_device(dev);
117
	devid = pci_get_device(dev);
118
	sub_vendid = pci_get_subvendor(dev);
119
	sub_devid = pci_get_subdevice(dev);
120
118
121
	for (m = aacraid_family_identifiers; m->vendor != 0; m++) {
119
	for (m = aacraid_family_identifiers; m->vendor != 0; m++) {
122
		if ((m->vendor == vendid) && (m->device == devid))
120
		if ((m->vendor == vendid) && (m->device == devid))
(-)new/aacraid/aacraid_reg.h (-1 / +1 lines)
Lines 40-46 Link Here
40
/*
40
/*
41
 * Misc. magic numbers.
41
 * Misc. magic numbers.
42
 */
42
 */
43
#define AAC_MAX_CONTAINERS	64
43
#define AAC_MAX_CONTAINERS	240
44
#define AAC_BLOCK_SIZE		512
44
#define AAC_BLOCK_SIZE		512
45
45
46
/*
46
/*
(-)new/aacraid/aacraid_var.h (-1 / +3 lines)
Lines 47-53 Link Here
47
47
48
#define	AAC_DRIVER_MAJOR_VERSION	3
48
#define	AAC_DRIVER_MAJOR_VERSION	3
49
#define	AAC_DRIVER_MINOR_VERSION	2
49
#define	AAC_DRIVER_MINOR_VERSION	2
50
#define	AAC_DRIVER_BUGFIX_LEVEL		5
50
#define	AAC_DRIVER_BUGFIX_LEVEL		10
51
#define	AAC_DRIVER_TYPE			AAC_TYPE_RELEASE
51
#define	AAC_DRIVER_TYPE			AAC_TYPE_RELEASE
52
52
53
#ifndef AAC_DRIVER_BUILD
53
#ifndef AAC_DRIVER_BUILD
Lines 479-487 Link Here
479
	u_int32_t	aac_feature_bits;		/* feature bits from suppl. info */
479
	u_int32_t	aac_feature_bits;		/* feature bits from suppl. info */
480
	u_int32_t	aac_support_opt2;		/* supp. options from suppl. info */
480
	u_int32_t	aac_support_opt2;		/* supp. options from suppl. info */
481
	u_int32_t	aac_max_aif;			/* max. AIF count */
481
	u_int32_t	aac_max_aif;			/* max. AIF count */
482
	u_int32_t	doorbell_mask;			/* for IOP reset */
482
	u_int32_t	aac_max_msix;			/* max. MSI-X vectors */
483
	u_int32_t	aac_max_msix;			/* max. MSI-X vectors */
483
	u_int32_t	aac_vector_cap;			/* MSI-X vector capab.*/
484
	u_int32_t	aac_vector_cap;			/* MSI-X vector capab.*/
484
	int		msi_enabled;			/* MSI/MSI-X enabled */
485
	int		msi_enabled;			/* MSI/MSI-X enabled */
486
	int		msi_tupelo;
485
#define AAC_CAM_TARGET_WILDCARD ~0
487
#define AAC_CAM_TARGET_WILDCARD ~0
486
	void			(*cam_rescan_cb)(struct aac_softc *, uint32_t,
488
	void			(*cam_rescan_cb)(struct aac_softc *, uint32_t,
487
				    uint32_t);
489
				    uint32_t);

Return to bug 209468