mpt_cam.c (164837) | mpt_cam.c (164846) |
---|---|
1/*- 2 * FreeBSD/CAM specific routines for LSI '909 FC adapters. 3 * FreeBSD Version. 4 * 5 * Copyright (c) 2000, 2001 by Greg Ansley 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 80 unchanged lines hidden (view full) --- 89 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 90 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 91 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 92 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 93 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT 94 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 95 */ 96#include <sys/cdefs.h> | 1/*- 2 * FreeBSD/CAM specific routines for LSI '909 FC adapters. 3 * FreeBSD Version. 4 * 5 * Copyright (c) 2000, 2001 by Greg Ansley 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 80 unchanged lines hidden (view full) --- 89 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 90 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 91 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 92 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 93 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT 94 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 95 */ 96#include <sys/cdefs.h> |
97__FBSDID("$FreeBSD: head/sys/dev/mpt/mpt_cam.c 164837 2006-12-03 00:28:11Z mjacob $"); | 97__FBSDID("$FreeBSD: head/sys/dev/mpt/mpt_cam.c 164846 2006-12-03 07:59:12Z mjacob $"); |
98 99#include <dev/mpt/mpt.h> 100#include <dev/mpt/mpt_cam.h> 101#include <dev/mpt/mpt_raid.h> 102 103#include "dev/mpt/mpilib/mpi_ioc.h" /* XXX Fix Event Handling!!! */ 104#include "dev/mpt/mpilib/mpi_init.h" 105#include "dev/mpt/mpilib/mpi_targ.h" --- 549 unchanged lines hidden (view full) --- 655 * along. 656 */ 657 658 rv = mpt_read_cur_cfg_page(mpt, 0, &mpt->mpt_port_page0.Header, 659 sizeof(mpt->mpt_port_page0), FALSE, 5000); 660 if (rv) { 661 mpt_prt(mpt, "failed to read SPI Port Page 0\n"); 662 } else { | 98 99#include <dev/mpt/mpt.h> 100#include <dev/mpt/mpt_cam.h> 101#include <dev/mpt/mpt_raid.h> 102 103#include "dev/mpt/mpilib/mpi_ioc.h" /* XXX Fix Event Handling!!! */ 104#include "dev/mpt/mpilib/mpi_init.h" 105#include "dev/mpt/mpilib/mpi_targ.h" --- 549 unchanged lines hidden (view full) --- 655 * along. 656 */ 657 658 rv = mpt_read_cur_cfg_page(mpt, 0, &mpt->mpt_port_page0.Header, 659 sizeof(mpt->mpt_port_page0), FALSE, 5000); 660 if (rv) { 661 mpt_prt(mpt, "failed to read SPI Port Page 0\n"); 662 } else { |
663 mpt_lprt(mpt, MPT_PRT_DEBUG, | 663 mpt_lprt(mpt, MPT_PRT_NEGOTIATION, |
664 "SPI Port Page 0: Capabilities %x PhysicalInterface %x\n", 665 mpt->mpt_port_page0.Capabilities, 666 mpt->mpt_port_page0.PhysicalInterface); 667 } 668 669 rv = mpt_read_cur_cfg_page(mpt, 0, &mpt->mpt_port_page1.Header, 670 sizeof(mpt->mpt_port_page1), FALSE, 5000); 671 if (rv) { --- 2613 unchanged lines hidden (view full) --- 3285} 3286 3287static int 3288mpt_get_spi_settings(struct mpt_softc *mpt, struct ccb_trans_settings *cts) 3289{ 3290 struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi; 3291 struct ccb_trans_settings_spi *spi = &cts->xport_specific.spi; 3292 target_id_t tgt; | 664 "SPI Port Page 0: Capabilities %x PhysicalInterface %x\n", 665 mpt->mpt_port_page0.Capabilities, 666 mpt->mpt_port_page0.PhysicalInterface); 667 } 668 669 rv = mpt_read_cur_cfg_page(mpt, 0, &mpt->mpt_port_page1.Header, 670 sizeof(mpt->mpt_port_page1), FALSE, 5000); 671 if (rv) { --- 2613 unchanged lines hidden (view full) --- 3285} 3286 3287static int 3288mpt_get_spi_settings(struct mpt_softc *mpt, struct ccb_trans_settings *cts) 3289{ 3290 struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi; 3291 struct ccb_trans_settings_spi *spi = &cts->xport_specific.spi; 3292 target_id_t tgt; |
3293 uint8_t dval, pval, oval; | 3293 uint32_t dval, pval, oval; |
3294 int rv; 3295 3296 cts->protocol = PROTO_SCSI; 3297 cts->protocol_version = SCSI_REV_2; 3298 cts->transport = XPORT_SPI; 3299 cts->transport_version = 2; 3300 3301 if (cts->type == CTS_TYPE_USER_SETTINGS) { --- 41 unchanged lines hidden (view full) --- 3343 oval = tmp.NegotiatedParameters; 3344 oval &= MPI_SCSIDEVPAGE0_NP_NEG_SYNC_OFFSET_MASK; 3345 oval >>= MPI_SCSIDEVPAGE0_NP_SHIFT_SYNC_OFFSET; 3346 pval = tmp.NegotiatedParameters; 3347 pval &= MPI_SCSIDEVPAGE0_NP_NEG_SYNC_PERIOD_MASK; 3348 pval >>= MPI_SCSIDEVPAGE0_NP_SHIFT_SYNC_PERIOD; 3349 mpt->mpt_dev_page0[tgt] = tmp; 3350 } else { | 3294 int rv; 3295 3296 cts->protocol = PROTO_SCSI; 3297 cts->protocol_version = SCSI_REV_2; 3298 cts->transport = XPORT_SPI; 3299 cts->transport_version = 2; 3300 3301 if (cts->type == CTS_TYPE_USER_SETTINGS) { --- 41 unchanged lines hidden (view full) --- 3343 oval = tmp.NegotiatedParameters; 3344 oval &= MPI_SCSIDEVPAGE0_NP_NEG_SYNC_OFFSET_MASK; 3345 oval >>= MPI_SCSIDEVPAGE0_NP_SHIFT_SYNC_OFFSET; 3346 pval = tmp.NegotiatedParameters; 3347 pval &= MPI_SCSIDEVPAGE0_NP_NEG_SYNC_PERIOD_MASK; 3348 pval >>= MPI_SCSIDEVPAGE0_NP_SHIFT_SYNC_PERIOD; 3349 mpt->mpt_dev_page0[tgt] = tmp; 3350 } else { |
3351 dval = DP_WIDE|DP_DISC_ENABLE|DP_TQING_ENABLE; | 3351 dval = DP_WIDE|DP_DISC_ENABLE|DP_TQING_ENABLE|DP_SYNC; |
3352 oval = mpt->mpt_port_page0.Capabilities; 3353 oval = MPI_SCSIPORTPAGE0_CAP_GET_MAX_SYNC_OFFSET(oval); 3354 pval = mpt->mpt_port_page0.Capabilities; 3355 pval = MPI_SCSIPORTPAGE0_CAP_GET_MIN_SYNC_PERIOD(pval); 3356 } 3357 3358 spi->valid = 0; 3359 scsi->valid = 0; 3360 spi->flags = 0; 3361 scsi->flags = 0; | 3352 oval = mpt->mpt_port_page0.Capabilities; 3353 oval = MPI_SCSIPORTPAGE0_CAP_GET_MAX_SYNC_OFFSET(oval); 3354 pval = mpt->mpt_port_page0.Capabilities; 3355 pval = MPI_SCSIPORTPAGE0_CAP_GET_MIN_SYNC_PERIOD(pval); 3356 } 3357 3358 spi->valid = 0; 3359 scsi->valid = 0; 3360 spi->flags = 0; 3361 scsi->flags = 0; |
3362 if (dval & DP_DISC_ENABLE) { 3363 spi->flags |= CTS_SPI_FLAGS_DISC_ENB; 3364 } 3365 if (oval) { 3366 spi->sync_offset = oval; 3367 spi->valid |= CTS_SPI_VALID_SYNC_OFFSET; 3368 } 3369 if (pval) { 3370 spi->sync_period = pval; 3371 spi->valid |= CTS_SPI_VALID_SYNC_RATE; 3372 } | 3362 spi->sync_offset = oval; 3363 spi->sync_period = pval; 3364 spi->valid |= CTS_SPI_VALID_SYNC_OFFSET; 3365 spi->valid |= CTS_SPI_VALID_SYNC_RATE; |
3373 spi->valid |= CTS_SPI_VALID_BUS_WIDTH; 3374 if (dval & DP_WIDE) { 3375 spi->bus_width = MSG_EXT_WDTR_BUS_16_BIT; 3376 } else { 3377 spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT; 3378 } | 3366 spi->valid |= CTS_SPI_VALID_BUS_WIDTH; 3367 if (dval & DP_WIDE) { 3368 spi->bus_width = MSG_EXT_WDTR_BUS_16_BIT; 3369 } else { 3370 spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT; 3371 } |
3379 if (dval & DP_TQING_ENABLE) { 3380 scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB; 3381 } | |
3382 if (cts->ccb_h.target_lun != CAM_LUN_WILDCARD) { 3383 scsi->valid = CTS_SCSI_VALID_TQ; | 3372 if (cts->ccb_h.target_lun != CAM_LUN_WILDCARD) { 3373 scsi->valid = CTS_SCSI_VALID_TQ; |
3374 if (dval & DP_TQING_ENABLE) { 3375 scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB; 3376 } |
|
3384 spi->valid |= CTS_SPI_VALID_DISC; | 3377 spi->valid |= CTS_SPI_VALID_DISC; |
3385 } else { 3386 scsi->valid = 0; | 3378 if (dval & DP_DISC_ENABLE) { 3379 spi->flags |= CTS_SPI_FLAGS_DISC_ENB; 3380 } |
3387 } 3388 mpt_lprt(mpt, MPT_PRT_NEGOTIATION, | 3381 } 3382 mpt_lprt(mpt, MPT_PRT_NEGOTIATION, |
3389 "mpt_get_spi_settings[%d]:%s per=%x off=%d SPF=%x SPV=%x SCF=%x SCV" 3390 "=%x bw=%x\n", 3391 tgt, IS_CURRENT_SETTINGS(cts)? "ACTIVE" : "NVRAM ", pval, oval, 3392 spi->flags, spi->valid, scsi->flags, scsi->valid, spi->bus_width); | 3383 "mpt_get_spi_settings[%d]: %s flags 0x%x per 0x%x off=%d\n", tgt, 3384 IS_CURRENT_SETTINGS(cts)? "ACTIVE" : "NVRAM ", dval, pval, oval); |
3393 return (0); 3394} 3395 3396static void 3397mpt_setwidth(struct mpt_softc *mpt, int tgt, int onoff) 3398{ 3399 PTR_CONFIG_PAGE_SCSI_DEVICE_1 ptr; 3400 --- 1691 unchanged lines hidden --- | 3385 return (0); 3386} 3387 3388static void 3389mpt_setwidth(struct mpt_softc *mpt, int tgt, int onoff) 3390{ 3391 PTR_CONFIG_PAGE_SCSI_DEVICE_1 ptr; 3392 --- 1691 unchanged lines hidden --- |