aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/isp
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2020-11-20 01:15:48 +0000
committerAlexander Motin <mav@FreeBSD.org>2020-11-20 01:15:48 +0000
commit1b760be482c53871fa36c7d8877923f35dbbce4c (patch)
treeb2aa561711574fd7cf44f75b788a5fca8ef74056 /sys/dev/isp
parentb33ba834704eed574b752e1f97a8fb075514ab78 (diff)
downloadsrc-1b760be482c53871fa36c7d8877923f35dbbce4c.tar.gz
src-1b760be482c53871fa36c7d8877923f35dbbce4c.zip
Remove parallel SCSI and 1/2Gb FC support from isp(4).
This removes 288KB (36%) of the driver code and zillions of hacks and workarounds, making single driver uniformly support several different generations of hardware interfaces, not counting minor card variations. After years of the hopeless fight, I don't think it worth to continue support for hardware obsolete for 15-20 years. Instead much cleaner now code should allow to move forward toward better locking, multiple queues and other cool features. All the remaining Qlogic cards starting from 4Gb 24xx to 32Gb 27xx use the same hardware/firmware interface with minor incremental improvements, so it seems to be a good new starting point. Except one PCI-X model all all of them are PCIe and so still usable in modern systems. Discussed with: ken, scottl, jpaetzel, imp Relnotes: yes
Notes
Notes: svn path=/head/; revision=367857
Diffstat (limited to 'sys/dev/isp')
-rw-r--r--sys/dev/isp/isp.c4825
-rw-r--r--sys/dev/isp/isp_freebsd.c1686
-rw-r--r--sys/dev/isp/isp_freebsd.h102
-rw-r--r--sys/dev/isp/isp_library.c1341
-rw-r--r--sys/dev/isp/isp_library.h42
-rw-r--r--sys/dev/isp/isp_pci.c981
-rw-r--r--sys/dev/isp/isp_target.c857
-rw-r--r--sys/dev/isp/ispmbox.h1026
-rw-r--r--sys/dev/isp/ispreg.h959
-rw-r--r--sys/dev/isp/ispvar.h188
10 files changed, 1487 insertions, 10520 deletions
diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c
index fe50aab77d43..8d9a3f19f1c4 100644
--- a/sys/dev/isp/isp.c
+++ b/sys/dev/isp/isp.c
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * Copyright (c) 2009-2018 Alexander Motin <mav@FreeBSD.org>
+ * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
*
@@ -98,21 +98,11 @@ static const uint8_t alpa_map[] = {
/*
* Local function prototypes.
*/
-static void isp_parse_async(ispsoftc_t *, uint16_t);
-static void isp_parse_async_fc(ispsoftc_t *, uint16_t);
static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t *);
-static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, uint32_t *);
static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, uint32_t *);
-static void isp_fastpost_complete(ispsoftc_t *, uint32_t);
-static void isp_scsi_init(ispsoftc_t *);
-static void isp_scsi_channel_init(ispsoftc_t *, int);
-static void isp_fibre_init(ispsoftc_t *);
-static void isp_fibre_init_2400(ispsoftc_t *);
static void isp_clear_portdb(ispsoftc_t *, int);
static void isp_mark_portdb(ispsoftc_t *, int);
static int isp_plogx(ispsoftc_t *, int, uint16_t, uint32_t, int);
-static int isp_port_login(ispsoftc_t *, uint16_t, uint32_t);
-static int isp_port_logout(ispsoftc_t *, uint16_t, uint32_t);
static int isp_getpdb(ispsoftc_t *, int, uint16_t, isp_pdb_t *);
static int isp_gethandles(ispsoftc_t *, int, uint16_t *, int *, int);
static void isp_dump_chip_portdb(ispsoftc_t *, int);
@@ -123,7 +113,6 @@ static int isp_scan_loop(ispsoftc_t *, int);
static int isp_gid_pt(ispsoftc_t *, int);
static int isp_scan_fabric(ispsoftc_t *, int);
static int isp_login_device(ispsoftc_t *, int, uint32_t, isp_pdb_t *, uint16_t *);
-static int isp_send_change_request(ispsoftc_t *, int);
static int isp_register_fc4_type(ispsoftc_t *, int);
static int isp_register_fc4_features_24xx(ispsoftc_t *, int);
static int isp_register_port_name_24xx(ispsoftc_t *, int);
@@ -132,17 +121,10 @@ static uint16_t isp_next_handle(ispsoftc_t *, uint16_t *);
static int isp_fw_state(ispsoftc_t *, int);
static void isp_mboxcmd(ispsoftc_t *, mbreg_t *);
-static void isp_spi_update(ispsoftc_t *, int);
-static void isp_setdfltsdparm(ispsoftc_t *);
static void isp_setdfltfcparm(ispsoftc_t *, int);
static int isp_read_nvram(ispsoftc_t *, int);
-static int isp_read_nvram_2400(ispsoftc_t *, uint8_t *);
-static void isp_rdnvram_word(ispsoftc_t *, int, uint16_t *);
+static int isp_read_nvram_2400(ispsoftc_t *);
static void isp_rd_2400_nvram(ispsoftc_t *, uint32_t, uint32_t *);
-static void isp_parse_nvram_1020(ispsoftc_t *, uint8_t *);
-static void isp_parse_nvram_1080(ispsoftc_t *, int, uint8_t *);
-static void isp_parse_nvram_12160(ispsoftc_t *, int, uint8_t *);
-static void isp_parse_nvram_2100(ispsoftc_t *, uint8_t *);
static void isp_parse_nvram_2400(ispsoftc_t *, uint8_t *);
static void
@@ -177,16 +159,6 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
const char *btype = "????";
static const char dcrc[] = "Downloaded RISC Code Checksum Failure";
- /*
- * Basic types (SCSI, FibreChannel and PCI or SBus)
- * have been set in the MD code. We figure out more
- * here. Possibly more refined types based upon PCI
- * identification. Chip revision has been gathered.
- *
- * After we've fired this chip up, zero out the conf1 register
- * for SCSI adapters and do other settings for the 2100.
- */
-
isp->isp_state = ISP_NILSTATE;
ISP_DISABLE_INTS(isp);
@@ -194,229 +166,25 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
* Put the board into PAUSE mode (so we can read the SXP registers
* or write FPM/FBM registers).
*/
- if (IS_24XX(isp)) {
- ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_HOST_INT);
- ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_RISC_INT);
- ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_PAUSE);
- } else {
- ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
- }
-
- if (IS_FC(isp)) {
- switch (isp->isp_type) {
- case ISP_HA_FC_2100:
- btype = "2100";
- break;
- case ISP_HA_FC_2200:
- btype = "2200";
- break;
- case ISP_HA_FC_2300:
- btype = "2300";
- break;
- case ISP_HA_FC_2312:
- btype = "2312";
- break;
- case ISP_HA_FC_2322:
- btype = "2322";
- break;
- case ISP_HA_FC_2400:
- btype = "2422";
- break;
- case ISP_HA_FC_2500:
- btype = "2532";
- break;
- case ISP_HA_FC_2600:
- btype = "2600";
- break;
- case ISP_HA_FC_2700:
- btype = "2700";
- break;
- default:
- break;
- }
-
- if (!IS_24XX(isp)) {
- /*
- * While we're paused, reset the FPM module and FBM
- * fifos.
- */
- ISP_WRITE(isp, BIU2100_CSR, BIU2100_FPM0_REGS);
- ISP_WRITE(isp, FPM_DIAG_CONFIG, FPM_SOFT_RESET);
- ISP_WRITE(isp, BIU2100_CSR, BIU2100_FB_REGS);
- ISP_WRITE(isp, FBM_CMD, FBMCMD_FIFO_RESET_ALL);
- ISP_WRITE(isp, BIU2100_CSR, BIU2100_RISC_REGS);
- }
- } else if (IS_1240(isp)) {
- sdparam *sdp;
-
- btype = "1240";
- isp->isp_clock = 60;
- sdp = SDPARAM(isp, 0);
- sdp->isp_ultramode = 1;
- sdp = SDPARAM(isp, 1);
- sdp->isp_ultramode = 1;
- /*
- * XXX: Should probably do some bus sensing.
- */
- } else if (IS_ULTRA3(isp)) {
- sdparam *sdp = isp->isp_param;
-
- isp->isp_clock = 100;
-
- if (IS_10160(isp))
- btype = "10160";
- else if (IS_12160(isp))
- btype = "12160";
- else
- btype = "<UNKLVD>";
- sdp->isp_lvdmode = 1;
-
- if (IS_DUALBUS(isp)) {
- sdp++;
- sdp->isp_lvdmode = 1;
- }
- } else if (IS_ULTRA2(isp)) {
- static const char m[] = "bus %d is in %s Mode";
- uint16_t l;
- sdparam *sdp = SDPARAM(isp, 0);
-
- isp->isp_clock = 100;
-
- if (IS_1280(isp))
- btype = "1280";
- else if (IS_1080(isp))
- btype = "1080";
- else
- btype = "<UNKLVD>";
-
- l = ISP_READ(isp, SXP_PINS_DIFF) & ISP1080_MODE_MASK;
- switch (l) {
- case ISP1080_LVD_MODE:
- sdp->isp_lvdmode = 1;
- isp_prt(isp, ISP_LOGCONFIG, m, 0, "LVD");
- break;
- case ISP1080_HVD_MODE:
- sdp->isp_diffmode = 1;
- isp_prt(isp, ISP_LOGCONFIG, m, 0, "Differential");
- break;
- case ISP1080_SE_MODE:
- sdp->isp_ultramode = 1;
- isp_prt(isp, ISP_LOGCONFIG, m, 0, "Single-Ended");
- break;
- default:
- isp_prt(isp, ISP_LOGERR,
- "unknown mode on bus %d (0x%x)", 0, l);
- break;
- }
-
- if (IS_DUALBUS(isp)) {
- sdp = SDPARAM(isp, 1);
- l = ISP_READ(isp, SXP_PINS_DIFF|SXP_BANK1_SELECT);
- l &= ISP1080_MODE_MASK;
- switch (l) {
- case ISP1080_LVD_MODE:
- sdp->isp_lvdmode = 1;
- isp_prt(isp, ISP_LOGCONFIG, m, 1, "LVD");
- break;
- case ISP1080_HVD_MODE:
- sdp->isp_diffmode = 1;
- isp_prt(isp, ISP_LOGCONFIG,
- m, 1, "Differential");
- break;
- case ISP1080_SE_MODE:
- sdp->isp_ultramode = 1;
- isp_prt(isp, ISP_LOGCONFIG,
- m, 1, "Single-Ended");
- break;
- default:
- isp_prt(isp, ISP_LOGERR,
- "unknown mode on bus %d (0x%x)", 1, l);
- break;
- }
- }
- } else {
- sdparam *sdp = SDPARAM(isp, 0);
- i = ISP_READ(isp, BIU_CONF0) & BIU_CONF0_HW_MASK;
- switch (i) {
- default:
- isp_prt(isp, ISP_LOGALL, "Unknown Chip Type 0x%x", i);
- /* FALLTHROUGH */
- case 1:
- btype = "1020";
- isp->isp_type = ISP_HA_SCSI_1020;
- isp->isp_clock = 40;
- break;
- case 2:
- /*
- * Some 1020A chips are Ultra Capable, but don't
- * run the clock rate up for that unless told to
- * do so by the Ultra Capable bits being set.
- */
- btype = "1020A";
- isp->isp_type = ISP_HA_SCSI_1020A;
- isp->isp_clock = 40;
- break;
- case 3:
- btype = "1040";
- isp->isp_type = ISP_HA_SCSI_1040;
- isp->isp_clock = 60;
- break;
- case 4:
- btype = "1040A";
- isp->isp_type = ISP_HA_SCSI_1040A;
- isp->isp_clock = 60;
- break;
- case 5:
- btype = "1040B";
- isp->isp_type = ISP_HA_SCSI_1040B;
- isp->isp_clock = 60;
- break;
- case 6:
- btype = "1040C";
- isp->isp_type = ISP_HA_SCSI_1040C;
- isp->isp_clock = 60;
- break;
- }
- /*
- * Now, while we're at it, gather info about ultra
- * and/or differential mode.
- */
- if (ISP_READ(isp, SXP_PINS_DIFF) & SXP_PINS_DIFF_MODE) {
- isp_prt(isp, ISP_LOGCONFIG, "Differential Mode");
- sdp->isp_diffmode = 1;
- } else {
- sdp->isp_diffmode = 0;
- }
- i = ISP_READ(isp, RISC_PSR);
- if (isp->isp_bustype == ISP_BT_SBUS) {
- i &= RISC_PSR_SBUS_ULTRA;
- } else {
- i &= RISC_PSR_PCI_ULTRA;
- }
- if (i != 0) {
- isp_prt(isp, ISP_LOGCONFIG, "Ultra Mode Capable");
- sdp->isp_ultramode = 1;
- /*
- * If we're in Ultra Mode, we have to be 60MHz clock-
- * even for the SBus version.
- */
- isp->isp_clock = 60;
- } else {
- sdp->isp_ultramode = 0;
- /*
- * Clock is known. Gronk.
- */
- }
+ ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_HOST_INT);
+ ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_RISC_INT);
+ ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_PAUSE);
- /*
- * Machine dependent clock (if set) overrides
- * our generic determinations.
- */
- if (isp->isp_mdvec->dv_clock) {
- if (isp->isp_mdvec->dv_clock < isp->isp_clock) {
- isp->isp_clock = isp->isp_mdvec->dv_clock;
- }
- }
+ switch (isp->isp_type) {
+ case ISP_HA_FC_2400:
+ btype = "2422";
+ break;
+ case ISP_HA_FC_2500:
+ btype = "2532";
+ break;
+ case ISP_HA_FC_2600:
+ btype = "2600";
+ break;
+ case ISP_HA_FC_2700:
+ btype = "2700";
+ break;
+ default:
+ break;
}
/*
@@ -424,68 +192,39 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
* and give it a chance to recover.
*/
- if (IS_SCSI(isp)) {
- ISP_WRITE(isp, BIU_ICR, BIU_ICR_SOFT_RESET);
- /*
- * A slight delay...
- */
- ISP_DELAY(100);
-
- /*
- * Clear data && control DMA engines.
- */
- ISP_WRITE(isp, CDMA_CONTROL, DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT);
- ISP_WRITE(isp, DDMA_CONTROL, DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT);
-
-
- } else if (IS_24XX(isp)) {
- /*
- * Stop DMA and wait for it to stop.
- */
- ISP_WRITE(isp, BIU2400_CSR, BIU2400_DMA_STOP|(3 << 4));
- for (val = loops = 0; loops < 30000; loops++) {
- ISP_DELAY(10);
- val = ISP_READ(isp, BIU2400_CSR);
- if ((val & BIU2400_DMA_ACTIVE) == 0) {
- break;
- }
- }
- if (val & BIU2400_DMA_ACTIVE) {
- isp_prt(isp, ISP_LOGERR, "DMA Failed to Stop on Reset");
- return;
- }
- /*
- * Hold it in SOFT_RESET and STOP state for 100us.
- */
- ISP_WRITE(isp, BIU2400_CSR, BIU2400_SOFT_RESET|BIU2400_DMA_STOP|(3 << 4));
- ISP_DELAY(100);
- for (loops = 0; loops < 10000; loops++) {
- ISP_DELAY(5);
- val = ISP_READ(isp, OUTMAILBOX0);
- }
- for (val = loops = 0; loops < 500000; loops ++) {
- val = ISP_READ(isp, BIU2400_CSR);
- if ((val & BIU2400_SOFT_RESET) == 0) {
- break;
- }
+ /*
+ * Stop DMA and wait for it to stop.
+ */
+ ISP_WRITE(isp, BIU2400_CSR, BIU2400_DMA_STOP|(3 << 4));
+ for (val = loops = 0; loops < 30000; loops++) {
+ ISP_DELAY(10);
+ val = ISP_READ(isp, BIU2400_CSR);
+ if ((val & BIU2400_DMA_ACTIVE) == 0) {
+ break;
}
- if (val & BIU2400_SOFT_RESET) {
- isp_prt(isp, ISP_LOGERR, "Failed to come out of reset");
- return;
+ }
+ if (val & BIU2400_DMA_ACTIVE) {
+ isp_prt(isp, ISP_LOGERR, "DMA Failed to Stop on Reset");
+ return;
+ }
+ /*
+ * Hold it in SOFT_RESET and STOP state for 100us.
+ */
+ ISP_WRITE(isp, BIU2400_CSR, BIU2400_SOFT_RESET|BIU2400_DMA_STOP|(3 << 4));
+ ISP_DELAY(100);
+ for (loops = 0; loops < 10000; loops++) {
+ ISP_DELAY(5);
+ val = ISP_READ(isp, OUTMAILBOX0);
+ }
+ for (val = loops = 0; loops < 500000; loops ++) {
+ val = ISP_READ(isp, BIU2400_CSR);
+ if ((val & BIU2400_SOFT_RESET) == 0) {
+ break;
}
- } else {
- ISP_WRITE(isp, BIU2100_CSR, BIU2100_SOFT_RESET);
- /*
- * A slight delay...
- */
- ISP_DELAY(100);
-
- /*
- * Clear data && control DMA engines.
- */
- ISP_WRITE(isp, CDMA2100_CONTROL, DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT);
- ISP_WRITE(isp, TDMA2100_CONTROL, DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT);
- ISP_WRITE(isp, RDMA2100_CONTROL, DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT);
+ }
+ if (val & BIU2400_SOFT_RESET) {
+ isp_prt(isp, ISP_LOGERR, "Failed to come out of reset");
+ return;
}
/*
@@ -493,18 +232,8 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
*/
loops = MBOX_DELAY_COUNT;
for (;;) {
- if (IS_SCSI(isp)) {
- if (!(ISP_READ(isp, BIU_ICR) & BIU_ICR_SOFT_RESET)) {
- break;
- }
- } else if (IS_24XX(isp)) {
- if (ISP_READ(isp, OUTMAILBOX0) == 0) {
- break;
- }
- } else {
- if (!(ISP_READ(isp, BIU2100_CSR) & BIU2100_SOFT_RESET))
- break;
- }
+ if (ISP_READ(isp, OUTMAILBOX0) == 0)
+ break;
ISP_DELAY(100);
if (--loops < 0) {
ISP_DUMPREGS(isp, "chip reset timed out");
@@ -513,136 +242,47 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
}
/*
- * After we've fired this chip up, zero out the conf1 register
- * for SCSI adapters and other settings for the 2100.
- */
-
- if (IS_SCSI(isp)) {
- ISP_WRITE(isp, BIU_CONF1, 0);
- } else if (!IS_24XX(isp)) {
- ISP_WRITE(isp, BIU2100_CSR, 0);
- }
-
- /*
* Reset RISC Processor
*/
- if (IS_24XX(isp)) {
- ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_RESET);
- ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_RELEASE);
- ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_RESET);
- } else {
- ISP_WRITE(isp, HCCR, HCCR_CMD_RESET);
- ISP_DELAY(100);
- ISP_WRITE(isp, BIU_SEMA, 0);
- }
+ ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_RESET);
+ ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_RELEASE);
+ ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_RESET);
/*
* Post-RISC Reset stuff.
*/
- if (IS_24XX(isp)) {
- for (val = loops = 0; loops < 5000000; loops++) {
- ISP_DELAY(5);
- val = ISP_READ(isp, OUTMAILBOX0);
- if (val == 0) {
- break;
- }
- }
- if (val != 0) {
- isp_prt(isp, ISP_LOGERR, "reset didn't clear");
- return;
- }
- } else if (IS_SCSI(isp)) {
- uint16_t tmp = isp->isp_mdvec->dv_conf1;
- /*
- * Busted FIFO. Turn off all but burst enables.
- */
- if (isp->isp_type == ISP_HA_SCSI_1040A) {
- tmp &= BIU_BURST_ENABLE;
- }
- ISP_SETBITS(isp, BIU_CONF1, tmp);
- if (tmp & BIU_BURST_ENABLE) {
- ISP_SETBITS(isp, CDMA_CONF, DMA_ENABLE_BURST);
- ISP_SETBITS(isp, DDMA_CONF, DMA_ENABLE_BURST);
- }
- if (SDPARAM(isp, 0)->isp_ptisp) {
- if (SDPARAM(isp, 0)->isp_ultramode) {
- while (ISP_READ(isp, RISC_MTR) != 0x1313) {
- ISP_WRITE(isp, RISC_MTR, 0x1313);
- ISP_WRITE(isp, HCCR, HCCR_CMD_STEP);
- }
- } else {
- ISP_WRITE(isp, RISC_MTR, 0x1212);
- }
- /*
- * PTI specific register
- */
- ISP_WRITE(isp, RISC_EMB, DUAL_BANK);
- } else {
- ISP_WRITE(isp, RISC_MTR, 0x1212);
- }
- ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
- } else {
- ISP_WRITE(isp, RISC_MTR2100, 0x1212);
- if (IS_2200(isp) || IS_23XX(isp)) {
- ISP_WRITE(isp, HCCR, HCCR_2X00_DISABLE_PARITY_PAUSE);
+ for (val = loops = 0; loops < 5000000; loops++) {
+ ISP_DELAY(5);
+ val = ISP_READ(isp, OUTMAILBOX0);
+ if (val == 0) {
+ break;
}
- ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
}
-
- /*
- * Set up default request/response queue in-pointer/out-pointer
- * register indices.
- */
- if (IS_24XX(isp)) {
- isp->isp_rqstinrp = BIU2400_REQINP;
- isp->isp_rqstoutrp = BIU2400_REQOUTP;
- isp->isp_respinrp = BIU2400_RSPINP;
- isp->isp_respoutrp = BIU2400_RSPOUTP;
- } else if (IS_23XX(isp)) {
- isp->isp_rqstinrp = BIU_REQINP;
- isp->isp_rqstoutrp = BIU_REQOUTP;
- isp->isp_respinrp = BIU_RSPINP;
- isp->isp_respoutrp = BIU_RSPOUTP;
- } else {
- isp->isp_rqstinrp = INMAILBOX4;
- isp->isp_rqstoutrp = OUTMAILBOX4;
- isp->isp_respinrp = OUTMAILBOX5;
- isp->isp_respoutrp = INMAILBOX5;
- }
- ISP_WRITE(isp, isp->isp_rqstinrp, 0);
- ISP_WRITE(isp, isp->isp_rqstoutrp, 0);
- ISP_WRITE(isp, isp->isp_respinrp, 0);
- ISP_WRITE(isp, isp->isp_respoutrp, 0);
- if (IS_24XX(isp)) {
- if (!IS_26XX(isp)) {
- ISP_WRITE(isp, BIU2400_PRI_REQINP, 0);
- ISP_WRITE(isp, BIU2400_PRI_REQOUTP, 0);
- }
- ISP_WRITE(isp, BIU2400_ATIO_RSPINP, 0);
- ISP_WRITE(isp, BIU2400_ATIO_RSPOUTP, 0);
+ if (val != 0) {
+ isp_prt(isp, ISP_LOGERR, "reset didn't clear");
+ return;
}
- if (!IS_24XX(isp) && isp->isp_bustype == ISP_BT_PCI) {
- /* Make sure the BIOS is disabled */
- ISP_WRITE(isp, HCCR, PCI_HCCR_CMD_BIOS);
+ ISP_WRITE(isp, BIU2400_REQINP, 0);
+ ISP_WRITE(isp, BIU2400_REQOUTP, 0);
+ ISP_WRITE(isp, BIU2400_RSPINP, 0);
+ ISP_WRITE(isp, BIU2400_RSPOUTP, 0);
+ if (!IS_26XX(isp)) {
+ ISP_WRITE(isp, BIU2400_PRI_REQINP, 0);
+ ISP_WRITE(isp, BIU2400_PRI_REQOUTP, 0);
}
+ ISP_WRITE(isp, BIU2400_ATIO_RSPINP, 0);
+ ISP_WRITE(isp, BIU2400_ATIO_RSPOUTP, 0);
/*
* Wait for everything to finish firing up.
- *
- * Avoid doing this on early 2312s because you can generate a PCI
- * parity error (chip breakage).
*/
- if (IS_2312(isp) && isp->isp_revision < 2) {
+ loops = MBOX_DELAY_COUNT;
+ while (ISP_READ(isp, OUTMAILBOX0) == MBOX_BUSY) {
ISP_DELAY(100);
- } else {
- loops = MBOX_DELAY_COUNT;
- while (ISP_READ(isp, OUTMAILBOX0) == MBOX_BUSY) {
- ISP_DELAY(100);
- if (--loops < 0) {
- isp_prt(isp, ISP_LOGERR, "MBOX_BUSY never cleared on reset");
- return;
- }
+ if (--loops < 0) {
+ isp_prt(isp, ISP_LOGERR, "MBOX_BUSY never cleared on reset");
+ return;
}
}
@@ -666,7 +306,7 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
/*
* Do some operational tests
*/
- if (IS_SCSI(isp) || IS_24XX(isp)) {
+ {
static const uint16_t patterns[MAX_MAILBOX] = {
0x0000, 0xdead, 0xbeef, 0xffff,
0xa5a5, 0x5a5a, 0x7f7f, 0x7ff7,
@@ -678,8 +318,6 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
0x0000, 0x0001, 0x1000, 0x1010,
};
int nmbox = ISP_NMBOX(isp);
- if (IS_SCSI(isp))
- nmbox = 6;
MBSINIT(&mbs, MBOX_MAILBOX_REG_TEST, MBLOGALL, 0);
for (i = 1; i < nmbox; i++) {
mbs.param[i] = patterns[i];
@@ -720,16 +358,9 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
}
}
- if (IS_24XX(isp)) {
- code_org = ISP_CODE_ORG_2400;
- } else if (IS_23XX(isp)) {
- code_org = ISP_CODE_ORG_2300;
- } else {
- code_org = ISP_CODE_ORG;
- }
-
+ code_org = ISP_CODE_ORG_2400;
isp->isp_loaded_fw = 0;
- if (dodnld && IS_24XX(isp)) {
+ if (dodnld) {
const uint32_t *ptr = isp->isp_mdvec->dv_ispfw;
uint32_t la, wi, wl;
@@ -737,9 +368,7 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
* Keep loading until we run out of f/w.
*/
code_org = ptr[2]; /* 1st load address is our start addr */
-
for (;;) {
-
isp_prt(isp, ISP_LOGDEBUG0, "load 0x%x words of code at load address 0x%x", ptr[3], ptr[2]);
wi = 0;
@@ -780,101 +409,6 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
ptr += ptr[3];
}
isp->isp_loaded_fw = 1;
- } else if (dodnld && IS_23XX(isp)) {
- const uint16_t *ptr = isp->isp_mdvec->dv_ispfw;
- uint16_t wi, wl, segno;
- uint32_t la;
-
- la = code_org;
- segno = 0;
-
- for (;;) {
- uint32_t nxtaddr;
-
- isp_prt(isp, ISP_LOGDEBUG0, "load 0x%x words of code at load address 0x%x", ptr[3], la);
-
- wi = 0;
- wl = ptr[3];
-
- while (wi < ptr[3]) {
- uint16_t *cp;
- uint16_t nw;
-
- nw = min(wl, min((1 << 15), ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)) / 2));
- cp = isp->isp_rquest;
- for (i = 0; i < nw; i++)
- ISP_IOXPUT_16(isp, ptr[wi + i], &cp[i]);
- MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)), -1);
- MBSINIT(&mbs, 0, MBLOGALL, 0);
- if (la < 0x10000) {
- mbs.param[0] = MBOX_LOAD_RISC_RAM_2100;
- mbs.param[1] = la;
- mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
- mbs.param[3] = DMA_WD0(isp->isp_rquest_dma);
- mbs.param[4] = nw;
- mbs.param[6] = DMA_WD3(isp->isp_rquest_dma);
- mbs.param[7] = DMA_WD2(isp->isp_rquest_dma);
- isp_prt(isp, ISP_LOGDEBUG1, "LOAD RISC RAM 2100 %u words at load address 0x%x\n", nw, la);
- } else {
- mbs.param[0] = MBOX_LOAD_RISC_RAM;
- mbs.param[1] = la;
- mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
- mbs.param[3] = DMA_WD0(isp->isp_rquest_dma);
- mbs.param[4] = nw;
- mbs.param[6] = DMA_WD3(isp->isp_rquest_dma);
- mbs.param[7] = DMA_WD2(isp->isp_rquest_dma);
- mbs.param[8] = la >> 16;
- isp_prt(isp, ISP_LOGDEBUG1, "LOAD RISC RAM %u words at load address 0x%x\n", nw, la);
- }
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- isp_prt(isp, ISP_LOGERR, "F/W download failed");
- return;
- }
- la += nw;
- wi += nw;
- wl -= nw;
- }
-
- if (!IS_2322(isp)) {
- break;
- }
-
- if (++segno == 3) {
- break;
- }
-
- /*
- * If we're a 2322, the firmware actually comes in
- * three chunks. We loaded the first at the code_org
- * address. The other two chunks, which follow right
- * after each other in memory here, get loaded at
- * addresses specfied at offset 0x9..0xB.
- */
-
- nxtaddr = ptr[3];
- ptr = &ptr[nxtaddr];
- la = ptr[5] | ((ptr[4] & 0x3f) << 16);
- }
- isp->isp_loaded_fw = 1;
- } else if (dodnld) {
- const uint16_t *ptr = isp->isp_mdvec->dv_ispfw;
- u_int i, wl;
-
- wl = ptr[3];
- isp_prt(isp, ISP_LOGDEBUG1,
- "WRITE RAM %u words at load address 0x%x", wl, code_org);
- for (i = 0; i < wl; i++) {
- MBSINIT(&mbs, MBOX_WRITE_RAM_WORD, MBLOGNONE, 0);
- mbs.param[1] = code_org + i;
- mbs.param[2] = ptr[i];
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- isp_prt(isp, ISP_LOGERR,
- "F/W download failed at word %d", i);
- return;
- }
- }
} else if (IS_26XX(isp)) {
isp_prt(isp, ISP_LOGDEBUG1, "loading firmware from flash");
MBSINIT(&mbs, MBOX_LOAD_FLASH_FIRMWARE, MBLOGALL, 5000000);
@@ -894,12 +428,8 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
*/
if (isp->isp_loaded_fw) {
MBSINIT(&mbs, MBOX_VERIFY_CHECKSUM, MBLOGNONE, 0);
- if (IS_24XX(isp)) {
- mbs.param[1] = code_org >> 16;
- mbs.param[2] = code_org;
- } else {
- mbs.param[1] = code_org;
- }
+ mbs.param[1] = code_org >> 16;
+ mbs.param[2] = code_org;
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
isp_prt(isp, ISP_LOGERR, dcrc);
@@ -917,42 +447,17 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
if (IS_26XX(isp)) {
mbs.param[1] = code_org >> 16;
mbs.param[2] = code_org;
- } else if (IS_24XX(isp)) {
+ } else {
mbs.param[1] = code_org >> 16;
mbs.param[2] = code_org;
- if (isp->isp_loaded_fw) {
+ if (isp->isp_loaded_fw)
mbs.param[3] = 0;
- } else {
+ else
mbs.param[3] = 1;
- }
- } else if (IS_2322(isp)) {
- mbs.param[1] = code_org;
- if (isp->isp_loaded_fw) {
- mbs.param[2] = 0;
- } else {
- mbs.param[2] = 1;
- }
- } else {
- mbs.param[1] = code_org;
}
isp_mboxcmd(isp, &mbs);
- if (IS_2322(isp) || IS_24XX(isp)) {
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
- }
-
- if (IS_SCSI(isp)) {
- /*
- * Set CLOCK RATE, but only if asked to.
- */
- if (isp->isp_clock) {
- MBSINIT(&mbs, MBOX_SET_CLOCK_RATE, MBLOGALL, 0);
- mbs.param[1] = isp->isp_clock;
- isp_mboxcmd(isp, &mbs);
- /* we will try not to care if this fails */
- }
- }
+ if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
+ return;
/*
* Ask the chip for the current firmware version.
@@ -964,211 +469,116 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
return;
}
- /*
- * The SBus firmware that we are using apparently does not return
- * major, minor, micro revisions in the mailbox registers, which
- * is really, really, annoying.
- */
- if (ISP_SBUS_SUPPORTED && isp->isp_bustype == ISP_BT_SBUS) {
- if (dodnld) {
-#ifdef ISP_TARGET_MODE
- isp->isp_fwrev[0] = 7;
- isp->isp_fwrev[1] = 55;
-#else
- isp->isp_fwrev[0] = 1;
- isp->isp_fwrev[1] = 37;
-#endif
- isp->isp_fwrev[2] = 0;
- }
- } else {
- isp->isp_fwrev[0] = mbs.param[1];
- isp->isp_fwrev[1] = mbs.param[2];
- isp->isp_fwrev[2] = mbs.param[3];
- }
-
- if (IS_FC(isp)) {
- /*
- * We do not believe firmware attributes for 2100 code less
- * than 1.17.0, unless it's the firmware we specifically
- * are loading.
- *
- * Note that all 22XX and later f/w is greater than 1.X.0.
- */
- if ((ISP_FW_OLDER_THAN(isp, 1, 17, 1))) {
-#ifdef USE_SMALLER_2100_FIRMWARE
- isp->isp_fwattr = ISP_FW_ATTR_SCCLUN;
-#else
- isp->isp_fwattr = 0;
-#endif
- } else {
- isp->isp_fwattr = mbs.param[6];
- }
- if (IS_24XX(isp)) {
- isp->isp_fwattr |= ((uint64_t) mbs.param[15]) << 16;
- if (isp->isp_fwattr & ISP2400_FW_ATTR_EXTNDED) {
- isp->isp_fwattr |=
- (((uint64_t) mbs.param[16]) << 32) |
- (((uint64_t) mbs.param[17]) << 48);
- }
- }
- } else {
- isp->isp_fwattr = 0;
+ isp->isp_fwrev[0] = mbs.param[1];
+ isp->isp_fwrev[1] = mbs.param[2];
+ isp->isp_fwrev[2] = mbs.param[3];
+ isp->isp_fwattr = mbs.param[6];
+ isp->isp_fwattr |= ((uint64_t) mbs.param[15]) << 16;
+ if (isp->isp_fwattr & ISP2400_FW_ATTR_EXTNDED) {
+ isp->isp_fwattr |=
+ (((uint64_t) mbs.param[16]) << 32) |
+ (((uint64_t) mbs.param[17]) << 48);
}
isp_prt(isp, ISP_LOGCONFIG, "Board Type %s, Chip Revision 0x%x, %s F/W Revision %d.%d.%d",
btype, isp->isp_revision, dodnld? "loaded" : "resident", isp->isp_fwrev[0], isp->isp_fwrev[1], isp->isp_fwrev[2]);
fwt = isp->isp_fwattr;
- if (IS_24XX(isp)) {
- buf = FCPARAM(isp, 0)->isp_scanscratch;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:");
- if (fwt & ISP2400_FW_ATTR_CLASS2) {
- fwt ^=ISP2400_FW_ATTR_CLASS2;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s Class2", buf);
- }
- if (fwt & ISP2400_FW_ATTR_IP) {
- fwt ^=ISP2400_FW_ATTR_IP;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s IP", buf);
- }
- if (fwt & ISP2400_FW_ATTR_MULTIID) {
- fwt ^=ISP2400_FW_ATTR_MULTIID;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s MultiID", buf);
- }
- if (fwt & ISP2400_FW_ATTR_SB2) {
- fwt ^=ISP2400_FW_ATTR_SB2;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s SB2", buf);
- }
- if (fwt & ISP2400_FW_ATTR_T10CRC) {
- fwt ^=ISP2400_FW_ATTR_T10CRC;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s T10CRC", buf);
- }
- if (fwt & ISP2400_FW_ATTR_VI) {
- fwt ^=ISP2400_FW_ATTR_VI;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VI", buf);
- }
- if (fwt & ISP2400_FW_ATTR_MQ) {
- fwt ^=ISP2400_FW_ATTR_MQ;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s MQ", buf);
- }
- if (fwt & ISP2400_FW_ATTR_MSIX) {
- fwt ^=ISP2400_FW_ATTR_MSIX;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s MSIX", buf);
- }
- if (fwt & ISP2400_FW_ATTR_FCOE) {
- fwt ^=ISP2400_FW_ATTR_FCOE;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s FCOE", buf);
- }
- if (fwt & ISP2400_FW_ATTR_VP0) {
- fwt ^= ISP2400_FW_ATTR_VP0;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VP0_Decoupling", buf);
- }
- if (fwt & ISP2400_FW_ATTR_EXPFW) {
- fwt ^= ISP2400_FW_ATTR_EXPFW;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (Experimental)", buf);
- }
- if (fwt & ISP2400_FW_ATTR_HOTFW) {
- fwt ^= ISP2400_FW_ATTR_HOTFW;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s HotFW", buf);
- }
- fwt &= ~ISP2400_FW_ATTR_EXTNDED;
- if (fwt & ISP2400_FW_ATTR_EXTVP) {
- fwt ^= ISP2400_FW_ATTR_EXTVP;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s ExtVP", buf);
- }
- if (fwt & ISP2400_FW_ATTR_VN2VN) {
- fwt ^= ISP2400_FW_ATTR_VN2VN;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VN2VN", buf);
- }
- if (fwt & ISP2400_FW_ATTR_EXMOFF) {
- fwt ^= ISP2400_FW_ATTR_EXMOFF;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s EXMOFF", buf);
- }
- if (fwt & ISP2400_FW_ATTR_NPMOFF) {
- fwt ^= ISP2400_FW_ATTR_NPMOFF;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s NPMOFF", buf);
- }
- if (fwt & ISP2400_FW_ATTR_DIFCHOP) {
- fwt ^= ISP2400_FW_ATTR_DIFCHOP;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s DIFCHOP", buf);
- }
- if (fwt & ISP2400_FW_ATTR_SRIOV) {
- fwt ^= ISP2400_FW_ATTR_SRIOV;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s SRIOV", buf);
- }
- if (fwt & ISP2400_FW_ATTR_ASICTMP) {
- fwt ^= ISP2400_FW_ATTR_ASICTMP;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s ASICTMP", buf);
- }
- if (fwt & ISP2400_FW_ATTR_ATIOMQ) {
- fwt ^= ISP2400_FW_ATTR_ATIOMQ;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s ATIOMQ", buf);
- }
- if (fwt) {
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (unknown 0x%08x%08x)", buf,
- (uint32_t) (fwt >> 32), (uint32_t) fwt);
- }
- isp_prt(isp, ISP_LOGCONFIG, "%s", buf);
- } else if (IS_FC(isp)) {
- buf = FCPARAM(isp, 0)->isp_scanscratch;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:");
- if (fwt & ISP_FW_ATTR_TMODE) {
- fwt ^=ISP_FW_ATTR_TMODE;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s TargetMode", buf);
- }
- if (fwt & ISP_FW_ATTR_SCCLUN) {
- fwt ^=ISP_FW_ATTR_SCCLUN;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s SCC-Lun", buf);
- }
- if (fwt & ISP_FW_ATTR_FABRIC) {
- fwt ^=ISP_FW_ATTR_FABRIC;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s Fabric", buf);
- }
- if (fwt & ISP_FW_ATTR_CLASS2) {
- fwt ^=ISP_FW_ATTR_CLASS2;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s Class2", buf);
- }
- if (fwt & ISP_FW_ATTR_FCTAPE) {
- fwt ^=ISP_FW_ATTR_FCTAPE;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s FC-Tape", buf);
- }
- if (fwt & ISP_FW_ATTR_IP) {
- fwt ^=ISP_FW_ATTR_IP;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s IP", buf);
- }
- if (fwt & ISP_FW_ATTR_VI) {
- fwt ^=ISP_FW_ATTR_VI;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VI", buf);
- }
- if (fwt & ISP_FW_ATTR_VI_SOLARIS) {
- fwt ^=ISP_FW_ATTR_VI_SOLARIS;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VI_SOLARIS", buf);
- }
- if (fwt & ISP_FW_ATTR_2KLOGINS) {
- fwt ^=ISP_FW_ATTR_2KLOGINS;
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s 2K-Login", buf);
- }
- if (fwt != 0) {
- ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (unknown 0x%08x%08x)", buf,
- (uint32_t) (fwt >> 32), (uint32_t) fwt);
- }
- isp_prt(isp, ISP_LOGCONFIG, "%s", buf);
+ buf = FCPARAM(isp, 0)->isp_scanscratch;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:");
+ if (fwt & ISP2400_FW_ATTR_CLASS2) {
+ fwt ^=ISP2400_FW_ATTR_CLASS2;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s Class2", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_IP) {
+ fwt ^=ISP2400_FW_ATTR_IP;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s IP", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_MULTIID) {
+ fwt ^=ISP2400_FW_ATTR_MULTIID;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s MultiID", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_SB2) {
+ fwt ^=ISP2400_FW_ATTR_SB2;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s SB2", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_T10CRC) {
+ fwt ^=ISP2400_FW_ATTR_T10CRC;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s T10CRC", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_VI) {
+ fwt ^=ISP2400_FW_ATTR_VI;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VI", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_MQ) {
+ fwt ^=ISP2400_FW_ATTR_MQ;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s MQ", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_MSIX) {
+ fwt ^=ISP2400_FW_ATTR_MSIX;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s MSIX", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_FCOE) {
+ fwt ^=ISP2400_FW_ATTR_FCOE;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s FCOE", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_VP0) {
+ fwt ^= ISP2400_FW_ATTR_VP0;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VP0_Decoupling", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_EXPFW) {
+ fwt ^= ISP2400_FW_ATTR_EXPFW;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (Experimental)", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_HOTFW) {
+ fwt ^= ISP2400_FW_ATTR_HOTFW;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s HotFW", buf);
+ }
+ fwt &= ~ISP2400_FW_ATTR_EXTNDED;
+ if (fwt & ISP2400_FW_ATTR_EXTVP) {
+ fwt ^= ISP2400_FW_ATTR_EXTVP;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s ExtVP", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_VN2VN) {
+ fwt ^= ISP2400_FW_ATTR_VN2VN;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VN2VN", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_EXMOFF) {
+ fwt ^= ISP2400_FW_ATTR_EXMOFF;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s EXMOFF", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_NPMOFF) {
+ fwt ^= ISP2400_FW_ATTR_NPMOFF;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s NPMOFF", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_DIFCHOP) {
+ fwt ^= ISP2400_FW_ATTR_DIFCHOP;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s DIFCHOP", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_SRIOV) {
+ fwt ^= ISP2400_FW_ATTR_SRIOV;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s SRIOV", buf);
}
+ if (fwt & ISP2400_FW_ATTR_ASICTMP) {
+ fwt ^= ISP2400_FW_ATTR_ASICTMP;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s ASICTMP", buf);
+ }
+ if (fwt & ISP2400_FW_ATTR_ATIOMQ) {
+ fwt ^= ISP2400_FW_ATTR_ATIOMQ;
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s ATIOMQ", buf);
+ }
+ if (fwt) {
+ ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (unknown 0x%08x%08x)", buf,
+ (uint32_t) (fwt >> 32), (uint32_t) fwt);
+ }
+ isp_prt(isp, ISP_LOGCONFIG, "%s", buf);
- if (IS_24XX(isp)) {
- MBSINIT(&mbs, MBOX_GET_RESOURCE_COUNT, MBLOGALL, 0);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
- isp->isp_maxcmds = mbs.param[3];
- } else {
- MBSINIT(&mbs, MBOX_GET_FIRMWARE_STATUS, MBLOGALL, 0);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
- isp->isp_maxcmds = mbs.param[2];
+ MBSINIT(&mbs, MBOX_GET_RESOURCE_COUNT, MBLOGALL, 0);
+ isp_mboxcmd(isp, &mbs);
+ if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+ return;
}
+ isp->isp_maxcmds = mbs.param[3];
isp_prt(isp, ISP_LOGCONFIG, "%d max I/O command limit set", isp->isp_maxcmds);
/*
@@ -1176,7 +586,7 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
* Only make this check for non-SCSI cards (I'm not sure firmware attributes
* work for them).
*/
- if (IS_FC(isp) && isp->isp_nchan > 1) {
+ if (isp->isp_nchan > 1) {
if (!ISP_CAP_MULTI_ID(isp)) {
isp_prt(isp, ISP_LOGWARN, "non-MULTIID f/w loaded, "
"only can enable 1 of %d channels", isp->isp_nchan);
@@ -1205,61 +615,19 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
}
ISP_ENABLE_INTS(isp);
- if (IS_FC(isp)) {
- for (i = 0; i < isp->isp_nchan; i++)
- isp_change_fw_state(isp, i, FW_CONFIG_WAIT);
- }
+ for (i = 0; i < isp->isp_nchan; i++)
+ isp_change_fw_state(isp, i, FW_CONFIG_WAIT);
isp->isp_state = ISP_RESETSTATE;
/*
- * Okay- now that we have new firmware running, we now (re)set our
- * notion of how many luns we support. This is somewhat tricky because
- * if we haven't loaded firmware, we sometimes do not have an easy way
- * of knowing how many luns we support.
- *
- * Expanded lun firmware gives you 32 luns for SCSI cards and
- * unlimited luns for Fibre Channel cards.
- *
- * It turns out that even for QLogic 2100s with ROM 1.10 and above
- * we do get a firmware attributes word returned in mailbox register 6.
- *
- * Because the lun is in a different position in the Request Queue
- * Entry structure for Fibre Channel with expanded lun firmware, we
- * can only support one lun (lun zero) when we don't know what kind
- * of firmware we're running.
- */
- if (IS_SCSI(isp)) {
- if (dodnld) {
- if (IS_ULTRA2(isp) || IS_ULTRA3(isp)) {
- isp->isp_maxluns = 32;
- } else {
- isp->isp_maxluns = 8;
- }
- } else {
- isp->isp_maxluns = 8;
- }
- } else {
- if (ISP_CAP_SCCFW(isp)) {
- isp->isp_maxluns = 0; /* No limit -- 2/8 bytes */
- } else {
- isp->isp_maxluns = 16;
- }
- }
-
- /*
* We get some default values established. As a side
* effect, NVRAM is read here (unless overriden by
* a configuration flag).
*/
if (do_load_defaults) {
- if (IS_SCSI(isp)) {
- isp_setdfltsdparm(isp);
- } else {
- for (i = 0; i < isp->isp_nchan; i++) {
- isp_setdfltfcparm(isp, i);
- }
- }
+ for (i = 0; i < isp->isp_nchan; i++)
+ isp_setdfltfcparm(isp, i);
}
}
@@ -1295,23 +663,8 @@ isp_shutdown(ispsoftc_t *isp)
if (isp->isp_state >= ISP_RESETSTATE)
isp_stop(isp);
ISP_DISABLE_INTS(isp);
- if (IS_FC(isp)) {
- if (IS_24XX(isp)) {
- ISP_WRITE(isp, BIU2400_ICR, 0);
- ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_PAUSE);
- } else {
- ISP_WRITE(isp, BIU_ICR, 0);
- ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
- ISP_WRITE(isp, BIU2100_CSR, BIU2100_FPM0_REGS);
- ISP_WRITE(isp, FPM_DIAG_CONFIG, FPM_SOFT_RESET);
- ISP_WRITE(isp, BIU2100_CSR, BIU2100_FB_REGS);
- ISP_WRITE(isp, FBM_CMD, FBMCMD_FIFO_RESET_ALL);
- ISP_WRITE(isp, BIU2100_CSR, BIU2100_RISC_REGS);
- }
- } else {
- ISP_WRITE(isp, BIU_ICR, 0);
- ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
- }
+ ISP_WRITE(isp, BIU2400_ICR, 0);
+ ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_PAUSE);
}
/*
@@ -1322,648 +675,6 @@ isp_shutdown(ispsoftc_t *isp)
void
isp_init(ispsoftc_t *isp)
{
- if (IS_FC(isp)) {
- if (IS_24XX(isp)) {
- isp_fibre_init_2400(isp);
- } else {
- isp_fibre_init(isp);
- }
- } else {
- isp_scsi_init(isp);
- }
-}
-
-static void
-isp_scsi_init(ispsoftc_t *isp)
-{
- sdparam *sdp_chan0, *sdp_chan1;
- mbreg_t mbs;
-
- isp->isp_state = ISP_INITSTATE;
-
- sdp_chan0 = SDPARAM(isp, 0);
- sdp_chan1 = sdp_chan0;
- if (IS_DUALBUS(isp)) {
- sdp_chan1 = SDPARAM(isp, 1);
- }
-
- /* First do overall per-card settings. */
-
- /*
- * If we have fast memory timing enabled, turn it on.
- */
- if (sdp_chan0->isp_fast_mttr) {
- ISP_WRITE(isp, RISC_MTR, 0x1313);
- }
-
- /*
- * Set Retry Delay and Count.
- * You set both channels at the same time.
- */
- MBSINIT(&mbs, MBOX_SET_RETRY_COUNT, MBLOGALL, 0);
- mbs.param[1] = sdp_chan0->isp_retry_count;
- mbs.param[2] = sdp_chan0->isp_retry_delay;
- mbs.param[6] = sdp_chan1->isp_retry_count;
- mbs.param[7] = sdp_chan1->isp_retry_delay;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
-
- /*
- * Set ASYNC DATA SETUP time. This is very important.
- */
- MBSINIT(&mbs, MBOX_SET_ASYNC_DATA_SETUP_TIME, MBLOGALL, 0);
- mbs.param[1] = sdp_chan0->isp_async_data_setup;
- mbs.param[2] = sdp_chan1->isp_async_data_setup;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
-
- /*
- * Set ACTIVE Negation State.
- */
- MBSINIT(&mbs, MBOX_SET_ACT_NEG_STATE, MBLOGNONE, 0);
- mbs.param[1] =
- (sdp_chan0->isp_req_ack_active_neg << 4) |
- (sdp_chan0->isp_data_line_active_neg << 5);
- mbs.param[2] =
- (sdp_chan1->isp_req_ack_active_neg << 4) |
- (sdp_chan1->isp_data_line_active_neg << 5);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- isp_prt(isp, ISP_LOGERR,
- "failed to set active negation state (%d,%d), (%d,%d)",
- sdp_chan0->isp_req_ack_active_neg,
- sdp_chan0->isp_data_line_active_neg,
- sdp_chan1->isp_req_ack_active_neg,
- sdp_chan1->isp_data_line_active_neg);
- /*
- * But don't return.
- */
- }
-
- /*
- * Set the Tag Aging limit
- */
- MBSINIT(&mbs, MBOX_SET_TAG_AGE_LIMIT, MBLOGALL, 0);
- mbs.param[1] = sdp_chan0->isp_tag_aging;
- mbs.param[2] = sdp_chan1->isp_tag_aging;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- isp_prt(isp, ISP_LOGERR, "failed to set tag age limit (%d,%d)",
- sdp_chan0->isp_tag_aging, sdp_chan1->isp_tag_aging);
- return;
- }
-
- /*
- * Set selection timeout.
- */
- MBSINIT(&mbs, MBOX_SET_SELECT_TIMEOUT, MBLOGALL, 0);
- mbs.param[1] = sdp_chan0->isp_selection_timeout;
- mbs.param[2] = sdp_chan1->isp_selection_timeout;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
-
- /* now do per-channel settings */
- isp_scsi_channel_init(isp, 0);
- if (IS_DUALBUS(isp))
- isp_scsi_channel_init(isp, 1);
-
- /*
- * Now enable request/response queues
- */
-
- if (IS_ULTRA2(isp) || IS_1240(isp)) {
- MBSINIT(&mbs, MBOX_INIT_RES_QUEUE_A64, MBLOGALL, 0);
- mbs.param[1] = RESULT_QUEUE_LEN(isp);
- mbs.param[2] = DMA_WD1(isp->isp_result_dma);
- mbs.param[3] = DMA_WD0(isp->isp_result_dma);
- mbs.param[4] = 0;
- mbs.param[6] = DMA_WD3(isp->isp_result_dma);
- mbs.param[7] = DMA_WD2(isp->isp_result_dma);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
- isp->isp_residx = isp->isp_resodx = mbs.param[5];
-
- MBSINIT(&mbs, MBOX_INIT_REQ_QUEUE_A64, MBLOGALL, 0);
- mbs.param[1] = RQUEST_QUEUE_LEN(isp);
- mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
- mbs.param[3] = DMA_WD0(isp->isp_rquest_dma);
- mbs.param[5] = 0;
- mbs.param[6] = DMA_WD3(isp->isp_result_dma);
- mbs.param[7] = DMA_WD2(isp->isp_result_dma);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
- isp->isp_reqidx = isp->isp_reqodx = mbs.param[4];
- } else {
- MBSINIT(&mbs, MBOX_INIT_RES_QUEUE, MBLOGALL, 0);
- mbs.param[1] = RESULT_QUEUE_LEN(isp);
- mbs.param[2] = DMA_WD1(isp->isp_result_dma);
- mbs.param[3] = DMA_WD0(isp->isp_result_dma);
- mbs.param[4] = 0;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
- isp->isp_residx = isp->isp_resodx = mbs.param[5];
-
- MBSINIT(&mbs, MBOX_INIT_REQ_QUEUE, MBLOGALL, 0);
- mbs.param[1] = RQUEST_QUEUE_LEN(isp);
- mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
- mbs.param[3] = DMA_WD0(isp->isp_rquest_dma);
- mbs.param[5] = 0;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
- isp->isp_reqidx = isp->isp_reqodx = mbs.param[4];
- }
-
- /*
- * Turn on LVD transitions for ULTRA2 or better and other features
- *
- * Now that we have 32 bit handles, don't do any fast posting
- * any more. For Ultra2/Ultra3 cards, we can turn on 32 bit RIO
- * operation or use fast posting. To be conservative, we'll only
- * do this for Ultra3 cards now because the other cards are so
- * rare for this author to find and test with.
- */
-
- MBSINIT(&mbs, MBOX_SET_FW_FEATURES, MBLOGALL, 0);
- if (IS_ULTRA2(isp))
- mbs.param[1] |= FW_FEATURE_LVD_NOTIFY;
-#ifdef ISP_NO_RIO
- if (IS_ULTRA3(isp))
- mbs.param[1] |= FW_FEATURE_FAST_POST;
-#else
- if (IS_ULTRA3(isp))
- mbs.param[1] |= FW_FEATURE_RIO_32BIT;
-#endif
- if (mbs.param[1] != 0) {
- uint16_t sfeat = mbs.param[1];
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
- isp_prt(isp, ISP_LOGINFO,
- "Enabled FW features (0x%x)", sfeat);
- }
- }
-
- isp->isp_state = ISP_RUNSTATE;
-}
-
-static void
-isp_scsi_channel_init(ispsoftc_t *isp, int chan)
-{
- sdparam *sdp;
- mbreg_t mbs;
- int tgt;
-
- sdp = SDPARAM(isp, chan);
-
- /*
- * Set (possibly new) Initiator ID.
- */
- MBSINIT(&mbs, MBOX_SET_INIT_SCSI_ID, MBLOGALL, 0);
- mbs.param[1] = (chan << 7) | sdp->isp_initiator_id;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
- isp_prt(isp, ISP_LOGINFO, "Chan %d Initiator ID is %d",
- chan, sdp->isp_initiator_id);
-
-
- /*
- * Set current per-target parameters to an initial safe minimum.
- */
- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
- int lun;
- uint16_t sdf;
-
- if (sdp->isp_devparam[tgt].dev_enable == 0) {
- continue;
- }
-#ifndef ISP_TARGET_MODE
- sdf = sdp->isp_devparam[tgt].goal_flags;
- sdf &= DPARM_SAFE_DFLT;
- /*
- * It is not quite clear when this changed over so that
- * we could force narrow and async for 1000/1020 cards,
- * but assume that this is only the case for loaded
- * firmware.
- */
- if (isp->isp_loaded_fw) {
- sdf |= DPARM_NARROW | DPARM_ASYNC;
- }
-#else
- /*
- * The !$*!)$!$)* f/w uses the same index into some
- * internal table to decide how to respond to negotiations,
- * so if we've said "let's be safe" for ID X, and ID X
- * selects *us*, the negotiations will back to 'safe'
- * (as in narrow/async). What the f/w *should* do is
- * use the initiator id settings to decide how to respond.
- */
- sdp->isp_devparam[tgt].goal_flags = sdf = DPARM_DEFAULT;
-#endif
- MBSINIT(&mbs, MBOX_SET_TARGET_PARAMS, MBLOGNONE, 0);
- mbs.param[1] = (chan << 15) | (tgt << 8);
- mbs.param[2] = sdf;
- if ((sdf & DPARM_SYNC) == 0) {
- mbs.param[3] = 0;
- } else {
- mbs.param[3] =
- (sdp->isp_devparam[tgt].goal_offset << 8) |
- (sdp->isp_devparam[tgt].goal_period);
- }
- isp_prt(isp, ISP_LOGDEBUG0, "Initial Settings bus%d tgt%d flags 0x%x off 0x%x per 0x%x",
- chan, tgt, mbs.param[2], mbs.param[3] >> 8, mbs.param[3] & 0xff);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- sdf = DPARM_SAFE_DFLT;
- MBSINIT(&mbs, MBOX_SET_TARGET_PARAMS, MBLOGALL, 0);
- mbs.param[1] = (tgt << 8) | (chan << 15);
- mbs.param[2] = sdf;
- mbs.param[3] = 0;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- continue;
- }
- }
-
- /*
- * We don't update any information directly from the f/w
- * because we need to run at least one command to cause a
- * new state to be latched up. So, we just assume that we
- * converge to the values we just had set.
- *
- * Ensure that we don't believe tagged queuing is enabled yet.
- * It turns out that sometimes the ISP just ignores our
- * attempts to set parameters for devices that it hasn't
- * seen yet.
- */
- sdp->isp_devparam[tgt].actv_flags = sdf & ~DPARM_TQING;
- for (lun = 0; lun < (int) isp->isp_maxluns; lun++) {
- MBSINIT(&mbs, MBOX_SET_DEV_QUEUE_PARAMS, MBLOGALL, 0);
- mbs.param[1] = (chan << 15) | (tgt << 8) | lun;
- mbs.param[2] = sdp->isp_max_queue_depth;
- mbs.param[3] = sdp->isp_devparam[tgt].exc_throttle;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- break;
- }
- }
- }
- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
- if (sdp->isp_devparam[tgt].dev_refresh) {
- sdp->sendmarker = 1;
- sdp->update = 1;
- break;
- }
- }
-}
-
-/*
- * Fibre Channel specific initialization.
- */
-static void
-isp_fibre_init(ispsoftc_t *isp)
-{
- fcparam *fcp;
- isp_icb_t local, *icbp = &local;
- mbreg_t mbs;
- int ownloopid;
-
- /*
- * We only support one channel on non-24XX cards
- */
- fcp = FCPARAM(isp, 0);
- if (fcp->role == ISP_ROLE_NONE)
- return;
-
- isp->isp_state = ISP_INITSTATE;
- ISP_MEMZERO(icbp, sizeof (*icbp));
- icbp->icb_version = ICB_VERSION1;
- icbp->icb_fwoptions = fcp->isp_fwoptions;
-
- /*
- * Firmware Options are either retrieved from NVRAM or
- * are patched elsewhere. We check them for sanity here
- * and make changes based on board revision, but otherwise
- * let others decide policy.
- */
-
- /*
- * If this is a 2100 < revision 5, we have to turn off FAIRNESS.
- */
- if (IS_2100(isp) && isp->isp_revision < 5) {
- icbp->icb_fwoptions &= ~ICBOPT_FAIRNESS;
- }
-
- /*
- * We have to use FULL LOGIN even though it resets the loop too much
- * because otherwise port database entries don't get updated after
- * a LIP- this is a known f/w bug for 2100 f/w less than 1.17.0.
- */
- if (!ISP_FW_NEWER_THAN(isp, 1, 17, 0)) {
- icbp->icb_fwoptions |= ICBOPT_FULL_LOGIN;
- }
-
- /*
- * Insist on Port Database Update Async notifications
- */
- icbp->icb_fwoptions |= ICBOPT_PDBCHANGE_AE;
-
- /*
- * Make sure that target role reflects into fwoptions.
- */
- if (fcp->role & ISP_ROLE_TARGET) {
- icbp->icb_fwoptions |= ICBOPT_TGT_ENABLE;
- } else {
- icbp->icb_fwoptions &= ~ICBOPT_TGT_ENABLE;
- }
-
- /*
- * For some reason my 2200 does not generate ATIOs in target mode
- * if initiator is disabled. Extra logins are better then target
- * not working at all.
- */
- if ((fcp->role & ISP_ROLE_INITIATOR) || IS_2100(isp) || IS_2200(isp)) {
- icbp->icb_fwoptions &= ~ICBOPT_INI_DISABLE;
- } else {
- icbp->icb_fwoptions |= ICBOPT_INI_DISABLE;
- }
-
- icbp->icb_maxfrmlen = DEFAULT_FRAMESIZE(isp);
- if (icbp->icb_maxfrmlen < ICB_MIN_FRMLEN || icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) {
- isp_prt(isp, ISP_LOGERR, "bad frame length (%d) from NVRAM- using %d", DEFAULT_FRAMESIZE(isp), ICB_DFLT_FRMLEN);
- icbp->icb_maxfrmlen = ICB_DFLT_FRMLEN;
- }
- icbp->icb_maxalloc = fcp->isp_maxalloc;
- if (icbp->icb_maxalloc < 1) {
- isp_prt(isp, ISP_LOGERR, "bad maximum allocation (%d)- using 16", fcp->isp_maxalloc);
- icbp->icb_maxalloc = 16;
- }
- icbp->icb_execthrottle = DEFAULT_EXEC_THROTTLE(isp);
- if (icbp->icb_execthrottle < 1) {
- isp_prt(isp, ISP_LOGERR, "bad execution throttle of %d- using %d", DEFAULT_EXEC_THROTTLE(isp), ICB_DFLT_THROTTLE);
- icbp->icb_execthrottle = ICB_DFLT_THROTTLE;
- }
- icbp->icb_retry_delay = fcp->isp_retry_delay;
- icbp->icb_retry_count = fcp->isp_retry_count;
- icbp->icb_hardaddr = fcp->isp_loopid;
- ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
- if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) {
- icbp->icb_hardaddr = 0;
- ownloopid = 0;
- }
-
- /*
- * Our life seems so much better with 2200s and later with
- * the latest f/w if we set Hard Address.
- */
- if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) {
- icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
- }
-
- /*
- * Right now we just set extended options to prefer point-to-point
- * over loop based upon some soft config options.
- *
- * NB: for the 2300, ICBOPT_EXTENDED is required.
- */
- if (IS_2100(isp)) {
- /*
- * We can't have Fast Posting any more- we now
- * have 32 bit handles.
- */
- icbp->icb_fwoptions &= ~ICBOPT_FAST_POST;
- } else if (IS_2200(isp) || IS_23XX(isp)) {
- icbp->icb_fwoptions |= ICBOPT_EXTENDED;
-
- icbp->icb_xfwoptions = fcp->isp_xfwoptions;
-
- if (ISP_CAP_FCTAPE(isp)) {
- if (isp->isp_confopts & ISP_CFG_NOFCTAPE)
- icbp->icb_xfwoptions &= ~ICBXOPT_FCTAPE;
-
- if (isp->isp_confopts & ISP_CFG_FCTAPE)
- icbp->icb_xfwoptions |= ICBXOPT_FCTAPE;
-
- if (icbp->icb_xfwoptions & ICBXOPT_FCTAPE) {
- icbp->icb_fwoptions &= ~ICBOPT_FULL_LOGIN; /* per documents */
- icbp->icb_xfwoptions |= ICBXOPT_FCTAPE_CCQ|ICBXOPT_FCTAPE_CONFIRM;
- FCPARAM(isp, 0)->fctape_enabled = 1;
- } else {
- FCPARAM(isp, 0)->fctape_enabled = 0;
- }
- } else {
- icbp->icb_xfwoptions &= ~ICBXOPT_FCTAPE;
- FCPARAM(isp, 0)->fctape_enabled = 0;
- }
-
- /*
- * Prefer or force Point-To-Point instead Loop?
- */
- switch (isp->isp_confopts & ISP_CFG_PORT_PREF) {
- case ISP_CFG_LPORT_ONLY:
- icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK;
- icbp->icb_xfwoptions |= ICBXOPT_LOOP_ONLY;
- break;
- case ISP_CFG_NPORT_ONLY:
- icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK;
- icbp->icb_xfwoptions |= ICBXOPT_PTP_ONLY;
- break;
- case ISP_CFG_LPORT:
- icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK;
- icbp->icb_xfwoptions |= ICBXOPT_LOOP_2_PTP;
- break;
- case ISP_CFG_NPORT:
- icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK;
- icbp->icb_xfwoptions |= ICBXOPT_PTP_2_LOOP;
- break;
- default:
- /* Let NVRAM settings define it if they are sane */
- switch (icbp->icb_xfwoptions & ICBXOPT_TOPO_MASK) {
- case ICBXOPT_PTP_2_LOOP:
- case ICBXOPT_PTP_ONLY:
- case ICBXOPT_LOOP_ONLY:
- case ICBXOPT_LOOP_2_PTP:
- break;
- default:
- icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK;
- icbp->icb_xfwoptions |= ICBXOPT_LOOP_2_PTP;
- }
- break;
- }
- if (IS_2200(isp)) {
- /*
- * We can't have Fast Posting any more- we now
- * have 32 bit handles.
- *
- * RIO seemed to have to much breakage.
- *
- * Just opt for safety.
- */
- icbp->icb_xfwoptions &= ~ICBXOPT_RIO_16BIT;
- icbp->icb_fwoptions &= ~ICBOPT_FAST_POST;
- } else {
- /*
- * QLogic recommends that FAST Posting be turned
- * off for 23XX cards and instead allow the HBA
- * to write response queue entries and interrupt
- * after a delay (ZIO).
- */
- icbp->icb_fwoptions &= ~ICBOPT_FAST_POST;
- if ((fcp->isp_xfwoptions & ICBXOPT_TIMER_MASK) == ICBXOPT_ZIO) {
- icbp->icb_xfwoptions |= ICBXOPT_ZIO;
- icbp->icb_idelaytimer = 10;
- }
- icbp->icb_zfwoptions = fcp->isp_zfwoptions;
- if (isp->isp_confopts & ISP_CFG_1GB) {
- icbp->icb_zfwoptions &= ~ICBZOPT_RATE_MASK;
- icbp->icb_zfwoptions |= ICBZOPT_RATE_1GB;
- } else if (isp->isp_confopts & ISP_CFG_2GB) {
- icbp->icb_zfwoptions &= ~ICBZOPT_RATE_MASK;
- icbp->icb_zfwoptions |= ICBZOPT_RATE_2GB;
- } else {
- switch (icbp->icb_zfwoptions & ICBZOPT_RATE_MASK) {
- case ICBZOPT_RATE_1GB:
- case ICBZOPT_RATE_2GB:
- case ICBZOPT_RATE_AUTO:
- break;
- default:
- icbp->icb_zfwoptions &= ~ICBZOPT_RATE_MASK;
- icbp->icb_zfwoptions |= ICBZOPT_RATE_AUTO;
- break;
- }
- }
- }
- }
-
-
- /*
- * For 22XX > 2.1.26 && 23XX, set some options.
- */
- if (ISP_FW_NEWER_THAN(isp, 2, 26, 0)) {
- MBSINIT(&mbs, MBOX_SET_FIRMWARE_OPTIONS, MBLOGALL, 0);
- mbs.param[1] = IFCOPT1_DISF7SWTCH|IFCOPT1_LIPASYNC|IFCOPT1_LIPF8;
- mbs.param[2] = 0;
- mbs.param[3] = 0;
- if (ISP_FW_NEWER_THAN(isp, 3, 16, 0)) {
- mbs.param[1] |= IFCOPT1_EQFQASYNC|IFCOPT1_CTIO_RETRY;
- if (fcp->role & ISP_ROLE_TARGET) {
- if (ISP_FW_NEWER_THAN(isp, 3, 25, 0)) {
- mbs.param[1] |= IFCOPT1_ENAPURE;
- }
- mbs.param[3] = IFCOPT3_NOPRLI;
- }
- }
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- return;
- }
- }
- icbp->icb_logintime = ICB_LOGIN_TOV;
-
-#ifdef ISP_TARGET_MODE
- if (icbp->icb_fwoptions & ICBOPT_TGT_ENABLE) {
- icbp->icb_lunenables = 0xffff;
- icbp->icb_ccnt = 0xff;
- icbp->icb_icnt = 0xff;
- icbp->icb_lunetimeout = ICB_LUN_ENABLE_TOV;
- }
-#endif
- if (fcp->isp_wwnn && fcp->isp_wwpn) {
- icbp->icb_fwoptions |= ICBOPT_BOTH_WWNS;
- MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, fcp->isp_wwnn);
- MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname, fcp->isp_wwpn);
- isp_prt(isp, ISP_LOGDEBUG1,
- "Setting ICB Node 0x%08x%08x Port 0x%08x%08x",
- ((uint32_t) (fcp->isp_wwnn >> 32)),
- ((uint32_t) (fcp->isp_wwnn)),
- ((uint32_t) (fcp->isp_wwpn >> 32)),
- ((uint32_t) (fcp->isp_wwpn)));
- } else if (fcp->isp_wwpn) {
- icbp->icb_fwoptions &= ~ICBOPT_BOTH_WWNS;
- MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname, fcp->isp_wwpn);
- isp_prt(isp, ISP_LOGDEBUG1,
- "Setting ICB Port 0x%08x%08x",
- ((uint32_t) (fcp->isp_wwpn >> 32)),
- ((uint32_t) (fcp->isp_wwpn)));
- } else {
- isp_prt(isp, ISP_LOGERR, "No valid WWNs to use");
- return;
- }
- icbp->icb_rqstqlen = RQUEST_QUEUE_LEN(isp);
- if (icbp->icb_rqstqlen < 1) {
- isp_prt(isp, ISP_LOGERR, "bad request queue length");
- }
- icbp->icb_rsltqlen = RESULT_QUEUE_LEN(isp);
- if (icbp->icb_rsltqlen < 1) {
- isp_prt(isp, ISP_LOGERR, "bad result queue length");
- }
- icbp->icb_rqstaddr[RQRSP_ADDR0015] = DMA_WD0(isp->isp_rquest_dma);
- icbp->icb_rqstaddr[RQRSP_ADDR1631] = DMA_WD1(isp->isp_rquest_dma);
- icbp->icb_rqstaddr[RQRSP_ADDR3247] = DMA_WD2(isp->isp_rquest_dma);
- icbp->icb_rqstaddr[RQRSP_ADDR4863] = DMA_WD3(isp->isp_rquest_dma);
- icbp->icb_respaddr[RQRSP_ADDR0015] = DMA_WD0(isp->isp_result_dma);
- icbp->icb_respaddr[RQRSP_ADDR1631] = DMA_WD1(isp->isp_result_dma);
- icbp->icb_respaddr[RQRSP_ADDR3247] = DMA_WD2(isp->isp_result_dma);
- icbp->icb_respaddr[RQRSP_ADDR4863] = DMA_WD3(isp->isp_result_dma);
-
- if (FC_SCRATCH_ACQUIRE(isp, 0)) {
- isp_prt(isp, ISP_LOGERR, sacq);
- return;
- }
- isp_prt(isp, ISP_LOGDEBUG0, "isp_fibre_init: fwopt 0x%x xfwopt 0x%x zfwopt 0x%x",
- icbp->icb_fwoptions, icbp->icb_xfwoptions, icbp->icb_zfwoptions);
-
- isp_put_icb(isp, icbp, (isp_icb_t *)fcp->isp_scratch);
- if (isp->isp_dblev & ISP_LOGDEBUG1) {
- isp_print_bytes(isp, "isp_fibre_init",
- sizeof(*icbp), fcp->isp_scratch);
- }
-
- /*
- * Init the firmware
- */
- MBSINIT(&mbs, MBOX_INIT_FIRMWARE, MBLOGALL, 30000000);
- mbs.param[1] = 0;
- mbs.param[2] = DMA_WD1(fcp->isp_scdma);
- mbs.param[3] = DMA_WD0(fcp->isp_scdma);
- mbs.param[6] = DMA_WD3(fcp->isp_scdma);
- mbs.param[7] = DMA_WD2(fcp->isp_scdma);
- isp_prt(isp, ISP_LOGDEBUG0, "INIT F/W from %p (%08x%08x)",
- fcp->isp_scratch, (uint32_t) ((uint64_t)fcp->isp_scdma >> 32),
- (uint32_t) fcp->isp_scdma);
- MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp), 0);
- isp_mboxcmd(isp, &mbs);
- FC_SCRATCH_RELEASE(isp, 0);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
- return;
- isp->isp_reqidx = 0;
- isp->isp_reqodx = 0;
- isp->isp_residx = 0;
- isp->isp_resodx = 0;
-
- /*
- * Whatever happens, we're now committed to being here.
- */
- isp->isp_state = ISP_RUNSTATE;
-}
-
-static void
-isp_fibre_init_2400(ispsoftc_t *isp)
-{
fcparam *fcp;
isp_icb_2400_t local, *icbp = &local;
mbreg_t mbs;
@@ -2210,7 +921,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_atioqaddr[RQRSP_ADDR1631] = DMA_WD1(isp->isp_atioq_dma);
icbp->icb_atioqaddr[RQRSP_ADDR3247] = DMA_WD2(isp->isp_atioq_dma);
icbp->icb_atioqaddr[RQRSP_ADDR4863] = DMA_WD3(isp->isp_atioq_dma);
- isp_prt(isp, ISP_LOGDEBUG0, "isp_fibre_init_2400: atioq %04x%04x%04x%04x", DMA_WD3(isp->isp_atioq_dma), DMA_WD2(isp->isp_atioq_dma),
+ isp_prt(isp, ISP_LOGDEBUG0, "isp_init: atioq %04x%04x%04x%04x", DMA_WD3(isp->isp_atioq_dma), DMA_WD2(isp->isp_atioq_dma),
DMA_WD1(isp->isp_atioq_dma), DMA_WD0(isp->isp_atioq_dma));
#endif
@@ -2220,9 +931,9 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_msixatio = 2;
}
- isp_prt(isp, ISP_LOGDEBUG0, "isp_fibre_init_2400: fwopt1 0x%x fwopt2 0x%x fwopt3 0x%x", icbp->icb_fwoptions1, icbp->icb_fwoptions2, icbp->icb_fwoptions3);
+ isp_prt(isp, ISP_LOGDEBUG0, "isp_init: fwopt1 0x%x fwopt2 0x%x fwopt3 0x%x", icbp->icb_fwoptions1, icbp->icb_fwoptions2, icbp->icb_fwoptions3);
- isp_prt(isp, ISP_LOGDEBUG0, "isp_fibre_init_2400: rqst %04x%04x%04x%04x rsp %04x%04x%04x%04x", DMA_WD3(isp->isp_rquest_dma), DMA_WD2(isp->isp_rquest_dma),
+ isp_prt(isp, ISP_LOGDEBUG0, "isp_init: rqst %04x%04x%04x%04x rsp %04x%04x%04x%04x", DMA_WD3(isp->isp_rquest_dma), DMA_WD2(isp->isp_rquest_dma),
DMA_WD1(isp->isp_rquest_dma), DMA_WD0(isp->isp_rquest_dma), DMA_WD3(isp->isp_result_dma), DMA_WD2(isp->isp_result_dma),
DMA_WD1(isp->isp_result_dma), DMA_WD0(isp->isp_result_dma));
@@ -2233,7 +944,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
ISP_MEMZERO(fcp->isp_scratch, ISP_FC_SCRLEN);
isp_put_icb_2400(isp, icbp, fcp->isp_scratch);
if (isp->isp_dblev & ISP_LOGDEBUG1) {
- isp_print_bytes(isp, "isp_fibre_init_2400",
+ isp_print_bytes(isp, "isp_init",
sizeof (*icbp), fcp->isp_scratch);
}
@@ -2291,7 +1002,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
amt += ICB2400_VPOPT_WRITE_SIZE;
}
if (isp->isp_dblev & ISP_LOGDEBUG1) {
- isp_print_bytes(isp, "isp_fibre_init_2400",
+ isp_print_bytes(isp, "isp_init",
amt - ICB2400_VPINFO_OFF,
(char *)fcp->isp_scratch + ICB2400_VPINFO_OFF);
}
@@ -2556,16 +1267,6 @@ isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags
isp_prt(isp, ISP_LOG_SANCFG, "Chan %d PLOGX %s PortID 0x%06x nphdl 0x%x",
chan, (flags & PLOGX_FLG_CMD_MASK) == PLOGX_FLG_CMD_PLOGI ?
"Login":"Logout", portid, handle);
- if (!IS_24XX(isp)) {
- int action = flags & PLOGX_FLG_CMD_MASK;
- if (action == PLOGX_FLG_CMD_PLOGI) {
- return (isp_port_login(isp, handle, portid));
- } else if (action == PLOGX_FLG_CMD_LOGO) {
- return (isp_port_logout(isp, handle, portid));
- } else {
- return (MBOX_INVALID_COMMAND);
- }
- }
ISP_MEMZERO(&pl, sizeof(pl));
pl.plogx_header.rqs_entry_count = 1;
@@ -2693,94 +1394,22 @@ isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags
}
static int
-isp_port_login(ispsoftc_t *isp, uint16_t handle, uint32_t portid)
-{
- mbreg_t mbs;
-
- MBSINIT(&mbs, MBOX_FABRIC_LOGIN, MBLOGNONE, 500000);
- if (ISP_CAP_2KLOGIN(isp)) {
- mbs.param[1] = handle;
- mbs.ibits = (1 << 10);
- } else {
- mbs.param[1] = handle << 8;
- }
- mbs.param[2] = portid >> 16;
- mbs.param[3] = portid;
- mbs.logval = MBLOGNONE;
- mbs.timeout = 500000;
- isp_mboxcmd(isp, &mbs);
-
- switch (mbs.param[0]) {
- case MBOX_PORT_ID_USED:
- isp_prt(isp, ISP_LOG_SANCFG|ISP_LOG_WARN1, "isp_port_login: portid 0x%06x already logged in as 0x%x", portid, mbs.param[1]);
- return (MBOX_PORT_ID_USED | (mbs.param[1] << 16));
-
- case MBOX_LOOP_ID_USED:
- isp_prt(isp, ISP_LOG_SANCFG|ISP_LOG_WARN1, "isp_port_login: handle 0x%x in use for port id 0x%02xXXXX", handle, mbs.param[1] & 0xff);
- return (MBOX_LOOP_ID_USED);
-
- case MBOX_COMMAND_COMPLETE:
- return (0);
-
- case MBOX_COMMAND_ERROR:
- isp_prt(isp, ISP_LOG_SANCFG|ISP_LOG_WARN1, "isp_port_login: error 0x%x in PLOGI to port 0x%06x", mbs.param[1], portid);
- return (MBOX_COMMAND_ERROR);
-
- case MBOX_ALL_IDS_USED:
- isp_prt(isp, ISP_LOG_SANCFG|ISP_LOG_WARN1, "isp_port_login: all IDs used for fabric login");
- return (MBOX_ALL_IDS_USED);
-
- default:
- isp_prt(isp, ISP_LOG_SANCFG, "isp_port_login: error 0x%x on port login of 0x%06x@0x%0x", mbs.param[0], portid, handle);
- return (mbs.param[0]);
- }
-}
-
-/*
- * Pre-24XX fabric port logout
- *
- * Note that portid is not used
- */
-static int
-isp_port_logout(ispsoftc_t *isp, uint16_t handle, uint32_t portid)
-{
- mbreg_t mbs;
-
- MBSINIT(&mbs, MBOX_FABRIC_LOGOUT, MBLOGNONE, 500000);
- if (ISP_CAP_2KLOGIN(isp)) {
- mbs.param[1] = handle;
- mbs.ibits = (1 << 10);
- } else {
- mbs.param[1] = handle << 8;
- }
- isp_mboxcmd(isp, &mbs);
- return (mbs.param[0] == MBOX_COMMAND_COMPLETE? 0 : mbs.param[0]);
-}
-
-static int
isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp_pdb_t *pdb)
{
mbreg_t mbs;
union {
- isp_pdb_21xx_t fred;
isp_pdb_24xx_t bill;
} un;
MBSINIT(&mbs, MBOX_GET_PORT_DB,
MBLOGALL & ~MBLOGMASK(MBOX_COMMAND_PARAM_ERROR), 250000);
- if (IS_24XX(isp)) {
- mbs.ibits = (1 << 9)|(1 << 10);
- mbs.param[1] = id;
- mbs.param[9] = chan;
- } else if (ISP_CAP_2KLOGIN(isp)) {
- mbs.param[1] = id;
- } else {
- mbs.param[1] = id << 8;
- }
+ mbs.ibits = (1 << 9)|(1 << 10);
+ mbs.param[1] = id;
mbs.param[2] = DMA_WD1(isp->isp_iocb_dma);
mbs.param[3] = DMA_WD0(isp->isp_iocb_dma);
mbs.param[6] = DMA_WD3(isp->isp_iocb_dma);
mbs.param[7] = DMA_WD2(isp->isp_iocb_dma);
+ mbs.param[9] = chan;
MEMORYBARRIER(isp, SYNC_IFORDEV, 0, sizeof(un), chan);
isp_mboxcmd(isp, &mbs);
@@ -2788,33 +1417,21 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp_pdb_t *pdb)
return (mbs.param[0] | (mbs.param[1] << 16));
MEMORYBARRIER(isp, SYNC_IFORCPU, 0, sizeof(un), chan);
- if (IS_24XX(isp)) {
- isp_get_pdb_24xx(isp, isp->isp_iocb, &un.bill);
- pdb->handle = un.bill.pdb_handle;
- pdb->prli_word0 = un.bill.pdb_prli_svc0;
- pdb->prli_word3 = un.bill.pdb_prli_svc3;
- pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits);
- ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8);
- ISP_MEMCPY(pdb->nodename, un.bill.pdb_nodename, 8);
- isp_prt(isp, ISP_LOGDEBUG0,
- "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x laststate %x",
- chan, id, pdb->portid, un.bill.pdb_flags,
- un.bill.pdb_curstate, un.bill.pdb_laststate);
-
- if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) {
- mbs.param[0] = MBOX_NOT_LOGGED_IN;
- return (mbs.param[0]);
- }
- } else {
- isp_get_pdb_21xx(isp, isp->isp_iocb, &un.fred);
- pdb->handle = un.fred.pdb_loopid;
- pdb->prli_word0 = un.fred.pdb_prli_svc0;
- pdb->prli_word3 = un.fred.pdb_prli_svc3;
- pdb->portid = BITS2WORD(un.fred.pdb_portid_bits);
- ISP_MEMCPY(pdb->portname, un.fred.pdb_portname, 8);
- ISP_MEMCPY(pdb->nodename, un.fred.pdb_nodename, 8);
- isp_prt(isp, ISP_LOGDEBUG1,
- "Chan %d handle 0x%x Port 0x%06x", chan, id, pdb->portid);
+ isp_get_pdb_24xx(isp, isp->isp_iocb, &un.bill);
+ pdb->handle = un.bill.pdb_handle;
+ pdb->prli_word0 = un.bill.pdb_prli_svc0;
+ pdb->prli_word3 = un.bill.pdb_prli_svc3;
+ pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits);
+ ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8);
+ ISP_MEMCPY(pdb->nodename, un.bill.pdb_nodename, 8);
+ isp_prt(isp, ISP_LOGDEBUG0,
+ "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x laststate %x",
+ chan, id, pdb->portid, un.bill.pdb_flags,
+ un.bill.pdb_curstate, un.bill.pdb_laststate);
+
+ if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) {
+ mbs.param[0] = MBOX_NOT_LOGGED_IN;
+ return (mbs.param[0]);
}
return (0);
}
@@ -2824,28 +1441,17 @@ isp_gethandles(ispsoftc_t *isp, int chan, uint16_t *handles, int *num, int loop)
{
fcparam *fcp = FCPARAM(isp, chan);
mbreg_t mbs;
- isp_pnhle_21xx_t el1, *elp1;
- isp_pnhle_23xx_t el3, *elp3;
isp_pnhle_24xx_t el4, *elp4;
int i, j;
uint32_t p;
- uint16_t h;
MBSINIT(&mbs, MBOX_GET_ID_LIST, MBLOGALL, 250000);
- if (IS_24XX(isp)) {
- mbs.param[2] = DMA_WD1(fcp->isp_scdma);
- mbs.param[3] = DMA_WD0(fcp->isp_scdma);
- mbs.param[6] = DMA_WD3(fcp->isp_scdma);
- mbs.param[7] = DMA_WD2(fcp->isp_scdma);
- mbs.param[8] = ISP_FC_SCRLEN;
- mbs.param[9] = chan;
- } else {
- mbs.ibits = (1 << 1)|(1 << 2)|(1 << 3)|(1 << 6);
- mbs.param[1] = DMA_WD1(fcp->isp_scdma);
- mbs.param[2] = DMA_WD0(fcp->isp_scdma);
- mbs.param[3] = DMA_WD3(fcp->isp_scdma);
- mbs.param[6] = DMA_WD2(fcp->isp_scdma);
- }
+ mbs.param[2] = DMA_WD1(fcp->isp_scdma);
+ mbs.param[3] = DMA_WD0(fcp->isp_scdma);
+ mbs.param[6] = DMA_WD3(fcp->isp_scdma);
+ mbs.param[7] = DMA_WD2(fcp->isp_scdma);
+ mbs.param[8] = ISP_FC_SCRLEN;
+ mbs.param[9] = chan;
if (FC_SCRATCH_ACQUIRE(isp, chan)) {
isp_prt(isp, ISP_LOGERR, sacq);
return (-1);
@@ -2857,29 +1463,13 @@ isp_gethandles(ispsoftc_t *isp, int chan, uint16_t *handles, int *num, int loop)
return (mbs.param[0] | (mbs.param[1] << 16));
}
MEMORYBARRIER(isp, SYNC_SFORCPU, 0, ISP_FC_SCRLEN, chan);
- elp1 = fcp->isp_scratch;
- elp3 = fcp->isp_scratch;
elp4 = fcp->isp_scratch;
for (i = 0, j = 0; i < mbs.param[1] && j < *num; i++) {
- if (IS_24XX(isp)) {
- isp_get_pnhle_24xx(isp, &elp4[i], &el4);
- p = el4.pnhle_port_id_lo |
- (el4.pnhle_port_id_hi << 16);
- h = el4.pnhle_handle;
- } else if (IS_23XX(isp)) {
- isp_get_pnhle_23xx(isp, &elp3[i], &el3);
- p = el3.pnhle_port_id_lo |
- (el3.pnhle_port_id_hi << 16);
- h = el3.pnhle_handle;
- } else { /* 21xx */
- isp_get_pnhle_21xx(isp, &elp1[i], &el1);
- p = el1.pnhle_port_id_lo |
- ((el1.pnhle_port_id_hi_handle & 0xff) << 16);
- h = el1.pnhle_port_id_hi_handle >> 8;
- }
+ isp_get_pnhle_24xx(isp, &elp4[i], &el4);
+ p = el4.pnhle_port_id_lo | (el4.pnhle_port_id_hi << 16);
if (loop && (p >> 8) != (fcp->isp_portid >> 8))
continue;
- handles[j++] = h;
+ handles[j++] = el4.pnhle_handle;
}
*num = j;
FC_SCRATCH_RELEASE(isp, chan);
@@ -2890,15 +1480,10 @@ static void
isp_dump_chip_portdb(ispsoftc_t *isp, int chan)
{
isp_pdb_t pdb;
- uint16_t lim, nphdl;
+ uint16_t nphdl;
isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGINFO, "Chan %d chip port dump", chan);
- if (ISP_CAP_2KLOGIN(isp)) {
- lim = NPH_MAX_2K;
- } else {
- lim = NPH_MAX;
- }
- for (nphdl = 0; nphdl != lim; nphdl++) {
+ for (nphdl = 0; nphdl != NPH_MAX_2K; nphdl++) {
if (isp_getpdb(isp, chan, nphdl, &pdb)) {
continue;
}
@@ -2918,44 +1503,22 @@ isp_get_wwn(ispsoftc_t *isp, int chan, int nphdl, int nodename)
MBSINIT(&mbs, MBOX_GET_PORT_NAME,
MBLOGALL & ~MBLOGMASK(MBOX_COMMAND_PARAM_ERROR), 500000);
- if (ISP_CAP_2KLOGIN(isp)) {
- mbs.param[1] = nphdl;
- if (nodename) {
- mbs.param[10] = 1;
- }
- mbs.param[9] = chan;
- } else {
- mbs.ibitm = 3;
- mbs.param[1] = nphdl << 8;
- if (nodename) {
- mbs.param[1] |= 1;
- }
- }
+ mbs.param[1] = nphdl;
+ if (nodename)
+ mbs.param[10] = 1;
+ mbs.param[9] = chan;
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return (wwn);
}
- if (IS_24XX(isp)) {
- wwn =
- (((uint64_t)(mbs.param[2] >> 8)) << 56) |
- (((uint64_t)(mbs.param[2] & 0xff)) << 48) |
- (((uint64_t)(mbs.param[3] >> 8)) << 40) |
- (((uint64_t)(mbs.param[3] & 0xff)) << 32) |
- (((uint64_t)(mbs.param[6] >> 8)) << 24) |
- (((uint64_t)(mbs.param[6] & 0xff)) << 16) |
- (((uint64_t)(mbs.param[7] >> 8)) << 8) |
- (((uint64_t)(mbs.param[7] & 0xff)));
- } else {
- wwn =
- (((uint64_t)(mbs.param[2] & 0xff)) << 56) |
- (((uint64_t)(mbs.param[2] >> 8)) << 48) |
- (((uint64_t)(mbs.param[3] & 0xff)) << 40) |
- (((uint64_t)(mbs.param[3] >> 8)) << 32) |
- (((uint64_t)(mbs.param[6] & 0xff)) << 24) |
- (((uint64_t)(mbs.param[6] >> 8)) << 16) |
- (((uint64_t)(mbs.param[7] & 0xff)) << 8) |
- (((uint64_t)(mbs.param[7] >> 8)));
- }
+ wwn = (((uint64_t)(mbs.param[2] >> 8)) << 56) |
+ (((uint64_t)(mbs.param[2] & 0xff))<< 48) |
+ (((uint64_t)(mbs.param[3] >> 8)) << 40) |
+ (((uint64_t)(mbs.param[3] & 0xff))<< 32) |
+ (((uint64_t)(mbs.param[6] >> 8)) << 24) |
+ (((uint64_t)(mbs.param[6] & 0xff))<< 16) |
+ (((uint64_t)(mbs.param[7] >> 8)) << 8) |
+ (((uint64_t)(mbs.param[7] & 0xff)));
return (wwn);
}
@@ -2967,8 +1530,7 @@ static int
isp_fclink_test(ispsoftc_t *isp, int chan, int usdelay)
{
mbreg_t mbs;
- int i, r;
- uint16_t nphdl;
+ int i, r, topo;
fcparam *fcp;
isp_pdb_t pdb;
NANOTIME_T hra, hrb;
@@ -3015,22 +1577,10 @@ isp_fclink_test(ispsoftc_t *isp, int chan, int usdelay)
return (-1);
}
- if (IS_2100(isp)) {
- /*
- * Don't bother with fabric if we are using really old
- * 2100 firmware. It's just not worth it.
- */
- if (ISP_FW_NEWER_THAN(isp, 1, 15, 37))
- fcp->isp_topo = TOPO_FL_PORT;
- else
- fcp->isp_topo = TOPO_NL_PORT;
- } else {
- int topo = (int) mbs.param[6];
- if (topo < TOPO_NL_PORT || topo > TOPO_PTP_STUB) {
- topo = TOPO_PTP_STUB;
- }
- fcp->isp_topo = topo;
- }
+ topo = (int) mbs.param[6];
+ if (topo < TOPO_NL_PORT || topo > TOPO_PTP_STUB)
+ topo = TOPO_PTP_STUB;
+ fcp->isp_topo = topo;
fcp->isp_portid = mbs.param[2] | (mbs.param[3] << 16);
if (!TOPO_IS_FABRIC(fcp->isp_topo)) {
@@ -3052,74 +1602,58 @@ isp_fclink_test(ispsoftc_t *isp, int chan, int usdelay)
fcp->isp_loopstate = LOOP_TESTING_LINK;
if (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT) {
- nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID;
- r = isp_getpdb(isp, chan, nphdl, &pdb);
+ r = isp_getpdb(isp, chan, NPH_FL_ID, &pdb);
if (r != 0 || pdb.portid == 0) {
- if (IS_2100(isp)) {
- fcp->isp_topo = TOPO_NL_PORT;
- } else {
- isp_prt(isp, ISP_LOGWARN,
- "fabric topology, but cannot get info about fabric controller (0x%x)", r);
- fcp->isp_topo = TOPO_PTP_STUB;
- }
+ isp_prt(isp, ISP_LOGWARN,
+ "fabric topology, but cannot get info about fabric controller (0x%x)", r);
+ fcp->isp_topo = TOPO_PTP_STUB;
goto not_on_fabric;
}
- if (IS_24XX(isp)) {
- fcp->isp_fabric_params = mbs.param[7];
- fcp->isp_sns_hdl = NPH_SNS_ID;
- r = isp_register_fc4_type(isp, chan);
- if (fcp->isp_loopstate < LOOP_TESTING_LINK)
- goto abort;
- if (r != 0)
- goto not_on_fabric;
- r = isp_register_fc4_features_24xx(isp, chan);
- if (fcp->isp_loopstate < LOOP_TESTING_LINK)
- goto abort;
- if (r != 0)
- goto not_on_fabric;
- r = isp_register_port_name_24xx(isp, chan);
- if (fcp->isp_loopstate < LOOP_TESTING_LINK)
- goto abort;
- if (r != 0)
- goto not_on_fabric;
- isp_register_node_name_24xx(isp, chan);
- if (fcp->isp_loopstate < LOOP_TESTING_LINK)
- goto abort;
- } else {
- fcp->isp_sns_hdl = SNS_ID;
- r = isp_register_fc4_type(isp, chan);
- if (r != 0)
- goto not_on_fabric;
- if (fcp->role == ISP_ROLE_TARGET)
- isp_send_change_request(isp, chan);
- }
+ fcp->isp_fabric_params = mbs.param[7];
+ fcp->isp_sns_hdl = NPH_SNS_ID;
+ r = isp_register_fc4_type(isp, chan);
+ if (fcp->isp_loopstate < LOOP_TESTING_LINK)
+ goto abort;
+ if (r != 0)
+ goto not_on_fabric;
+ r = isp_register_fc4_features_24xx(isp, chan);
+ if (fcp->isp_loopstate < LOOP_TESTING_LINK)
+ goto abort;
+ if (r != 0)
+ goto not_on_fabric;
+ r = isp_register_port_name_24xx(isp, chan);
+ if (fcp->isp_loopstate < LOOP_TESTING_LINK)
+ goto abort;
+ if (r != 0)
+ goto not_on_fabric;
+ isp_register_node_name_24xx(isp, chan);
+ if (fcp->isp_loopstate < LOOP_TESTING_LINK)
+ goto abort;
}
not_on_fabric:
/* Get link speed. */
fcp->isp_gbspeed = 1;
- if (IS_23XX(isp) || IS_24XX(isp)) {
- MBSINIT(&mbs, MBOX_GET_SET_DATA_RATE, MBLOGALL, 3000000);
- mbs.param[1] = MBGSD_GET_RATE;
- /* mbs.param[2] undefined if we're just getting rate */
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
- if (mbs.param[1] == MBGSD_10GB)
- fcp->isp_gbspeed = 10;
- else if (mbs.param[1] == MBGSD_32GB)
- fcp->isp_gbspeed = 32;
- else if (mbs.param[1] == MBGSD_16GB)
- fcp->isp_gbspeed = 16;
- else if (mbs.param[1] == MBGSD_8GB)
- fcp->isp_gbspeed = 8;
- else if (mbs.param[1] == MBGSD_4GB)
- fcp->isp_gbspeed = 4;
- else if (mbs.param[1] == MBGSD_2GB)
- fcp->isp_gbspeed = 2;
- else if (mbs.param[1] == MBGSD_1GB)
- fcp->isp_gbspeed = 1;
- }
+ MBSINIT(&mbs, MBOX_GET_SET_DATA_RATE, MBLOGALL, 3000000);
+ mbs.param[1] = MBGSD_GET_RATE;
+ /* mbs.param[2] undefined if we're just getting rate */
+ isp_mboxcmd(isp, &mbs);
+ if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
+ if (mbs.param[1] == MBGSD_10GB)
+ fcp->isp_gbspeed = 10;
+ else if (mbs.param[1] == MBGSD_32GB)
+ fcp->isp_gbspeed = 32;
+ else if (mbs.param[1] == MBGSD_16GB)
+ fcp->isp_gbspeed = 16;
+ else if (mbs.param[1] == MBGSD_8GB)
+ fcp->isp_gbspeed = 8;
+ else if (mbs.param[1] == MBGSD_4GB)
+ fcp->isp_gbspeed = 4;
+ else if (mbs.param[1] == MBGSD_2GB)
+ fcp->isp_gbspeed = 2;
+ else if (mbs.param[1] == MBGSD_1GB)
+ fcp->isp_gbspeed = 1;
}
if (fcp->isp_loopstate < LOOP_TESTING_LINK) {
@@ -3293,48 +1827,6 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_t *pdb)
}
/*
- * Fix port IDs for logged-in initiators on pre-2400 chips.
- * For those chips we are not receiving login events, adding initiators
- * based on ATIO requests, but there is no port ID in that structure.
- */
-static void
-isp_fix_portids(ispsoftc_t *isp, int chan)
-{
- fcparam *fcp = FCPARAM(isp, chan);
- isp_pdb_t pdb;
- uint64_t wwpn;
- int i, r;
-
- for (i = 0; i < MAX_FC_TARG; i++) {
- fcportdb_t *lp = &fcp->portdb[i];
-
- if (lp->state == FC_PORTDB_STATE_NIL ||
- lp->state == FC_PORTDB_STATE_ZOMBIE)
- continue;
- if (VALID_PORT(lp->portid))
- continue;
-
- r = isp_getpdb(isp, chan, lp->handle, &pdb);
- if (fcp->isp_loopstate < LOOP_SCANNING_LOOP)
- return;
- if (r != 0) {
- isp_prt(isp, ISP_LOGDEBUG1,
- "Chan %d FC Scan Loop handle %d returned %x",
- chan, lp->handle, r);
- continue;
- }
-
- MAKE_WWN_FROM_NODE_NAME(wwpn, pdb.portname);
- if (lp->port_wwn != wwpn)
- continue;
- lp->portid = lp->new_portid = pdb.portid;
- isp_prt(isp, ISP_LOG_SANCFG,
- "Chan %d Port 0x%06x@0x%04x is fixed",
- chan, pdb.portid, pdb.handle);
- }
-}
-
-/*
* Scan local loop for devices.
*/
static int
@@ -3354,11 +1846,6 @@ isp_scan_loop(ispsoftc_t *isp, int chan)
isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC loop scan", chan);
fcp->isp_loopstate = LOOP_SCANNING_LOOP;
if (TOPO_IS_FABRIC(fcp->isp_topo)) {
- if (!IS_24XX(isp)) {
- isp_fix_portids(isp, chan);
- if (fcp->isp_loopstate < LOOP_SCANNING_LOOP)
- goto abort;
- }
isp_prt(isp, ISP_LOG_SANCFG,
"Chan %d FC loop scan done (no loop)", chan);
fcp->isp_loopstate = LOOP_LSCAN_DONE;
@@ -3389,37 +1876,19 @@ isp_scan_loop(ispsoftc_t *isp, int chan)
/*
* Don't scan "special" ids.
*/
- if (ISP_CAP_2KLOGIN(isp)) {
- if (handle >= NPH_RESERVED)
- continue;
- } else {
- if (handle >= FL_ID && handle <= SNS_ID)
- continue;
- }
-
- /*
- * In older cards with older f/w GET_PORT_DATABASE has been
- * known to hang. This trick gets around that problem.
- */
- if (IS_2100(isp) || IS_2200(isp)) {
- uint64_t node_wwn = isp_get_wwn(isp, chan, handle, 1);
- if (fcp->isp_loopstate < LOOP_SCANNING_LOOP) {
-abort:
- isp_prt(isp, ISP_LOG_SANCFG,
- "Chan %d FC loop scan aborted", chan);
- return (1);
- }
- if (node_wwn == INI_NONE) {
- continue;
- }
- }
+ if (handle >= NPH_RESERVED)
+ continue;
/*
* Get the port database entity for this index.
*/
r = isp_getpdb(isp, chan, handle, &pdb);
- if (fcp->isp_loopstate < LOOP_SCANNING_LOOP)
- goto abort;
+ if (fcp->isp_loopstate < LOOP_SCANNING_LOOP) {
+abort:
+ isp_prt(isp, ISP_LOG_SANCFG,
+ "Chan %d FC loop scan aborted", chan);
+ return (1);
+ }
if (r != 0) {
isp_prt(isp, ISP_LOGDEBUG1,
"Chan %d FC Scan Loop handle %d returned %x",
@@ -3437,37 +1906,6 @@ abort:
}
static int
-isp_ct_sns(ispsoftc_t *isp, int chan, uint32_t cmd_bcnt, uint32_t rsp_bcnt)
-{
- fcparam *fcp = FCPARAM(isp, chan);
- mbreg_t mbs;
-
- if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "CT SNS request", cmd_bcnt, fcp->isp_scratch);
- MEMORYBARRIER(isp, SYNC_SFORDEV, 0, cmd_bcnt, chan);
-
- MBSINIT(&mbs, MBOX_SEND_SNS, MBLOGALL, 10000000);
- mbs.param[1] = cmd_bcnt >> 1;
- mbs.param[2] = DMA_WD1(fcp->isp_scdma);
- mbs.param[3] = DMA_WD0(fcp->isp_scdma);
- mbs.param[6] = DMA_WD3(fcp->isp_scdma);
- mbs.param[7] = DMA_WD2(fcp->isp_scdma);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- if (mbs.param[0] == MBOX_INVALID_COMMAND) {
- return (1);
- } else {
- return (-1);
- }
- }
-
- MEMORYBARRIER(isp, SYNC_SFORCPU, 0, rsp_bcnt, chan);
- if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "CT response", rsp_bcnt, fcp->isp_scratch);
- return (0);
-}
-
-static int
isp_ct_passthru(ispsoftc_t *isp, int chan, uint32_t cmd_bcnt, uint32_t rsp_bcnt)
{
fcparam *fcp = FCPARAM(isp, chan);
@@ -3548,10 +1986,7 @@ isp_ct_passthru(ispsoftc_t *isp, int chan, uint32_t cmd_bcnt, uint32_t rsp_bcnt)
* Use the GID_PT command to get list of all Nx_Port IDs SNS knows.
* Use GFF_ID and GFT_ID to check port type (FCP) and features (target).
*
- * For 2100-23XX cards, we use the SNS mailbox command to pass simple name
- * server commands to the switch management server via the QLogic f/w.
- *
- * For the 24XX and above card, we use CT Pass-through IOCB.
+ * We use CT Pass-through IOCB.
*/
#define GIDLEN ISP_FC_SCRLEN
#define NGENT ((GIDLEN - 16) >> 2)
@@ -3561,7 +1996,6 @@ isp_gid_pt(ispsoftc_t *isp, int chan)
{
fcparam *fcp = FCPARAM(isp, chan);
ct_hdr_t ct;
- sns_gid_pt_req_t rq;
uint8_t *scp = fcp->isp_scratch;
isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_PT", chan);
@@ -3570,45 +2004,22 @@ isp_gid_pt(ispsoftc_t *isp, int chan)
return (-1);
}
- if (IS_24XX(isp)) {
- /* Build the CT command and execute via pass-through. */
- ISP_MEMZERO(&ct, sizeof (ct));
- ct.ct_revision = CT_REVISION;
- ct.ct_fcs_type = CT_FC_TYPE_FC;
- ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS;
- ct.ct_cmd_resp = SNS_GID_PT;
- ct.ct_bcnt_resid = (GIDLEN - 16) >> 2;
- isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp);
- scp[sizeof(ct)] = 0x7f; /* Port Type = Nx_Port */
- scp[sizeof(ct)+1] = 0; /* Domain_ID = any */
- scp[sizeof(ct)+2] = 0; /* Area_ID = any */
- scp[sizeof(ct)+3] = 0; /* Flags = no Area_ID */
-
- if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t), GIDLEN)) {
- FC_SCRATCH_RELEASE(isp, chan);
- return (-1);
- }
- } else {
- /* Build the SNS request and execute via firmware. */
- ISP_MEMZERO(&rq, SNS_GID_PT_REQ_SIZE);
- rq.snscb_rblen = GIDLEN >> 1;
- rq.snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma);
- rq.snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma);
- rq.snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma);
- rq.snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma);
- rq.snscb_sblen = 6;
- rq.snscb_cmd = SNS_GID_PT;
- rq.snscb_mword_div_2 = NGENT;
- rq.snscb_port_type = 0x7f; /* Port Type = Nx_Port */
- rq.snscb_domain = 0; /* Domain_ID = any */
- rq.snscb_area = 0; /* Area_ID = any */
- rq.snscb_flags = 0; /* Flags = no Area_ID */
- isp_put_gid_pt_request(isp, &rq, (sns_gid_pt_req_t *)scp);
-
- if (isp_ct_sns(isp, chan, sizeof(rq), NGENT)) {
- FC_SCRATCH_RELEASE(isp, chan);
- return (-1);
- }
+ /* Build the CT command and execute via pass-through. */
+ ISP_MEMZERO(&ct, sizeof (ct));
+ ct.ct_revision = CT_REVISION;
+ ct.ct_fcs_type = CT_FC_TYPE_FC;
+ ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS;
+ ct.ct_cmd_resp = SNS_GID_PT;
+ ct.ct_bcnt_resid = (GIDLEN - 16) >> 2;
+ isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp);
+ scp[sizeof(ct)] = 0x7f; /* Port Type = Nx_Port */
+ scp[sizeof(ct)+1] = 0; /* Domain_ID = any */
+ scp[sizeof(ct)+2] = 0; /* Area_ID = any */
+ scp[sizeof(ct)+3] = 0; /* Flags = no Area_ID */
+
+ if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t), GIDLEN)) {
+ FC_SCRATCH_RELEASE(isp, chan);
+ return (-1);
}
isp_get_gid_xx_response(isp, (sns_gid_xx_rsp_t *)scp,
@@ -3630,9 +2041,6 @@ isp_gff_id(ispsoftc_t *isp, int chan, uint32_t portid)
if (!fcp->isp_use_gff_id) /* User may block GFF_ID use. */
return (res);
- if (!IS_24XX(isp)) /* Old chips can't request GFF_ID. */
- return (res);
-
isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GFF_ID", chan);
if (FC_SCRATCH_ACQUIRE(isp, chan)) {
isp_prt(isp, ISP_LOGERR, sacq);
@@ -3682,7 +2090,6 @@ isp_gft_id(ispsoftc_t *isp, int chan, uint32_t portid)
{
fcparam *fcp = FCPARAM(isp, chan);
ct_hdr_t ct;
- sns_gxx_id_req_t rq;
uint32_t *rp;
uint8_t *scp = fcp->isp_scratch;
sns_gft_id_rsp_t rsp;
@@ -3697,41 +2104,21 @@ isp_gft_id(ispsoftc_t *isp, int chan, uint32_t portid)
return (res);
}
- if (IS_24XX(isp)) {
- /* Build the CT command and execute via pass-through. */
- ISP_MEMZERO(&ct, sizeof (ct));
- ct.ct_revision = CT_REVISION;
- ct.ct_fcs_type = CT_FC_TYPE_FC;
- ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS;
- ct.ct_cmd_resp = SNS_GFT_ID;
- ct.ct_bcnt_resid = (SNS_GFT_ID_RESP_SIZE - sizeof(ct)) / 4;
- isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp);
- rp = (uint32_t *) &scp[sizeof(ct)];
- ISP_IOZPUT_32(isp, portid, rp);
-
- if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t),
- SNS_GFT_ID_RESP_SIZE)) {
- FC_SCRATCH_RELEASE(isp, chan);
- return (res);
- }
- } else {
- /* Build the SNS request and execute via firmware. */
- ISP_MEMZERO(&rq, SNS_GXX_ID_REQ_SIZE);
- rq.snscb_rblen = SNS_GFT_ID_RESP_SIZE >> 1;
- rq.snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma);
- rq.snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma);
- rq.snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma);
- rq.snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma);
- rq.snscb_sblen = 6;
- rq.snscb_cmd = SNS_GFT_ID;
- rq.snscb_mword_div_2 = (SNS_GFT_ID_RESP_SIZE - sizeof(ct)) / 4;
- rq.snscb_portid = portid;
- isp_put_gxx_id_request(isp, &rq, (sns_gxx_id_req_t *)scp);
-
- if (isp_ct_sns(isp, chan, sizeof(rq), SNS_GFT_ID_RESP_SIZE)) {
- FC_SCRATCH_RELEASE(isp, chan);
- return (res);
- }
+ /* Build the CT command and execute via pass-through. */
+ ISP_MEMZERO(&ct, sizeof (ct));
+ ct.ct_revision = CT_REVISION;
+ ct.ct_fcs_type = CT_FC_TYPE_FC;
+ ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS;
+ ct.ct_cmd_resp = SNS_GFT_ID;
+ ct.ct_bcnt_resid = (SNS_GFT_ID_RESP_SIZE - sizeof(ct)) / 4;
+ isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp);
+ rp = (uint32_t *) &scp[sizeof(ct)];
+ ISP_IOZPUT_32(isp, portid, rp);
+
+ if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t),
+ SNS_GFT_ID_RESP_SIZE)) {
+ FC_SCRATCH_RELEASE(isp, chan);
+ return (res);
}
isp_get_gft_id_response(isp, (sns_gft_id_rsp_t *)scp, &rsp);
@@ -3757,7 +2144,6 @@ isp_scan_fabric(ispsoftc_t *isp, int chan)
fcparam *fcp = FCPARAM(isp, chan);
fcportdb_t *lp;
uint32_t portid;
- uint16_t nphdl;
isp_pdb_t pdb;
int portidx, portlim, r;
sns_gid_xx_rsp_t *rs;
@@ -3787,8 +2173,7 @@ abort:
/*
* Make sure we still are logged into the fabric controller.
*/
- nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID;
- r = isp_getpdb(isp, chan, nphdl, &pdb);
+ r = isp_getpdb(isp, chan, NPH_FL_ID, &pdb);
if ((r & 0xffff) == MBOX_NOT_LOGGED_IN) {
isp_dump_chip_portdb(isp, chan);
}
@@ -3994,17 +2379,11 @@ relogin:
static int
isp_login_device(ispsoftc_t *isp, int chan, uint32_t portid, isp_pdb_t *p, uint16_t *ohp)
{
- int lim, i, r;
+ int i, r;
uint16_t handle;
- if (ISP_CAP_2KLOGIN(isp)) {
- lim = NPH_MAX_2K;
- } else {
- lim = NPH_MAX;
- }
-
handle = isp_next_handle(isp, ohp);
- for (i = 0; i < lim; i++) {
+ for (i = 0; i < NPH_MAX_2K; i++) {
if (FCPARAM(isp, chan)->isp_loopstate != LOOP_SCANNING_FABRIC)
return (-1);
@@ -4040,19 +2419,19 @@ isp_login_device(ispsoftc_t *isp, int chan, uint32_t portid, isp_pdb_t *p, uint1
return (-1);
r = isp_plogx(isp, chan, handle, portid, PLOGX_FLG_CMD_PLOGI);
if (r != 0)
- i = lim;
+ i = NPH_MAX_2K;
break;
} else if ((r & 0xffff) == MBOX_LOOP_ID_USED) {
/* Try the next handle. */
handle = isp_next_handle(isp, ohp);
} else {
/* Give up. */
- i = lim;
+ i = NPH_MAX_2K;
break;
}
}
- if (i == lim) {
+ if (i == NPH_MAX_2K) {
isp_prt(isp, ISP_LOGWARN, "Chan %d PLOGI 0x%06x failed", chan, portid);
return (-1);
}
@@ -4077,31 +2456,11 @@ isp_login_device(ispsoftc_t *isp, int chan, uint32_t portid, isp_pdb_t *p, uint1
}
static int
-isp_send_change_request(ispsoftc_t *isp, int chan)
-{
- mbreg_t mbs;
-
- MBSINIT(&mbs, MBOX_SEND_CHANGE_REQUEST, MBLOGALL, 500000);
- mbs.param[1] = 0x03;
- mbs.param[9] = chan;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
- return (0);
- } else {
- isp_prt(isp, ISP_LOGWARN, "Chan %d Send Change Request: 0x%x",
- chan, mbs.param[0]);
- return (-1);
- }
-}
-
-static int
isp_register_fc4_type(ispsoftc_t *isp, int chan)
{
fcparam *fcp = FCPARAM(isp, chan);
rft_id_t rp;
ct_hdr_t *ct = &rp.rftid_hdr;
- uint8_t local[SNS_RFT_ID_REQ_SIZE];
- sns_screq_t *reqp = (sns_screq_t *) local;
uint8_t *scp = fcp->isp_scratch;
if (FC_SCRATCH_ACQUIRE(isp, chan)) {
@@ -4109,43 +2468,22 @@ isp_register_fc4_type(ispsoftc_t *isp, int chan)
return (-1);
}
- if (IS_24XX(isp)) {
- /* Build the CT command and execute via pass-through. */
- ISP_MEMZERO(&rp, sizeof(rp));
- ct->ct_revision = CT_REVISION;
- ct->ct_fcs_type = CT_FC_TYPE_FC;
- ct->ct_fcs_subtype = CT_FC_SUBTYPE_NS;
- ct->ct_cmd_resp = SNS_RFT_ID;
- ct->ct_bcnt_resid = (sizeof (rft_id_t) - sizeof (ct_hdr_t)) >> 2;
- rp.rftid_portid[0] = fcp->isp_portid >> 16;
- rp.rftid_portid[1] = fcp->isp_portid >> 8;
- rp.rftid_portid[2] = fcp->isp_portid;
- rp.rftid_fc4types[FC4_SCSI >> 5] = 1 << (FC4_SCSI & 0x1f);
- isp_put_rft_id(isp, &rp, (rft_id_t *)scp);
-
- if (isp_ct_passthru(isp, chan, sizeof(rft_id_t), sizeof(ct_hdr_t))) {
- FC_SCRATCH_RELEASE(isp, chan);
- return (-1);
- }
- } else {
- /* Build the SNS request and execute via firmware. */
- ISP_MEMZERO((void *) reqp, SNS_RFT_ID_REQ_SIZE);
- reqp->snscb_rblen = sizeof (ct_hdr_t) >> 1;
- reqp->snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma);
- reqp->snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma);
- reqp->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma);
- reqp->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma);
- reqp->snscb_sblen = 22;
- reqp->snscb_data[0] = SNS_RFT_ID;
- reqp->snscb_data[4] = fcp->isp_portid & 0xffff;
- reqp->snscb_data[5] = (fcp->isp_portid >> 16) & 0xff;
- reqp->snscb_data[6] = (1 << FC4_SCSI);
- isp_put_sns_request(isp, reqp, (sns_screq_t *)scp);
-
- if (isp_ct_sns(isp, chan, SNS_RFT_ID_REQ_SIZE, sizeof(ct_hdr_t))) {
- FC_SCRATCH_RELEASE(isp, chan);
- return (-1);
- }
+ /* Build the CT command and execute via pass-through. */
+ ISP_MEMZERO(&rp, sizeof(rp));
+ ct->ct_revision = CT_REVISION;
+ ct->ct_fcs_type = CT_FC_TYPE_FC;
+ ct->ct_fcs_subtype = CT_FC_SUBTYPE_NS;
+ ct->ct_cmd_resp = SNS_RFT_ID;
+ ct->ct_bcnt_resid = (sizeof (rft_id_t) - sizeof (ct_hdr_t)) >> 2;
+ rp.rftid_portid[0] = fcp->isp_portid >> 16;
+ rp.rftid_portid[1] = fcp->isp_portid >> 8;
+ rp.rftid_portid[2] = fcp->isp_portid;
+ rp.rftid_fc4types[FC4_SCSI >> 5] = 1 << (FC4_SCSI & 0x1f);
+ isp_put_rft_id(isp, &rp, (rft_id_t *)scp);
+
+ if (isp_ct_passthru(isp, chan, sizeof(rft_id_t), sizeof(ct_hdr_t))) {
+ FC_SCRATCH_RELEASE(isp, chan);
+ return (-1);
}
isp_get_ct_hdr(isp, (ct_hdr_t *) scp, ct);
@@ -4345,29 +2683,22 @@ isp_next_handle(ispsoftc_t *isp, uint16_t *ohp)
{
fcparam *fcp;
int i, chan, wrap;
- uint16_t handle, minh, maxh;
+ uint16_t handle;
handle = *ohp;
- if (ISP_CAP_2KLOGIN(isp)) {
- minh = 0;
- maxh = NPH_RESERVED - 1;
- } else {
- minh = SNS_ID + 1;
- maxh = NPH_MAX - 1;
- }
wrap = 0;
next:
if (handle == NIL_HANDLE) {
- handle = minh;
+ handle = 0;
} else {
handle++;
- if (handle > maxh) {
+ if (handle > NPH_RESERVED - 1) {
if (++wrap >= 2) {
isp_prt(isp, ISP_LOGERR, "Out of port handles!");
return (NIL_HANDLE);
}
- handle = minh;
+ handle = 0;
}
}
for (chan = 0; chan < isp->isp_nchan; chan++) {
@@ -4392,11 +2723,10 @@ int
isp_start(XS_T *xs)
{
ispsoftc_t *isp;
+ fcparam *fcp;
uint32_t cdblen;
- uint8_t local[QENTRY_LEN];
- ispreq_t *reqp;
- void *cdbp, *qep;
- uint16_t *tptr;
+ ispreqt7_t local, *reqp = &local;
+ void *qep;
fcportdb_t *lp;
int target, dmaresult;
@@ -4410,7 +2740,7 @@ isp_start(XS_T *xs)
* let the old f/w choke on an extended command queue entry).
*/
- if (XS_CDBLEN(xs) > (IS_FC(isp)? 16 : 44) || XS_CDBLEN(xs) == 0) {
+ if (XS_CDBLEN(xs) > 16 || XS_CDBLEN(xs) == 0) {
isp_prt(isp, ISP_LOGERR, "unsupported cdb length (%d, CDB[0]=0x%x)", XS_CDBLEN(xs), XS_CDBP(xs)[0] & 0xff);
XS_SETERR(xs, HBA_REQINVAL);
return (CMD_COMPLETE);
@@ -4421,61 +2751,47 @@ isp_start(XS_T *xs)
* for correct device state as well.
*/
target = XS_TGT(xs);
- if (IS_FC(isp)) {
- fcparam *fcp = FCPARAM(isp, XS_CHANNEL(xs));
-
- if ((fcp->role & ISP_ROLE_INITIATOR) == 0) {
- isp_prt(isp, ISP_LOG_WARN1,
- "%d.%d.%jx I am not an initiator",
- XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
- XS_SETERR(xs, HBA_SELTIMEOUT);
- return (CMD_COMPLETE);
- }
+ fcp = FCPARAM(isp, XS_CHANNEL(xs));
- if (isp->isp_state != ISP_RUNSTATE) {
- isp_prt(isp, ISP_LOGERR, "Adapter not at RUNSTATE");
- XS_SETERR(xs, HBA_BOTCH);
- return (CMD_COMPLETE);
- }
+ if ((fcp->role & ISP_ROLE_INITIATOR) == 0) {
+ isp_prt(isp, ISP_LOG_WARN1,
+ "%d.%d.%jx I am not an initiator",
+ XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
+ XS_SETERR(xs, HBA_SELTIMEOUT);
+ return (CMD_COMPLETE);
+ }
- isp_prt(isp, ISP_LOGDEBUG2, "XS_TGT(xs)=%d", target);
- lp = &fcp->portdb[target];
- if (target < 0 || target >= MAX_FC_TARG ||
- lp->is_target == 0) {
- XS_SETERR(xs, HBA_SELTIMEOUT);
- return (CMD_COMPLETE);
- }
- if (fcp->isp_loopstate != LOOP_READY) {
- isp_prt(isp, ISP_LOGDEBUG1,
- "%d.%d.%jx loop is not ready",
- XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
- return (CMD_RQLATER);
- }
- if (lp->state == FC_PORTDB_STATE_ZOMBIE) {
- isp_prt(isp, ISP_LOGDEBUG1,
- "%d.%d.%jx target zombie",
- XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
- return (CMD_RQLATER);
- }
- if (lp->state != FC_PORTDB_STATE_VALID) {
- isp_prt(isp, ISP_LOGDEBUG1,
- "%d.%d.%jx bad db port state 0x%x",
- XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs), lp->state);
- XS_SETERR(xs, HBA_SELTIMEOUT);
- return (CMD_COMPLETE);
- }
- } else {
- sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs));
- if (isp->isp_state != ISP_RUNSTATE) {
- isp_prt(isp, ISP_LOGERR, "Adapter not at RUNSTATE");
- XS_SETERR(xs, HBA_BOTCH);
- return (CMD_COMPLETE);
- }
+ if (isp->isp_state != ISP_RUNSTATE) {
+ isp_prt(isp, ISP_LOGERR, "Adapter not at RUNSTATE");
+ XS_SETERR(xs, HBA_BOTCH);
+ return (CMD_COMPLETE);
+ }
- if (sdp->update) {
- isp_spi_update(isp, XS_CHANNEL(xs));
- }
- lp = NULL;
+ isp_prt(isp, ISP_LOGDEBUG2, "XS_TGT(xs)=%d", target);
+ lp = &fcp->portdb[target];
+ if (target < 0 || target >= MAX_FC_TARG ||
+ lp->is_target == 0) {
+ XS_SETERR(xs, HBA_SELTIMEOUT);
+ return (CMD_COMPLETE);
+ }
+ if (fcp->isp_loopstate != LOOP_READY) {
+ isp_prt(isp, ISP_LOGDEBUG1,
+ "%d.%d.%jx loop is not ready",
+ XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
+ return (CMD_RQLATER);
+ }
+ if (lp->state == FC_PORTDB_STATE_ZOMBIE) {
+ isp_prt(isp, ISP_LOGDEBUG1,
+ "%d.%d.%jx target zombie",
+ XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
+ return (CMD_RQLATER);
+ }
+ if (lp->state != FC_PORTDB_STATE_VALID) {
+ isp_prt(isp, ISP_LOGDEBUG1,
+ "%d.%d.%jx bad db port state 0x%x",
+ XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs), lp->state);
+ XS_SETERR(xs, HBA_SELTIMEOUT);
+ return (CMD_COMPLETE);
}
start_again:
@@ -4493,171 +2809,59 @@ isp_start(XS_T *xs)
* We do dual duty here (cough) for synchronizing for buses other
* than which we got here to send a command to.
*/
- reqp = (ispreq_t *) local;
- ISP_MEMZERO(local, QENTRY_LEN);
+ ISP_MEMZERO(reqp, QENTRY_LEN);
if (ISP_TST_SENDMARKER(isp, XS_CHANNEL(xs))) {
- if (IS_24XX(isp)) {
- isp_marker_24xx_t *m = (isp_marker_24xx_t *) reqp;
- m->mrk_header.rqs_entry_count = 1;
- m->mrk_header.rqs_entry_type = RQSTYPE_MARKER;
- m->mrk_modifier = SYNC_ALL;
- m->mrk_vphdl = XS_CHANNEL(xs);
- isp_put_marker_24xx(isp, m, qep);
- } else {
- isp_marker_t *m = (isp_marker_t *) reqp;
- m->mrk_header.rqs_entry_count = 1;
- m->mrk_header.rqs_entry_type = RQSTYPE_MARKER;
- m->mrk_target = (XS_CHANNEL(xs) << 7); /* bus # */
- m->mrk_modifier = SYNC_ALL;
- isp_put_marker(isp, m, qep);
- }
+ isp_marker_24xx_t *m = (isp_marker_24xx_t *) reqp;
+ m->mrk_header.rqs_entry_count = 1;
+ m->mrk_header.rqs_entry_type = RQSTYPE_MARKER;
+ m->mrk_modifier = SYNC_ALL;
+ m->mrk_vphdl = XS_CHANNEL(xs);
+ isp_put_marker_24xx(isp, m, qep);
ISP_SYNC_REQUEST(isp);
ISP_SET_SENDMARKER(isp, XS_CHANNEL(xs), 0);
goto start_again;
}
reqp->req_header.rqs_entry_count = 1;
-
- /*
- * Select and install Header Code.
- * Note that it might be overridden before going out
- * if we're on a 64 bit platform. The lower level
- * code (isp_send_cmd) will select the appropriate
- * 64 bit variant if it needs to.
- */
- if (IS_24XX(isp)) {
- reqp->req_header.rqs_entry_type = RQSTYPE_T7RQS;
- } else if (IS_FC(isp)) {
- reqp->req_header.rqs_entry_type = RQSTYPE_T2RQS;
- } else {
- if (XS_CDBLEN(xs) > 12) {
- reqp->req_header.rqs_entry_type = RQSTYPE_CMDONLY;
- } else {
- reqp->req_header.rqs_entry_type = RQSTYPE_REQUEST;
- }
- }
+ reqp->req_header.rqs_entry_type = RQSTYPE_T7RQS;
/*
* Set task attributes
*/
- if (IS_24XX(isp)) {
- int ttype;
- if (XS_TAG_P(xs)) {
- ttype = XS_TAG_TYPE(xs);
- } else {
- ttype = REQFLAG_STAG;
- }
- if (ttype == REQFLAG_OTAG) {
- ttype = FCP_CMND_TASK_ATTR_ORDERED;
- } else if (ttype == REQFLAG_HTAG) {
- ttype = FCP_CMND_TASK_ATTR_HEAD;
- } else {
- ttype = FCP_CMND_TASK_ATTR_SIMPLE;
- }
- ((ispreqt7_t *)reqp)->req_task_attribute = ttype |
- ((XS_PRIORITY(xs) << FCP_CMND_PRIO_SHIFT) &
- FCP_CMND_PRIO_MASK);
- } else if (IS_FC(isp)) {
- /*
- * See comment in isp_intr_respq
- */
- /* XS_SET_RESID(xs, 0); */
-
- /*
- * Fibre Channel always requires some kind of tag.
- * The Qlogic drivers seem be happy not to use a tag,
- * but this breaks for some devices (IBM drives).
- */
- if (XS_TAG_P(xs)) {
- ((ispreqt2_t *)reqp)->req_flags = XS_TAG_TYPE(xs);
- } else {
- ((ispreqt2_t *)reqp)->req_flags = REQFLAG_STAG;
- }
- } else {
- sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs));
- if ((sdp->isp_devparam[target].actv_flags & DPARM_TQING) && XS_TAG_P(xs)) {
- reqp->req_flags = XS_TAG_TYPE(xs);
- }
- }
+ if (XS_TAG_P(xs))
+ reqp->req_task_attribute = XS_TAG_TYPE(xs);
+ else
+ reqp->req_task_attribute = FCP_CMND_TASK_ATTR_SIMPLE;
+ reqp->req_task_attribute |= (XS_PRIORITY(xs) << FCP_CMND_PRIO_SHIFT) &
+ FCP_CMND_PRIO_MASK;
/*
* NB: we do not support long CDBs (yet)
*/
cdblen = XS_CDBLEN(xs);
- if (IS_SCSI(isp)) {
- if (cdblen > sizeof (reqp->req_cdb)) {
- isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen);
- XS_SETERR(xs, HBA_REQINVAL);
- return (CMD_COMPLETE);
- }
- reqp->req_target = target | (XS_CHANNEL(xs) << 7);
- reqp->req_lun_trn = XS_LUN(xs);
- reqp->req_cdblen = cdblen;
- tptr = &reqp->req_time;
- cdbp = reqp->req_cdb;
- } else if (IS_24XX(isp)) {
- ispreqt7_t *t7 = (ispreqt7_t *)local;
-
- if (cdblen > sizeof (t7->req_cdb)) {
- isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen);
- XS_SETERR(xs, HBA_REQINVAL);
- return (CMD_COMPLETE);
- }
-
- t7->req_nphdl = lp->handle;
- t7->req_tidlo = lp->portid;
- t7->req_tidhi = lp->portid >> 16;
- t7->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs));
- be64enc(t7->req_lun, CAM_EXTLUN_BYTE_SWIZZLE(XS_LUN(xs)));
- if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & PRLI_WD3_RETRY)) {
- if (FCP_NEXT_CRN(isp, &t7->req_crn, xs)) {
- isp_prt(isp, ISP_LOG_WARN1,
- "%d.%d.%jx cannot generate next CRN",
- XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
- XS_SETERR(xs, HBA_BOTCH);
- return (CMD_EAGAIN);
- }
- }
- tptr = &t7->req_time;
- cdbp = t7->req_cdb;
- } else {
- ispreqt2_t *t2 = (ispreqt2_t *)local;
+ if (cdblen > sizeof (reqp->req_cdb)) {
+ isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen);
+ XS_SETERR(xs, HBA_REQINVAL);
+ return (CMD_COMPLETE);
+ }
- if (cdblen > sizeof t2->req_cdb) {
- isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen);
- XS_SETERR(xs, HBA_REQINVAL);
- return (CMD_COMPLETE);
- }
- if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & PRLI_WD3_RETRY)) {
- if (FCP_NEXT_CRN(isp, &t2->req_crn, xs)) {
- isp_prt(isp, ISP_LOG_WARN1,
- "%d.%d.%jx cannot generate next CRN",
- XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
- XS_SETERR(xs, HBA_BOTCH);
- return (CMD_EAGAIN);
- }
- }
- if (ISP_CAP_2KLOGIN(isp)) {
- ispreqt2e_t *t2e = (ispreqt2e_t *)local;
- t2e->req_target = lp->handle;
- t2e->req_scclun = XS_LUN(xs);
- tptr = &t2e->req_time;
- cdbp = t2e->req_cdb;
- } else if (ISP_CAP_SCCFW(isp)) {
- t2->req_target = lp->handle;
- t2->req_scclun = XS_LUN(xs);
- tptr = &t2->req_time;
- cdbp = t2->req_cdb;
- } else {
- t2->req_target = lp->handle;
- t2->req_lun_trn = XS_LUN(xs);
- tptr = &t2->req_time;
- cdbp = t2->req_cdb;
+ reqp->req_nphdl = lp->handle;
+ reqp->req_tidlo = lp->portid;
+ reqp->req_tidhi = lp->portid >> 16;
+ reqp->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs));
+ be64enc(reqp->req_lun, CAM_EXTLUN_BYTE_SWIZZLE(XS_LUN(xs)));
+ if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & PRLI_WD3_RETRY)) {
+ if (FCP_NEXT_CRN(isp, &reqp->req_crn, xs)) {
+ isp_prt(isp, ISP_LOG_WARN1,
+ "%d.%d.%jx cannot generate next CRN",
+ XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
+ XS_SETERR(xs, HBA_BOTCH);
+ return (CMD_EAGAIN);
}
}
- *tptr = XS_TIME(xs);
- ISP_MEMCPY(cdbp, XS_CDBP(xs), cdblen);
+ reqp->req_time = XS_TIME(xs);
+ ISP_MEMCPY(reqp->req_cdb, XS_CDBP(xs), cdblen);
/* Whew. Thankfully the same for type 7 requests */
reqp->req_handle = isp_allocate_handle(isp, xs, ISP_HANDLE_INITIATOR);
@@ -4694,125 +2898,88 @@ isp_start(XS_T *xs)
int
isp_control(ispsoftc_t *isp, ispctl_t ctl, ...)
{
+ fcparam *fcp;
+ fcportdb_t *lp;
XS_T *xs;
- mbreg_t *mbr, mbs;
+ mbreg_t mbs;
int chan, tgt;
uint32_t handle;
va_list ap;
+ uint8_t local[QENTRY_LEN];
switch (ctl) {
case ISPCTL_RESET_BUS:
/*
* Issue a bus reset.
*/
- if (IS_24XX(isp)) {
- isp_prt(isp, ISP_LOGERR, "BUS RESET NOT IMPLEMENTED");
- break;
- } else if (IS_FC(isp)) {
- mbs.param[1] = 10;
- chan = 0;
- } else {
- va_start(ap, ctl);
- chan = va_arg(ap, int);
- va_end(ap);
- mbs.param[1] = SDPARAM(isp, chan)->isp_bus_reset_delay;
- if (mbs.param[1] < 2) {
- mbs.param[1] = 2;
- }
- mbs.param[2] = chan;
- }
- MBSINIT(&mbs, MBOX_BUS_RESET, MBLOGALL, 0);
- ISP_SET_SENDMARKER(isp, chan, 1);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- break;
- }
- isp_prt(isp, ISP_LOGINFO, "driver initiated bus reset of bus %d", chan);
- return (0);
+ isp_prt(isp, ISP_LOGERR, "BUS RESET NOT IMPLEMENTED");
+ break;
case ISPCTL_RESET_DEV:
+ {
+ isp24xx_tmf_t *tmf;
+ isp24xx_statusreq_t *sp;
+
va_start(ap, ctl);
chan = va_arg(ap, int);
tgt = va_arg(ap, int);
va_end(ap);
- if (IS_24XX(isp)) {
- uint8_t local[QENTRY_LEN];
- isp24xx_tmf_t *tmf;
- isp24xx_statusreq_t *sp;
- fcparam *fcp = FCPARAM(isp, chan);
- fcportdb_t *lp;
-
- if (tgt < 0 || tgt >= MAX_FC_TARG) {
- isp_prt(isp, ISP_LOGWARN, "Chan %d trying to reset bad target %d", chan, tgt);
- break;
- }
- lp = &fcp->portdb[tgt];
- if (lp->is_target == 0 ||
- lp->state != FC_PORTDB_STATE_VALID) {
- isp_prt(isp, ISP_LOGWARN, "Chan %d abort of no longer valid target %d", chan, tgt);
- break;
- }
-
- tmf = (isp24xx_tmf_t *) local;
- ISP_MEMZERO(tmf, QENTRY_LEN);
- tmf->tmf_header.rqs_entry_type = RQSTYPE_TSK_MGMT;
- tmf->tmf_header.rqs_entry_count = 1;
- tmf->tmf_nphdl = lp->handle;
- tmf->tmf_delay = 2;
- tmf->tmf_timeout = 4;
- tmf->tmf_flags = ISP24XX_TMF_TARGET_RESET;
- tmf->tmf_tidlo = lp->portid;
- tmf->tmf_tidhi = lp->portid >> 16;
- tmf->tmf_vpidx = ISP_GET_VPIDX(isp, chan);
- isp_put_24xx_tmf(isp, tmf, isp->isp_iocb);
- if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "TMF IOCB request", QENTRY_LEN, isp->isp_iocb);
- MEMORYBARRIER(isp, SYNC_IFORDEV, 0, QENTRY_LEN, chan);
- fcp->sendmarker = 1;
-
- isp_prt(isp, ISP_LOGALL, "Chan %d Reset N-Port Handle 0x%04x @ Port 0x%06x", chan, lp->handle, lp->portid);
- MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL,
- MBCMD_DEFAULT_TIMEOUT + tmf->tmf_timeout * 1000000);
- mbs.param[1] = QENTRY_LEN;
- mbs.param[2] = DMA_WD1(isp->isp_iocb_dma);
- mbs.param[3] = DMA_WD0(isp->isp_iocb_dma);
- mbs.param[6] = DMA_WD3(isp->isp_iocb_dma);
- mbs.param[7] = DMA_WD2(isp->isp_iocb_dma);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
- break;
+ fcp = FCPARAM(isp, chan);
- MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
- if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "TMF IOCB response", QENTRY_LEN, &((isp24xx_statusreq_t *)isp->isp_iocb)[1]);
- sp = (isp24xx_statusreq_t *) local;
- isp_get_24xx_response(isp, &((isp24xx_statusreq_t *)isp->isp_iocb)[1], sp);
- if (sp->req_completion_status == 0) {
- return (0);
- }
- isp_prt(isp, ISP_LOGWARN, "Chan %d reset of target %d returned 0x%x", chan, tgt, sp->req_completion_status);
+ if (tgt < 0 || tgt >= MAX_FC_TARG) {
+ isp_prt(isp, ISP_LOGWARN, "Chan %d trying to reset bad target %d", chan, tgt);
break;
- } else if (IS_FC(isp)) {
- if (ISP_CAP_2KLOGIN(isp)) {
- mbs.param[1] = tgt;
- mbs.ibits = (1 << 10);
- } else {
- mbs.param[1] = (tgt << 8);
- }
- } else {
- mbs.param[1] = (chan << 15) | (tgt << 8);
}
- MBSINIT(&mbs, MBOX_ABORT_TARGET, MBLOGALL, 0);
- mbs.param[2] = 3; /* 'delay', in seconds */
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+ lp = &fcp->portdb[tgt];
+ if (lp->is_target == 0 || lp->state != FC_PORTDB_STATE_VALID) {
+ isp_prt(isp, ISP_LOGWARN, "Chan %d abort of no longer valid target %d", chan, tgt);
break;
}
- isp_prt(isp, ISP_LOGINFO, "Target %d on Bus %d Reset Succeeded", tgt, chan);
- ISP_SET_SENDMARKER(isp, chan, 1);
- return (0);
+ tmf = (isp24xx_tmf_t *) local;
+ ISP_MEMZERO(tmf, QENTRY_LEN);
+ tmf->tmf_header.rqs_entry_type = RQSTYPE_TSK_MGMT;
+ tmf->tmf_header.rqs_entry_count = 1;
+ tmf->tmf_nphdl = lp->handle;
+ tmf->tmf_delay = 2;
+ tmf->tmf_timeout = 4;
+ tmf->tmf_flags = ISP24XX_TMF_TARGET_RESET;
+ tmf->tmf_tidlo = lp->portid;
+ tmf->tmf_tidhi = lp->portid >> 16;
+ tmf->tmf_vpidx = ISP_GET_VPIDX(isp, chan);
+ isp_put_24xx_tmf(isp, tmf, isp->isp_iocb);
+ if (isp->isp_dblev & ISP_LOGDEBUG1)
+ isp_print_bytes(isp, "TMF IOCB request", QENTRY_LEN, isp->isp_iocb);
+ MEMORYBARRIER(isp, SYNC_IFORDEV, 0, QENTRY_LEN, chan);
+ fcp->sendmarker = 1;
+
+ isp_prt(isp, ISP_LOGALL, "Chan %d Reset N-Port Handle 0x%04x @ Port 0x%06x", chan, lp->handle, lp->portid);
+ MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL,
+ MBCMD_DEFAULT_TIMEOUT + tmf->tmf_timeout * 1000000);
+ mbs.param[1] = QENTRY_LEN;
+ mbs.param[2] = DMA_WD1(isp->isp_iocb_dma);
+ mbs.param[3] = DMA_WD0(isp->isp_iocb_dma);
+ mbs.param[6] = DMA_WD3(isp->isp_iocb_dma);
+ mbs.param[7] = DMA_WD2(isp->isp_iocb_dma);
+ isp_mboxcmd(isp, &mbs);
+ if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
+ break;
+
+ MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
+ if (isp->isp_dblev & ISP_LOGDEBUG1)
+ isp_print_bytes(isp, "TMF IOCB response", QENTRY_LEN, &((isp24xx_statusreq_t *)isp->isp_iocb)[1]);
+ sp = (isp24xx_statusreq_t *) local;
+ isp_get_24xx_response(isp, &((isp24xx_statusreq_t *)isp->isp_iocb)[1], sp);
+ if (sp->req_completion_status == 0) {
+ return (0);
+ }
+ isp_prt(isp, ISP_LOGWARN, "Chan %d reset of target %d returned 0x%x", chan, tgt, sp->req_completion_status);
+ break;
+ }
case ISPCTL_ABORT_CMD:
+ {
+ isp24xx_abrt_t *ab = (isp24xx_abrt_t *)&local;
+
va_start(ap, ctl);
xs = va_arg(ap, XS_T *);
va_end(ap);
@@ -4825,159 +2992,98 @@ isp_control(ispsoftc_t *isp, ispctl_t ctl, ...)
isp_prt(isp, ISP_LOGWARN, "cannot find handle for command to abort");
break;
}
- if (IS_24XX(isp)) {
- isp24xx_abrt_t local, *ab = &local;
- fcparam *fcp;
- fcportdb_t *lp;
-
- fcp = FCPARAM(isp, chan);
- if (tgt < 0 || tgt >= MAX_FC_TARG) {
- isp_prt(isp, ISP_LOGWARN, "Chan %d trying to abort bad target %d", chan, tgt);
- break;
- }
- lp = &fcp->portdb[tgt];
- if (lp->is_target == 0 ||
- lp->state != FC_PORTDB_STATE_VALID) {
- isp_prt(isp, ISP_LOGWARN, "Chan %d abort of no longer valid target %d", chan, tgt);
- break;
- }
- isp_prt(isp, ISP_LOGALL, "Chan %d Abort Cmd for N-Port 0x%04x @ Port 0x%06x", chan, lp->handle, lp->portid);
- ISP_MEMZERO(ab, QENTRY_LEN);
- ab->abrt_header.rqs_entry_type = RQSTYPE_ABORT_IO;
- ab->abrt_header.rqs_entry_count = 1;
- ab->abrt_handle = lp->handle;
- ab->abrt_cmd_handle = handle;
- ab->abrt_tidlo = lp->portid;
- ab->abrt_tidhi = lp->portid >> 16;
- ab->abrt_vpidx = ISP_GET_VPIDX(isp, chan);
- isp_put_24xx_abrt(isp, ab, isp->isp_iocb);
- if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "AB IOCB quest", QENTRY_LEN, isp->isp_iocb);
- MEMORYBARRIER(isp, SYNC_IFORDEV, 0, 2 * QENTRY_LEN, chan);
-
- ISP_MEMZERO(&mbs, sizeof (mbs));
- MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 5000000);
- mbs.param[1] = QENTRY_LEN;
- mbs.param[2] = DMA_WD1(isp->isp_iocb_dma);
- mbs.param[3] = DMA_WD0(isp->isp_iocb_dma);
- mbs.param[6] = DMA_WD3(isp->isp_iocb_dma);
- mbs.param[7] = DMA_WD2(isp->isp_iocb_dma);
-
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
- break;
- MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
- if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "AB IOCB response", QENTRY_LEN, &((isp24xx_abrt_t *)isp->isp_iocb)[1]);
- isp_get_24xx_abrt(isp, &((isp24xx_abrt_t *)isp->isp_iocb)[1], ab);
- if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY) {
- return (0);
- }
- isp_prt(isp, ISP_LOGWARN, "Chan %d handle %d abort returned 0x%x", chan, tgt, ab->abrt_nphdl);
+ fcp = FCPARAM(isp, chan);
+ if (tgt < 0 || tgt >= MAX_FC_TARG) {
+ isp_prt(isp, ISP_LOGWARN, "Chan %d trying to abort bad target %d", chan, tgt);
break;
- } else if (IS_FC(isp)) {
- if (ISP_CAP_SCCFW(isp)) {
- if (ISP_CAP_2KLOGIN(isp)) {
- mbs.param[1] = tgt;
- } else {
- mbs.param[1] = tgt << 8;
- }
- mbs.param[6] = XS_LUN(xs);
- } else {
- mbs.param[1] = tgt << 8 | XS_LUN(xs);
- }
- } else {
- mbs.param[1] = (chan << 15) | (tgt << 8) | XS_LUN(xs);
}
- MBSINIT(&mbs, MBOX_ABORT,
- MBLOGALL & ~MBLOGMASK(MBOX_COMMAND_ERROR), 0);
- mbs.param[2] = handle;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+ lp = &fcp->portdb[tgt];
+ if (lp->is_target == 0 || lp->state != FC_PORTDB_STATE_VALID) {
+ isp_prt(isp, ISP_LOGWARN, "Chan %d abort of no longer valid target %d", chan, tgt);
break;
}
- return (0);
+ isp_prt(isp, ISP_LOGALL, "Chan %d Abort Cmd for N-Port 0x%04x @ Port 0x%06x", chan, lp->handle, lp->portid);
+ ISP_MEMZERO(ab, QENTRY_LEN);
+ ab->abrt_header.rqs_entry_type = RQSTYPE_ABORT_IO;
+ ab->abrt_header.rqs_entry_count = 1;
+ ab->abrt_handle = lp->handle;
+ ab->abrt_cmd_handle = handle;
+ ab->abrt_tidlo = lp->portid;
+ ab->abrt_tidhi = lp->portid >> 16;
+ ab->abrt_vpidx = ISP_GET_VPIDX(isp, chan);
+ isp_put_24xx_abrt(isp, ab, isp->isp_iocb);
+ if (isp->isp_dblev & ISP_LOGDEBUG1)
+ isp_print_bytes(isp, "AB IOCB quest", QENTRY_LEN, isp->isp_iocb);
+ MEMORYBARRIER(isp, SYNC_IFORDEV, 0, 2 * QENTRY_LEN, chan);
- case ISPCTL_UPDATE_PARAMS:
+ ISP_MEMZERO(&mbs, sizeof (mbs));
+ MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 5000000);
+ mbs.param[1] = QENTRY_LEN;
+ mbs.param[2] = DMA_WD1(isp->isp_iocb_dma);
+ mbs.param[3] = DMA_WD0(isp->isp_iocb_dma);
+ mbs.param[6] = DMA_WD3(isp->isp_iocb_dma);
+ mbs.param[7] = DMA_WD2(isp->isp_iocb_dma);
- va_start(ap, ctl);
- chan = va_arg(ap, int);
- va_end(ap);
- isp_spi_update(isp, chan);
- return (0);
-
- case ISPCTL_FCLINK_TEST:
+ isp_mboxcmd(isp, &mbs);
+ if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
+ break;
- if (IS_FC(isp)) {
- int usdelay;
- va_start(ap, ctl);
- chan = va_arg(ap, int);
- usdelay = va_arg(ap, int);
- va_end(ap);
- if (usdelay == 0) {
- usdelay = 250000;
- }
- return (isp_fclink_test(isp, chan, usdelay));
+ MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
+ if (isp->isp_dblev & ISP_LOGDEBUG1)
+ isp_print_bytes(isp, "AB IOCB response", QENTRY_LEN, &((isp24xx_abrt_t *)isp->isp_iocb)[1]);
+ isp_get_24xx_abrt(isp, &((isp24xx_abrt_t *)isp->isp_iocb)[1], ab);
+ if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY) {
+ return (0);
}
- break;
+ isp_prt(isp, ISP_LOGWARN, "Chan %d handle %d abort returned 0x%x", chan, tgt, ab->abrt_nphdl);
+ }
+ case ISPCTL_FCLINK_TEST:
+ {
+ int usdelay;
+ va_start(ap, ctl);
+ chan = va_arg(ap, int);
+ usdelay = va_arg(ap, int);
+ va_end(ap);
+ if (usdelay == 0)
+ usdelay = 250000;
+ return (isp_fclink_test(isp, chan, usdelay));
+ }
case ISPCTL_SCAN_FABRIC:
- if (IS_FC(isp)) {
- va_start(ap, ctl);
- chan = va_arg(ap, int);
- va_end(ap);
- return (isp_scan_fabric(isp, chan));
- }
- break;
+ va_start(ap, ctl);
+ chan = va_arg(ap, int);
+ va_end(ap);
+ return (isp_scan_fabric(isp, chan));
case ISPCTL_SCAN_LOOP:
- if (IS_FC(isp)) {
- va_start(ap, ctl);
- chan = va_arg(ap, int);
- va_end(ap);
- return (isp_scan_loop(isp, chan));
- }
- break;
+ va_start(ap, ctl);
+ chan = va_arg(ap, int);
+ va_end(ap);
+ return (isp_scan_loop(isp, chan));
case ISPCTL_PDB_SYNC:
- if (IS_FC(isp)) {
- va_start(ap, ctl);
- chan = va_arg(ap, int);
- va_end(ap);
- return (isp_pdb_sync(isp, chan));
- }
- break;
+ va_start(ap, ctl);
+ chan = va_arg(ap, int);
+ va_end(ap);
+ return (isp_pdb_sync(isp, chan));
case ISPCTL_SEND_LIP:
-
- if (IS_FC(isp) && !IS_24XX(isp)) {
- MBSINIT(&mbs, MBOX_INIT_LIP, MBLOGALL, 0);
- if (ISP_CAP_2KLOGIN(isp)) {
- mbs.ibits = (1 << 10);
- }
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
- return (0);
- }
- }
break;
case ISPCTL_GET_PDB:
- if (IS_FC(isp)) {
- isp_pdb_t *pdb;
- va_start(ap, ctl);
- chan = va_arg(ap, int);
- tgt = va_arg(ap, int);
- pdb = va_arg(ap, isp_pdb_t *);
- va_end(ap);
- return (isp_getpdb(isp, chan, tgt, pdb));
- }
- break;
-
+ {
+ isp_pdb_t *pdb;
+ va_start(ap, ctl);
+ chan = va_arg(ap, int);
+ tgt = va_arg(ap, int);
+ pdb = va_arg(ap, isp_pdb_t *);
+ va_end(ap);
+ return (isp_getpdb(isp, chan, tgt, pdb));
+ }
case ISPCTL_GET_NAMES:
{
uint64_t *wwnn, *wwnp;
@@ -5004,14 +3110,6 @@ isp_control(ispsoftc_t *isp, ispctl_t ctl, ...)
}
return (0);
}
- case ISPCTL_RUN_MBOXCMD:
- {
- va_start(ap, ctl);
- mbr = va_arg(ap, mbreg_t *);
- va_end(ap);
- isp_mboxcmd(isp, mbr);
- return (0);
- }
case ISPCTL_PLOGX:
{
isp_plcmd_t *p;
@@ -5036,17 +3134,15 @@ isp_control(ispsoftc_t *isp, ispctl_t ctl, ...)
return (r);
}
case ISPCTL_CHANGE_ROLE:
- if (IS_FC(isp)) {
- int role, r;
-
- va_start(ap, ctl);
- chan = va_arg(ap, int);
- role = va_arg(ap, int);
- va_end(ap);
- r = isp_fc_change_role(isp, chan, role);
- return (r);
- }
- break;
+ {
+ int role;
+
+ va_start(ap, ctl);
+ chan = va_arg(ap, int);
+ role = va_arg(ap, int);
+ va_end(ap);
+ return (isp_fc_change_role(isp, chan, role));
+ }
default:
isp_prt(isp, ISP_LOGERR, "Unknown Control Opcode 0x%x", ctl);
break;
@@ -5082,8 +3178,11 @@ isp_intr_atioq(ispsoftc_t *isp)
switch (hp->rqs_entry_type) {
case RQSTYPE_NOTIFY:
case RQSTYPE_ATIO:
+ case RQSTYPE_NOTIFY_ACK: /* Can be set to ATIO queue.*/
+ case RQSTYPE_ABTS_RCVD: /* Can be set to ATIO queue.*/
(void) isp_target_notify(isp, addr, &oop);
break;
+ case RQSTYPE_RPT_ID_ACQ: /* Can be set to ATIO queue.*/
default:
isp_print_qentry(isp, "?ATIOQ entry?", oop, addr);
break;
@@ -5098,16 +3197,6 @@ isp_intr_atioq(ispsoftc_t *isp)
#endif
void
-isp_intr_async(ispsoftc_t *isp, uint16_t event)
-{
-
- if (IS_FC(isp))
- isp_parse_async_fc(isp, event);
- else
- isp_parse_async(isp, event);
-}
-
-void
isp_intr_mbox(ispsoftc_t *isp, uint16_t mbox0)
{
int i, obits;
@@ -5131,13 +3220,12 @@ isp_intr_respq(ispsoftc_t *isp)
{
XS_T *xs, *cont_xs;
uint8_t qe[QENTRY_LEN];
- ispstatusreq_t *sp = (ispstatusreq_t *)qe;
- isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe;
+ isp24xx_statusreq_t *sp = (isp24xx_statusreq_t *)qe;
isphdr_t *hp;
uint8_t *resp, *snsp;
int buddaboom, completion_status, cont = 0, etype, i;
int req_status_flags, req_state_flags, scsi_status;
- uint32_t iptr, junk, cptr, optr, rlen, slen, sptr, totslen, resid;
+ uint32_t iptr, cptr, optr, rlen, slen, sptr, totslen, resid;
/*
* We can't be getting this now.
@@ -5147,14 +3235,7 @@ isp_intr_respq(ispsoftc_t *isp)
return;
}
- iptr = ISP_READ(isp, isp->isp_respinrp);
- /* Debounce the 2300 if revision less than 2. */
- if (IS_2100(isp) || (IS_2300(isp) && isp->isp_revision < 2)) {
- do {
- junk = iptr;
- iptr = ISP_READ(isp, isp->isp_respinrp);
- } while (junk != iptr);
- }
+ iptr = ISP_READ(isp, BIU2400_RSPINP);
isp->isp_residx = iptr;
optr = isp->isp_resodx;
@@ -5178,35 +3259,16 @@ isp_intr_respq(ispsoftc_t *isp)
isp_done(cont_xs);
}
- if (IS_24XX(isp) && etype == RQSTYPE_RESPONSE) {
- isp_get_24xx_response(isp, (isp24xx_statusreq_t *)hp, sp2);
- scsi_status = sp2->req_scsi_status;
- completion_status = sp2->req_completion_status;
+ if (etype == RQSTYPE_RESPONSE) {
+ isp_get_24xx_response(isp, (isp24xx_statusreq_t *)hp, sp);
+ scsi_status = sp->req_scsi_status;
+ completion_status = sp->req_completion_status;
req_status_flags = 0;
if ((scsi_status & 0xff) != 0)
req_state_flags = RQSF_GOT_STATUS;
else
req_state_flags = 0;
- resid = sp2->req_resid;
- } else if (etype == RQSTYPE_RESPONSE) {
- isp_get_response(isp, (ispstatusreq_t *) hp, sp);
- scsi_status = sp->req_scsi_status;
- completion_status = sp->req_completion_status;
- req_status_flags = sp->req_status_flags;
- req_state_flags = sp->req_state_flags;
resid = sp->req_resid;
- } else if (etype == RQSTYPE_RIO1) {
- isp_rio1_t *rio = (isp_rio1_t *) qe;
- isp_get_rio1(isp, (isp_rio1_t *) hp, rio);
- for (i = 0; i < rio->req_header.rqs_seqno; i++) {
- isp_fastpost_complete(isp, rio->req_handles[i]);
- }
- ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */
- continue;
- } else if (etype == RQSTYPE_RIO2) {
- isp_prt(isp, ISP_LOGERR, "dropping RIO2 response");
- ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */
- continue;
} else if (etype == RQSTYPE_STATUS_CONT) {
ispstatus_cont_t *scp = (ispstatus_cont_t *)qe;
isp_get_cont_response(isp, (ispstatus_cont_t *)hp, scp);
@@ -5307,34 +3369,20 @@ isp_intr_respq(ispsoftc_t *isp)
resp = snsp = NULL;
rlen = slen = totslen = 0;
- if (IS_24XX(isp) && (scsi_status & (RQCS_RV|RQCS_SV)) != 0) {
- resp = sp2->req_rsp_sense;
- rlen = sp2->req_response_len;
- } else if (IS_FC(isp) && (scsi_status & RQCS_RV) != 0) {
- resp = sp->req_response;
+ if ((scsi_status & (RQCS_RV|RQCS_SV)) != 0) {
+ resp = sp->req_rsp_sense;
rlen = sp->req_response_len;
}
- if (IS_FC(isp) && (scsi_status & RQCS_SV) != 0) {
+ if ((scsi_status & RQCS_SV) != 0) {
/*
* Fibre Channel F/W doesn't say we got status
* if there's Sense Data instead. I guess they
* think it goes w/o saying.
*/
req_state_flags |= RQSF_GOT_STATUS|RQSF_GOT_SENSE;
- if (IS_24XX(isp)) {
- snsp = sp2->req_rsp_sense;
- snsp += rlen;
- totslen = sp2->req_sense_len;
- slen = sizeof(sp2->req_rsp_sense) - rlen;
- } else {
- snsp = sp->req_sense_data;
- totslen = sp->req_sense_len;
- slen = sizeof(sp->req_sense_data);
- }
- } else if (IS_SCSI(isp) && (req_state_flags & RQSF_GOT_SENSE)) {
- snsp = sp->req_sense_data;
+ snsp = sp->req_rsp_sense + rlen;
totslen = sp->req_sense_len;
- slen = sizeof (sp->req_sense_data);
+ slen = sizeof(sp->req_rsp_sense) - rlen;
}
if (slen > totslen)
slen = totslen;
@@ -5370,34 +3418,16 @@ isp_intr_respq(ispsoftc_t *isp)
if (code != 0 && code != 8)
XS_SETERR(xs, HBA_BOTCH);
}
- if (IS_24XX(isp))
- isp_parse_status_24xx(isp, sp2, xs, &resid);
- else
- isp_parse_status(isp, sp, xs, &resid);
+ isp_parse_status_24xx(isp, sp, xs, &resid);
if ((XS_NOERR(xs) || XS_ERR(xs) == HBA_NOERROR) &&
(*XS_STSP(xs) == SCSI_BUSY))
XS_SETERR(xs, HBA_TGTBSY);
- if (IS_SCSI(isp)) {
+ if (req_status_flags & RQSF_XFER_COMPLETE) {
+ XS_SET_RESID(xs, 0);
+ } else if (scsi_status & RQCS_RESID) {
XS_SET_RESID(xs, resid);
- /*
- * A new synchronous rate was negotiated for
- * this target. Mark state such that we'll go
- * look up that which has changed later.
- */
- if (req_status_flags & RQSTF_NEGOTIATION) {
- int t = XS_TGT(xs);
- sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs));
- sdp->isp_devparam[t].dev_refresh = 1;
- sdp->update = 1;
- }
} else {
- if (req_status_flags & RQSF_XFER_COMPLETE) {
- XS_SET_RESID(xs, 0);
- } else if (scsi_status & RQCS_RESID) {
- XS_SET_RESID(xs, resid);
- } else {
- XS_SET_RESID(xs, 0);
- }
+ XS_SET_RESID(xs, 0);
}
if (slen > 0) {
XS_SAVE_SENSE(xs, snsp, slen);
@@ -5429,197 +3459,27 @@ isp_intr_respq(ispsoftc_t *isp)
/* If we processed any IOCBs, let ISP know about it. */
if (optr != isp->isp_resodx) {
- ISP_WRITE(isp, isp->isp_respoutrp, optr);
+ ISP_WRITE(isp, BIU2400_RSPOUTP, optr);
isp->isp_resodx = optr;
}
}
-/*
- * Parse an ASYNC mailbox complete
- */
-static void
-isp_parse_async(ispsoftc_t *isp, uint16_t mbox)
-{
- uint32_t h1 = 0, h2 = 0;
- uint16_t chan = 0;
-
- /*
- * Pick up the channel, but not if this is a ASYNC_RIO32_2,
- * where Mailboxes 6/7 have the second handle.
- */
- if (mbox != ASYNC_RIO32_2) {
- if (IS_DUALBUS(isp)) {
- chan = ISP_READ(isp, OUTMAILBOX6);
- }
- }
- isp_prt(isp, ISP_LOGDEBUG2, "Async Mbox 0x%x", mbox);
-
- switch (mbox) {
- case ASYNC_BUS_RESET:
- ISP_SET_SENDMARKER(isp, chan, 1);
-#ifdef ISP_TARGET_MODE
- isp_target_async(isp, chan, mbox);
-#endif
- isp_async(isp, ISPASYNC_BUS_RESET, chan);
- break;
- case ASYNC_SYSTEM_ERROR:
- isp->isp_state = ISP_CRASHED;
- /*
- * Were we waiting for a mailbox command to complete?
- * If so, it's dead, so wake up the waiter.
- */
- if (isp->isp_mboxbsy) {
- isp->isp_obits = 1;
- isp->isp_mboxtmp[0] = MBOX_HOST_INTERFACE_ERROR;
- MBOX_NOTIFY_COMPLETE(isp);
- }
- /*
- * It's up to the handler for isp_async to reinit stuff and
- * restart the firmware
- */
- isp_async(isp, ISPASYNC_FW_CRASH);
- break;
-
- case ASYNC_RQS_XFER_ERR:
- isp_prt(isp, ISP_LOGERR, "Request Queue Transfer Error");
- break;
-
- case ASYNC_RSP_XFER_ERR:
- isp_prt(isp, ISP_LOGERR, "Response Queue Transfer Error");
- break;
-
- case ASYNC_QWAKEUP:
- /*
- * We've just been notified that the Queue has woken up.
- * We don't need to be chatty about this- just unlatch things
- * and move on.
- */
- mbox = ISP_READ(isp, isp->isp_rqstoutrp);
- break;
-
- case ASYNC_TIMEOUT_RESET:
- isp_prt(isp, ISP_LOGWARN, "timeout initiated SCSI bus reset of chan %d", chan);
- ISP_SET_SENDMARKER(isp, chan, 1);
-#ifdef ISP_TARGET_MODE
- isp_target_async(isp, chan, mbox);
-#endif
- break;
-
- case ASYNC_DEVICE_RESET:
- isp_prt(isp, ISP_LOGINFO, "device reset on chan %d", chan);
- ISP_SET_SENDMARKER(isp, chan, 1);
-#ifdef ISP_TARGET_MODE
- isp_target_async(isp, chan, mbox);
-#endif
- break;
-
- case ASYNC_EXTMSG_UNDERRUN:
- isp_prt(isp, ISP_LOGWARN, "extended message underrun");
- break;
-
- case ASYNC_SCAM_INT:
- isp_prt(isp, ISP_LOGINFO, "SCAM interrupt");
- break;
-
- case ASYNC_HUNG_SCSI:
- isp_prt(isp, ISP_LOGERR, "stalled SCSI Bus after DATA Overrun");
- /* XXX: Need to issue SCSI reset at this point */
- break;
-
- case ASYNC_KILLED_BUS:
- isp_prt(isp, ISP_LOGERR, "SCSI Bus reset after DATA Overrun");
- break;
-
- case ASYNC_BUS_TRANSIT:
- mbox = ISP_READ(isp, OUTMAILBOX2);
- switch (mbox & SXP_PINS_MODE_MASK) {
- case SXP_PINS_LVD_MODE:
- isp_prt(isp, ISP_LOGINFO, "Transition to LVD mode");
- SDPARAM(isp, chan)->isp_diffmode = 0;
- SDPARAM(isp, chan)->isp_ultramode = 0;
- SDPARAM(isp, chan)->isp_lvdmode = 1;
- break;
- case SXP_PINS_HVD_MODE:
- isp_prt(isp, ISP_LOGINFO,
- "Transition to Differential mode");
- SDPARAM(isp, chan)->isp_diffmode = 1;
- SDPARAM(isp, chan)->isp_ultramode = 0;
- SDPARAM(isp, chan)->isp_lvdmode = 0;
- break;
- case SXP_PINS_SE_MODE:
- isp_prt(isp, ISP_LOGINFO,
- "Transition to Single Ended mode");
- SDPARAM(isp, chan)->isp_diffmode = 0;
- SDPARAM(isp, chan)->isp_ultramode = 1;
- SDPARAM(isp, chan)->isp_lvdmode = 0;
- break;
- default:
- isp_prt(isp, ISP_LOGWARN,
- "Transition to Unknown Mode 0x%x", mbox);
- break;
- }
- /*
- * XXX: Set up to renegotiate again!
- */
- /* Can only be for a 1080... */
- ISP_SET_SENDMARKER(isp, chan, 1);
- break;
- case ASYNC_CMD_CMPLT:
- case ASYNC_RIO32_1:
- if (!IS_ULTRA3(isp)) {
- isp_prt(isp, ISP_LOGERR, "unexpected fast posting completion");
- break;
- }
- /* FALLTHROUGH */
- h1 = (ISP_READ(isp, OUTMAILBOX2) << 16) | ISP_READ(isp, OUTMAILBOX1);
- break;
-
- case ASYNC_RIO32_2:
- h1 = (ISP_READ(isp, OUTMAILBOX2) << 16) | ISP_READ(isp, OUTMAILBOX1);
- h2 = (ISP_READ(isp, OUTMAILBOX7) << 16) | ISP_READ(isp, OUTMAILBOX6);
- break;
-
- case ASYNC_RIO16_5:
- case ASYNC_RIO16_4:
- case ASYNC_RIO16_3:
- case ASYNC_RIO16_2:
- case ASYNC_RIO16_1:
- isp_prt(isp, ISP_LOGERR, "unexpected 16 bit RIO handle");
- break;
- default:
- isp_prt(isp, ISP_LOGWARN, "%s: unhandled async code 0x%x", __func__, mbox);
- break;
- }
-
- if (h1 || h2) {
- isp_prt(isp, ISP_LOGDEBUG3, "fast post/rio completion of 0x%08x", h1);
- isp_fastpost_complete(isp, h1);
- if (h2) {
- isp_prt(isp, ISP_LOGDEBUG3, "fast post/rio completion of 0x%08x", h2);
- isp_fastpost_complete(isp, h2);
- }
- }
-}
-
-static void
-isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox)
+void
+isp_intr_async(ispsoftc_t *isp, uint16_t mbox)
{
fcparam *fcp;
uint16_t chan;
- if (IS_DUALBUS(isp)) {
- chan = ISP_READ(isp, OUTMAILBOX6);
- } else {
- chan = 0;
- }
isp_prt(isp, ISP_LOGDEBUG2, "Async Mbox 0x%x", mbox);
switch (mbox) {
case ASYNC_SYSTEM_ERROR:
isp->isp_state = ISP_CRASHED;
- FCPARAM(isp, chan)->isp_loopstate = LOOP_NIL;
- isp_change_fw_state(isp, chan, FW_CONFIG_WAIT);
+ for (chan = 0; chan < isp->isp_nchan; chan++) {
+ FCPARAM(isp, chan)->isp_loopstate = LOOP_NIL;
+ isp_change_fw_state(isp, chan, FW_CONFIG_WAIT);
+ }
/*
* Were we waiting for a mailbox command to complete?
* If so, it's dead, so wake up the waiter.
@@ -5644,35 +3504,13 @@ isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox)
isp_prt(isp, ISP_LOGERR, "Response Queue Transfer Error");
break;
- case ASYNC_QWAKEUP:
-#ifdef ISP_TARGET_MODE
- if (IS_24XX(isp)) {
- isp_prt(isp, ISP_LOGERR, "ATIO Queue Transfer Error");
- break;
- }
-#endif
- isp_prt(isp, ISP_LOGERR, "%s: unexpected ASYNC_QWAKEUP code", __func__);
+ case ASYNC_ATIO_XFER_ERR:
+ isp_prt(isp, ISP_LOGERR, "ATIO Queue Transfer Error");
break;
- case ASYNC_CMD_CMPLT:
- isp_fastpost_complete(isp, (ISP_READ(isp, OUTMAILBOX2) << 16) | ISP_READ(isp, OUTMAILBOX1));
- break;
-
- case ASYNC_RIOZIO_STALL:
- isp_intr_respq(isp);
- break;
-
- case ASYNC_CTIO_DONE:
-#ifdef ISP_TARGET_MODE
- isp_target_async(isp, (ISP_READ(isp, OUTMAILBOX2) << 16) |
- ISP_READ(isp, OUTMAILBOX1), mbox);
-#else
- isp_prt(isp, ISP_LOGWARN, "unexpected ASYNC CTIO done");
-#endif
- break;
- case ASYNC_LIP_ERROR:
- case ASYNC_LIP_NOS_OLS_RECV:
case ASYNC_LIP_OCCURRED:
+ case ASYNC_LIP_NOS_OLS_RECV:
+ case ASYNC_LIP_ERROR:
case ASYNC_PTPMODE:
/*
* These are broadcast events that have to be sent across
@@ -5789,16 +3627,9 @@ isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox)
{
int echan, nphdl, nlstate, reason;
- if (IS_23XX(isp) || IS_24XX(isp)) {
- nphdl = ISP_READ(isp, OUTMAILBOX1);
- nlstate = ISP_READ(isp, OUTMAILBOX2);
- } else {
- nphdl = nlstate = 0xffff;
- }
- if (IS_24XX(isp))
- reason = ISP_READ(isp, OUTMAILBOX3) >> 8;
- else
- reason = 0xff;
+ nphdl = ISP_READ(isp, OUTMAILBOX1);
+ nlstate = ISP_READ(isp, OUTMAILBOX2);
+ reason = ISP_READ(isp, OUTMAILBOX3) >> 8;
if (ISP_CAP_MULTI_ID(isp)) {
chan = ISP_READ(isp, OUTMAILBOX3) & 0xff;
if (chan == 0xff || nphdl == NIL_HANDLE) {
@@ -5857,66 +3688,16 @@ isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox)
isp_prt(isp, ISP_LOGWARN, "Error logging disabled (reason 0x%x)",
ISP_READ(isp, OUTMAILBOX1));
break;
- case ASYNC_CONNMODE:
- /*
- * This only applies to 2100 amd 2200 cards
- */
- if (!IS_2200(isp) && !IS_2100(isp)) {
- isp_prt(isp, ISP_LOGWARN, "bad card for ASYNC_CONNMODE event");
- break;
- }
- chan = 0;
- mbox = ISP_READ(isp, OUTMAILBOX1);
- switch (mbox) {
- case ISP_CONN_LOOP:
- isp_prt(isp, ISP_LOGINFO,
- "Point-to-Point -> Loop mode");
- break;
- case ISP_CONN_PTP:
- isp_prt(isp, ISP_LOGINFO,
- "Loop -> Point-to-Point mode");
- break;
- case ISP_CONN_BADLIP:
- isp_prt(isp, ISP_LOGWARN,
- "Point-to-Point -> Loop mode (BAD LIP)");
- break;
- case ISP_CONN_FATAL:
- isp->isp_state = ISP_CRASHED;
- isp_prt(isp, ISP_LOGERR, "FATAL CONNECTION ERROR");
- isp_async(isp, ISPASYNC_FW_CRASH);
- return;
- case ISP_CONN_LOOPBACK:
- isp_prt(isp, ISP_LOGWARN,
- "Looped Back in Point-to-Point mode");
- break;
- default:
- isp_prt(isp, ISP_LOGWARN,
- "Unknown connection mode (0x%x)", mbox);
- break;
- }
- ISP_SET_SENDMARKER(isp, chan, 1);
- FCPARAM(isp, chan)->isp_loopstate = LOOP_HAVE_LINK;
- isp_async(isp, ISPASYNC_CHANGE_NOTIFY, chan, ISPASYNC_CHANGE_OTHER);
- break;
case ASYNC_P2P_INIT_ERR:
isp_prt(isp, ISP_LOGWARN, "P2P init error (reason 0x%x)",
ISP_READ(isp, OUTMAILBOX1));
break;
case ASYNC_RCV_ERR:
- if (IS_24XX(isp)) {
- isp_prt(isp, ISP_LOGWARN, "Receive Error");
- } else {
- isp_prt(isp, ISP_LOGWARN, "unexpected ASYNC_RCV_ERR");
- }
+ isp_prt(isp, ISP_LOGWARN, "Receive Error");
break;
case ASYNC_RJT_SENT: /* same as ASYNC_QFULL_SENT */
- if (IS_24XX(isp)) {
- isp_prt(isp, ISP_LOGTDEBUG0, "LS_RJT sent");
- break;
- } else {
- isp_prt(isp, ISP_LOGTDEBUG0, "QFULL sent");
- break;
- }
+ isp_prt(isp, ISP_LOGTDEBUG0, "LS_RJT sent");
+ break;
case ASYNC_FW_RESTART_COMPLETE:
isp_prt(isp, ISP_LOGDEBUG0, "FW restart complete");
break;
@@ -5961,7 +3742,7 @@ isp_handle_other_response(ispsoftc_t *isp, int type, isphdr_t *hp, uint32_t *opt
case RQSTYPE_MARKER:
isp_prt(isp, ISP_LOG_WARN1, "Marker Response");
return (1);
- case RQSTYPE_RPT_ID_ACQ:
+ case RQSTYPE_RPT_ID_ACQ: /* Can be set to ATIO queue.*/
isp_get_ridacq(isp, (isp_ridacq_t *)hp, &rid);
portid = (uint32_t)rid.ridacq_vp_port_hi << 16 |
rid.ridacq_vp_port_lo;
@@ -6010,356 +3791,20 @@ isp_handle_other_response(ispsoftc_t *isp, int type, isphdr_t *hp, uint32_t *opt
wakeup(ptr);
}
return (1);
- case RQSTYPE_ATIO:
- case RQSTYPE_CTIO:
- case RQSTYPE_NOTIFY:
- case RQSTYPE_NOTIFY_ACK:
- case RQSTYPE_CTIO1:
- case RQSTYPE_ATIO2:
- case RQSTYPE_CTIO2:
- case RQSTYPE_CTIO3:
+ case RQSTYPE_NOTIFY_ACK: /* Can be set to ATIO queue. */
case RQSTYPE_CTIO7:
- case RQSTYPE_ABTS_RCVD:
+ case RQSTYPE_ABTS_RCVD: /* Can be set to ATIO queue. */
case RQSTYPE_ABTS_RSP:
#ifdef ISP_TARGET_MODE
- return (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp));
+ return (isp_target_notify(isp, hp, optrp));
#endif
/* FALLTHROUGH */
- case RQSTYPE_REQUEST:
default:
return (0);
}
}
static void
-isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, uint32_t *rp)
-{
- switch (sp->req_completion_status & 0xff) {
- case RQCS_COMPLETE:
- if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_NOERROR);
- }
- return;
-
- case RQCS_INCOMPLETE:
- if ((sp->req_state_flags & RQSF_GOT_TARGET) == 0) {
- isp_xs_prt(isp, xs, ISP_LOG_WARN1, "Selection Timeout @ %s:%d", __func__, __LINE__);
- if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_SELTIMEOUT);
- *rp = XS_XFRLEN(xs);
- }
- return;
- }
- isp_xs_prt(isp, xs, ISP_LOGERR, "Command Incomplete, state 0x%x", sp->req_state_flags);
- break;
-
- case RQCS_DMA_ERROR:
- isp_xs_prt(isp, xs, ISP_LOGERR, "DMA Error");
- *rp = XS_XFRLEN(xs);
- break;
-
- case RQCS_TRANSPORT_ERROR:
- {
- char buf[172];
- ISP_SNPRINTF(buf, sizeof (buf), "states=>");
- if (sp->req_state_flags & RQSF_GOT_BUS) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s GOT_BUS", buf);
- }
- if (sp->req_state_flags & RQSF_GOT_TARGET) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s GOT_TGT", buf);
- }
- if (sp->req_state_flags & RQSF_SENT_CDB) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s SENT_CDB", buf);
- }
- if (sp->req_state_flags & RQSF_XFRD_DATA) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s XFRD_DATA", buf);
- }
- if (sp->req_state_flags & RQSF_GOT_STATUS) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s GOT_STS", buf);
- }
- if (sp->req_state_flags & RQSF_GOT_SENSE) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s GOT_SNS", buf);
- }
- if (sp->req_state_flags & RQSF_XFER_COMPLETE) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s XFR_CMPLT", buf);
- }
- ISP_SNPRINTF(buf, sizeof (buf), "%s\nstatus=>", buf);
- if (sp->req_status_flags & RQSTF_DISCONNECT) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s Disconnect", buf);
- }
- if (sp->req_status_flags & RQSTF_SYNCHRONOUS) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s Sync_xfr", buf);
- }
- if (sp->req_status_flags & RQSTF_PARITY_ERROR) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s Parity", buf);
- }
- if (sp->req_status_flags & RQSTF_BUS_RESET) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s Bus_Reset", buf);
- }
- if (sp->req_status_flags & RQSTF_DEVICE_RESET) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s Device_Reset", buf);
- }
- if (sp->req_status_flags & RQSTF_ABORTED) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s Aborted", buf);
- }
- if (sp->req_status_flags & RQSTF_TIMEOUT) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s Timeout", buf);
- }
- if (sp->req_status_flags & RQSTF_NEGOTIATION) {
- ISP_SNPRINTF(buf, sizeof (buf), "%s Negotiation", buf);
- }
- isp_xs_prt(isp, xs, ISP_LOGERR, "Transport Error: %s", buf);
- *rp = XS_XFRLEN(xs);
- break;
- }
- case RQCS_RESET_OCCURRED:
- {
- int chan;
- isp_xs_prt(isp, xs, ISP_LOGWARN, "Bus Reset destroyed command");
- for (chan = 0; chan < isp->isp_nchan; chan++) {
- FCPARAM(isp, chan)->sendmarker = 1;
- }
- if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_BUSRESET);
- }
- *rp = XS_XFRLEN(xs);
- return;
- }
- case RQCS_ABORTED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "Command Aborted");
- ISP_SET_SENDMARKER(isp, XS_CHANNEL(xs), 1);
- if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_ABORTED);
- }
- return;
-
- case RQCS_TIMEOUT:
- isp_xs_prt(isp, xs, ISP_LOGWARN, "Command timed out");
- /*
- * XXX: Check to see if we logged out of the device.
- */
- if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_CMDTIMEOUT);
- }
- return;
-
- case RQCS_DATA_OVERRUN:
- XS_SET_RESID(xs, sp->req_resid);
- isp_xs_prt(isp, xs, ISP_LOGERR, "data overrun (%ld)", (long) XS_GET_RESID(xs));
- if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_DATAOVR);
- }
- return;
-
- case RQCS_COMMAND_OVERRUN:
- isp_xs_prt(isp, xs, ISP_LOGERR, "command overrun");
- break;
-
- case RQCS_STATUS_OVERRUN:
- isp_xs_prt(isp, xs, ISP_LOGERR, "status overrun");
- break;
-
- case RQCS_BAD_MESSAGE:
- isp_xs_prt(isp, xs, ISP_LOGERR, "msg not COMMAND COMPLETE after status");
- break;
-
- case RQCS_NO_MESSAGE_OUT:
- isp_xs_prt(isp, xs, ISP_LOGERR, "No MESSAGE OUT phase after selection");
- break;
-
- case RQCS_EXT_ID_FAILED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "EXTENDED IDENTIFY failed");
- break;
-
- case RQCS_IDE_MSG_FAILED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "INITIATOR DETECTED ERROR rejected");
- break;
-
- case RQCS_ABORT_MSG_FAILED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "ABORT OPERATION rejected");
- break;
-
- case RQCS_REJECT_MSG_FAILED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "MESSAGE REJECT rejected");
- break;
-
- case RQCS_NOP_MSG_FAILED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "NOP rejected");
- break;
-
- case RQCS_PARITY_ERROR_MSG_FAILED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "MESSAGE PARITY ERROR rejected");
- break;
-
- case RQCS_DEVICE_RESET_MSG_FAILED:
- isp_xs_prt(isp, xs, ISP_LOGWARN, "BUS DEVICE RESET rejected");
- break;
-
- case RQCS_ID_MSG_FAILED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "IDENTIFY rejected");
- break;
-
- case RQCS_UNEXP_BUS_FREE:
- isp_xs_prt(isp, xs, ISP_LOGERR, "Unexpected Bus Free");
- break;
-
- case RQCS_DATA_UNDERRUN:
- {
- if (IS_FC(isp)) {
- int ru_marked = (sp->req_scsi_status & RQCS_RU) != 0;
- if (!ru_marked || sp->req_resid > XS_XFRLEN(xs)) {
- isp_xs_prt(isp, xs, ISP_LOGWARN, bun, XS_XFRLEN(xs), sp->req_resid, (ru_marked)? "marked" : "not marked");
- if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_BOTCH);
- }
- return;
- }
- }
- XS_SET_RESID(xs, sp->req_resid);
- if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_NOERROR);
- }
- return;
- }
-
- case RQCS_XACT_ERR1:
- isp_xs_prt(isp, xs, ISP_LOGERR, "HBA attempted queued transaction with disconnect not set");
- break;
-
- case RQCS_XACT_ERR2:
- isp_xs_prt(isp, xs, ISP_LOGERR,
- "HBA attempted queued transaction to target routine %jx",
- (uintmax_t)XS_LUN(xs));
- break;
-
- case RQCS_XACT_ERR3:
- isp_xs_prt(isp, xs, ISP_LOGERR, "HBA attempted queued cmd when queueing disabled");
- break;
-
- case RQCS_BAD_ENTRY:
- isp_prt(isp, ISP_LOGERR, "Invalid IOCB entry type detected");
- break;
-
- case RQCS_QUEUE_FULL:
- isp_xs_prt(isp, xs, ISP_LOG_WARN1, "internal queues full status 0x%x", *XS_STSP(xs));
-
- /*
- * If QFULL or some other status byte is set, then this
- * isn't an error, per se.
- *
- * Unfortunately, some QLogic f/w writers have, in
- * some cases, omitted to *set* status to QFULL.
- */
-#if 0
- if (*XS_STSP(xs) != SCSI_GOOD && XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_NOERROR);
- return;
- }
-
-#endif
- *XS_STSP(xs) = SCSI_QFULL;
- XS_SETERR(xs, HBA_NOERROR);
- return;
-
- case RQCS_PHASE_SKIPPED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "SCSI phase skipped");
- break;
-
- case RQCS_ARQS_FAILED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "Auto Request Sense Failed");
- if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_ARQFAIL);
- }
- return;
-
- case RQCS_WIDE_FAILED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "Wide Negotiation Failed");
- if (IS_SCSI(isp)) {
- sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs));
- sdp->isp_devparam[XS_TGT(xs)].goal_flags &= ~DPARM_WIDE;
- sdp->isp_devparam[XS_TGT(xs)].dev_update = 1;
- sdp->update = 1;
- }
- if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_NOERROR);
- }
- return;
-
- case RQCS_SYNCXFER_FAILED:
- isp_xs_prt(isp, xs, ISP_LOGERR, "SDTR Message Failed");
- if (IS_SCSI(isp)) {
- sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs));
- sdp += XS_CHANNEL(xs);
- sdp->isp_devparam[XS_TGT(xs)].goal_flags &= ~DPARM_SYNC;
- sdp->isp_devparam[XS_TGT(xs)].dev_update = 1;
- sdp->update = 1;
- }
- break;
-
- case RQCS_LVD_BUSERR:
- isp_xs_prt(isp, xs, ISP_LOGERR, "Bad LVD condition");
- break;
-
- case RQCS_PORT_UNAVAILABLE:
- /*
- * No such port on the loop. Moral equivalent of SELTIMEO
- */
- case RQCS_PORT_LOGGED_OUT:
- {
- const char *reason;
- uint8_t sts = sp->req_completion_status & 0xff;
- fcparam *fcp = FCPARAM(isp, 0);
- fcportdb_t *lp;
-
- /*
- * It was there (maybe)- treat as a selection timeout.
- */
- if (sts == RQCS_PORT_UNAVAILABLE) {
- reason = "unavailable";
- } else {
- reason = "logout";
- }
-
- isp_prt(isp, ISP_LOGINFO, "port %s for target %d", reason, XS_TGT(xs));
-
- /* XXX: Should we trigger rescan or FW announce change? */
-
- if (XS_NOERR(xs)) {
- lp = &fcp->portdb[XS_TGT(xs)];
- if (lp->state == FC_PORTDB_STATE_ZOMBIE) {
- *XS_STSP(xs) = SCSI_BUSY;
- XS_SETERR(xs, HBA_TGTBSY);
- } else
- XS_SETERR(xs, HBA_SELTIMEOUT);
- }
- return;
- }
- case RQCS_PORT_CHANGED:
- isp_prt(isp, ISP_LOGWARN, "port changed for target %d", XS_TGT(xs));
- if (XS_NOERR(xs)) {
- *XS_STSP(xs) = SCSI_BUSY;
- XS_SETERR(xs, HBA_TGTBSY);
- }
- return;
-
- case RQCS_PORT_BUSY:
- isp_prt(isp, ISP_LOGWARN, "port busy for target %d", XS_TGT(xs));
- if (XS_NOERR(xs)) {
- *XS_STSP(xs) = SCSI_BUSY;
- XS_SETERR(xs, HBA_TGTBSY);
- }
- return;
-
- default:
- isp_prt(isp, ISP_LOGERR, "Unknown Completion Status 0x%x", sp->req_completion_status);
- break;
- }
- if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_BOTCH);
- }
-}
-
-static void
isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, XS_T *xs, uint32_t *rp)
{
int ru_marked, sv_marked;
@@ -6516,233 +3961,6 @@ isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, XS_T *xs, uint32
}
}
-static void
-isp_fastpost_complete(ispsoftc_t *isp, uint32_t fph)
-{
- XS_T *xs;
-
- if (fph == 0) {
- return;
- }
- xs = isp_find_xs(isp, fph);
- if (xs == NULL) {
- isp_prt(isp, ISP_LOGWARN,
- "Command for fast post handle 0x%x not found", fph);
- return;
- }
- isp_destroy_handle(isp, fph);
-
- /*
- * Since we don't have a result queue entry item,
- * we must believe that SCSI status is zero and
- * that all data transferred.
- */
- XS_SET_RESID(xs, 0);
- *XS_STSP(xs) = SCSI_GOOD;
- if (XS_XFRLEN(xs)) {
- ISP_DMAFREE(isp, xs, fph);
- }
- isp_done(xs);
-}
-
-#define ISP_SCSI_IBITS(op) (mbpscsi[((op)<<1)])
-#define ISP_SCSI_OBITS(op) (mbpscsi[((op)<<1) + 1])
-#define ISP_SCSI_OPMAP(in, out) in, out
-static const uint8_t mbpscsi[] = {
- ISP_SCSI_OPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */
- ISP_SCSI_OPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */
- ISP_SCSI_OPMAP(0x03, 0x01), /* 0x02: MBOX_EXEC_FIRMWARE */
- ISP_SCSI_OPMAP(0x1f, 0x01), /* 0x03: MBOX_DUMP_RAM */
- ISP_SCSI_OPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */
- ISP_SCSI_OPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */
- ISP_SCSI_OPMAP(0x3f, 0x3f), /* 0x06: MBOX_MAILBOX_REG_TEST */
- ISP_SCSI_OPMAP(0x07, 0x07), /* 0x07: MBOX_VERIFY_CHECKSUM */
- ISP_SCSI_OPMAP(0x01, 0x0f), /* 0x08: MBOX_ABOUT_FIRMWARE */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x09: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x0a: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x0b: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x0c: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x0d: */
- ISP_SCSI_OPMAP(0x01, 0x05), /* 0x0e: MBOX_CHECK_FIRMWARE */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x0f: */
- ISP_SCSI_OPMAP(0x1f, 0x1f), /* 0x10: MBOX_INIT_REQ_QUEUE */
- ISP_SCSI_OPMAP(0x3f, 0x3f), /* 0x11: MBOX_INIT_RES_QUEUE */
- ISP_SCSI_OPMAP(0x0f, 0x0f), /* 0x12: MBOX_EXECUTE_IOCB */
- ISP_SCSI_OPMAP(0x03, 0x03), /* 0x13: MBOX_WAKE_UP */
- ISP_SCSI_OPMAP(0x01, 0x3f), /* 0x14: MBOX_STOP_FIRMWARE */
- ISP_SCSI_OPMAP(0x0f, 0x0f), /* 0x15: MBOX_ABORT */
- ISP_SCSI_OPMAP(0x03, 0x03), /* 0x16: MBOX_ABORT_DEVICE */
- ISP_SCSI_OPMAP(0x07, 0x07), /* 0x17: MBOX_ABORT_TARGET */
- ISP_SCSI_OPMAP(0x07, 0x07), /* 0x18: MBOX_BUS_RESET */
- ISP_SCSI_OPMAP(0x03, 0x07), /* 0x19: MBOX_STOP_QUEUE */
- ISP_SCSI_OPMAP(0x03, 0x07), /* 0x1a: MBOX_START_QUEUE */
- ISP_SCSI_OPMAP(0x03, 0x07), /* 0x1b: MBOX_SINGLE_STEP_QUEUE */
- ISP_SCSI_OPMAP(0x03, 0x07), /* 0x1c: MBOX_ABORT_QUEUE */
- ISP_SCSI_OPMAP(0x03, 0x4f), /* 0x1d: MBOX_GET_DEV_QUEUE_STATUS */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x1e: */
- ISP_SCSI_OPMAP(0x01, 0x07), /* 0x1f: MBOX_GET_FIRMWARE_STATUS */
- ISP_SCSI_OPMAP(0x01, 0x07), /* 0x20: MBOX_GET_INIT_SCSI_ID */
- ISP_SCSI_OPMAP(0x01, 0x07), /* 0x21: MBOX_GET_SELECT_TIMEOUT */
- ISP_SCSI_OPMAP(0x01, 0xc7), /* 0x22: MBOX_GET_RETRY_COUNT */
- ISP_SCSI_OPMAP(0x01, 0x07), /* 0x23: MBOX_GET_TAG_AGE_LIMIT */
- ISP_SCSI_OPMAP(0x01, 0x03), /* 0x24: MBOX_GET_CLOCK_RATE */
- ISP_SCSI_OPMAP(0x01, 0x07), /* 0x25: MBOX_GET_ACT_NEG_STATE */
- ISP_SCSI_OPMAP(0x01, 0x07), /* 0x26: MBOX_GET_ASYNC_DATA_SETUP_TIME */
- ISP_SCSI_OPMAP(0x01, 0x07), /* 0x27: MBOX_GET_PCI_PARAMS */
- ISP_SCSI_OPMAP(0x03, 0x4f), /* 0x28: MBOX_GET_TARGET_PARAMS */
- ISP_SCSI_OPMAP(0x03, 0x0f), /* 0x29: MBOX_GET_DEV_QUEUE_PARAMS */
- ISP_SCSI_OPMAP(0x01, 0x07), /* 0x2a: MBOX_GET_RESET_DELAY_PARAMS */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x2b: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x2c: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x2d: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x2e: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x2f: */
- ISP_SCSI_OPMAP(0x03, 0x03), /* 0x30: MBOX_SET_INIT_SCSI_ID */
- ISP_SCSI_OPMAP(0x07, 0x07), /* 0x31: MBOX_SET_SELECT_TIMEOUT */
- ISP_SCSI_OPMAP(0xc7, 0xc7), /* 0x32: MBOX_SET_RETRY_COUNT */
- ISP_SCSI_OPMAP(0x07, 0x07), /* 0x33: MBOX_SET_TAG_AGE_LIMIT */
- ISP_SCSI_OPMAP(0x03, 0x03), /* 0x34: MBOX_SET_CLOCK_RATE */
- ISP_SCSI_OPMAP(0x07, 0x07), /* 0x35: MBOX_SET_ACT_NEG_STATE */
- ISP_SCSI_OPMAP(0x07, 0x07), /* 0x36: MBOX_SET_ASYNC_DATA_SETUP_TIME */
- ISP_SCSI_OPMAP(0x07, 0x07), /* 0x37: MBOX_SET_PCI_CONTROL_PARAMS */
- ISP_SCSI_OPMAP(0x4f, 0x4f), /* 0x38: MBOX_SET_TARGET_PARAMS */
- ISP_SCSI_OPMAP(0x0f, 0x0f), /* 0x39: MBOX_SET_DEV_QUEUE_PARAMS */
- ISP_SCSI_OPMAP(0x07, 0x07), /* 0x3a: MBOX_SET_RESET_DELAY_PARAMS */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x3b: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x3c: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x3d: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x3e: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x3f: */
- ISP_SCSI_OPMAP(0x01, 0x03), /* 0x40: MBOX_RETURN_BIOS_BLOCK_ADDR */
- ISP_SCSI_OPMAP(0x3f, 0x01), /* 0x41: MBOX_WRITE_FOUR_RAM_WORDS */
- ISP_SCSI_OPMAP(0x03, 0x07), /* 0x42: MBOX_EXEC_BIOS_IOCB */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x43: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x44: */
- ISP_SCSI_OPMAP(0x03, 0x03), /* 0x45: SET SYSTEM PARAMETER */
- ISP_SCSI_OPMAP(0x01, 0x03), /* 0x46: GET SYSTEM PARAMETER */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x47: */
- ISP_SCSI_OPMAP(0x01, 0xcf), /* 0x48: GET SCAM CONFIGURATION */
- ISP_SCSI_OPMAP(0xcf, 0xcf), /* 0x49: SET SCAM CONFIGURATION */
- ISP_SCSI_OPMAP(0x03, 0x03), /* 0x4a: MBOX_SET_FIRMWARE_FEATURES */
- ISP_SCSI_OPMAP(0x01, 0x03), /* 0x4b: MBOX_GET_FIRMWARE_FEATURES */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x4c: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x4d: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x4e: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x4f: */
- ISP_SCSI_OPMAP(0xdf, 0xdf), /* 0x50: LOAD RAM A64 */
- ISP_SCSI_OPMAP(0xdf, 0xdf), /* 0x51: DUMP RAM A64 */
- ISP_SCSI_OPMAP(0xdf, 0xff), /* 0x52: INITIALIZE REQUEST QUEUE A64 */
- ISP_SCSI_OPMAP(0xef, 0xff), /* 0x53: INITIALIZE RESPONSE QUEUE A64 */
- ISP_SCSI_OPMAP(0xcf, 0x01), /* 0x54: EXECUCUTE COMMAND IOCB A64 */
- ISP_SCSI_OPMAP(0x07, 0x01), /* 0x55: ENABLE TARGET MODE */
- ISP_SCSI_OPMAP(0x03, 0x0f), /* 0x56: GET TARGET STATUS */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x57: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x58: */
- ISP_SCSI_OPMAP(0x00, 0x00), /* 0x59: */
- ISP_SCSI_OPMAP(0x03, 0x03), /* 0x5a: SET DATA OVERRUN RECOVERY MODE */
- ISP_SCSI_OPMAP(0x01, 0x03), /* 0x5b: GET DATA OVERRUN RECOVERY MODE */
- ISP_SCSI_OPMAP(0x0f, 0x0f), /* 0x5c: SET HOST DATA */
- ISP_SCSI_OPMAP(0x01, 0x01) /* 0x5d: GET NOST DATA */
-};
-#define MAX_SCSI_OPCODE 0x5d
-
-static const char *scsi_mbcmd_names[] = {
- "NO-OP",
- "LOAD RAM",
- "EXEC FIRMWARE",
- "DUMP RAM",
- "WRITE RAM WORD",
- "READ RAM WORD",
- "MAILBOX REG TEST",
- "VERIFY CHECKSUM",
- "ABOUT FIRMWARE",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "CHECK FIRMWARE",
- NULL,
- "INIT REQUEST QUEUE",
- "INIT RESULT QUEUE",
- "EXECUTE IOCB",
- "WAKE UP",
- "STOP FIRMWARE",
- "ABORT",
- "ABORT DEVICE",
- "ABORT TARGET",
- "BUS RESET",
- "STOP QUEUE",
- "START QUEUE",
- "SINGLE STEP QUEUE",
- "ABORT QUEUE",
- "GET DEV QUEUE STATUS",
- NULL,
- "GET FIRMWARE STATUS",
- "GET INIT SCSI ID",
- "GET SELECT TIMEOUT",
- "GET RETRY COUNT",
- "GET TAG AGE LIMIT",
- "GET CLOCK RATE",
- "GET ACT NEG STATE",
- "GET ASYNC DATA SETUP TIME",
- "GET PCI PARAMS",
- "GET TARGET PARAMS",
- "GET DEV QUEUE PARAMS",
- "GET RESET DELAY PARAMS",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "SET INIT SCSI ID",
- "SET SELECT TIMEOUT",
- "SET RETRY COUNT",
- "SET TAG AGE LIMIT",
- "SET CLOCK RATE",
- "SET ACT NEG STATE",
- "SET ASYNC DATA SETUP TIME",
- "SET PCI CONTROL PARAMS",
- "SET TARGET PARAMS",
- "SET DEV QUEUE PARAMS",
- "SET RESET DELAY PARAMS",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "RETURN BIOS BLOCK ADDR",
- "WRITE FOUR RAM WORDS",
- "EXEC BIOS IOCB",
- NULL,
- NULL,
- "SET SYSTEM PARAMETER",
- "GET SYSTEM PARAMETER",
- NULL,
- "GET SCAM CONFIGURATION",
- "SET SCAM CONFIGURATION",
- "SET FIRMWARE FEATURES",
- "GET FIRMWARE FEATURES",
- NULL,
- NULL,
- NULL,
- NULL,
- "LOAD RAM A64",
- "DUMP RAM A64",
- "INITIALIZE REQUEST QUEUE A64",
- "INITIALIZE RESPONSE QUEUE A64",
- "EXECUTE IOCB A64",
- "ENABLE TARGET MODE",
- "GET TARGET MODE STATE",
- NULL,
- NULL,
- NULL,
- "SET DATA OVERRUN RECOVERY MODE",
- "GET DATA OVERRUN RECOVERY MODE",
- "SET HOST DATA",
- "GET NOST DATA",
-};
-
#define ISP_FC_IBITS(op) ((mbpfc[((op)<<3) + 0] << 24) | (mbpfc[((op)<<3) + 1] << 16) | (mbpfc[((op)<<3) + 2] << 8) | (mbpfc[((op)<<3) + 3]))
#define ISP_FC_OBITS(op) ((mbpfc[((op)<<3) + 4] << 24) | (mbpfc[((op)<<3) + 5] << 16) | (mbpfc[((op)<<3) + 6] << 8) | (mbpfc[((op)<<3) + 7]))
@@ -7026,25 +4244,14 @@ isp_mboxcmd(ispsoftc_t *isp, mbreg_t *mbp)
unsigned int ibits, obits, box, opcode;
opcode = mbp->param[0];
- if (IS_FC(isp)) {
- if (opcode > MAX_FC_OPCODE) {
- mbp->param[0] = MBOX_INVALID_COMMAND;
- isp_prt(isp, ISP_LOGERR, "Unknown Command 0x%x", opcode);
- return;
- }
- cname = fc_mbcmd_names[opcode];
- ibits = ISP_FC_IBITS(opcode);
- obits = ISP_FC_OBITS(opcode);
- } else {
- if (opcode > MAX_SCSI_OPCODE) {
- mbp->param[0] = MBOX_INVALID_COMMAND;
- isp_prt(isp, ISP_LOGERR, "Unknown Command 0x%x", opcode);
- return;
- }
- cname = scsi_mbcmd_names[opcode];
- ibits = ISP_SCSI_IBITS(opcode);
- obits = ISP_SCSI_OBITS(opcode);
+ if (opcode > MAX_FC_OPCODE) {
+ mbp->param[0] = MBOX_INVALID_COMMAND;
+ isp_prt(isp, ISP_LOGERR, "Unknown Command 0x%x", opcode);
+ return;
}
+ cname = fc_mbcmd_names[opcode];
+ ibits = ISP_FC_IBITS(opcode);
+ obits = ISP_FC_OBITS(opcode);
if (cname == NULL) {
cname = tname;
ISP_SNPRINTF(tname, sizeof tname, "opcode %x", opcode);
@@ -7098,11 +4305,7 @@ isp_mboxcmd(ispsoftc_t *isp, mbreg_t *mbp)
/*
* Set Host Interrupt condition so that RISC will pick up mailbox regs.
*/
- if (IS_24XX(isp)) {
- ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_SET_HOST_INT);
- } else {
- ISP_WRITE(isp, HCCR, HCCR_CMD_SET_HOST_INT);
- }
+ ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_SET_HOST_INT);
/*
* While we haven't finished the command, spin our wheels here.
@@ -7204,267 +4407,13 @@ out:
static int
isp_fw_state(ispsoftc_t *isp, int chan)
{
- if (IS_FC(isp)) {
- mbreg_t mbs;
-
- MBSINIT(&mbs, MBOX_GET_FW_STATE, MBLOGALL, 0);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
- return (mbs.param[1]);
- }
- }
- return (FW_ERROR);
-}
-
-static void
-isp_spi_update(ispsoftc_t *isp, int chan)
-{
- int tgt;
mbreg_t mbs;
- sdparam *sdp;
-
- if (IS_FC(isp)) {
- /*
- * There are no 'per-bus' settings for Fibre Channel.
- */
- return;
- }
- sdp = SDPARAM(isp, chan);
- sdp->update = 0;
-
- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
- uint16_t flags, period, offset;
- int get;
-
- if (sdp->isp_devparam[tgt].dev_enable == 0) {
- sdp->isp_devparam[tgt].dev_update = 0;
- sdp->isp_devparam[tgt].dev_refresh = 0;
- isp_prt(isp, ISP_LOGDEBUG0, "skipping target %d bus %d update", tgt, chan);
- continue;
- }
- /*
- * If the goal is to update the status of the device,
- * take what's in goal_flags and try and set the device
- * toward that. Otherwise, if we're just refreshing the
- * current device state, get the current parameters.
- */
-
- MBSINIT(&mbs, 0, MBLOGALL, 0);
-
- /*
- * Refresh overrides set
- */
- if (sdp->isp_devparam[tgt].dev_refresh) {
- mbs.param[0] = MBOX_GET_TARGET_PARAMS;
- get = 1;
- } else if (sdp->isp_devparam[tgt].dev_update) {
- mbs.param[0] = MBOX_SET_TARGET_PARAMS;
-
- /*
- * Make sure goal_flags has "Renegotiate on Error"
- * on and "Freeze Queue on Error" off.
- */
- sdp->isp_devparam[tgt].goal_flags |= DPARM_RENEG;
- sdp->isp_devparam[tgt].goal_flags &= ~DPARM_QFRZ;
- mbs.param[2] = sdp->isp_devparam[tgt].goal_flags;
-
- /*
- * Insist that PARITY must be enabled
- * if SYNC or WIDE is enabled.
- */
- if ((mbs.param[2] & (DPARM_SYNC|DPARM_WIDE)) != 0) {
- mbs.param[2] |= DPARM_PARITY;
- }
-
- if (mbs.param[2] & DPARM_SYNC) {
- mbs.param[3] =
- (sdp->isp_devparam[tgt].goal_offset << 8) |
- (sdp->isp_devparam[tgt].goal_period);
- }
- /*
- * A command completion later that has
- * RQSTF_NEGOTIATION set can cause
- * the dev_refresh/announce cycle also.
- *
- * Note: It is really important to update our current
- * flags with at least the state of TAG capabilities-
- * otherwise we might try and send a tagged command
- * when we have it all turned off. So change it here
- * to say that current already matches goal.
- */
- sdp->isp_devparam[tgt].actv_flags &= ~DPARM_TQING;
- sdp->isp_devparam[tgt].actv_flags |=
- (sdp->isp_devparam[tgt].goal_flags & DPARM_TQING);
- isp_prt(isp, ISP_LOGDEBUG0, "bus %d set tgt %d flags 0x%x off 0x%x period 0x%x",
- chan, tgt, mbs.param[2], mbs.param[3] >> 8, mbs.param[3] & 0xff);
- get = 0;
- } else {
- continue;
- }
- mbs.param[1] = (chan << 15) | (tgt << 8);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- continue;
- }
- if (get == 0) {
- sdp->sendmarker = 1;
- sdp->isp_devparam[tgt].dev_update = 0;
- sdp->isp_devparam[tgt].dev_refresh = 1;
- } else {
- sdp->isp_devparam[tgt].dev_refresh = 0;
- flags = mbs.param[2];
- period = mbs.param[3] & 0xff;
- offset = mbs.param[3] >> 8;
- sdp->isp_devparam[tgt].actv_flags = flags;
- sdp->isp_devparam[tgt].actv_period = period;
- sdp->isp_devparam[tgt].actv_offset = offset;
- isp_async(isp, ISPASYNC_NEW_TGT_PARAMS, chan, tgt);
- }
- }
-
- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
- if (sdp->isp_devparam[tgt].dev_update ||
- sdp->isp_devparam[tgt].dev_refresh) {
- sdp->update = 1;
- break;
- }
- }
-}
-
-static void
-isp_setdfltsdparm(ispsoftc_t *isp)
-{
- int tgt;
- sdparam *sdp, *sdp1;
-
- sdp = SDPARAM(isp, 0);
- if (IS_DUALBUS(isp))
- sdp1 = sdp + 1;
- else
- sdp1 = NULL;
-
- /*
- * Establish some default parameters.
- */
- sdp->isp_cmd_dma_burst_enable = 0;
- sdp->isp_data_dma_burst_enabl = 1;
- sdp->isp_fifo_threshold = 0;
- sdp->isp_initiator_id = DEFAULT_IID(isp, 0);
- if (isp->isp_type >= ISP_HA_SCSI_1040) {
- sdp->isp_async_data_setup = 9;
- } else {
- sdp->isp_async_data_setup = 6;
- }
- sdp->isp_selection_timeout = 250;
- sdp->isp_max_queue_depth = MAXISPREQUEST(isp);
- sdp->isp_tag_aging = 8;
- sdp->isp_bus_reset_delay = 5;
- /*
- * Don't retry selection, busy or queue full automatically- reflect
- * these back to us.
- */
- sdp->isp_retry_count = 0;
- sdp->isp_retry_delay = 0;
-
- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
- sdp->isp_devparam[tgt].exc_throttle = ISP_EXEC_THROTTLE;
- sdp->isp_devparam[tgt].dev_enable = 1;
- }
-
- /*
- * The trick here is to establish a default for the default (honk!)
- * state (goal_flags). Then try and get the current status from
- * the card to fill in the current state. We don't, in fact, set
- * the default to the SAFE default state- that's not the goal state.
- */
- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
- uint8_t off, per;
- sdp->isp_devparam[tgt].actv_offset = 0;
- sdp->isp_devparam[tgt].actv_period = 0;
- sdp->isp_devparam[tgt].actv_flags = 0;
-
- sdp->isp_devparam[tgt].goal_flags =
- sdp->isp_devparam[tgt].nvrm_flags = DPARM_DEFAULT;
-
- /*
- * We default to Wide/Fast for versions less than a 1040
- * (unless it's SBus).
- */
- if (IS_ULTRA3(isp)) {
- off = ISP_80M_SYNCPARMS >> 8;
- per = ISP_80M_SYNCPARMS & 0xff;
- } else if (IS_ULTRA2(isp)) {
- off = ISP_40M_SYNCPARMS >> 8;
- per = ISP_40M_SYNCPARMS & 0xff;
- } else if (IS_1240(isp)) {
- off = ISP_20M_SYNCPARMS >> 8;
- per = ISP_20M_SYNCPARMS & 0xff;
- } else if ((isp->isp_bustype == ISP_BT_SBUS &&
- isp->isp_type < ISP_HA_SCSI_1020A) ||
- (isp->isp_bustype == ISP_BT_PCI &&
- isp->isp_type < ISP_HA_SCSI_1040) ||
- (isp->isp_clock && isp->isp_clock < 60) ||
- (sdp->isp_ultramode == 0)) {
- off = ISP_10M_SYNCPARMS >> 8;
- per = ISP_10M_SYNCPARMS & 0xff;
- } else {
- off = ISP_20M_SYNCPARMS_1040 >> 8;
- per = ISP_20M_SYNCPARMS_1040 & 0xff;
- }
- sdp->isp_devparam[tgt].goal_offset =
- sdp->isp_devparam[tgt].nvrm_offset = off;
- sdp->isp_devparam[tgt].goal_period =
- sdp->isp_devparam[tgt].nvrm_period = per;
-
- }
-
- /*
- * If we're a dual bus card, just copy the data over
- */
- if (sdp1) {
- *sdp1 = *sdp;
- sdp1->isp_initiator_id = DEFAULT_IID(isp, 1);
- }
-
- /*
- * If we've not been told to avoid reading NVRAM, try and read it.
- * If we're successful reading it, we can then return because NVRAM
- * will tell us what the desired settings are. Otherwise, we establish
- * some reasonable 'fake' nvram and goal defaults.
- */
- if ((isp->isp_confopts & ISP_CFG_NONVRAM) == 0) {
- mbreg_t mbs;
-
- if (isp_read_nvram(isp, 0) == 0) {
- if (IS_DUALBUS(isp)) {
- if (isp_read_nvram(isp, 1) == 0) {
- return;
- }
- }
- }
- MBSINIT(&mbs, MBOX_GET_ACT_NEG_STATE, MBLOGNONE, 0);
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- sdp->isp_req_ack_active_neg = 1;
- sdp->isp_data_line_active_neg = 1;
- if (sdp1) {
- sdp1->isp_req_ack_active_neg = 1;
- sdp1->isp_data_line_active_neg = 1;
- }
- } else {
- sdp->isp_req_ack_active_neg =
- (mbs.param[1] >> 4) & 0x1;
- sdp->isp_data_line_active_neg =
- (mbs.param[1] >> 5) & 0x1;
- if (sdp1) {
- sdp1->isp_req_ack_active_neg =
- (mbs.param[2] >> 4) & 0x1;
- sdp1->isp_data_line_active_neg =
- (mbs.param[2] >> 5) & 0x1;
- }
- }
- }
+ MBSINIT(&mbs, MBOX_GET_FW_STATE, MBLOGALL, 0);
+ isp_mboxcmd(isp, &mbs);
+ if (mbs.param[0] == MBOX_COMMAND_COMPLETE)
+ return (mbs.param[1]);
+ return (FW_ERROR);
}
static void
@@ -7488,29 +4437,13 @@ isp_setdfltfcparm(ispsoftc_t *isp, int chan)
fcp->isp_lasthdl = NIL_HANDLE;
fcp->isp_login_hdl = NIL_HANDLE;
- if (IS_24XX(isp)) {
- fcp->isp_fwoptions |= ICB2400_OPT1_FAIRNESS;
- fcp->isp_fwoptions |= ICB2400_OPT1_HARD_ADDRESS;
- if (isp->isp_confopts & ISP_CFG_FULL_DUPLEX)
- fcp->isp_fwoptions |= ICB2400_OPT1_FULL_DUPLEX;
- fcp->isp_fwoptions |= ICB2400_OPT1_BOTH_WWNS;
- fcp->isp_xfwoptions |= ICB2400_OPT2_LOOP_2_PTP;
- fcp->isp_zfwoptions |= ICB2400_OPT3_RATE_AUTO;
- } else {
- fcp->isp_fwoptions |= ICBOPT_FAIRNESS;
- fcp->isp_fwoptions |= ICBOPT_PDBCHANGE_AE;
- fcp->isp_fwoptions |= ICBOPT_HARD_ADDRESS;
- if (isp->isp_confopts & ISP_CFG_FULL_DUPLEX)
- fcp->isp_fwoptions |= ICBOPT_FULL_DUPLEX;
- /*
- * Make sure this is turned off now until we get
- * extended options from NVRAM
- */
- fcp->isp_fwoptions &= ~ICBOPT_EXTENDED;
- fcp->isp_xfwoptions |= ICBXOPT_LOOP_2_PTP;
- fcp->isp_zfwoptions |= ICBZOPT_RATE_AUTO;
- }
-
+ fcp->isp_fwoptions |= ICB2400_OPT1_FAIRNESS;
+ fcp->isp_fwoptions |= ICB2400_OPT1_HARD_ADDRESS;
+ if (isp->isp_confopts & ISP_CFG_FULL_DUPLEX)
+ fcp->isp_fwoptions |= ICB2400_OPT1_FULL_DUPLEX;
+ fcp->isp_fwoptions |= ICB2400_OPT1_BOTH_WWNS;
+ fcp->isp_xfwoptions |= ICB2400_OPT2_LOOP_2_PTP;
+ fcp->isp_zfwoptions |= ICB2400_OPT3_RATE_AUTO;
/*
* Now try and read NVRAM unless told to not do so.
@@ -7567,26 +4500,12 @@ isp_reinit(ispsoftc_t *isp, int do_load_defaults)
res = EIO;
isp_prt(isp, ISP_LOGERR, "%s: cannot init card", __func__);
ISP_DISABLE_INTS(isp);
- if (IS_FC(isp)) {
- /*
- * If we're in ISP_ROLE_NONE, turn off the lasers.
- */
- if (!IS_24XX(isp)) {
- ISP_WRITE(isp, BIU2100_CSR, BIU2100_FPM0_REGS);
- ISP_WRITE(isp, FPM_DIAG_CONFIG, FPM_SOFT_RESET);
- ISP_WRITE(isp, BIU2100_CSR, BIU2100_FB_REGS);
- ISP_WRITE(isp, FBM_CMD, FBMCMD_FIFO_RESET_ALL);
- ISP_WRITE(isp, BIU2100_CSR, BIU2100_RISC_REGS);
- }
- }
}
cleanup:
isp_clear_commands(isp);
- if (IS_FC(isp)) {
- for (i = 0; i < isp->isp_nchan; i++)
- isp_clear_portdb(isp, i);
- }
+ for (i = 0; i < isp->isp_nchan; i++)
+ isp_clear_portdb(isp, i);
return (res);
}
@@ -7596,81 +4515,16 @@ cleanup:
static int
isp_read_nvram(ispsoftc_t *isp, int bus)
{
- int i, amt, retval;
- uint8_t csum, minversion;
- union {
- uint8_t _x[ISP2400_NVRAM_SIZE];
- uint16_t _s[ISP2400_NVRAM_SIZE>>1];
- } _n;
-#define nvram_data _n._x
-#define nvram_words _n._s
-
- if (IS_24XX(isp)) {
- return (isp_read_nvram_2400(isp, nvram_data));
- } else if (IS_FC(isp)) {
- amt = ISP2100_NVRAM_SIZE;
- minversion = 1;
- } else if (IS_ULTRA2(isp)) {
- amt = ISP1080_NVRAM_SIZE;
- minversion = 0;
- } else {
- amt = ISP_NVRAM_SIZE;
- minversion = 2;
- }
- for (i = 0; i < amt>>1; i++) {
- isp_rdnvram_word(isp, i, &nvram_words[i]);
- }
-
- if (nvram_data[0] != 'I' || nvram_data[1] != 'S' ||
- nvram_data[2] != 'P') {
- if (isp->isp_bustype != ISP_BT_SBUS) {
- isp_prt(isp, ISP_LOGWARN, "invalid NVRAM header");
- isp_prt(isp, ISP_LOGDEBUG0, "%x %x %x", nvram_data[0], nvram_data[1], nvram_data[2]);
- }
- retval = -1;
- goto out;
- }
-
- for (csum = 0, i = 0; i < amt; i++) {
- csum += nvram_data[i];
- }
- if (csum != 0) {
- isp_prt(isp, ISP_LOGWARN, "invalid NVRAM checksum");
- retval = -1;
- goto out;
- }
-
- if (ISP_NVRAM_VERSION(nvram_data) < minversion) {
- isp_prt(isp, ISP_LOGWARN, "version %d NVRAM not understood",
- ISP_NVRAM_VERSION(nvram_data));
- retval = -1;
- goto out;
- }
-
- if (IS_ULTRA3(isp)) {
- isp_parse_nvram_12160(isp, bus, nvram_data);
- } else if (IS_1080(isp)) {
- isp_parse_nvram_1080(isp, bus, nvram_data);
- } else if (IS_1280(isp) || IS_1240(isp)) {
- isp_parse_nvram_1080(isp, bus, nvram_data);
- } else if (IS_SCSI(isp)) {
- isp_parse_nvram_1020(isp, nvram_data);
- } else {
- isp_parse_nvram_2100(isp, nvram_data);
- }
- retval = 0;
-out:
- return (retval);
-#undef nvram_data
-#undef nvram_words
+ return (isp_read_nvram_2400(isp));
}
static int
-isp_read_nvram_2400(ispsoftc_t *isp, uint8_t *nvram_data)
+isp_read_nvram_2400(ispsoftc_t *isp)
{
int retval = 0;
uint32_t addr, csum, lwrds, *dptr;
+ uint8_t nvram_data[ISP2400_NVRAM_SIZE];
if (isp->isp_port) {
addr = ISP2400_NVRAM_PORT1_ADDR;
@@ -7706,77 +4560,6 @@ out:
}
static void
-isp_rdnvram_word(ispsoftc_t *isp, int wo, uint16_t *rp)
-{
- int i, cbits;
- uint16_t bit, rqst, junk;
-
- ISP_WRITE(isp, BIU_NVRAM, BIU_NVRAM_SELECT);
- ISP_DELAY(10);
- ISP_WRITE(isp, BIU_NVRAM, BIU_NVRAM_SELECT|BIU_NVRAM_CLOCK);
- ISP_DELAY(10);
-
- if (IS_FC(isp)) {
- wo &= ((ISP2100_NVRAM_SIZE >> 1) - 1);
- if (IS_2312(isp) && isp->isp_port) {
- wo += 128;
- }
- rqst = (ISP_NVRAM_READ << 8) | wo;
- cbits = 10;
- } else if (IS_ULTRA2(isp)) {
- wo &= ((ISP1080_NVRAM_SIZE >> 1) - 1);
- rqst = (ISP_NVRAM_READ << 8) | wo;
- cbits = 10;
- } else {
- wo &= ((ISP_NVRAM_SIZE >> 1) - 1);
- rqst = (ISP_NVRAM_READ << 6) | wo;
- cbits = 8;
- }
-
- /*
- * Clock the word select request out...
- */
- for (i = cbits; i >= 0; i--) {
- if ((rqst >> i) & 1) {
- bit = BIU_NVRAM_SELECT | BIU_NVRAM_DATAOUT;
- } else {
- bit = BIU_NVRAM_SELECT;
- }
- ISP_WRITE(isp, BIU_NVRAM, bit);
- ISP_DELAY(10);
- junk = ISP_READ(isp, BIU_NVRAM); /* force PCI flush */
- ISP_WRITE(isp, BIU_NVRAM, bit | BIU_NVRAM_CLOCK);
- ISP_DELAY(10);
- junk = ISP_READ(isp, BIU_NVRAM); /* force PCI flush */
- ISP_WRITE(isp, BIU_NVRAM, bit);
- ISP_DELAY(10);
- junk = ISP_READ(isp, BIU_NVRAM); /* force PCI flush */
- }
- /*
- * Now read the result back in (bits come back in MSB format).
- */
- *rp = 0;
- for (i = 0; i < 16; i++) {
- uint16_t rv;
- *rp <<= 1;
- ISP_WRITE(isp, BIU_NVRAM, BIU_NVRAM_SELECT|BIU_NVRAM_CLOCK);
- ISP_DELAY(10);
- rv = ISP_READ(isp, BIU_NVRAM);
- if (rv & BIU_NVRAM_DATAIN) {
- *rp |= 1;
- }
- ISP_DELAY(10);
- ISP_WRITE(isp, BIU_NVRAM, BIU_NVRAM_SELECT);
- ISP_DELAY(10);
- junk = ISP_READ(isp, BIU_NVRAM); /* force PCI flush */
- }
- ISP_WRITE(isp, BIU_NVRAM, 0);
- ISP_DELAY(10);
- junk = ISP_READ(isp, BIU_NVRAM); /* force PCI flush */
- ISP_SWIZZLE_NVRAM_WORD(isp, rp);
-}
-
-static void
isp_rd_2400_nvram(ispsoftc_t *isp, uint32_t addr, uint32_t *rp)
{
int loops = 0;
@@ -7805,346 +4588,6 @@ isp_rd_2400_nvram(ispsoftc_t *isp, uint32_t addr, uint32_t *rp)
}
static void
-isp_parse_nvram_1020(ispsoftc_t *isp, uint8_t *nvram_data)
-{
- sdparam *sdp = SDPARAM(isp, 0);
- int tgt;
-
- sdp->isp_fifo_threshold =
- ISP_NVRAM_FIFO_THRESHOLD(nvram_data) |
- (ISP_NVRAM_FIFO_THRESHOLD_128(nvram_data) << 2);
-
- if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0)
- sdp->isp_initiator_id = ISP_NVRAM_INITIATOR_ID(nvram_data);
-
- sdp->isp_bus_reset_delay =
- ISP_NVRAM_BUS_RESET_DELAY(nvram_data);
-
- sdp->isp_retry_count =
- ISP_NVRAM_BUS_RETRY_COUNT(nvram_data);
-
- sdp->isp_retry_delay =
- ISP_NVRAM_BUS_RETRY_DELAY(nvram_data);
-
- sdp->isp_async_data_setup =
- ISP_NVRAM_ASYNC_DATA_SETUP_TIME(nvram_data);
-
- if (isp->isp_type >= ISP_HA_SCSI_1040) {
- if (sdp->isp_async_data_setup < 9) {
- sdp->isp_async_data_setup = 9;
- }
- } else {
- if (sdp->isp_async_data_setup != 6) {
- sdp->isp_async_data_setup = 6;
- }
- }
-
- sdp->isp_req_ack_active_neg =
- ISP_NVRAM_REQ_ACK_ACTIVE_NEGATION(nvram_data);
-
- sdp->isp_data_line_active_neg =
- ISP_NVRAM_DATA_LINE_ACTIVE_NEGATION(nvram_data);
-
- sdp->isp_data_dma_burst_enabl =
- ISP_NVRAM_DATA_DMA_BURST_ENABLE(nvram_data);
-
- sdp->isp_cmd_dma_burst_enable =
- ISP_NVRAM_CMD_DMA_BURST_ENABLE(nvram_data);
-
- sdp->isp_tag_aging =
- ISP_NVRAM_TAG_AGE_LIMIT(nvram_data);
-
- sdp->isp_selection_timeout =
- ISP_NVRAM_SELECTION_TIMEOUT(nvram_data);
-
- sdp->isp_max_queue_depth =
- ISP_NVRAM_MAX_QUEUE_DEPTH(nvram_data);
-
- sdp->isp_fast_mttr = ISP_NVRAM_FAST_MTTR_ENABLE(nvram_data);
-
- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
- sdp->isp_devparam[tgt].dev_enable =
- ISP_NVRAM_TGT_DEVICE_ENABLE(nvram_data, tgt);
- sdp->isp_devparam[tgt].exc_throttle =
- ISP_NVRAM_TGT_EXEC_THROTTLE(nvram_data, tgt);
- sdp->isp_devparam[tgt].nvrm_offset =
- ISP_NVRAM_TGT_SYNC_OFFSET(nvram_data, tgt);
- sdp->isp_devparam[tgt].nvrm_period =
- ISP_NVRAM_TGT_SYNC_PERIOD(nvram_data, tgt);
- /*
- * We probably shouldn't lie about this, but it
- * it makes it much safer if we limit NVRAM values
- * to sanity.
- */
- if (isp->isp_type < ISP_HA_SCSI_1040) {
- /*
- * If we're not ultra, we can't possibly
- * be a shorter period than this.
- */
- if (sdp->isp_devparam[tgt].nvrm_period < 0x19) {
- sdp->isp_devparam[tgt].nvrm_period = 0x19;
- }
- if (sdp->isp_devparam[tgt].nvrm_offset > 0xc) {
- sdp->isp_devparam[tgt].nvrm_offset = 0x0c;
- }
- } else {
- if (sdp->isp_devparam[tgt].nvrm_offset > 0x8) {
- sdp->isp_devparam[tgt].nvrm_offset = 0x8;
- }
- }
- sdp->isp_devparam[tgt].nvrm_flags = 0;
- if (ISP_NVRAM_TGT_RENEG(nvram_data, tgt))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_RENEG;
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_ARQ;
- if (ISP_NVRAM_TGT_TQING(nvram_data, tgt))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_TQING;
- if (ISP_NVRAM_TGT_SYNC(nvram_data, tgt))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_SYNC;
- if (ISP_NVRAM_TGT_WIDE(nvram_data, tgt))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_WIDE;
- if (ISP_NVRAM_TGT_PARITY(nvram_data, tgt))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_PARITY;
- if (ISP_NVRAM_TGT_DISC(nvram_data, tgt))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_DISC;
- sdp->isp_devparam[tgt].actv_flags = 0; /* we don't know */
- sdp->isp_devparam[tgt].goal_offset =
- sdp->isp_devparam[tgt].nvrm_offset;
- sdp->isp_devparam[tgt].goal_period =
- sdp->isp_devparam[tgt].nvrm_period;
- sdp->isp_devparam[tgt].goal_flags =
- sdp->isp_devparam[tgt].nvrm_flags;
- }
-}
-
-static void
-isp_parse_nvram_1080(ispsoftc_t *isp, int bus, uint8_t *nvram_data)
-{
- sdparam *sdp = SDPARAM(isp, bus);
- int tgt;
-
- sdp->isp_fifo_threshold =
- ISP1080_NVRAM_FIFO_THRESHOLD(nvram_data);
-
- if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0)
- sdp->isp_initiator_id = ISP1080_NVRAM_INITIATOR_ID(nvram_data, bus);
-
- sdp->isp_bus_reset_delay =
- ISP1080_NVRAM_BUS_RESET_DELAY(nvram_data, bus);
-
- sdp->isp_retry_count =
- ISP1080_NVRAM_BUS_RETRY_COUNT(nvram_data, bus);
-
- sdp->isp_retry_delay =
- ISP1080_NVRAM_BUS_RETRY_DELAY(nvram_data, bus);
-
- sdp->isp_async_data_setup =
- ISP1080_NVRAM_ASYNC_DATA_SETUP_TIME(nvram_data, bus);
-
- sdp->isp_req_ack_active_neg =
- ISP1080_NVRAM_REQ_ACK_ACTIVE_NEGATION(nvram_data, bus);
-
- sdp->isp_data_line_active_neg =
- ISP1080_NVRAM_DATA_LINE_ACTIVE_NEGATION(nvram_data, bus);
-
- sdp->isp_data_dma_burst_enabl =
- ISP1080_NVRAM_BURST_ENABLE(nvram_data);
-
- sdp->isp_cmd_dma_burst_enable =
- ISP1080_NVRAM_BURST_ENABLE(nvram_data);
-
- sdp->isp_selection_timeout =
- ISP1080_NVRAM_SELECTION_TIMEOUT(nvram_data, bus);
-
- sdp->isp_max_queue_depth =
- ISP1080_NVRAM_MAX_QUEUE_DEPTH(nvram_data, bus);
-
- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
- sdp->isp_devparam[tgt].dev_enable =
- ISP1080_NVRAM_TGT_DEVICE_ENABLE(nvram_data, tgt, bus);
- sdp->isp_devparam[tgt].exc_throttle =
- ISP1080_NVRAM_TGT_EXEC_THROTTLE(nvram_data, tgt, bus);
- sdp->isp_devparam[tgt].nvrm_offset =
- ISP1080_NVRAM_TGT_SYNC_OFFSET(nvram_data, tgt, bus);
- sdp->isp_devparam[tgt].nvrm_period =
- ISP1080_NVRAM_TGT_SYNC_PERIOD(nvram_data, tgt, bus);
- sdp->isp_devparam[tgt].nvrm_flags = 0;
- if (ISP1080_NVRAM_TGT_RENEG(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_RENEG;
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_ARQ;
- if (ISP1080_NVRAM_TGT_TQING(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_TQING;
- if (ISP1080_NVRAM_TGT_SYNC(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_SYNC;
- if (ISP1080_NVRAM_TGT_WIDE(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_WIDE;
- if (ISP1080_NVRAM_TGT_PARITY(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_PARITY;
- if (ISP1080_NVRAM_TGT_DISC(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_DISC;
- sdp->isp_devparam[tgt].actv_flags = 0;
- sdp->isp_devparam[tgt].goal_offset =
- sdp->isp_devparam[tgt].nvrm_offset;
- sdp->isp_devparam[tgt].goal_period =
- sdp->isp_devparam[tgt].nvrm_period;
- sdp->isp_devparam[tgt].goal_flags =
- sdp->isp_devparam[tgt].nvrm_flags;
- }
-}
-
-static void
-isp_parse_nvram_12160(ispsoftc_t *isp, int bus, uint8_t *nvram_data)
-{
- sdparam *sdp = SDPARAM(isp, bus);
- int tgt;
-
- sdp->isp_fifo_threshold =
- ISP12160_NVRAM_FIFO_THRESHOLD(nvram_data);
-
- if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0)
- sdp->isp_initiator_id = ISP12160_NVRAM_INITIATOR_ID(nvram_data, bus);
-
- sdp->isp_bus_reset_delay =
- ISP12160_NVRAM_BUS_RESET_DELAY(nvram_data, bus);
-
- sdp->isp_retry_count =
- ISP12160_NVRAM_BUS_RETRY_COUNT(nvram_data, bus);
-
- sdp->isp_retry_delay =
- ISP12160_NVRAM_BUS_RETRY_DELAY(nvram_data, bus);
-
- sdp->isp_async_data_setup =
- ISP12160_NVRAM_ASYNC_DATA_SETUP_TIME(nvram_data, bus);
-
- sdp->isp_req_ack_active_neg =
- ISP12160_NVRAM_REQ_ACK_ACTIVE_NEGATION(nvram_data, bus);
-
- sdp->isp_data_line_active_neg =
- ISP12160_NVRAM_DATA_LINE_ACTIVE_NEGATION(nvram_data, bus);
-
- sdp->isp_data_dma_burst_enabl =
- ISP12160_NVRAM_BURST_ENABLE(nvram_data);
-
- sdp->isp_cmd_dma_burst_enable =
- ISP12160_NVRAM_BURST_ENABLE(nvram_data);
-
- sdp->isp_selection_timeout =
- ISP12160_NVRAM_SELECTION_TIMEOUT(nvram_data, bus);
-
- sdp->isp_max_queue_depth =
- ISP12160_NVRAM_MAX_QUEUE_DEPTH(nvram_data, bus);
-
- for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
- sdp->isp_devparam[tgt].dev_enable =
- ISP12160_NVRAM_TGT_DEVICE_ENABLE(nvram_data, tgt, bus);
- sdp->isp_devparam[tgt].exc_throttle =
- ISP12160_NVRAM_TGT_EXEC_THROTTLE(nvram_data, tgt, bus);
- sdp->isp_devparam[tgt].nvrm_offset =
- ISP12160_NVRAM_TGT_SYNC_OFFSET(nvram_data, tgt, bus);
- sdp->isp_devparam[tgt].nvrm_period =
- ISP12160_NVRAM_TGT_SYNC_PERIOD(nvram_data, tgt, bus);
- sdp->isp_devparam[tgt].nvrm_flags = 0;
- if (ISP12160_NVRAM_TGT_RENEG(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_RENEG;
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_ARQ;
- if (ISP12160_NVRAM_TGT_TQING(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_TQING;
- if (ISP12160_NVRAM_TGT_SYNC(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_SYNC;
- if (ISP12160_NVRAM_TGT_WIDE(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_WIDE;
- if (ISP12160_NVRAM_TGT_PARITY(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_PARITY;
- if (ISP12160_NVRAM_TGT_DISC(nvram_data, tgt, bus))
- sdp->isp_devparam[tgt].nvrm_flags |= DPARM_DISC;
- sdp->isp_devparam[tgt].actv_flags = 0;
- sdp->isp_devparam[tgt].goal_offset =
- sdp->isp_devparam[tgt].nvrm_offset;
- sdp->isp_devparam[tgt].goal_period =
- sdp->isp_devparam[tgt].nvrm_period;
- sdp->isp_devparam[tgt].goal_flags =
- sdp->isp_devparam[tgt].nvrm_flags;
- }
-}
-
-static void
-isp_parse_nvram_2100(ispsoftc_t *isp, uint8_t *nvram_data)
-{
- fcparam *fcp = FCPARAM(isp, 0);
- uint64_t wwn;
-
- /*
- * There is NVRAM storage for both Port and Node entities-
- * but the Node entity appears to be unused on all the cards
- * I can find. However, we should account for this being set
- * at some point in the future.
- *
- * Qlogic WWNs have an NAA of 2, but usually nothing shows up in
- * bits 48..60. In the case of the 2202, it appears that they do
- * use bit 48 to distinguish between the two instances on the card.
- * The 2204, which I've never seen, *probably* extends this method.
- */
- wwn = ISP2100_NVRAM_PORT_NAME(nvram_data);
- if (wwn) {
- isp_prt(isp, ISP_LOGCONFIG, "NVRAM Port WWN 0x%08x%08x",
- (uint32_t) (wwn >> 32), (uint32_t) (wwn));
- if ((wwn >> 60) == 0) {
- wwn |= (((uint64_t) 2)<< 60);
- }
- }
- fcp->isp_wwpn_nvram = wwn;
- if (IS_2200(isp) || IS_23XX(isp)) {
- wwn = ISP2100_NVRAM_NODE_NAME(nvram_data);
- if (wwn) {
- isp_prt(isp, ISP_LOGCONFIG, "NVRAM Node WWN 0x%08x%08x",
- (uint32_t) (wwn >> 32),
- (uint32_t) (wwn));
- if ((wwn >> 60) == 0) {
- wwn |= (((uint64_t) 2)<< 60);
- }
- } else {
- wwn = fcp->isp_wwpn_nvram & ~((uint64_t) 0xfff << 48);
- }
- } else {
- wwn &= ~((uint64_t) 0xfff << 48);
- }
- fcp->isp_wwnn_nvram = wwn;
-
- fcp->isp_maxalloc = ISP2100_NVRAM_MAXIOCBALLOCATION(nvram_data);
- if ((isp->isp_confopts & ISP_CFG_OWNFSZ) == 0) {
- DEFAULT_FRAMESIZE(isp) =
- ISP2100_NVRAM_MAXFRAMELENGTH(nvram_data);
- }
- fcp->isp_retry_delay = ISP2100_NVRAM_RETRY_DELAY(nvram_data);
- fcp->isp_retry_count = ISP2100_NVRAM_RETRY_COUNT(nvram_data);
- if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0) {
- fcp->isp_loopid = ISP2100_NVRAM_HARDLOOPID(nvram_data);
- }
- if ((isp->isp_confopts & ISP_CFG_OWNEXCTHROTTLE) == 0) {
- DEFAULT_EXEC_THROTTLE(isp) =
- ISP2100_NVRAM_EXECUTION_THROTTLE(nvram_data);
- }
- fcp->isp_fwoptions = ISP2100_NVRAM_OPTIONS(nvram_data);
- isp_prt(isp, ISP_LOGDEBUG0,
- "NVRAM 0x%08x%08x 0x%08x%08x maxalloc %d maxframelen %d",
- (uint32_t) (fcp->isp_wwnn_nvram >> 32),
- (uint32_t) fcp->isp_wwnn_nvram,
- (uint32_t) (fcp->isp_wwpn_nvram >> 32),
- (uint32_t) fcp->isp_wwpn_nvram,
- ISP2100_NVRAM_MAXIOCBALLOCATION(nvram_data),
- ISP2100_NVRAM_MAXFRAMELENGTH(nvram_data));
- isp_prt(isp, ISP_LOGDEBUG0,
- "execthrottle %d fwoptions 0x%x hardloop %d tov %d",
- ISP2100_NVRAM_EXECUTION_THROTTLE(nvram_data),
- ISP2100_NVRAM_OPTIONS(nvram_data),
- ISP2100_NVRAM_HARDLOOPID(nvram_data),
- ISP2100_NVRAM_TOV(nvram_data));
- fcp->isp_xfwoptions = ISP2100_XFW_OPTIONS(nvram_data);
- fcp->isp_zfwoptions = ISP2100_ZFW_OPTIONS(nvram_data);
- isp_prt(isp, ISP_LOGDEBUG0, "xfwoptions 0x%x zfw options 0x%x",
- ISP2100_XFW_OPTIONS(nvram_data), ISP2100_ZFW_OPTIONS(nvram_data));
-}
-
-static void
isp_parse_nvram_2400(ispsoftc_t *isp, uint8_t *nvram_data)
{
fcparam *fcp = FCPARAM(isp, 0);
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index 84780b6ae122..2d7fd5759283 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * Copyright (c) 2009-2017 Alexander Motin <mav@FreeBSD.org>
+ * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
*
@@ -55,7 +55,6 @@ static const char prom3[] = "Chan %d [%u] PortID 0x%06x Departed because of %s";
static void isp_freeze_loopdown(ispsoftc_t *, int);
static void isp_loop_changed(ispsoftc_t *isp, int chan);
static d_ioctl_t ispioctl;
-static void isp_cam_async(void *, uint32_t, struct cam_path *, void *);
static void isp_poll(struct cam_sim *);
static callout_func_t isp_watchdog;
static callout_func_t isp_gdt;
@@ -108,7 +107,6 @@ isp_role_sysctl(SYSCTL_HANDLER_ARGS)
static int
isp_attach_chan(ispsoftc_t *isp, struct cam_devq *devq, int chan)
{
- struct ccb_setasync csa;
struct cam_sim *sim;
struct cam_path *path;
#ifdef ISP_TARGET_MODE
@@ -135,119 +133,93 @@ isp_attach_chan(ispsoftc_t *isp, struct cam_devq *devq, int chan)
cam_sim_free(sim, FALSE);
return (ENXIO);
}
- xpt_setup_ccb(&csa.ccb_h, path, 5);
- csa.ccb_h.func_code = XPT_SASYNC_CB;
- csa.event_enable = AC_LOST_DEVICE;
- csa.callback = isp_cam_async;
- csa.callback_arg = sim;
- ISP_LOCK(isp);
- xpt_action((union ccb *)&csa);
- ISP_UNLOCK(isp);
+ fcparam *fcp = FCPARAM(isp, chan);
+ struct isp_fc *fc = ISP_FC_PC(isp, chan);
+ struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(isp->isp_osinfo.dev);
+ struct sysctl_oid *tree = device_get_sysctl_tree(isp->isp_osinfo.dev);
+ char name[16];
- if (IS_SCSI(isp)) {
- struct isp_spi *spi = ISP_SPI_PC(isp, chan);
- spi->sim = sim;
- spi->path = path;
+ ISP_LOCK(isp);
+ fc->sim = sim;
+ fc->path = path;
+ fc->isp = isp;
+ fc->ready = 1;
+ fcp->isp_use_gft_id = 1;
+ fcp->isp_use_gff_id = 1;
+
+ callout_init_mtx(&fc->gdt, &isp->isp_lock, 0);
+ TASK_INIT(&fc->gtask, 1, isp_gdt_task, fc);
#ifdef ISP_TARGET_MODE
- TAILQ_INIT(&spi->waitq);
- STAILQ_INIT(&spi->ntfree);
- for (i = 0; i < ATPDPSIZE; i++)
- STAILQ_INSERT_TAIL(&spi->ntfree, &spi->ntpool[i], next);
- LIST_INIT(&spi->atfree);
- for (i = ATPDPSIZE-1; i >= 0; i--)
- LIST_INSERT_HEAD(&spi->atfree, &spi->atpool[i], next);
- for (i = 0; i < ATPDPHASHSIZE; i++)
- LIST_INIT(&spi->atused[i]);
+ TAILQ_INIT(&fc->waitq);
+ STAILQ_INIT(&fc->ntfree);
+ for (i = 0; i < ATPDPSIZE; i++)
+ STAILQ_INSERT_TAIL(&fc->ntfree, &fc->ntpool[i], next);
+ LIST_INIT(&fc->atfree);
+ for (i = ATPDPSIZE-1; i >= 0; i--)
+ LIST_INSERT_HEAD(&fc->atfree, &fc->atpool[i], next);
+ for (i = 0; i < ATPDPHASHSIZE; i++)
+ LIST_INIT(&fc->atused[i]);
#endif
- } else {
- fcparam *fcp = FCPARAM(isp, chan);
- struct isp_fc *fc = ISP_FC_PC(isp, chan);
- struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(isp->isp_osinfo.dev);
- struct sysctl_oid *tree = device_get_sysctl_tree(isp->isp_osinfo.dev);
- char name[16];
-
+ isp_loop_changed(isp, chan);
+ ISP_UNLOCK(isp);
+ if (kproc_create(isp_kthread, fc, &fc->kproc, 0, 0,
+ "%s_%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) {
+ xpt_free_path(fc->path);
ISP_LOCK(isp);
- fc->sim = sim;
- fc->path = path;
- fc->isp = isp;
- fc->ready = 1;
- fcp->isp_use_gft_id = 1;
- fcp->isp_use_gff_id = 1;
-
- callout_init_mtx(&fc->gdt, &isp->isp_lock, 0);
- TASK_INIT(&fc->gtask, 1, isp_gdt_task, fc);
-#ifdef ISP_TARGET_MODE
- TAILQ_INIT(&fc->waitq);
- STAILQ_INIT(&fc->ntfree);
- for (i = 0; i < ATPDPSIZE; i++)
- STAILQ_INSERT_TAIL(&fc->ntfree, &fc->ntpool[i], next);
- LIST_INIT(&fc->atfree);
- for (i = ATPDPSIZE-1; i >= 0; i--)
- LIST_INSERT_HEAD(&fc->atfree, &fc->atpool[i], next);
- for (i = 0; i < ATPDPHASHSIZE; i++)
- LIST_INIT(&fc->atused[i]);
-#endif
- isp_loop_changed(isp, chan);
+ xpt_bus_deregister(cam_sim_path(fc->sim));
ISP_UNLOCK(isp);
- if (kproc_create(isp_kthread, fc, &fc->kproc, 0, 0,
- "%s_%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) {
- xpt_free_path(fc->path);
- ISP_LOCK(isp);
- xpt_bus_deregister(cam_sim_path(fc->sim));
- ISP_UNLOCK(isp);
- cam_sim_free(fc->sim, FALSE);
- return (ENOMEM);
- }
- fc->num_threads += 1;
- if (chan > 0) {
- snprintf(name, sizeof(name), "chan%d", chan);
- tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(tree),
- OID_AUTO, name, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
- "Virtual channel");
- }
- SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "wwnn", CTLFLAG_RD, &fcp->isp_wwnn,
- "World Wide Node Name");
- SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "wwpn", CTLFLAG_RD, &fcp->isp_wwpn,
- "World Wide Port Name");
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "loop_down_limit", CTLFLAG_RW, &fc->loop_down_limit, 0,
- "Loop Down Limit");
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "gone_device_time", CTLFLAG_RW, &fc->gone_device_time, 0,
- "Gone Device Time");
+ cam_sim_free(fc->sim, FALSE);
+ return (ENOMEM);
+ }
+ fc->num_threads += 1;
+ if (chan > 0) {
+ snprintf(name, sizeof(name), "chan%d", chan);
+ tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(tree),
+ OID_AUTO, name, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
+ "Virtual channel");
+ }
+ SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "wwnn", CTLFLAG_RD, &fcp->isp_wwnn,
+ "World Wide Node Name");
+ SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "wwpn", CTLFLAG_RD, &fcp->isp_wwpn,
+ "World Wide Port Name");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "loop_down_limit", CTLFLAG_RW, &fc->loop_down_limit, 0,
+ "Loop Down Limit");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "gone_device_time", CTLFLAG_RW, &fc->gone_device_time, 0,
+ "Gone Device Time");
#if defined(ISP_TARGET_MODE) && defined(DEBUG)
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "inject_lost_data_frame", CTLFLAG_RW, &fc->inject_lost_data_frame, 0,
- "Cause a Lost Frame on a Read");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "inject_lost_data_frame", CTLFLAG_RW, &fc->inject_lost_data_frame, 0,
+ "Cause a Lost Frame on a Read");
#endif
- SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "role", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- isp, chan, isp_role_sysctl, "I", "Current role");
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "speed", CTLFLAG_RD, &fcp->isp_gbspeed, 0,
- "Connection speed in gigabits");
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "linkstate", CTLFLAG_RD, &fcp->isp_linkstate, 0,
- "Link state");
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "fwstate", CTLFLAG_RD, &fcp->isp_fwstate, 0,
- "Firmware state");
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "loopstate", CTLFLAG_RD, &fcp->isp_loopstate, 0,
- "Loop state");
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "topo", CTLFLAG_RD, &fcp->isp_topo, 0,
- "Connection topology");
- SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "use_gft_id", CTLFLAG_RWTUN, &fcp->isp_use_gft_id, 0,
- "Use GFT_ID during fabric scan");
- SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
- "use_gff_id", CTLFLAG_RWTUN, &fcp->isp_use_gff_id, 0,
- "Use GFF_ID during fabric scan");
- }
+ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "role", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
+ isp, chan, isp_role_sysctl, "I", "Current role");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "speed", CTLFLAG_RD, &fcp->isp_gbspeed, 0,
+ "Connection speed in gigabits");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "linkstate", CTLFLAG_RD, &fcp->isp_linkstate, 0,
+ "Link state");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "fwstate", CTLFLAG_RD, &fcp->isp_fwstate, 0,
+ "Firmware state");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "loopstate", CTLFLAG_RD, &fcp->isp_loopstate, 0,
+ "Loop state");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "topo", CTLFLAG_RD, &fcp->isp_topo, 0,
+ "Connection topology");
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "use_gft_id", CTLFLAG_RWTUN, &fcp->isp_use_gft_id, 0,
+ "Use GFT_ID during fabric scan");
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "use_gff_id", CTLFLAG_RWTUN, &fcp->isp_use_gff_id, 0,
+ "Use GFF_ID during fabric scan");
return (0);
}
@@ -256,19 +228,12 @@ isp_detach_chan(ispsoftc_t *isp, int chan)
{
struct cam_sim *sim;
struct cam_path *path;
- struct ccb_setasync csa;
int *num_threads;
ISP_GET_PC(isp, chan, sim, sim);
ISP_GET_PC(isp, chan, path, path);
ISP_GET_PC_ADDR(isp, chan, num_threads, num_threads);
- xpt_setup_ccb(&csa.ccb_h, path, 5);
- csa.ccb_h.func_code = XPT_SASYNC_CB;
- csa.event_enable = 0;
- csa.callback = isp_cam_async;
- csa.callback_arg = sim;
- xpt_action((union ccb *)&csa);
xpt_free_path(path);
xpt_bus_deregister(cam_sim_path(sim));
cam_sim_free(sim, FALSE);
@@ -408,16 +373,10 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int flags, struct thread *td)
retval = -ENXIO;
break;
}
- if (IS_FC(isp)) {
- *(int *)addr = FCPARAM(isp, chan)->role;
- } else {
- *(int *)addr = ISP_ROLE_INITIATOR;
- }
+ *(int *)addr = FCPARAM(isp, chan)->role;
retval = 0;
break;
case ISP_SETROLE:
- if (IS_SCSI(isp))
- break;
nr = *(int *)addr;
chan = nr >> 8;
if (chan < 0 || chan >= isp->isp_nchan) {
@@ -444,46 +403,39 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int flags, struct thread *td)
break;
case ISP_RESCAN:
- if (IS_FC(isp)) {
- chan = *(intptr_t *)addr;
- if (chan < 0 || chan >= isp->isp_nchan) {
- retval = -ENXIO;
- break;
- }
- ISP_LOCK(isp);
- if (isp_fc_runstate(isp, chan, 5 * 1000000) != LOOP_READY) {
- retval = EIO;
- } else {
- retval = 0;
- }
- ISP_UNLOCK(isp);
+ chan = *(intptr_t *)addr;
+ if (chan < 0 || chan >= isp->isp_nchan) {
+ retval = -ENXIO;
+ break;
}
+ ISP_LOCK(isp);
+ if (isp_fc_runstate(isp, chan, 5 * 1000000) != LOOP_READY) {
+ retval = EIO;
+ } else {
+ retval = 0;
+ }
+ ISP_UNLOCK(isp);
break;
case ISP_FC_LIP:
- if (IS_FC(isp)) {
- chan = *(intptr_t *)addr;
- if (chan < 0 || chan >= isp->isp_nchan) {
- retval = -ENXIO;
- break;
- }
- ISP_LOCK(isp);
- if (isp_control(isp, ISPCTL_SEND_LIP, chan)) {
- retval = EIO;
- } else {
- retval = 0;
- }
- ISP_UNLOCK(isp);
+ chan = *(intptr_t *)addr;
+ if (chan < 0 || chan >= isp->isp_nchan) {
+ retval = -ENXIO;
+ break;
}
+ ISP_LOCK(isp);
+ if (isp_control(isp, ISPCTL_SEND_LIP, chan)) {
+ retval = EIO;
+ } else {
+ retval = 0;
+ }
+ ISP_UNLOCK(isp);
break;
case ISP_FC_GETDINFO:
{
struct isp_fc_device *ifc = (struct isp_fc_device *) addr;
fcportdb_t *lp;
- if (IS_SCSI(isp)) {
- break;
- }
if (ifc->loopid >= MAX_FC_TARG) {
retval = EINVAL;
break;
@@ -514,24 +466,14 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int flags, struct thread *td)
hba->fc_fw_minor = ISP_FW_MINORX(isp->isp_fwrev);
hba->fc_fw_micro = ISP_FW_MICROX(isp->isp_fwrev);
hba->fc_nchannels = isp->isp_nchan;
- if (IS_FC(isp)) {
- hba->fc_nports = MAX_FC_TARG;
- hba->fc_speed = FCPARAM(isp, hba->fc_channel)->isp_gbspeed;
- hba->fc_topology = FCPARAM(isp, chan)->isp_topo + 1;
- hba->fc_loopid = FCPARAM(isp, chan)->isp_loopid;
- hba->nvram_node_wwn = FCPARAM(isp, chan)->isp_wwnn_nvram;
- hba->nvram_port_wwn = FCPARAM(isp, chan)->isp_wwpn_nvram;
- hba->active_node_wwn = FCPARAM(isp, chan)->isp_wwnn;
- hba->active_port_wwn = FCPARAM(isp, chan)->isp_wwpn;
- } else {
- hba->fc_nports = MAX_TARGETS;
- hba->fc_speed = 0;
- hba->fc_topology = 0;
- hba->nvram_node_wwn = 0ull;
- hba->nvram_port_wwn = 0ull;
- hba->active_node_wwn = 0ull;
- hba->active_port_wwn = 0ull;
- }
+ hba->fc_nports = MAX_FC_TARG;
+ hba->fc_speed = FCPARAM(isp, hba->fc_channel)->isp_gbspeed;
+ hba->fc_topology = FCPARAM(isp, chan)->isp_topo + 1;
+ hba->fc_loopid = FCPARAM(isp, chan)->isp_loopid;
+ hba->nvram_node_wwn = FCPARAM(isp, chan)->isp_wwnn_nvram;
+ hba->nvram_port_wwn = FCPARAM(isp, chan)->isp_wwpn_nvram;
+ hba->active_node_wwn = FCPARAM(isp, chan)->isp_wwnn;
+ hba->active_port_wwn = FCPARAM(isp, chan)->isp_wwpn;
retval = 0;
break;
}
@@ -540,11 +482,13 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int flags, struct thread *td)
int needmarker;
struct isp_fc_tsk_mgmt *fct = (struct isp_fc_tsk_mgmt *) addr;
uint16_t nphdl;
- mbreg_t mbs;
-
- if (IS_SCSI(isp)) {
- break;
- }
+ void *reqp;
+ uint8_t resp[QENTRY_LEN];
+ isp24xx_tmf_t tmf;
+ isp24xx_statusreq_t sp;
+ fcparam *fcp;
+ fcportdb_t *lp;
+ int i;
chan = fct->chan;
if (chan < 0 || chan >= isp->isp_nchan) {
@@ -555,161 +499,106 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int flags, struct thread *td)
needmarker = retval = 0;
nphdl = fct->loopid;
ISP_LOCK(isp);
- if (IS_24XX(isp)) {
- void *reqp;
- uint8_t resp[QENTRY_LEN];
- isp24xx_tmf_t tmf;
- isp24xx_statusreq_t sp;
- fcparam *fcp = FCPARAM(isp, chan);
- fcportdb_t *lp;
- int i;
-
- for (i = 0; i < MAX_FC_TARG; i++) {
- lp = &fcp->portdb[i];
- if (lp->handle == nphdl) {
- break;
- }
- }
- if (i == MAX_FC_TARG) {
- retval = ENXIO;
- ISP_UNLOCK(isp);
- break;
- }
- ISP_MEMZERO(&tmf, sizeof(tmf));
- tmf.tmf_header.rqs_entry_type = RQSTYPE_TSK_MGMT;
- tmf.tmf_header.rqs_entry_count = 1;
- tmf.tmf_nphdl = lp->handle;
- tmf.tmf_delay = 2;
- tmf.tmf_timeout = 4;
- tmf.tmf_tidlo = lp->portid;
- tmf.tmf_tidhi = lp->portid >> 16;
- tmf.tmf_vpidx = ISP_GET_VPIDX(isp, chan);
- tmf.tmf_lun[1] = fct->lun & 0xff;
- if (fct->lun >= 256) {
- tmf.tmf_lun[0] = 0x40 | (fct->lun >> 8);
- }
- switch (fct->action) {
- case IPT_CLEAR_ACA:
- tmf.tmf_flags = ISP24XX_TMF_CLEAR_ACA;
- break;
- case IPT_TARGET_RESET:
- tmf.tmf_flags = ISP24XX_TMF_TARGET_RESET;
- needmarker = 1;
- break;
- case IPT_LUN_RESET:
- tmf.tmf_flags = ISP24XX_TMF_LUN_RESET;
- needmarker = 1;
- break;
- case IPT_CLEAR_TASK_SET:
- tmf.tmf_flags = ISP24XX_TMF_CLEAR_TASK_SET;
- needmarker = 1;
- break;
- case IPT_ABORT_TASK_SET:
- tmf.tmf_flags = ISP24XX_TMF_ABORT_TASK_SET;
- needmarker = 1;
- break;
- default:
- retval = EINVAL;
- break;
- }
- if (retval) {
- ISP_UNLOCK(isp);
- break;
- }
+ fcp = FCPARAM(isp, chan);
- /* Prepare space for response in memory */
- memset(resp, 0xff, sizeof(resp));
- tmf.tmf_handle = isp_allocate_handle(isp, resp,
- ISP_HANDLE_CTRL);
- if (tmf.tmf_handle == 0) {
- isp_prt(isp, ISP_LOGERR,
- "%s: TMF of Chan %d out of handles",
- __func__, chan);
- ISP_UNLOCK(isp);
- retval = ENOMEM;
+ for (i = 0; i < MAX_FC_TARG; i++) {
+ lp = &fcp->portdb[i];
+ if (lp->handle == nphdl) {
break;
}
+ }
+ if (i == MAX_FC_TARG) {
+ retval = ENXIO;
+ ISP_UNLOCK(isp);
+ break;
+ }
+ ISP_MEMZERO(&tmf, sizeof(tmf));
+ tmf.tmf_header.rqs_entry_type = RQSTYPE_TSK_MGMT;
+ tmf.tmf_header.rqs_entry_count = 1;
+ tmf.tmf_nphdl = lp->handle;
+ tmf.tmf_delay = 2;
+ tmf.tmf_timeout = 4;
+ tmf.tmf_tidlo = lp->portid;
+ tmf.tmf_tidhi = lp->portid >> 16;
+ tmf.tmf_vpidx = ISP_GET_VPIDX(isp, chan);
+ tmf.tmf_lun[1] = fct->lun & 0xff;
+ if (fct->lun >= 256) {
+ tmf.tmf_lun[0] = 0x40 | (fct->lun >> 8);
+ }
+ switch (fct->action) {
+ case IPT_CLEAR_ACA:
+ tmf.tmf_flags = ISP24XX_TMF_CLEAR_ACA;
+ break;
+ case IPT_TARGET_RESET:
+ tmf.tmf_flags = ISP24XX_TMF_TARGET_RESET;
+ needmarker = 1;
+ break;
+ case IPT_LUN_RESET:
+ tmf.tmf_flags = ISP24XX_TMF_LUN_RESET;
+ needmarker = 1;
+ break;
+ case IPT_CLEAR_TASK_SET:
+ tmf.tmf_flags = ISP24XX_TMF_CLEAR_TASK_SET;
+ needmarker = 1;
+ break;
+ case IPT_ABORT_TASK_SET:
+ tmf.tmf_flags = ISP24XX_TMF_ABORT_TASK_SET;
+ needmarker = 1;
+ break;
+ default:
+ retval = EINVAL;
+ break;
+ }
+ if (retval) {
+ ISP_UNLOCK(isp);
+ break;
+ }
- /* Send request and wait for response. */
- reqp = isp_getrqentry(isp);
- if (reqp == NULL) {
- isp_prt(isp, ISP_LOGERR,
- "%s: TMF of Chan %d out of rqent",
- __func__, chan);
- isp_destroy_handle(isp, tmf.tmf_handle);
- ISP_UNLOCK(isp);
- retval = EIO;
- break;
- }
- isp_put_24xx_tmf(isp, &tmf, (isp24xx_tmf_t *)reqp);
- if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "IOCB TMF", QENTRY_LEN, reqp);
- ISP_SYNC_REQUEST(isp);
- if (msleep(resp, &isp->isp_lock, 0, "TMF", 5*hz) == EWOULDBLOCK) {
- isp_prt(isp, ISP_LOGERR,
- "%s: TMF of Chan %d timed out",
- __func__, chan);
- isp_destroy_handle(isp, tmf.tmf_handle);
- ISP_UNLOCK(isp);
- retval = EIO;
- break;
- }
- if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "IOCB TMF response", QENTRY_LEN, resp);
- isp_get_24xx_response(isp, (isp24xx_statusreq_t *)resp, &sp);
-
- if (sp.req_completion_status != 0)
- retval = EIO;
- else if (needmarker)
- fcp->sendmarker = 1;
- } else {
- MBSINIT(&mbs, 0, MBLOGALL, 0);
- if (ISP_CAP_2KLOGIN(isp) == 0) {
- nphdl <<= 8;
- }
- switch (fct->action) {
- case IPT_CLEAR_ACA:
- mbs.param[0] = MBOX_CLEAR_ACA;
- mbs.param[1] = nphdl;
- mbs.param[2] = fct->lun;
- break;
- case IPT_TARGET_RESET:
- mbs.param[0] = MBOX_TARGET_RESET;
- mbs.param[1] = nphdl;
- needmarker = 1;
- break;
- case IPT_LUN_RESET:
- mbs.param[0] = MBOX_LUN_RESET;
- mbs.param[1] = nphdl;
- mbs.param[2] = fct->lun;
- needmarker = 1;
- break;
- case IPT_CLEAR_TASK_SET:
- mbs.param[0] = MBOX_CLEAR_TASK_SET;
- mbs.param[1] = nphdl;
- mbs.param[2] = fct->lun;
- needmarker = 1;
- break;
- case IPT_ABORT_TASK_SET:
- mbs.param[0] = MBOX_ABORT_TASK_SET;
- mbs.param[1] = nphdl;
- mbs.param[2] = fct->lun;
- needmarker = 1;
- break;
- default:
- retval = EINVAL;
- break;
- }
- if (retval == 0) {
- if (needmarker) {
- FCPARAM(isp, chan)->sendmarker = 1;
- }
- retval = isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs);
- if (retval) {
- retval = EIO;
- }
- }
+ /* Prepare space for response in memory */
+ memset(resp, 0xff, sizeof(resp));
+ tmf.tmf_handle = isp_allocate_handle(isp, resp,
+ ISP_HANDLE_CTRL);
+ if (tmf.tmf_handle == 0) {
+ isp_prt(isp, ISP_LOGERR,
+ "%s: TMF of Chan %d out of handles",
+ __func__, chan);
+ ISP_UNLOCK(isp);
+ retval = ENOMEM;
+ break;
+ }
+
+ /* Send request and wait for response. */
+ reqp = isp_getrqentry(isp);
+ if (reqp == NULL) {
+ isp_prt(isp, ISP_LOGERR,
+ "%s: TMF of Chan %d out of rqent",
+ __func__, chan);
+ isp_destroy_handle(isp, tmf.tmf_handle);
+ ISP_UNLOCK(isp);
+ retval = EIO;
+ break;
+ }
+ isp_put_24xx_tmf(isp, &tmf, (isp24xx_tmf_t *)reqp);
+ if (isp->isp_dblev & ISP_LOGDEBUG1)
+ isp_print_bytes(isp, "IOCB TMF", QENTRY_LEN, reqp);
+ ISP_SYNC_REQUEST(isp);
+ if (msleep(resp, &isp->isp_lock, 0, "TMF", 5*hz) == EWOULDBLOCK) {
+ isp_prt(isp, ISP_LOGERR,
+ "%s: TMF of Chan %d timed out",
+ __func__, chan);
+ isp_destroy_handle(isp, tmf.tmf_handle);
+ ISP_UNLOCK(isp);
+ retval = EIO;
+ break;
}
+ if (isp->isp_dblev & ISP_LOGDEBUG1)
+ isp_print_bytes(isp, "IOCB TMF response", QENTRY_LEN, resp);
+ isp_get_24xx_response(isp, (isp24xx_statusreq_t *)resp, &sp);
+
+ if (sp.req_completion_status != 0)
+ retval = EIO;
+ else if (needmarker)
+ fcp->sendmarker = 1;
ISP_UNLOCK(isp);
break;
}
@@ -765,15 +654,12 @@ static cam_status create_lun_state(ispsoftc_t *, int, struct cam_path *, tstate_
static void destroy_lun_state(ispsoftc_t *, int, tstate_t *);
static void isp_enable_lun(ispsoftc_t *, union ccb *);
static void isp_disable_lun(ispsoftc_t *, union ccb *);
-static callout_func_t isp_refire_putback_atio;
static callout_func_t isp_refire_notify_ack;
static void isp_complete_ctio(union ccb *);
-static void isp_target_putback_atio(union ccb *);
enum Start_Ctio_How { FROM_CAM, FROM_TIMER, FROM_SRR, FROM_CTIO_DONE };
static void isp_target_start_ctio(ispsoftc_t *, union ccb *, enum Start_Ctio_How);
-static void isp_handle_platform_atio2(ispsoftc_t *, at2_entry_t *);
static void isp_handle_platform_atio7(ispsoftc_t *, at7_entry_t *);
-static void isp_handle_platform_ctio(ispsoftc_t *, void *);
+static void isp_handle_platform_ctio(ispsoftc_t *, ct7_entry_t *);
static int isp_handle_platform_target_notify_ack(ispsoftc_t *, isp_notify_t *, uint32_t rsp);
static void isp_handle_platform_target_tmf(ispsoftc_t *, isp_notify_t *);
static void isp_target_mark_aborted_early(ispsoftc_t *, int chan, tstate_t *, uint32_t);
@@ -806,17 +692,10 @@ isp_atio_restart(ispsoftc_t *isp, int bus, tstate_t *tptr)
STAILQ_CONCAT(&rq, &tptr->restart_queue);
while ((ntp = STAILQ_FIRST(&rq)) != NULL) {
STAILQ_REMOVE_HEAD(&rq, next);
- if (IS_24XX(isp)) {
- isp_prt(isp, ISP_LOGTDEBUG0,
- "%s: restarting resrc deprived %x", __func__,
- ((at7_entry_t *)ntp->data)->at_rxid);
- isp_handle_platform_atio7(isp, (at7_entry_t *) ntp->data);
- } else {
- isp_prt(isp, ISP_LOGTDEBUG0,
- "%s: restarting resrc deprived %x", __func__,
- ((at2_entry_t *)ntp->data)->at_rxid);
- isp_handle_platform_atio2(isp, (at2_entry_t *) ntp->data);
- }
+ isp_prt(isp, ISP_LOGTDEBUG0,
+ "%s: restarting resrc deprived %x", __func__,
+ ((at7_entry_t *)ntp->data)->at_rxid);
+ isp_handle_platform_atio7(isp, (at7_entry_t *) ntp->data);
isp_put_ntpd(isp, bus, ntp);
if (!STAILQ_EMPTY(&tptr->restart_queue))
break;
@@ -962,11 +841,6 @@ create_lun_state(ispsoftc_t *isp, int bus, struct cam_path *path, tstate_t **rsl
tstate_t *tptr;
lun = xpt_path_lun_id(path);
- if (lun != CAM_LUN_WILDCARD) {
- if (ISP_MAX_LUNS(isp) > 0 && lun >= ISP_MAX_LUNS(isp)) {
- return (CAM_LUN_INVALID);
- }
- }
tptr = malloc(sizeof (tstate_t), M_DEVBUF, M_NOWAIT|M_ZERO);
if (tptr == NULL) {
return (CAM_RESRC_UNAVAIL);
@@ -1017,13 +891,6 @@ isp_enable_lun(ispsoftc_t *isp, union ccb *ccb)
target_id_t target;
lun_id_t lun;
- if (!IS_FC(isp) || !ISP_CAP_TMODE(isp) || !ISP_CAP_SCCFW(isp)) {
- xpt_print(ccb->ccb_h.path, "Target mode is not supported\n");
- ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
- xpt_done(ccb);
- return;
- }
-
/*
* We only support either target and lun both wildcard
* or target and lun both non-wildcard.
@@ -1096,7 +963,7 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
struct ccb_scsiio *cso;
struct isp_ccbq *waitq;
uint32_t dmaresult, handle, xfrlen, sense_length, tmp;
- uint8_t local[QENTRY_LEN];
+ ct7_entry_t local, *cto = &local;
isp_prt(isp, ISP_LOGTDEBUG0, "%s: ENTRY[0x%x] how %u xfrlen %u sendstatus %d sense_len %u", __func__, ccb->csio.tag_id, how, ccb->csio.dxfer_len,
(ccb->ccb_h.flags & CAM_SEND_STATUS) != 0, ((ccb->ccb_h.flags & CAM_SEND_SENSE)? ccb->csio.sense_len : 0));
@@ -1214,8 +1081,6 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
sense_length = 0;
}
- memset(local, 0, QENTRY_LEN);
-
/*
* Check for overflow
*/
@@ -1238,288 +1103,146 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
}
}
- if (IS_24XX(isp)) {
- ct7_entry_t *cto = (ct7_entry_t *) local;
-
- cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
- cto->ct_header.rqs_entry_count = 1;
- cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM;
- ATPD_SET_SEQNO(cto, atp);
- cto->ct_nphdl = atp->nphdl;
- cto->ct_rxid = atp->tag;
- cto->ct_iid_lo = atp->sid;
- cto->ct_iid_hi = atp->sid >> 16;
- cto->ct_oxid = atp->oxid;
- cto->ct_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(ccb));
- cto->ct_timeout = XS_TIME(ccb);
- cto->ct_flags = atp->tattr << CT7_TASK_ATTR_SHIFT;
-
- /*
- * Mode 1, status, no data. Only possible when we are sending status, have
- * no data to transfer, and any sense data can fit into a ct7_entry_t.
- *
- * Mode 2, status, no data. We have to use this in the case that
- * the sense data won't fit into a ct7_entry_t.
- *
- */
- if (sendstatus && xfrlen == 0) {
- cto->ct_flags |= CT7_SENDSTATUS | CT7_NO_DATA;
- resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit;
- if (sense_length <= MAXRESPLEN_24XX) {
- cto->ct_flags |= CT7_FLAG_MODE1;
- cto->ct_scsi_status = cso->scsi_status;
- if (resid < 0) {
- cto->ct_resid = -resid;
- cto->ct_scsi_status |= (FCP_RESID_OVERFLOW << 8);
- } else if (resid > 0) {
- cto->ct_resid = resid;
- cto->ct_scsi_status |= (FCP_RESID_UNDERFLOW << 8);
- }
- if (fctape) {
- cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF;
- }
- if (sense_length) {
- cto->ct_scsi_status |= (FCP_SNSLEN_VALID << 8);
- cto->rsp.m1.ct_resplen = cto->ct_senselen = sense_length;
- memcpy(cto->rsp.m1.ct_resp, &cso->sense_data, sense_length);
- }
- } else {
- bus_addr_t addr;
- fcp_rsp_iu_t rp;
+ memset(cto, 0, QENTRY_LEN);
+ cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
+ cto->ct_header.rqs_entry_count = 1;
+ cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM;
+ ATPD_SET_SEQNO(cto, atp);
+ cto->ct_nphdl = atp->nphdl;
+ cto->ct_rxid = atp->tag;
+ cto->ct_iid_lo = atp->sid;
+ cto->ct_iid_hi = atp->sid >> 16;
+ cto->ct_oxid = atp->oxid;
+ cto->ct_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(ccb));
+ cto->ct_timeout = XS_TIME(ccb);
+ cto->ct_flags = atp->tattr << CT7_TASK_ATTR_SHIFT;
- if (atp->ests == NULL) {
- atp->ests = isp_get_ecmd(isp);
- if (atp->ests == NULL) {
- TAILQ_INSERT_HEAD(waitq, &ccb->ccb_h, sim_links.tqe);
- break;
- }
- }
- memset(&rp, 0, sizeof(rp));
- if (fctape) {
- cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF;
- rp.fcp_rsp_bits |= FCP_CONF_REQ;
- }
- cto->ct_flags |= CT7_FLAG_MODE2;
- rp.fcp_rsp_scsi_status = cso->scsi_status;
- if (resid < 0) {
- rp.fcp_rsp_resid = -resid;
- rp.fcp_rsp_bits |= FCP_RESID_OVERFLOW;
- } else if (resid > 0) {
- rp.fcp_rsp_resid = resid;
- rp.fcp_rsp_bits |= FCP_RESID_UNDERFLOW;
- }
- if (sense_length) {
- rp.fcp_rsp_snslen = sense_length;
- cto->ct_senselen = sense_length;
- rp.fcp_rsp_bits |= FCP_SNSLEN_VALID;
- isp_put_fcp_rsp_iu(isp, &rp, atp->ests);
- memcpy(((fcp_rsp_iu_t *)atp->ests)->fcp_rsp_extra, &cso->sense_data, sense_length);
- } else {
- isp_put_fcp_rsp_iu(isp, &rp, atp->ests);
- }
- if (isp->isp_dblev & ISP_LOGTDEBUG1) {
- isp_print_bytes(isp, "FCP Response Frame After Swizzling", MIN_FCP_RESPONSE_SIZE + sense_length, atp->ests);
- }
- bus_dmamap_sync(isp->isp_osinfo.ecmd_dmat, isp->isp_osinfo.ecmd_map, BUS_DMASYNC_PREWRITE);
- addr = isp->isp_osinfo.ecmd_dma;
- addr += ((((isp_ecmd_t *)atp->ests) - isp->isp_osinfo.ecmd_base) * XCMD_SIZE);
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests,
- (uintmax_t) isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + sense_length);
- cto->rsp.m2.ct_datalen = MIN_FCP_RESPONSE_SIZE + sense_length;
- cto->rsp.m2.ct_fcp_rsp_iudata.ds_base = DMA_LO32(addr);
- cto->rsp.m2.ct_fcp_rsp_iudata.ds_basehi = DMA_HI32(addr);
- cto->rsp.m2.ct_fcp_rsp_iudata.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length;
+ /*
+ * Mode 1, status, no data. Only possible when we are sending status, have
+ * no data to transfer, and any sense data can fit into a ct7_entry_t.
+ *
+ * Mode 2, status, no data. We have to use this in the case that
+ * the sense data won't fit into a ct7_entry_t.
+ *
+ */
+ if (sendstatus && xfrlen == 0) {
+ cto->ct_flags |= CT7_SENDSTATUS | CT7_NO_DATA;
+ resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit;
+ if (sense_length <= MAXRESPLEN_24XX) {
+ cto->ct_flags |= CT7_FLAG_MODE1;
+ cto->ct_scsi_status = cso->scsi_status;
+ if (resid < 0) {
+ cto->ct_resid = -resid;
+ cto->ct_scsi_status |= (FCP_RESID_OVERFLOW << 8);
+ } else if (resid > 0) {
+ cto->ct_resid = resid;
+ cto->ct_scsi_status |= (FCP_RESID_UNDERFLOW << 8);
+ }
+ if (fctape) {
+ cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF;
}
if (sense_length) {
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d slen %u sense: %x %x/%x/%x", __func__,
- cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, cto->ct_resid, sense_length,
- cso->sense_data.error_code, cso->sense_data.sense_buf[1], cso->sense_data.sense_buf[11], cso->sense_data.sense_buf[12]);
- } else {
- isp_prt(isp, ISP_LOGDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d", __func__,
- cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, cto->ct_resid);
+ cto->ct_scsi_status |= (FCP_SNSLEN_VALID << 8);
+ cto->rsp.m1.ct_resplen = cto->ct_senselen = sense_length;
+ memcpy(cto->rsp.m1.ct_resp, &cso->sense_data, sense_length);
}
- atp->state = ATPD_STATE_LAST_CTIO;
- }
+ } else {
+ bus_addr_t addr;
+ fcp_rsp_iu_t rp;
- /*
- * Mode 0 data transfers, *possibly* with status.
- */
- if (xfrlen != 0) {
- cto->ct_flags |= CT7_FLAG_MODE0;
- if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
- cto->ct_flags |= CT7_DATA_IN;
- } else {
- cto->ct_flags |= CT7_DATA_OUT;
+ if (atp->ests == NULL) {
+ atp->ests = isp_get_ecmd(isp);
+ if (atp->ests == NULL) {
+ TAILQ_INSERT_HEAD(waitq, &ccb->ccb_h, sim_links.tqe);
+ break;
+ }
}
-
- cto->rsp.m0.reloff = atp->bytes_xfered + atp->bytes_in_transit;
- cto->rsp.m0.ct_xfrlen = xfrlen;
-
-#ifdef DEBUG
- if (ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame && xfrlen > ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame) {
- isp_prt(isp, ISP_LOGWARN, "%s: truncating data frame with xfrlen %d to %d", __func__, xfrlen, xfrlen - (xfrlen >> 2));
- ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame = 0;
- cto->rsp.m0.ct_xfrlen -= xfrlen >> 2;
+ memset(&rp, 0, sizeof(rp));
+ if (fctape) {
+ cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF;
+ rp.fcp_rsp_bits |= FCP_CONF_REQ;
}
-#endif
- if (sendstatus) {
- resid = atp->orig_datalen - atp->bytes_xfered - xfrlen;
- if (cso->scsi_status == SCSI_STATUS_OK && resid == 0 /* && fctape == 0 */) {
- cto->ct_flags |= CT7_SENDSTATUS;
- atp->state = ATPD_STATE_LAST_CTIO;
- if (fctape) {
- cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF;
- }
- } else {
- atp->sendst = 1; /* send status later */
- cto->ct_header.rqs_seqno &= ~ATPD_SEQ_NOTIFY_CAM;
- atp->state = ATPD_STATE_CTIO;
- }
+ cto->ct_flags |= CT7_FLAG_MODE2;
+ rp.fcp_rsp_scsi_status = cso->scsi_status;
+ if (resid < 0) {
+ rp.fcp_rsp_resid = -resid;
+ rp.fcp_rsp_bits |= FCP_RESID_OVERFLOW;
+ } else if (resid > 0) {
+ rp.fcp_rsp_resid = resid;
+ rp.fcp_rsp_bits |= FCP_RESID_UNDERFLOW;
+ }
+ if (sense_length) {
+ rp.fcp_rsp_snslen = sense_length;
+ cto->ct_senselen = sense_length;
+ rp.fcp_rsp_bits |= FCP_SNSLEN_VALID;
+ isp_put_fcp_rsp_iu(isp, &rp, atp->ests);
+ memcpy(((fcp_rsp_iu_t *)atp->ests)->fcp_rsp_extra, &cso->sense_data, sense_length);
} else {
- atp->state = ATPD_STATE_CTIO;
+ isp_put_fcp_rsp_iu(isp, &rp, atp->ests);
+ }
+ if (isp->isp_dblev & ISP_LOGTDEBUG1) {
+ isp_print_bytes(isp, "FCP Response Frame After Swizzling", MIN_FCP_RESPONSE_SIZE + sense_length, atp->ests);
}
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x xfrlen=%u off=%u", __func__,
- cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, xfrlen, atp->bytes_xfered);
+ bus_dmamap_sync(isp->isp_osinfo.ecmd_dmat, isp->isp_osinfo.ecmd_map, BUS_DMASYNC_PREWRITE);
+ addr = isp->isp_osinfo.ecmd_dma;
+ addr += ((((isp_ecmd_t *)atp->ests) - isp->isp_osinfo.ecmd_base) * XCMD_SIZE);
+ isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests,
+ (uintmax_t) isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + sense_length);
+ cto->rsp.m2.ct_datalen = MIN_FCP_RESPONSE_SIZE + sense_length;
+ cto->rsp.m2.ct_fcp_rsp_iudata.ds_base = DMA_LO32(addr);
+ cto->rsp.m2.ct_fcp_rsp_iudata.ds_basehi = DMA_HI32(addr);
+ cto->rsp.m2.ct_fcp_rsp_iudata.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length;
}
- } else {
- ct2_entry_t *cto = (ct2_entry_t *) local;
-
- cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
- cto->ct_header.rqs_entry_count = 1;
- cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM;
- ATPD_SET_SEQNO(cto, atp);
- if (ISP_CAP_2KLOGIN(isp)) {
- ((ct2e_entry_t *)cto)->ct_iid = atp->nphdl;
+ if (sense_length) {
+ isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d slen %u sense: %x %x/%x/%x", __func__,
+ cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, cto->ct_resid, sense_length,
+ cso->sense_data.error_code, cso->sense_data.sense_buf[1], cso->sense_data.sense_buf[11], cso->sense_data.sense_buf[12]);
} else {
- cto->ct_iid = atp->nphdl;
- if (ISP_CAP_SCCFW(isp) == 0) {
- cto->ct_lun = ccb->ccb_h.target_lun;
- }
+ isp_prt(isp, ISP_LOGDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d", __func__,
+ cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, cto->ct_resid);
}
- cto->ct_timeout = XS_TIME(ccb);
- cto->ct_rxid = cso->tag_id;
-
- /*
- * Mode 1, status, no data. Only possible when we are sending status, have
- * no data to transfer, and the sense length can fit in the ct7_entry.
- *
- * Mode 2, status, no data. We have to use this in the case the response
- * length won't fit into a ct2_entry_t.
- *
- * We'll fill out this structure with information as if this were a
- * Mode 1. The hardware layer will create the Mode 2 FCP RSP IU as
- * needed based upon this.
- */
- if (sendstatus && xfrlen == 0) {
- cto->ct_flags |= CT2_SENDSTATUS | CT2_NO_DATA;
- resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit;
- if (sense_length <= MAXRESPLEN) {
- if (resid < 0) {
- cto->ct_resid = -resid;
- } else if (resid > 0) {
- cto->ct_resid = resid;
- }
- cto->ct_flags |= CT2_FLAG_MODE1;
- cto->rsp.m1.ct_scsi_status = cso->scsi_status;
- if (resid < 0) {
- cto->rsp.m1.ct_scsi_status |= CT2_DATA_OVER;
- } else if (resid > 0) {
- cto->rsp.m1.ct_scsi_status |= CT2_DATA_UNDER;
- }
- if (fctape) {
- cto->ct_flags |= CT2_CONFIRM;
- }
- if (sense_length) {
- cto->rsp.m1.ct_scsi_status |= CT2_SNSLEN_VALID;
- cto->rsp.m1.ct_resplen = cto->rsp.m1.ct_senselen = sense_length;
- memcpy(cto->rsp.m1.ct_resp, &cso->sense_data, sense_length);
- }
- } else {
- bus_addr_t addr;
- fcp_rsp_iu_t rp;
+ atp->state = ATPD_STATE_LAST_CTIO;
+ }
- if (atp->ests == NULL) {
- atp->ests = isp_get_ecmd(isp);
- if (atp->ests == NULL) {
- TAILQ_INSERT_HEAD(waitq, &ccb->ccb_h, sim_links.tqe);
- break;
- }
- }
- memset(&rp, 0, sizeof(rp));
- if (fctape) {
- cto->ct_flags |= CT2_CONFIRM;
- rp.fcp_rsp_bits |= FCP_CONF_REQ;
- }
- cto->ct_flags |= CT2_FLAG_MODE2;
- rp.fcp_rsp_scsi_status = cso->scsi_status;
- if (resid < 0) {
- rp.fcp_rsp_resid = -resid;
- rp.fcp_rsp_bits |= FCP_RESID_OVERFLOW;
- } else if (resid > 0) {
- rp.fcp_rsp_resid = resid;
- rp.fcp_rsp_bits |= FCP_RESID_UNDERFLOW;
- }
- if (sense_length) {
- rp.fcp_rsp_snslen = sense_length;
- rp.fcp_rsp_bits |= FCP_SNSLEN_VALID;
- isp_put_fcp_rsp_iu(isp, &rp, atp->ests);
- memcpy(((fcp_rsp_iu_t *)atp->ests)->fcp_rsp_extra, &cso->sense_data, sense_length);
- } else {
- isp_put_fcp_rsp_iu(isp, &rp, atp->ests);
- }
- if (isp->isp_dblev & ISP_LOGTDEBUG1) {
- isp_print_bytes(isp, "FCP Response Frame After Swizzling", MIN_FCP_RESPONSE_SIZE + sense_length, atp->ests);
- }
- bus_dmamap_sync(isp->isp_osinfo.ecmd_dmat, isp->isp_osinfo.ecmd_map, BUS_DMASYNC_PREWRITE);
- addr = isp->isp_osinfo.ecmd_dma;
- addr += ((((isp_ecmd_t *)atp->ests) - isp->isp_osinfo.ecmd_base) * XCMD_SIZE);
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests,
- (uintmax_t) isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + sense_length);
- cto->rsp.m2.ct_datalen = MIN_FCP_RESPONSE_SIZE + sense_length;
- cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr);
- cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length;
- }
- if (sense_length) {
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d sense: %x %x/%x/%x", __func__,
- cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid,
- cso->sense_data.error_code, cso->sense_data.sense_buf[1], cso->sense_data.sense_buf[11], cso->sense_data.sense_buf[12]);
- } else {
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d", __func__, cto->ct_rxid,
- ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid);
- }
- atp->state = ATPD_STATE_LAST_CTIO;
+ /*
+ * Mode 0 data transfers, *possibly* with status.
+ */
+ if (xfrlen != 0) {
+ cto->ct_flags |= CT7_FLAG_MODE0;
+ if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
+ cto->ct_flags |= CT7_DATA_IN;
+ } else {
+ cto->ct_flags |= CT7_DATA_OUT;
}
- if (xfrlen != 0) {
- cto->ct_flags |= CT2_FLAG_MODE0;
- if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
- cto->ct_flags |= CT2_DATA_IN;
- } else {
- cto->ct_flags |= CT2_DATA_OUT;
- }
+ cto->rsp.m0.reloff = atp->bytes_xfered + atp->bytes_in_transit;
+ cto->rsp.m0.ct_xfrlen = xfrlen;
- cto->ct_reloff = atp->bytes_xfered + atp->bytes_in_transit;
- cto->rsp.m0.ct_xfrlen = xfrlen;
-
- if (sendstatus) {
- resid = atp->orig_datalen - atp->bytes_xfered - xfrlen;
- if (cso->scsi_status == SCSI_STATUS_OK && resid == 0 /*&& fctape == 0*/) {
- cto->ct_flags |= CT2_SENDSTATUS;
- atp->state = ATPD_STATE_LAST_CTIO;
- if (fctape) {
- cto->ct_flags |= CT2_CONFIRM;
- }
- } else {
- atp->sendst = 1; /* send status later */
- cto->ct_header.rqs_seqno &= ~ATPD_SEQ_NOTIFY_CAM;
- atp->state = ATPD_STATE_CTIO;
+#ifdef DEBUG
+ if (ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame && xfrlen > ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame) {
+ isp_prt(isp, ISP_LOGWARN, "%s: truncating data frame with xfrlen %d to %d", __func__, xfrlen, xfrlen - (xfrlen >> 2));
+ ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame = 0;
+ cto->rsp.m0.ct_xfrlen -= xfrlen >> 2;
+ }
+#endif
+ if (sendstatus) {
+ resid = atp->orig_datalen - atp->bytes_xfered - xfrlen;
+ if (cso->scsi_status == SCSI_STATUS_OK && resid == 0 /* && fctape == 0 */) {
+ cto->ct_flags |= CT7_SENDSTATUS;
+ atp->state = ATPD_STATE_LAST_CTIO;
+ if (fctape) {
+ cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF;
}
} else {
+ atp->sendst = 1; /* send status later */
+ cto->ct_header.rqs_seqno &= ~ATPD_SEQ_NOTIFY_CAM;
atp->state = ATPD_STATE_CTIO;
}
+ } else {
+ atp->state = ATPD_STATE_CTIO;
}
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[%x] seq %u nc %d CDB0=%x scsi status %x flags %x resid %d xfrlen %u offset %u", __func__, cto->ct_rxid,
- ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid, cso->dxfer_len, atp->bytes_xfered);
+ isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x xfrlen=%u off=%u", __func__,
+ cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, xfrlen, atp->bytes_xfered);
}
if (isp_get_pcmd(isp, ccb)) {
@@ -1537,7 +1260,6 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
atp->bytes_in_transit += xfrlen;
PISP_PCMD(ccb)->datalen = xfrlen;
-
/*
* Call the dma setup routines for this entry (and any subsequent
* CTIOs) if there's data to move, and then tell the f/w it's got
@@ -1546,16 +1268,8 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
* of this, we put the request onto the queue area first in native
* format.
*/
-
- if (IS_24XX(isp)) {
- ct7_entry_t *cto = (ct7_entry_t *) local;
- cto->ct_syshandle = handle;
- } else {
- ct2_entry_t *cto = (ct2_entry_t *) local;
- cto->ct_syshandle = handle;
- }
-
- dmaresult = ISP_DMASETUP(isp, cso, (ispreq_t *) local);
+ cto->ct_syshandle = handle;
+ dmaresult = ISP_DMASETUP(isp, cso, cto);
if (dmaresult != CMD_QUEUED) {
isp_destroy_handle(isp, handle);
isp_free_pcmd(isp, ccb);
@@ -1579,15 +1293,6 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
}
static void
-isp_refire_putback_atio(void *arg)
-{
- union ccb *ccb = arg;
-
- ISP_ASSERT_LOCKED((ispsoftc_t *)XS_ISP(ccb));
- isp_target_putback_atio(ccb);
-}
-
-static void
isp_refire_notify_ack(void *arg)
{
isp_tna_t *tp = arg;
@@ -1603,31 +1308,6 @@ isp_refire_notify_ack(void *arg)
static void
-isp_target_putback_atio(union ccb *ccb)
-{
- ispsoftc_t *isp = XS_ISP(ccb);
- struct ccb_scsiio *cso = &ccb->csio;
- at2_entry_t local, *at = &local;
-
- ISP_MEMZERO(at, sizeof (at2_entry_t));
- at->at_header.rqs_entry_type = RQSTYPE_ATIO2;
- at->at_header.rqs_entry_count = 1;
- if (ISP_CAP_SCCFW(isp)) {
- at->at_scclun = (uint16_t) ccb->ccb_h.target_lun;
- } else {
- at->at_lun = (uint8_t) ccb->ccb_h.target_lun;
- }
- at->at_status = CT_OK;
- at->at_rxid = cso->tag_id;
- at->at_iid = cso->init_id;
- if (isp_target_put_entry(isp, at)) {
- callout_reset(&PISP_PCMD(ccb)->wdog, 10,
- isp_refire_putback_atio, ccb);
- } else
- isp_complete_ctio(ccb);
-}
-
-static void
isp_complete_ctio(union ccb *ccb)
{
if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) {
@@ -1637,144 +1317,6 @@ isp_complete_ctio(union ccb *ccb)
}
static void
-isp_handle_platform_atio2(ispsoftc_t *isp, at2_entry_t *aep)
-{
- fcparam *fcp;
- lun_id_t lun;
- fcportdb_t *lp;
- tstate_t *tptr;
- struct ccb_accept_tio *atiop;
- uint16_t nphdl;
- atio_private_data_t *atp;
- inot_private_data_t *ntp;
-
- /*
- * The firmware status (except for the QLTM_SVALID bit)
- * indicates why this ATIO was sent to us.
- *
- * If QLTM_SVALID is set, the firmware has recommended Sense Data.
- */
- if ((aep->at_status & ~QLTM_SVALID) != AT_CDB) {
- isp_prt(isp, ISP_LOGWARN, "bogus atio (0x%x) leaked to platform", aep->at_status);
- isp_endcmd(isp, aep, NIL_HANDLE, 0, SCSI_STATUS_BUSY, 0);
- return;
- }
-
- fcp = FCPARAM(isp, 0);
- if (ISP_CAP_SCCFW(isp)) {
- lun = aep->at_scclun;
- } else {
- lun = aep->at_lun;
- }
- if (ISP_CAP_2KLOGIN(isp)) {
- nphdl = ((at2e_entry_t *)aep)->at_iid;
- } else {
- nphdl = aep->at_iid;
- }
- tptr = get_lun_statep(isp, 0, lun);
- if (tptr == NULL) {
- tptr = get_lun_statep(isp, 0, CAM_LUN_WILDCARD);
- if (tptr == NULL) {
- isp_prt(isp, ISP_LOGWARN, "%s: [0x%x] no state pointer for lun %jx or wildcard", __func__, aep->at_rxid, (uintmax_t)lun);
- if (lun == 0) {
- isp_endcmd(isp, aep, nphdl, 0, SCSI_STATUS_BUSY, 0);
- } else {
- isp_endcmd(isp, aep, nphdl, 0, SCSI_STATUS_CHECK_COND | ECMD_SVALID | (0x5 << 12) | (0x25 << 16), 0);
- }
- return;
- }
- }
-
- /*
- * Start any commands pending resources first.
- */
- if (isp_atio_restart(isp, 0, tptr))
- goto noresrc;
-
- atiop = (struct ccb_accept_tio *) SLIST_FIRST(&tptr->atios);
- if (atiop == NULL) {
- goto noresrc;
- }
-
- atp = isp_get_atpd(isp, 0, aep->at_rxid);
- if (atp == NULL) {
- goto noresrc;
- }
-
- atp->state = ATPD_STATE_ATIO;
- SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle);
- ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, atiop->ccb_h.path, "Take FREE ATIO\n");
- atiop->ccb_h.target_id = ISP_MAX_TARGETS(isp);
- atiop->ccb_h.target_lun = lun;
-
- /*
- * We don't get 'suggested' sense data as we do with SCSI cards.
- */
- atiop->sense_len = 0;
-
- /*
- * If we're not in the port database, add ourselves.
- */
- if (IS_2100(isp))
- atiop->init_id = nphdl;
- else {
- if (isp_find_pdb_by_handle(isp, 0, nphdl, &lp)) {
- atiop->init_id = FC_PORTDB_TGT(isp, 0, lp);
- } else {
- isp_prt(isp, ISP_LOGTINFO, "%s: port %x isn't in PDB",
- __func__, nphdl);
- isp_dump_portdb(isp, 0);
- isp_endcmd(isp, aep, NIL_HANDLE, 0, ECMD_TERMINATE, 0);
- return;
- }
- }
- atiop->cdb_len = ATIO2_CDBLEN;
- ISP_MEMCPY(atiop->cdb_io.cdb_bytes, aep->at_cdb, ATIO2_CDBLEN);
- atiop->ccb_h.status = CAM_CDB_RECVD;
- atiop->tag_id = atp->tag;
- switch (aep->at_taskflags & ATIO2_TC_ATTR_MASK) {
- case ATIO2_TC_ATTR_SIMPLEQ:
- atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID;
- atiop->tag_action = MSG_SIMPLE_Q_TAG;
- break;
- case ATIO2_TC_ATTR_HEADOFQ:
- atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID;
- atiop->tag_action = MSG_HEAD_OF_Q_TAG;
- break;
- case ATIO2_TC_ATTR_ORDERED:
- atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID;
- atiop->tag_action = MSG_ORDERED_Q_TAG;
- break;
- case ATIO2_TC_ATTR_ACAQ: /* ?? */
- case ATIO2_TC_ATTR_UNTAGGED:
- default:
- atiop->tag_action = 0;
- break;
- }
-
- atp->orig_datalen = aep->at_datalen;
- atp->bytes_xfered = 0;
- atp->lun = lun;
- atp->nphdl = nphdl;
- atp->sid = PORT_ANY;
- atp->oxid = aep->at_oxid;
- atp->cdb0 = aep->at_cdb[0];
- atp->tattr = aep->at_taskflags & ATIO2_TC_ATTR_MASK;
- atp->state = ATPD_STATE_CAM;
- xpt_done((union ccb *)atiop);
- isp_prt(isp, ISP_LOGTDEBUG0, "ATIO2[0x%x] CDB=0x%x lun %jx datalen %u", aep->at_rxid, atp->cdb0, (uintmax_t)lun, atp->orig_datalen);
- return;
-noresrc:
- ntp = isp_get_ntpd(isp, 0);
- if (ntp == NULL) {
- isp_endcmd(isp, aep, nphdl, 0, SCSI_STATUS_BUSY, 0);
- return;
- }
- memcpy(ntp->data, aep, QENTRY_LEN);
- STAILQ_INSERT_TAIL(&tptr->restart_queue, ntp, next);
-}
-
-static void
isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
{
int cdbxlen;
@@ -1898,20 +1440,22 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
switch (aep->at_cmnd.fcp_cmnd_task_attribute & FCP_CMND_TASK_ATTR_MASK) {
case FCP_CMND_TASK_ATTR_SIMPLE:
atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID;
- atiop->tag_action = MSG_SIMPLE_Q_TAG;
+ atiop->tag_action = MSG_SIMPLE_TASK;
break;
case FCP_CMND_TASK_ATTR_HEAD:
atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID;
- atiop->tag_action = MSG_HEAD_OF_Q_TAG;
+ atiop->tag_action = MSG_HEAD_OF_QUEUE_TASK;
break;
case FCP_CMND_TASK_ATTR_ORDERED:
atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID;
- atiop->tag_action = MSG_ORDERED_Q_TAG;
+ atiop->tag_action = MSG_ORDERED_TASK;
break;
- default:
- /* FALLTHROUGH */
case FCP_CMND_TASK_ATTR_ACA:
+ atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID;
+ atiop->tag_action = MSG_ACA_TASK;
+ break;
case FCP_CMND_TASK_ATTR_UNTAGGED:
+ default:
atiop->tag_action = 0;
break;
}
@@ -2073,7 +1617,7 @@ isp_handle_platform_srr(ispsoftc_t *isp, isp_notify_t *notify)
}
static void
-isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
+isp_handle_platform_ctio(ispsoftc_t *isp, ct7_entry_t *ct)
{
union ccb *ccb;
int sentstatus = 0, ok = 0, notify_cam = 0, failure = 0;
@@ -2081,10 +1625,10 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
int bus;
uint32_t handle, data_requested, resid;
- handle = ((ct2_entry_t *)arg)->ct_syshandle;
+ handle = ct->ct_syshandle;
ccb = isp_find_xs(isp, handle);
if (ccb == NULL) {
- isp_print_bytes(isp, "null ccb in isp_handle_platform_ctio", QENTRY_LEN, arg);
+ isp_print_bytes(isp, "null ccb in isp_handle_platform_ctio", QENTRY_LEN, ct);
return;
}
isp_destroy_handle(isp, handle);
@@ -2092,11 +1636,7 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
isp_free_pcmd(isp, ccb);
bus = XS_CHANNEL(ccb);
- if (IS_24XX(isp)) {
- atp = isp_find_atpd(isp, bus, ((ct7_entry_t *)arg)->ct_rxid);
- } else {
- atp = isp_find_atpd(isp, bus, ((ct2_entry_t *)arg)->ct_rxid);
- }
+ atp = isp_find_atpd(isp, bus, ct->ct_rxid);
if (atp == NULL) {
/*
* XXX: isp_clear_commands() generates fake CTIO with zero
@@ -2114,51 +1654,25 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
atp->ctcnt -= 1;
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
- if (IS_24XX(isp)) {
- ct7_entry_t *ct = arg;
-
- if (ct->ct_nphdl == CT7_SRR) {
- atp->srr_ccb = ccb;
- if (atp->srr_notify_rcvd)
- isp_handle_srr_start(isp, atp);
- return;
- }
- if (ct->ct_nphdl == CT_HBA_RESET) {
- sentstatus = (ccb->ccb_h.flags & CAM_SEND_STATUS) &&
- (atp->sendst == 0);
- failure = CAM_UNREC_HBA_ERROR;
- } else {
- sentstatus = ct->ct_flags & CT7_SENDSTATUS;
- ok = (ct->ct_nphdl == CT7_OK);
- notify_cam = (ct->ct_header.rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0;
- if ((ct->ct_flags & CT7_DATAMASK) != CT7_NO_DATA)
- resid = ct->ct_resid;
- }
- isp_prt(isp, ok? ISP_LOGTDEBUG0 : ISP_LOGWARN, "%s: CTIO7[%x] seq %u nc %d sts 0x%x flg 0x%x sns %d resid %d %s", __func__, ct->ct_rxid, ATPD_GET_SEQNO(ct),
- notify_cam, ct->ct_nphdl, ct->ct_flags, (ccb->ccb_h.status & CAM_SENT_SENSE) != 0, resid, sentstatus? "FIN" : "MID");
- } else {
- ct2_entry_t *ct = arg;
- if (ct->ct_status == CT_SRR) {
- atp->srr_ccb = ccb;
- if (atp->srr_notify_rcvd)
- isp_handle_srr_start(isp, atp);
- isp_target_putback_atio(ccb);
- return;
- }
- if (ct->ct_status == CT_HBA_RESET) {
- sentstatus = (ccb->ccb_h.flags & CAM_SEND_STATUS) &&
- (atp->sendst == 0);
- failure = CAM_UNREC_HBA_ERROR;
- } else {
- sentstatus = ct->ct_flags & CT2_SENDSTATUS;
- ok = (ct->ct_status & ~QLTM_SVALID) == CT_OK;
- notify_cam = (ct->ct_header.rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0;
- if ((ct->ct_flags & CT2_DATAMASK) != CT2_NO_DATA)
- resid = ct->ct_resid;
- }
- isp_prt(isp, ok? ISP_LOGTDEBUG0 : ISP_LOGWARN, "%s: CTIO2[%x] seq %u nc %d sts 0x%x flg 0x%x sns %d resid %d %s", __func__, ct->ct_rxid, ATPD_GET_SEQNO(ct),
- notify_cam, ct->ct_status, ct->ct_flags, (ccb->ccb_h.status & CAM_SENT_SENSE) != 0, resid, sentstatus? "FIN" : "MID");
+ if (ct->ct_nphdl == CT7_SRR) {
+ atp->srr_ccb = ccb;
+ if (atp->srr_notify_rcvd)
+ isp_handle_srr_start(isp, atp);
+ return;
}
+ if (ct->ct_nphdl == CT_HBA_RESET) {
+ sentstatus = (ccb->ccb_h.flags & CAM_SEND_STATUS) &&
+ (atp->sendst == 0);
+ failure = CAM_UNREC_HBA_ERROR;
+ } else {
+ sentstatus = ct->ct_flags & CT7_SENDSTATUS;
+ ok = (ct->ct_nphdl == CT7_OK);
+ notify_cam = (ct->ct_header.rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0;
+ if ((ct->ct_flags & CT7_DATAMASK) != CT7_NO_DATA)
+ resid = ct->ct_resid;
+ }
+ isp_prt(isp, ok? ISP_LOGTDEBUG0 : ISP_LOGWARN, "%s: CTIO7[%x] seq %u nc %d sts 0x%x flg 0x%x sns %d resid %d %s", __func__, ct->ct_rxid, ATPD_GET_SEQNO(ct),
+ notify_cam, ct->ct_nphdl, ct->ct_flags, (ccb->ccb_h.status & CAM_SENT_SENSE) != 0, resid, sentstatus? "FIN" : "MID");
if (ok) {
if (data_requested > 0) {
atp->bytes_xfered += data_requested - resid;
@@ -2201,24 +1715,14 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
* We're telling CAM we're done with this CTIO transaction.
*
* 24XX cards never need an ATIO put back.
- *
- * Other cards need one put back only on error.
- * In the latter case, a timeout will re-fire
- * and try again in case we didn't have
- * queue resources to do so at first. In any case,
- * once the putback is done we do the completion
- * call.
*/
- if (ok || IS_24XX(isp)) {
- isp_complete_ctio(ccb);
- } else {
- isp_target_putback_atio(ccb);
- }
+ isp_complete_ctio(ccb);
}
static int
isp_handle_platform_target_notify_ack(ispsoftc_t *isp, isp_notify_t *mp, uint32_t rsp)
{
+ ct7_entry_t local, *cto = &local;
if (isp->isp_state != ISP_RUNSTATE) {
isp_prt(isp, ISP_LOGTINFO, "Notify Code 0x%x (qevalid=%d) acked- h/w not ready (dropping)", mp->nt_ncode, mp->nt_lreserved != NULL);
@@ -2228,8 +1732,7 @@ isp_handle_platform_target_notify_ack(ispsoftc_t *isp, isp_notify_t *mp, uint32_
/*
* This case is for a Task Management Function, which shows up as an ATIO7 entry.
*/
- if (IS_24XX(isp) && mp->nt_lreserved && ((isphdr_t *)mp->nt_lreserved)->rqs_entry_type == RQSTYPE_ATIO) {
- ct7_entry_t local, *cto = &local;
+ if (mp->nt_lreserved && ((isphdr_t *)mp->nt_lreserved)->rqs_entry_type == RQSTYPE_ATIO) {
at7_entry_t *aep = (at7_entry_t *)mp->nt_lreserved;
fcportdb_t *lp;
uint32_t sid;
@@ -2241,7 +1744,7 @@ isp_handle_platform_target_notify_ack(ispsoftc_t *isp, isp_notify_t *mp, uint32_
} else {
nphdl = NIL_HANDLE;
}
- ISP_MEMZERO(&local, sizeof (local));
+ ISP_MEMZERO(cto, sizeof (ct7_entry_t));
cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
cto->ct_header.rqs_entry_count = 1;
cto->ct_nphdl = nphdl;
@@ -2261,20 +1764,18 @@ isp_handle_platform_target_notify_ack(ispsoftc_t *isp, isp_notify_t *mp, uint32_
cto->rsp.m1.ct_resp[2] = (rsp >> 16) & 0xff;
cto->rsp.m1.ct_resp[3] = (rsp >> 24) & 0xff;
}
- return (isp_target_put_entry(isp, &local));
+ return (isp_target_put_entry(isp, &cto));
}
/*
* This case is for a responding to an ABTS frame
*/
- if (IS_24XX(isp) && mp->nt_lreserved && ((isphdr_t *)mp->nt_lreserved)->rqs_entry_type == RQSTYPE_ABTS_RCVD) {
+ if (mp->nt_lreserved && ((isphdr_t *)mp->nt_lreserved)->rqs_entry_type == RQSTYPE_ABTS_RCVD) {
/*
* Overload nt_need_ack here to mark whether we've terminated the associated command.
*/
if (mp->nt_need_ack) {
- uint8_t storage[QENTRY_LEN];
- ct7_entry_t *cto = (ct7_entry_t *) storage;
abts_t *abts = (abts_t *)mp->nt_lreserved;
ISP_MEMZERO(cto, sizeof (ct7_entry_t));
@@ -2307,11 +1808,8 @@ isp_handle_platform_target_notify_ack(ispsoftc_t *isp, isp_notify_t *mp, uint32_
isp_del_all_wwn_entries(isp, mp->nt_channel);
}
- if (mp->nt_ncode == NT_LOGOUT) {
- if (!IS_2100(isp) && IS_FC(isp)) {
- isp_del_wwn_entries(isp, mp);
- }
- }
+ if (mp->nt_ncode == NT_LOGOUT)
+ isp_del_wwn_entries(isp, mp);
/*
* General purpose acknowledgement
@@ -2454,10 +1952,7 @@ isp_target_mark_aborted_early(ispsoftc_t *isp, int chan, tstate_t *tptr, uint32_
* First, clean any commands pending restart
*/
STAILQ_FOREACH_SAFE(ntp, &tptr->restart_queue, next, tmp) {
- if (IS_24XX(isp))
- this_tag_id = ((at7_entry_t *)ntp->data)->at_rxid;
- else
- this_tag_id = ((at2_entry_t *)ntp->data)->at_rxid;
+ this_tag_id = ((at7_entry_t *)ntp->data)->at_rxid;
if ((uint64_t)tag_id == TAG_ANY || tag_id == this_tag_id) {
isp_endcmd(isp, ntp->data, NIL_HANDLE, chan,
ECMD_TERMINATE, 0);
@@ -2481,45 +1976,6 @@ isp_target_mark_aborted_early(ispsoftc_t *isp, int chan, tstate_t *tptr, uint32_
#endif
static void
-isp_cam_async(void *cbarg, uint32_t code, struct cam_path *path, void *arg)
-{
- struct cam_sim *sim;
- int bus, tgt;
- ispsoftc_t *isp;
-
- sim = (struct cam_sim *)cbarg;
- isp = (ispsoftc_t *) cam_sim_softc(sim);
- bus = cam_sim_bus(sim);
- tgt = xpt_path_target_id(path);
-
- switch (code) {
- case AC_LOST_DEVICE:
- if (IS_SCSI(isp)) {
- uint16_t oflags, nflags;
- sdparam *sdp = SDPARAM(isp, bus);
-
- if (tgt >= 0) {
- nflags = sdp->isp_devparam[tgt].nvrm_flags;
- nflags &= DPARM_SAFE_DFLT;
- if (isp->isp_loaded_fw) {
- nflags |= DPARM_NARROW | DPARM_ASYNC;
- }
- oflags = sdp->isp_devparam[tgt].goal_flags;
- sdp->isp_devparam[tgt].goal_flags = nflags;
- sdp->isp_devparam[tgt].dev_update = 1;
- sdp->update = 1;
- (void) isp_control(isp, ISPCTL_UPDATE_PARAMS, bus);
- sdp->isp_devparam[tgt].goal_flags = oflags;
- }
- }
- break;
- default:
- isp_prt(isp, ISP_LOGWARN, "isp_cam_async: Code 0x%x", code);
- break;
- }
-}
-
-static void
isp_poll(struct cam_sim *sim)
{
ispsoftc_t *isp = cam_sim_softc(sim);
@@ -2909,7 +2365,7 @@ isp_abort_atio(ispsoftc_t *isp, union ccb *ccb)
atp = isp_find_atpd(isp, XS_CHANNEL(accb), accb->atio.tag_id);
if (atp != NULL) {
/* Send TERMINATE to firmware. */
- if (!atp->dead && IS_24XX(isp)) {
+ if (!atp->dead) {
uint8_t storage[QENTRY_LEN];
ct7_entry_t *cto = (ct7_entry_t *) storage;
@@ -2977,6 +2433,7 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
{
int bus, tgt, error;
ispsoftc_t *isp;
+ fcparam *fcp;
struct ccb_trans_settings *cts;
sbintime_t ts;
@@ -3005,10 +2462,6 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
if (ccb->ccb_h.target_id >= ISP_MAX_TARGETS(isp)) {
xpt_print(ccb->ccb_h.path, "invalid target\n");
ccb->ccb_h.status = CAM_PATH_INVALID;
- } else if (ISP_MAX_LUNS(isp) > 0 &&
- ccb->ccb_h.target_lun >= ISP_MAX_LUNS(isp)) {
- xpt_print(ccb->ccb_h.path, "invalid lun\n");
- ccb->ccb_h.status = CAM_PATH_INVALID;
}
if (ccb->ccb_h.status == CAM_PATH_INVALID) {
xpt_done(ccb);
@@ -3156,8 +2609,7 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
* Reference Number, because the target will expect
* that we re-start the CRN at 1 after a reset.
*/
- if (IS_FC(isp))
- isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1);
+ isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1);
ccb->ccb_h.status = CAM_REQ_CMP;
}
@@ -3201,153 +2653,40 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
xpt_done(ccb);
break;
}
- tgt = cts->ccb_h.target_id;
- if (IS_SCSI(isp)) {
- struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi;
- struct ccb_trans_settings_spi *spi = &cts->xport_specific.spi;
- sdparam *sdp = SDPARAM(isp, bus);
- uint16_t *dptr;
-
- if (spi->valid == 0 && scsi->valid == 0) {
- ccb->ccb_h.status = CAM_REQ_CMP;
- xpt_done(ccb);
- break;
- }
-
- /*
- * We always update (internally) from goal_flags
- * so any request to change settings just gets
- * vectored to that location.
- */
- dptr = &sdp->isp_devparam[tgt].goal_flags;
-
- if ((spi->valid & CTS_SPI_VALID_DISC) != 0) {
- if ((spi->flags & CTS_SPI_FLAGS_DISC_ENB) != 0)
- *dptr |= DPARM_DISC;
- else
- *dptr &= ~DPARM_DISC;
- }
-
- if ((scsi->valid & CTS_SCSI_VALID_TQ) != 0) {
- if ((scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) != 0)
- *dptr |= DPARM_TQING;
- else
- *dptr &= ~DPARM_TQING;
- }
-
- if ((spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0) {
- if (spi->bus_width == MSG_EXT_WDTR_BUS_16_BIT)
- *dptr |= DPARM_WIDE;
- else
- *dptr &= ~DPARM_WIDE;
- }
-
- /*
- * XXX: FIX ME
- */
- if ((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) && (spi->valid & CTS_SPI_VALID_SYNC_RATE) && (spi->sync_period && spi->sync_offset)) {
- *dptr |= DPARM_SYNC;
- /*
- * XXX: CHECK FOR LEGALITY
- */
- sdp->isp_devparam[tgt].goal_period = spi->sync_period;
- sdp->isp_devparam[tgt].goal_offset = spi->sync_offset;
- } else {
- *dptr &= ~DPARM_SYNC;
- }
- isp_prt(isp, ISP_LOGDEBUG0, "SET (%d.%d.%jx) to flags %x off %x per %x", bus, tgt, (uintmax_t)cts->ccb_h.target_lun, sdp->isp_devparam[tgt].goal_flags,
- sdp->isp_devparam[tgt].goal_offset, sdp->isp_devparam[tgt].goal_period);
- sdp->isp_devparam[tgt].dev_update = 1;
- sdp->update = 1;
- }
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
break;
case XPT_GET_TRAN_SETTINGS:
+ {
+ struct ccb_trans_settings_scsi *scsi;
+ struct ccb_trans_settings_fc *fc;
+
cts = &ccb->cts;
+ scsi = &cts->proto_specific.scsi;
+ fc = &cts->xport_specific.fc;
tgt = cts->ccb_h.target_id;
- if (IS_FC(isp)) {
- fcparam *fcp = FCPARAM(isp, bus);
- struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi;
- struct ccb_trans_settings_fc *fc = &cts->xport_specific.fc;
-
- cts->protocol = PROTO_SCSI;
- cts->protocol_version = SCSI_REV_2;
- cts->transport = XPORT_FC;
- cts->transport_version = 0;
-
- scsi->valid = CTS_SCSI_VALID_TQ;
- scsi->flags = CTS_SCSI_FLAGS_TAG_ENB;
- fc->valid = CTS_FC_VALID_SPEED;
- fc->bitrate = 100000;
- fc->bitrate *= fcp->isp_gbspeed;
- if (tgt < MAX_FC_TARG) {
- fcportdb_t *lp = &fcp->portdb[tgt];
- fc->wwnn = lp->node_wwn;
- fc->wwpn = lp->port_wwn;
- fc->port = lp->portid;
- fc->valid |= CTS_FC_VALID_WWNN | CTS_FC_VALID_WWPN | CTS_FC_VALID_PORT;
- }
- } else {
- struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi;
- struct ccb_trans_settings_spi *spi = &cts->xport_specific.spi;
- sdparam *sdp = SDPARAM(isp, bus);
- uint16_t dval, pval, oval;
-
- if (IS_CURRENT_SETTINGS(cts)) {
- sdp->isp_devparam[tgt].dev_refresh = 1;
- sdp->update = 1;
- (void) isp_control(isp, ISPCTL_UPDATE_PARAMS, bus);
- dval = sdp->isp_devparam[tgt].actv_flags;
- oval = sdp->isp_devparam[tgt].actv_offset;
- pval = sdp->isp_devparam[tgt].actv_period;
- } else {
- dval = sdp->isp_devparam[tgt].nvrm_flags;
- oval = sdp->isp_devparam[tgt].nvrm_offset;
- pval = sdp->isp_devparam[tgt].nvrm_period;
- }
+ fcp = FCPARAM(isp, bus);
- cts->protocol = PROTO_SCSI;
- cts->protocol_version = SCSI_REV_2;
- cts->transport = XPORT_SPI;
- cts->transport_version = 2;
-
- spi->valid = 0;
- scsi->valid = 0;
- spi->flags = 0;
- scsi->flags = 0;
- if (dval & DPARM_DISC) {
- spi->flags |= CTS_SPI_FLAGS_DISC_ENB;
- }
- if ((dval & DPARM_SYNC) && oval && pval) {
- spi->sync_offset = oval;
- spi->sync_period = pval;
- } else {
- spi->sync_offset = 0;
- spi->sync_period = 0;
- }
- spi->valid |= CTS_SPI_VALID_SYNC_OFFSET;
- spi->valid |= CTS_SPI_VALID_SYNC_RATE;
- spi->valid |= CTS_SPI_VALID_BUS_WIDTH;
- if (dval & DPARM_WIDE) {
- spi->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
- } else {
- spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
- }
- if (cts->ccb_h.target_lun != CAM_LUN_WILDCARD) {
- scsi->valid = CTS_SCSI_VALID_TQ;
- if (dval & DPARM_TQING) {
- scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB;
- }
- spi->valid |= CTS_SPI_VALID_DISC;
- }
- isp_prt(isp, ISP_LOGDEBUG0, "GET %s (%d.%d.%jx) to flags %x off %x per %x", IS_CURRENT_SETTINGS(cts)? "ACTIVE" : "NVRAM",
- bus, tgt, (uintmax_t)cts->ccb_h.target_lun, dval, oval, pval);
+ cts->protocol = PROTO_SCSI;
+ cts->protocol_version = SCSI_REV_2;
+ cts->transport = XPORT_FC;
+ cts->transport_version = 0;
+
+ scsi->valid = CTS_SCSI_VALID_TQ;
+ scsi->flags = CTS_SCSI_FLAGS_TAG_ENB;
+ fc->valid = CTS_FC_VALID_SPEED;
+ fc->bitrate = fcp->isp_gbspeed * 100000;
+ if (tgt < MAX_FC_TARG) {
+ fcportdb_t *lp = &fcp->portdb[tgt];
+ fc->wwnn = lp->node_wwn;
+ fc->wwpn = lp->port_wwn;
+ fc->port = lp->portid;
+ fc->valid |= CTS_FC_VALID_WWNN | CTS_FC_VALID_WWPN | CTS_FC_VALID_PORT;
}
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
break;
-
+ }
case XPT_CALC_GEOMETRY:
cam_calc_geometry(&ccb->ccg, 1);
xpt_done(ccb);
@@ -3363,11 +2702,7 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
if (bootverbose) {
xpt_print(ccb->ccb_h.path, "reset bus on channel %d\n", bus);
}
- if (IS_FC(isp)) {
- xpt_async(AC_BUS_RESET, ISP_FC_PC(isp, bus)->path, 0);
- } else {
- xpt_async(AC_BUS_RESET, ISP_SPI_PC(isp, bus)->path, 0);
- }
+ xpt_async(AC_BUS_RESET, ISP_FC_PC(isp, bus)->path, 0);
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
break;
@@ -3380,15 +2715,7 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
case XPT_SET_SIM_KNOB: /* Set SIM knobs */
{
struct ccb_sim_knob *kp = &ccb->knob;
- fcparam *fcp;
-
- if (!IS_FC(isp)) {
- ccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(ccb);
- break;
- }
-
- fcp = FCPARAM(isp, bus);
+ fcparam *fcp = FCPARAM(isp, bus);
if (kp->xport_specific.fc.valid & KNOB_VALID_ADDRESS) {
fcp->isp_wwnn = ISP_FC_PC(isp, bus)->def_wwnn = kp->xport_specific.fc.wwnn;
@@ -3443,33 +2770,26 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
case XPT_GET_SIM_KNOB: /* Get SIM knobs */
{
struct ccb_sim_knob *kp = &ccb->knob;
+ fcparam *fcp = FCPARAM(isp, bus);
- if (IS_FC(isp)) {
- fcparam *fcp;
-
- fcp = FCPARAM(isp, bus);
-
- kp->xport_specific.fc.wwnn = fcp->isp_wwnn;
- kp->xport_specific.fc.wwpn = fcp->isp_wwpn;
- switch (fcp->role) {
- case ISP_ROLE_NONE:
- kp->xport_specific.fc.role = KNOB_ROLE_NONE;
- break;
- case ISP_ROLE_TARGET:
- kp->xport_specific.fc.role = KNOB_ROLE_TARGET;
- break;
- case ISP_ROLE_INITIATOR:
- kp->xport_specific.fc.role = KNOB_ROLE_INITIATOR;
- break;
- case ISP_ROLE_BOTH:
- kp->xport_specific.fc.role = KNOB_ROLE_BOTH;
- break;
- }
- kp->xport_specific.fc.valid = KNOB_VALID_ADDRESS | KNOB_VALID_ROLE;
- ccb->ccb_h.status = CAM_REQ_CMP;
- } else {
- ccb->ccb_h.status = CAM_REQ_INVALID;
+ kp->xport_specific.fc.wwnn = fcp->isp_wwnn;
+ kp->xport_specific.fc.wwpn = fcp->isp_wwpn;
+ switch (fcp->role) {
+ case ISP_ROLE_NONE:
+ kp->xport_specific.fc.role = KNOB_ROLE_NONE;
+ break;
+ case ISP_ROLE_TARGET:
+ kp->xport_specific.fc.role = KNOB_ROLE_TARGET;
+ break;
+ case ISP_ROLE_INITIATOR:
+ kp->xport_specific.fc.role = KNOB_ROLE_INITIATOR;
+ break;
+ case ISP_ROLE_BOTH:
+ kp->xport_specific.fc.role = KNOB_ROLE_BOTH;
+ break;
}
+ kp->xport_specific.fc.valid = KNOB_VALID_ADDRESS | KNOB_VALID_ROLE;
+ ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
break;
}
@@ -3479,61 +2799,41 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
cpi->version_num = 1;
#ifdef ISP_TARGET_MODE
- if (IS_FC(isp) && ISP_CAP_TMODE(isp) && ISP_CAP_SCCFW(isp))
- cpi->target_sprt = PIT_PROCESSOR | PIT_DISCONNECT | PIT_TERM_IO;
- else
+ cpi->target_sprt = PIT_PROCESSOR | PIT_DISCONNECT | PIT_TERM_IO;
+#else
+ cpi->target_sprt = 0;
#endif
- cpi->target_sprt = 0;
cpi->hba_eng_cnt = 0;
cpi->max_target = ISP_MAX_TARGETS(isp) - 1;
- cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ?
- 255 : ISP_MAX_LUNS(isp) - 1;
+ cpi->max_lun = 255;
cpi->bus_id = cam_sim_bus(sim);
- if (sizeof (bus_size_t) > 4)
- cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE;
- else
- cpi->maxio = (ISP_NSEG_MAX - 1) * PAGE_SIZE;
+ cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE;
- if (IS_FC(isp)) {
- fcparam *fcp = FCPARAM(isp, bus);
+ fcp = FCPARAM(isp, bus);
- cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED;
- cpi->hba_misc |= PIM_EXTLUNS | PIM_NOSCAN;
+ cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED;
+ cpi->hba_misc |= PIM_EXTLUNS | PIM_NOSCAN;
- /*
- * Because our loop ID can shift from time to time,
- * make our initiator ID out of range of our bus.
- */
- cpi->initiator_id = cpi->max_target + 1;
+ /*
+ * Because our loop ID can shift from time to time,
+ * make our initiator ID out of range of our bus.
+ */
+ cpi->initiator_id = cpi->max_target + 1;
- /*
- * Set base transfer capabilities for Fibre Channel, for this HBA.
- */
- if (IS_25XX(isp)) {
- cpi->base_transfer_speed = 8000000;
- } else if (IS_24XX(isp)) {
- cpi->base_transfer_speed = 4000000;
- } else if (IS_23XX(isp)) {
- cpi->base_transfer_speed = 2000000;
- } else {
- cpi->base_transfer_speed = 1000000;
- }
- cpi->hba_inquiry = PI_TAG_ABLE;
- cpi->transport = XPORT_FC;
- cpi->transport_version = 0;
- cpi->xport_specific.fc.wwnn = fcp->isp_wwnn;
- cpi->xport_specific.fc.wwpn = fcp->isp_wwpn;
- cpi->xport_specific.fc.port = fcp->isp_portid;
- cpi->xport_specific.fc.bitrate = fcp->isp_gbspeed * 1000;
- } else {
- sdparam *sdp = SDPARAM(isp, bus);
- cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16;
- cpi->hba_misc = PIM_UNMAPPED;
- cpi->initiator_id = sdp->isp_initiator_id;
- cpi->base_transfer_speed = 3300;
- cpi->transport = XPORT_SPI;
- cpi->transport_version = 2;
- }
+ /*
+ * Set base transfer capabilities for Fibre Channel, for this HBA.
+ */
+ if (IS_25XX(isp))
+ cpi->base_transfer_speed = 8000000;
+ else
+ cpi->base_transfer_speed = 4000000;
+ cpi->hba_inquiry = PI_TAG_ABLE;
+ cpi->transport = XPORT_FC;
+ cpi->transport_version = 0;
+ cpi->xport_specific.fc.wwnn = fcp->isp_wwnn;
+ cpi->xport_specific.fc.wwpn = fcp->isp_wwpn;
+ cpi->xport_specific.fc.port = fcp->isp_portid;
+ cpi->xport_specific.fc.bitrate = fcp->isp_gbspeed * 1000;
cpi->protocol = PROTO_SCSI;
cpi->protocol_version = SCSI_REV_2;
strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
@@ -3595,78 +2895,18 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
target_id_t tgt = 0;
fcportdb_t *lp;
struct isp_fc *fc;
- struct cam_path *tmppath;
struct ac_contract ac;
struct ac_device_changed *adc;
va_list ap;
switch (cmd) {
- case ISPASYNC_NEW_TGT_PARAMS:
- {
- struct ccb_trans_settings_scsi *scsi;
- struct ccb_trans_settings_spi *spi;
- int flags, tgt;
- sdparam *sdp;
- struct ccb_trans_settings cts;
-
- memset(&cts, 0, sizeof (struct ccb_trans_settings));
-
- va_start(ap, cmd);
- bus = va_arg(ap, int);
- tgt = va_arg(ap, int);
- va_end(ap);
- sdp = SDPARAM(isp, bus);
-
- if (xpt_create_path(&tmppath, NULL, cam_sim_path(ISP_SPI_PC(isp, bus)->sim), tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
- isp_prt(isp, ISP_LOGWARN, "isp_async cannot make temp path for %d.%d", tgt, bus);
- break;
- }
- flags = sdp->isp_devparam[tgt].actv_flags;
- cts.type = CTS_TYPE_CURRENT_SETTINGS;
- cts.protocol = PROTO_SCSI;
- cts.transport = XPORT_SPI;
-
- scsi = &cts.proto_specific.scsi;
- spi = &cts.xport_specific.spi;
-
- if (flags & DPARM_TQING) {
- scsi->valid |= CTS_SCSI_VALID_TQ;
- scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB;
- }
-
- if (flags & DPARM_DISC) {
- spi->valid |= CTS_SPI_VALID_DISC;
- spi->flags |= CTS_SPI_FLAGS_DISC_ENB;
- }
- spi->flags |= CTS_SPI_VALID_BUS_WIDTH;
- if (flags & DPARM_WIDE) {
- spi->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
- } else {
- spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
- }
- if (flags & DPARM_SYNC) {
- spi->valid |= CTS_SPI_VALID_SYNC_RATE;
- spi->valid |= CTS_SPI_VALID_SYNC_OFFSET;
- spi->sync_period = sdp->isp_devparam[tgt].actv_period;
- spi->sync_offset = sdp->isp_devparam[tgt].actv_offset;
- }
- isp_prt(isp, ISP_LOGDEBUG2, "NEW_TGT_PARAMS bus %d tgt %d period %x offset %x flags %x", bus, tgt, sdp->isp_devparam[tgt].actv_period, sdp->isp_devparam[tgt].actv_offset, flags);
- xpt_setup_ccb(&cts.ccb_h, tmppath, 1);
- xpt_async(AC_TRANSFER_NEG, tmppath, &cts);
- xpt_free_path(tmppath);
- break;
- }
case ISPASYNC_BUS_RESET:
{
va_start(ap, cmd);
bus = va_arg(ap, int);
va_end(ap);
isp_prt(isp, ISP_LOGINFO, "SCSI bus reset on bus %d detected", bus);
- if (IS_FC(isp)) {
- xpt_async(AC_BUS_RESET, ISP_FC_PC(isp, bus)->path, NULL);
- } else {
- xpt_async(AC_BUS_RESET, ISP_SPI_PC(isp, bus)->path, NULL);
- }
+ xpt_async(AC_BUS_RESET, ISP_FC_PC(isp, bus)->path, NULL);
break;
}
case ISPASYNC_LOOP_RESET:
@@ -3968,16 +3208,10 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
va_end(ap);
switch (hp->rqs_entry_type) {
case RQSTYPE_ATIO:
- isp_handle_platform_atio7(isp, (at7_entry_t *) hp);
- break;
- case RQSTYPE_ATIO2:
- isp_handle_platform_atio2(isp, (at2_entry_t *) hp);
+ isp_handle_platform_atio7(isp, (at7_entry_t *)hp);
break;
case RQSTYPE_CTIO7:
- case RQSTYPE_CTIO3:
- case RQSTYPE_CTIO2:
- case RQSTYPE_CTIO:
- isp_handle_platform_ctio(isp, hp);
+ isp_handle_platform_ctio(isp, (ct7_entry_t *)hp);
break;
default:
isp_prt(isp, ISP_LOGWARN, "%s: unhandled target action 0x%x",
@@ -3989,14 +3223,9 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
#endif
case ISPASYNC_FW_CRASH:
{
- uint16_t mbox1, mbox6;
+ uint16_t mbox1;
mbox1 = ISP_READ(isp, OUTMAILBOX1);
- if (IS_DUALBUS(isp)) {
- mbox6 = ISP_READ(isp, OUTMAILBOX6);
- } else {
- mbox6 = 0;
- }
- isp_prt(isp, ISP_LOGERR, "Internal Firmware Error on bus %d @ RISC Address 0x%x", mbox6, mbox1);
+ isp_prt(isp, ISP_LOGERR, "Internal Firmware Error @ RISC Address 0x%x", mbox1);
#if 0
mbox1 = isp->isp_osinfo.mbox_sleep_ok;
isp->isp_osinfo.mbox_sleep_ok = 0;
@@ -4262,9 +3491,6 @@ isp_fcp_next_crn(ispsoftc_t *isp, uint8_t *crnp, XS_T *cmd)
struct isp_nexus *nxp;
int idx;
- if (IS_2100(isp))
- return (0);
-
chan = XS_CHANNEL(cmd);
tgt = XS_TGT(cmd);
lun = XS_LUN(cmd);
diff --git a/sys/dev/isp/isp_freebsd.h b/sys/dev/isp/isp_freebsd.h
index 7d5da25d1ade..158d5702513d 100644
--- a/sys/dev/isp/isp_freebsd.h
+++ b/sys/dev/isp/isp_freebsd.h
@@ -4,6 +4,7 @@
*
* Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions
*
+ * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
* Copyright (c) 1997-2008 by Matthew Jacob
* All rights reserved.
*
@@ -68,11 +69,6 @@
#define ISP_PLATFORM_VERSION_MAJOR 7
#define ISP_PLATFORM_VERSION_MINOR 10
-/*
- * Efficiency- get rid of SBus code && tests unless we need them.
- */
-#define ISP_SBUS_SUPPORTED 0
-
#define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE
#ifdef ISP_TARGET_MODE
@@ -237,24 +233,6 @@ struct isp_fc {
int num_threads;
};
-struct isp_spi {
- struct cam_sim *sim;
- struct cam_path *path;
- uint32_t
- simqfrozen : 3,
- iid : 4;
-#ifdef ISP_TARGET_MODE
- struct tslist lun_hash[LUN_HASH_SIZE];
- struct isp_ccbq waitq; /* waiting CCBs */
- struct ntpdlist ntfree;
- inot_private_data_t ntpool[ATPDPSIZE];
- struct atpdlist atfree;
- struct atpdlist atused[ATPDPHASHSIZE];
- atio_private_data_t atpool[ATPDPSIZE];
-#endif
- int num_threads;
-};
-
struct isposinfo {
/*
* Linkage, locking, and identity
@@ -318,32 +296,18 @@ struct isposinfo {
*/
union {
struct isp_fc *fc;
- struct isp_spi *spi;
void *ptr;
} pc;
int is_exiting;
};
#define ISP_FC_PC(isp, chan) (&(isp)->isp_osinfo.pc.fc[(chan)])
-#define ISP_SPI_PC(isp, chan) (&(isp)->isp_osinfo.pc.spi[(chan)])
#define ISP_GET_PC(isp, chan, tag, rslt) \
- if (IS_SCSI(isp)) { \
- rslt = ISP_SPI_PC(isp, chan)-> tag; \
- } else { \
- rslt = ISP_FC_PC(isp, chan)-> tag; \
- }
+ rslt = ISP_FC_PC(isp, chan)->tag
#define ISP_GET_PC_ADDR(isp, chan, tag, rp) \
- if (IS_SCSI(isp)) { \
- rp = &ISP_SPI_PC(isp, chan)-> tag; \
- } else { \
- rp = &ISP_FC_PC(isp, chan)-> tag; \
- }
+ rp = &ISP_FC_PC(isp, chan)->tag
#define ISP_SET_PC(isp, chan, tag, val) \
- if (IS_SCSI(isp)) { \
- ISP_SPI_PC(isp, chan)-> tag = val; \
- } else { \
- ISP_FC_PC(isp, chan)-> tag = val; \
- }
+ ISP_FC_PC(isp, chan)-> tag = val
#define FCP_NEXT_CRN isp_fcp_next_crn
#define isp_lock isp_osinfo.lock
@@ -382,7 +346,7 @@ struct isposinfo {
#define GET_NANOSEC(x) ((x)->tv_sec * 1000000000 + (x)->tv_nsec)
#define NANOTIME_SUB isp_nanotime_sub
-#define MAXISPREQUEST(isp) ((IS_FC(isp) || IS_ULTRA2(isp))? 1024 : 256)
+#define MAXISPREQUEST(isp) 1024
#define MEMORYBARRIER(isp, type, offset, size, chan) \
switch (type) { \
@@ -497,22 +461,6 @@ default: \
d->ds_basehi = DMA_HI32(e->ds_addr); \
d->ds_count = e->ds_len; \
}
-#define XS_GET_DMA_SEG(a, b, c) \
-{ \
- ispds_t *d = a; \
- bus_dma_segment_t *e = b; \
- uint32_t f = c; \
- e += f; \
- d->ds_base = DMA_LO32(e->ds_addr); \
- d->ds_count = e->ds_len; \
-}
-#if (BUS_SPACE_MAXADDR > UINT32_MAX)
-#define XS_NEED_DMA64_SEG(s, n) \
- (((bus_dma_segment_t *)s)[n].ds_addr + \
- ((bus_dma_segment_t *)s)[n].ds_len > UINT32_MAX)
-#else
-#define XS_NEED_DMA64_SEG(s, n) (0)
-#endif
#define XS_ISP(ccb) cam_sim_softc(xpt_path_sim((ccb)->ccb_h.path))
#define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path))
#define XS_TGT(ccb) (ccb)->ccb_h.target_id
@@ -547,9 +495,11 @@ default: \
(((ccb)->ccb_h.flags & CAM_TAG_ACTION_VALID) && \
(ccb)->tag_action != CAM_TAG_ACTION_NONE)
-#define XS_TAG_TYPE(ccb) \
- ((ccb->tag_action == MSG_SIMPLE_Q_TAG)? REQFLAG_STAG : \
- ((ccb->tag_action == MSG_HEAD_OF_Q_TAG)? REQFLAG_HTAG : REQFLAG_OTAG))
+#define XS_TAG_TYPE(ccb) \
+ ((ccb->tag_action == MSG_HEAD_OF_QUEUE_TASK)? FCP_CMND_TASK_ATTR_HEAD:\
+ ((ccb->tag_action == MSG_ORDERED_TASK) ? FCP_CMND_TASK_ATTR_ORDERED :\
+ ((ccb->tag_action == MSG_ACA_TASK) ? FCP_CMND_TASK_ATTR_ACA : \
+ FCP_CMND_TASK_ATTR_SIMPLE)))
#define XS_PRIORITY(ccb) (ccb)->priority
@@ -594,10 +544,7 @@ default: \
#define DEFAULT_FRAMESIZE(isp) isp->isp_osinfo.framesize
#define DEFAULT_EXEC_THROTTLE(isp) isp->isp_osinfo.exec_throttle
-#define DEFAULT_ROLE(isp, chan) \
- (IS_FC(isp)? ISP_FC_PC(isp, chan)->def_role : ISP_ROLE_INITIATOR)
-
-#define DEFAULT_IID(isp, chan) isp->isp_osinfo.pc.spi[chan].iid
+#define DEFAULT_ROLE(isp, chan) ISP_FC_PC(isp, chan)->def_role
#define DEFAULT_LOOPID(x, chan) isp->isp_osinfo.pc.fc[chan].default_id
@@ -608,28 +555,12 @@ default: \
#if BYTE_ORDER == BIG_ENDIAN
-#ifdef ISP_SBUS_SUPPORTED
-#define ISP_IOXPUT_8(isp, s, d) *(d) = s
-#define ISP_IOXPUT_16(isp, s, d) \
- *(d) = (isp->isp_bustype == ISP_BT_SBUS)? s : bswap16(s)
-#define ISP_IOXPUT_32(isp, s, d) \
- *(d) = (isp->isp_bustype == ISP_BT_SBUS)? s : bswap32(s)
-#define ISP_IOXGET_8(isp, s, d) d = (*((uint8_t *)s))
-#define ISP_IOXGET_16(isp, s, d) \
- d = (isp->isp_bustype == ISP_BT_SBUS)? \
- *((uint16_t *)s) : bswap16(*((uint16_t *)s))
-#define ISP_IOXGET_32(isp, s, d) \
- d = (isp->isp_bustype == ISP_BT_SBUS)? \
- *((uint32_t *)s) : bswap32(*((uint32_t *)s))
-
-#else /* ISP_SBUS_SUPPORTED */
#define ISP_IOXPUT_8(isp, s, d) *(d) = s
#define ISP_IOXPUT_16(isp, s, d) *(d) = bswap16(s)
#define ISP_IOXPUT_32(isp, s, d) *(d) = bswap32(s)
#define ISP_IOXGET_8(isp, s, d) d = (*((uint8_t *)s))
#define ISP_IOXGET_16(isp, s, d) d = bswap16(*((uint16_t *)s))
#define ISP_IOXGET_32(isp, s, d) d = bswap32(*((uint32_t *)s))
-#endif
#define ISP_SWIZZLE_NVRAM_WORD(isp, rp) *rp = bswap16(*rp)
#define ISP_SWIZZLE_NVRAM_LONG(isp, rp) *rp = bswap32(*rp)
@@ -640,7 +571,6 @@ default: \
#define ISP_IOZPUT_16(isp, s, d) *(d) = s
#define ISP_IOZPUT_32(isp, s, d) *(d) = s
-
#else
#define ISP_IOXPUT_8(isp, s, d) *(d) = s
#define ISP_IOXPUT_16(isp, s, d) *(d) = s
@@ -654,11 +584,9 @@ default: \
#define ISP_IOZPUT_8(isp, s, d) *(d) = s
#define ISP_IOZPUT_16(isp, s, d) *(d) = bswap16(s)
#define ISP_IOZPUT_32(isp, s, d) *(d) = bswap32(s)
-
#define ISP_IOZGET_8(isp, s, d) d = (*((uint8_t *)(s)))
#define ISP_IOZGET_16(isp, s, d) d = bswap16(*((uint16_t *)(s)))
#define ISP_IOZGET_32(isp, s, d) d = bswap32(*((uint32_t *)(s)))
-
#endif
#define ISP_SWAP16(isp, s) bswap16(s)
@@ -697,10 +625,6 @@ extern int isp_gone_device_time;
extern int isp_quickboot_time;
/*
- * Platform private flags
- */
-
-/*
* Platform Library Functions
*/
void isp_prt(ispsoftc_t *, int level, const char *, ...) __printflike(3, 4);
@@ -727,10 +651,6 @@ int isp_fcp_next_crn(ispsoftc_t *, uint8_t *, XS_T *);
}
/*
- * Platform specific inline functions
- */
-
-/*
* ISP General Library functions
*/
diff --git a/sys/dev/isp/isp_library.c b/sys/dev/isp/isp_library.c
index 204603e783e1..ae3196503349 100644
--- a/sys/dev/isp/isp_library.c
+++ b/sys/dev/isp/isp_library.c
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * Copyright (c) 2009-2017 Alexander Motin <mav@FreeBSD.org>
+ * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
*
@@ -63,10 +63,9 @@ const char *isp_class3_roles[4] = {
int
isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, ispds64_t *ecmd)
{
- uint8_t storage[QENTRY_LEN];
- uint8_t type, nqe, need64;
+ ispcontreq64_t crq;
+ uint8_t type, nqe;
uint32_t seg, seglim, nxt, nxtnxt, ddf;
- ispds_t *dsp = NULL;
ispds64_t *dsp64 = NULL;
void *qe0, *qe1;
@@ -83,69 +82,21 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t to
* If we have no data to transmit, just copy the first IOCB and start it up.
*/
if (ddir == ISP_NOXFR) {
- if (type == RQSTYPE_T2RQS || type == RQSTYPE_T3RQS) {
- ddf = CT2_NO_DATA;
- } else {
- ddf = 0;
- }
+ ddf = 0;
goto copy_and_sync;
}
- need64 = 0;
- for (seg = 0; seg < nsegs; seg++)
- need64 |= XS_NEED_DMA64_SEG(segp, seg);
- if (need64) {
- if (type == RQSTYPE_T2RQS)
- ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_T3RQS;
- else if (type == RQSTYPE_REQUEST)
- ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_A64;
- else if (type == RQSTYPE_CTIO2)
- ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_CTIO3;
- }
-
/*
* First figure out how many pieces of data to transfer, what
* kind and how many we can put into the first queue entry.
*/
switch (type) {
- case RQSTYPE_REQUEST:
- ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN;
- dsp = ((ispreq_t *)fqe)->req_dataseg;
- seglim = ISP_RQDSEG;
- break;
- case RQSTYPE_CMDONLY:
- ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN;
- seglim = 0;
- break;
- case RQSTYPE_T2RQS:
- ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN;
- dsp = ((ispreqt2_t *)fqe)->req_dataseg;
- seglim = ISP_RQDSEG_T2;
- break;
- case RQSTYPE_A64:
- ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN;
- dsp64 = ((ispreqt3_t *)fqe)->req_dataseg;
- seglim = ISP_RQDSEG_T3;
- break;
- case RQSTYPE_T3RQS:
- ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN;
- dsp64 = ((ispreqt3_t *)fqe)->req_dataseg;
- seglim = ISP_RQDSEG_T3;
- break;
case RQSTYPE_T7RQS:
ddf = (ddir == ISP_TO_DEVICE)? FCP_CMND_DATA_WRITE : FCP_CMND_DATA_READ;
dsp64 = &((ispreqt7_t *)fqe)->req_dataseg;
seglim = 1;
break;
#ifdef ISP_TARGET_MODE
- case RQSTYPE_CTIO2:
- dsp = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg;
- seglim = ISP_RQDSEG_T2;
- break;
- case RQSTYPE_CTIO3:
- dsp64 = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg64;
- seglim = ISP_RQDSEG_T3;
- break;
case RQSTYPE_CTIO7:
dsp64 = &((ct7_entry_t *)fqe)->rsp.m0.ds;
seglim = 1;
@@ -157,13 +108,8 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t to
if (seglim > nsegs)
seglim = nsegs;
seg = 0;
- while (seg < seglim) {
- if (dsp64) {
- XS_GET_DMA64_SEG(dsp64++, segp, seg++);
- } else {
- XS_GET_DMA_SEG(dsp++, segp, seg++);
- }
- }
+ while (seg < seglim)
+ XS_GET_DMA64_SEG(dsp64++, segp, seg++);
/*
* Second, start building additional continuation segments as needed.
@@ -171,41 +117,24 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t to
while (seg < nsegs) {
nxtnxt = ISP_NXT_QENTRY(nxt, RQUEST_QUEUE_LEN(isp));
if (nxtnxt == isp->isp_reqodx) {
- isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp);
+ isp->isp_reqodx = ISP_READ(isp, BIU2400_REQOUTP);
if (nxtnxt == isp->isp_reqodx)
return (CMD_EAGAIN);
}
- ISP_MEMZERO(storage, QENTRY_LEN);
qe1 = ISP_QUEUE_ENTRY(isp->isp_rquest, nxt);
nxt = nxtnxt;
- if (dsp64) {
- ispcontreq64_t *crq = (ispcontreq64_t *) storage;
- seglim = ISP_CDSEG64;
- crq->req_header.rqs_entry_type = RQSTYPE_A64_CONT;
- crq->req_header.rqs_entry_count = 1;
- dsp64 = crq->req_dataseg;
- } else {
- ispcontreq_t *crq = (ispcontreq_t *) storage;
- seglim = ISP_CDSEG;
- crq->req_header.rqs_entry_type = RQSTYPE_DATASEG;
- crq->req_header.rqs_entry_count = 1;
- dsp = crq->req_dataseg;
- }
- seglim += seg;
+
+ ISP_MEMZERO(&crq, QENTRY_LEN);
+ crq.req_header.rqs_entry_type = RQSTYPE_A64_CONT;
+ crq.req_header.rqs_entry_count = 1;
+ dsp64 = crq.req_dataseg;
+
+ seglim = seg + ISP_CDSEG64;
if (seglim > nsegs)
seglim = nsegs;
- while (seg < seglim) {
- if (dsp64) {
- XS_GET_DMA64_SEG(dsp64++, segp, seg++);
- } else {
- XS_GET_DMA_SEG(dsp++, segp, seg++);
- }
- }
- if (dsp64) {
- isp_put_cont64_req(isp, (ispcontreq64_t *)storage, qe1);
- } else {
- isp_put_cont_req(isp, (ispcontreq_t *)storage, qe1);
- }
+ while (seg < seglim)
+ XS_GET_DMA64_SEG(dsp64++, segp, seg++);
+ isp_put_cont64_req(isp, &crq, qe1);
if (isp->isp_dblev & ISP_LOGDEBUG1) {
isp_print_bytes(isp, "additional queue entry",
QENTRY_LEN, qe1);
@@ -216,43 +145,6 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t to
copy_and_sync:
((isphdr_t *)fqe)->rqs_entry_count = nqe;
switch (type) {
- case RQSTYPE_REQUEST:
- ((ispreq_t *)fqe)->req_flags |= ddf;
- /* This is historical and not clear whether really needed. */
- if (nsegs == 0)
- nsegs = 1;
- ((ispreq_t *)fqe)->req_seg_count = nsegs;
- isp_put_request(isp, fqe, qe0);
- break;
- case RQSTYPE_CMDONLY:
- ((ispreq_t *)fqe)->req_flags |= ddf;
- /* This is historical and not clear whether really needed. */
- if (nsegs == 0)
- nsegs = 1;
- ((ispextreq_t *)fqe)->req_seg_count = nsegs;
- isp_put_extended_request(isp, fqe, qe0);
- break;
- case RQSTYPE_T2RQS:
- ((ispreqt2_t *)fqe)->req_flags |= ddf;
- ((ispreqt2_t *)fqe)->req_seg_count = nsegs;
- ((ispreqt2_t *)fqe)->req_totalcnt = totalcnt;
- if (ISP_CAP_2KLOGIN(isp)) {
- isp_put_request_t2e(isp, fqe, qe0);
- } else {
- isp_put_request_t2(isp, fqe, qe0);
- }
- break;
- case RQSTYPE_A64:
- case RQSTYPE_T3RQS:
- ((ispreqt3_t *)fqe)->req_flags |= ddf;
- ((ispreqt3_t *)fqe)->req_seg_count = nsegs;
- ((ispreqt3_t *)fqe)->req_totalcnt = totalcnt;
- if (ISP_CAP_2KLOGIN(isp)) {
- isp_put_request_t3e(isp, fqe, qe0);
- } else {
- isp_put_request_t3(isp, fqe, qe0);
- }
- break;
case RQSTYPE_T7RQS:
((ispreqt7_t *)fqe)->req_alen_datadir = ddf;
((ispreqt7_t *)fqe)->req_seg_count = nsegs;
@@ -260,19 +152,6 @@ copy_and_sync:
isp_put_request_t7(isp, fqe, qe0);
break;
#ifdef ISP_TARGET_MODE
- case RQSTYPE_CTIO2:
- case RQSTYPE_CTIO3:
- if (((ct2_entry_t *)fqe)->ct_flags & CT2_FLAG_MODE2) {
- ((ct2_entry_t *)fqe)->ct_seg_count = 1;
- } else {
- ((ct2_entry_t *)fqe)->ct_seg_count = nsegs;
- }
- if (ISP_CAP_2KLOGIN(isp)) {
- isp_put_ctio2e(isp, fqe, qe0);
- } else {
- isp_put_ctio2(isp, fqe, qe0);
- }
- break;
case RQSTYPE_CTIO7:
if (((ct7_entry_t *)fqe)->ct_flags & CT7_FLAG_MODE2) {
((ct7_entry_t *)fqe)->ct_seg_count = 1;
@@ -360,7 +239,7 @@ isp_getrqentry(ispsoftc_t *isp)
next = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp));
if (next == isp->isp_reqodx) {
- isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp);
+ isp->isp_reqodx = ISP_READ(isp, BIU2400_REQOUTP);
if (next == isp->isp_reqodx)
return (NULL);
}
@@ -634,21 +513,14 @@ isp_clear_commands(ispsoftc_t *isp)
}
#ifdef ISP_TARGET_MODE
case ISP_HANDLE_TARGET: {
- uint8_t local[QENTRY_LEN];
+ ct7_entry_t ctio;
+
ISP_DMAFREE(isp, hdp->cmd, hdp->handle);
- ISP_MEMZERO(local, QENTRY_LEN);
- if (IS_24XX(isp)) {
- ct7_entry_t *ctio = (ct7_entry_t *) local;
- ctio->ct_syshandle = hdp->handle;
- ctio->ct_nphdl = CT_HBA_RESET;
- ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
- } else {
- ct2_entry_t *ctio = (ct2_entry_t *) local;
- ctio->ct_syshandle = hdp->handle;
- ctio->ct_status = CT_HBA_RESET;
- ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
- }
- isp_async(isp, ISPASYNC_TARGET_ACTION, local);
+ ISP_MEMZERO(&ctio, sizeof(ct7_entry_t));
+ ctio.ct_syshandle = hdp->handle;
+ ctio.ct_nphdl = CT_HBA_RESET;
+ ctio.ct_header.rqs_entry_type = RQSTYPE_CTIO7;
+ isp_async(isp, ISPASYNC_TARGET_ACTION, &ctio);
break;
}
#endif
@@ -687,104 +559,36 @@ isp_clear_commands(ispsoftc_t *isp)
* (with a few exceptions for efficiency).
*/
-#define ISP_IS_SBUS(isp) (ISP_SBUS_SUPPORTED && (isp)->isp_bustype == ISP_BT_SBUS)
-
-#define ASIZE(x) (sizeof (x) / sizeof (x[0]))
/*
* Swizzle/Copy Functions
*/
void
isp_put_hdr(ispsoftc_t *isp, isphdr_t *hpsrc, isphdr_t *hpdst)
{
- if (ISP_IS_SBUS(isp)) {
- ISP_IOXPUT_8(isp, hpsrc->rqs_entry_type, &hpdst->rqs_entry_count);
- ISP_IOXPUT_8(isp, hpsrc->rqs_entry_count, &hpdst->rqs_entry_type);
- ISP_IOXPUT_8(isp, hpsrc->rqs_seqno, &hpdst->rqs_flags);
- ISP_IOXPUT_8(isp, hpsrc->rqs_flags, &hpdst->rqs_seqno);
- } else {
- ISP_IOXPUT_8(isp, hpsrc->rqs_entry_type, &hpdst->rqs_entry_type);
- ISP_IOXPUT_8(isp, hpsrc->rqs_entry_count, &hpdst->rqs_entry_count);
- ISP_IOXPUT_8(isp, hpsrc->rqs_seqno, &hpdst->rqs_seqno);
- ISP_IOXPUT_8(isp, hpsrc->rqs_flags, &hpdst->rqs_flags);
- }
+ ISP_IOXPUT_8(isp, hpsrc->rqs_entry_type, &hpdst->rqs_entry_type);
+ ISP_IOXPUT_8(isp, hpsrc->rqs_entry_count, &hpdst->rqs_entry_count);
+ ISP_IOXPUT_8(isp, hpsrc->rqs_seqno, &hpdst->rqs_seqno);
+ ISP_IOXPUT_8(isp, hpsrc->rqs_flags, &hpdst->rqs_flags);
}
void
isp_get_hdr(ispsoftc_t *isp, isphdr_t *hpsrc, isphdr_t *hpdst)
{
- if (ISP_IS_SBUS(isp)) {
- ISP_IOXGET_8(isp, &hpsrc->rqs_entry_type, hpdst->rqs_entry_count);
- ISP_IOXGET_8(isp, &hpsrc->rqs_entry_count, hpdst->rqs_entry_type);
- ISP_IOXGET_8(isp, &hpsrc->rqs_seqno, hpdst->rqs_flags);
- ISP_IOXGET_8(isp, &hpsrc->rqs_flags, hpdst->rqs_seqno);
- } else {
- ISP_IOXGET_8(isp, &hpsrc->rqs_entry_type, hpdst->rqs_entry_type);
- ISP_IOXGET_8(isp, &hpsrc->rqs_entry_count, hpdst->rqs_entry_count);
- ISP_IOXGET_8(isp, &hpsrc->rqs_seqno, hpdst->rqs_seqno);
- ISP_IOXGET_8(isp, &hpsrc->rqs_flags, hpdst->rqs_flags);
- }
+ ISP_IOXGET_8(isp, &hpsrc->rqs_entry_type, hpdst->rqs_entry_type);
+ ISP_IOXGET_8(isp, &hpsrc->rqs_entry_count, hpdst->rqs_entry_count);
+ ISP_IOXGET_8(isp, &hpsrc->rqs_seqno, hpdst->rqs_seqno);
+ ISP_IOXGET_8(isp, &hpsrc->rqs_flags, hpdst->rqs_flags);
}
int
isp_get_response_type(ispsoftc_t *isp, isphdr_t *hp)
{
uint8_t type;
- if (ISP_IS_SBUS(isp)) {
- ISP_IOXGET_8(isp, &hp->rqs_entry_count, type);
- } else {
- ISP_IOXGET_8(isp, &hp->rqs_entry_type, type);
- }
+ ISP_IOXGET_8(isp, &hp->rqs_entry_type, type);
return ((int)type);
}
void
-isp_put_request(ispsoftc_t *isp, ispreq_t *rqsrc, ispreq_t *rqdst)
-{
- int i;
- isp_put_hdr(isp, &rqsrc->req_header, &rqdst->req_header);
- ISP_IOXPUT_32(isp, rqsrc->req_handle, &rqdst->req_handle);
- if (ISP_IS_SBUS(isp)) {
- ISP_IOXPUT_8(isp, rqsrc->req_lun_trn, &rqdst->req_target);
- ISP_IOXPUT_8(isp, rqsrc->req_target, &rqdst->req_lun_trn);
- } else {
- ISP_IOXPUT_8(isp, rqsrc->req_lun_trn, &rqdst->req_lun_trn);
- ISP_IOXPUT_8(isp, rqsrc->req_target, &rqdst->req_target);
- }
- ISP_IOXPUT_16(isp, rqsrc->req_cdblen, &rqdst->req_cdblen);
- ISP_IOXPUT_16(isp, rqsrc->req_flags, &rqdst->req_flags);
- ISP_IOXPUT_16(isp, rqsrc->req_time, &rqdst->req_time);
- ISP_IOXPUT_16(isp, rqsrc->req_seg_count, &rqdst->req_seg_count);
- for (i = 0; i < ASIZE(rqsrc->req_cdb); i++) {
- ISP_IOXPUT_8(isp, rqsrc->req_cdb[i], &rqdst->req_cdb[i]);
- }
- for (i = 0; i < ISP_RQDSEG; i++) {
- ISP_IOXPUT_32(isp, rqsrc->req_dataseg[i].ds_base, &rqdst->req_dataseg[i].ds_base);
- ISP_IOXPUT_32(isp, rqsrc->req_dataseg[i].ds_count, &rqdst->req_dataseg[i].ds_count);
- }
-}
-
-void
-isp_put_marker(ispsoftc_t *isp, isp_marker_t *src, isp_marker_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->mrk_header, &dst->mrk_header);
- ISP_IOXPUT_32(isp, src->mrk_handle, &dst->mrk_handle);
- if (ISP_IS_SBUS(isp)) {
- ISP_IOXPUT_8(isp, src->mrk_reserved0, &dst->mrk_target);
- ISP_IOXPUT_8(isp, src->mrk_target, &dst->mrk_reserved0);
- } else {
- ISP_IOXPUT_8(isp, src->mrk_reserved0, &dst->mrk_reserved0);
- ISP_IOXPUT_8(isp, src->mrk_target, &dst->mrk_target);
- }
- ISP_IOXPUT_16(isp, src->mrk_modifier, &dst->mrk_modifier);
- ISP_IOXPUT_16(isp, src->mrk_flags, &dst->mrk_flags);
- ISP_IOXPUT_16(isp, src->mrk_lun, &dst->mrk_lun);
- for (i = 0; i < ASIZE(src->mrk_reserved1); i++) {
- ISP_IOXPUT_8(isp, src->mrk_reserved1[i], &dst->mrk_reserved1[i]);
- }
-}
-
-void
isp_put_marker_24xx(ispsoftc_t *isp, isp_marker_24xx_t *src, isp_marker_24xx_t *dst)
{
int i;
@@ -796,133 +600,15 @@ isp_put_marker_24xx(ispsoftc_t *isp, isp_marker_24xx_t *src, isp_marker_24xx_t *
ISP_IOXPUT_8(isp, src->mrk_reserved1, &dst->mrk_reserved1);
ISP_IOXPUT_8(isp, src->mrk_vphdl, &dst->mrk_vphdl);
ISP_IOXPUT_8(isp, src->mrk_reserved2, &dst->mrk_reserved2);
- for (i = 0; i < ASIZE(src->mrk_lun); i++) {
+ for (i = 0; i < nitems(src->mrk_lun); i++) {
ISP_IOXPUT_8(isp, src->mrk_lun[i], &dst->mrk_lun[i]);
}
- for (i = 0; i < ASIZE(src->mrk_reserved3); i++) {
+ for (i = 0; i < nitems(src->mrk_reserved3); i++) {
ISP_IOXPUT_8(isp, src->mrk_reserved3[i], &dst->mrk_reserved3[i]);
}
}
void
-isp_put_request_t2(ispsoftc_t *isp, ispreqt2_t *src, ispreqt2_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->req_header, &dst->req_header);
- ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
- ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_lun_trn);
- ISP_IOXPUT_8(isp, src->req_target, &dst->req_target);
- ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
- ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
- ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
- ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
- ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
- ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
- for (i = 0; i < ASIZE(src->req_cdb); i++) {
- ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
- }
- ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
- for (i = 0; i < ISP_RQDSEG_T2; i++) {
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count);
- }
-}
-
-void
-isp_put_request_t2e(ispsoftc_t *isp, ispreqt2e_t *src, ispreqt2e_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->req_header, &dst->req_header);
- ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
- ISP_IOXPUT_16(isp, src->req_target, &dst->req_target);
- ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
- ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
- ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
- ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
- ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
- ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
- for (i = 0; i < ASIZE(src->req_cdb); i++) {
- ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
- }
- ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
- for (i = 0; i < ISP_RQDSEG_T2; i++) {
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count);
- }
-}
-
-void
-isp_put_request_t3(ispsoftc_t *isp, ispreqt3_t *src, ispreqt3_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->req_header, &dst->req_header);
- ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
- ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_lun_trn);
- ISP_IOXPUT_8(isp, src->req_target, &dst->req_target);
- ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
- ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
- ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
- ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
- ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
- ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
- for (i = 0; i < ASIZE(src->req_cdb); i++) {
- ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
- }
- ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
- for (i = 0; i < ISP_RQDSEG_T3; i++) {
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_basehi, &dst->req_dataseg[i].ds_basehi);
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count);
- }
-}
-
-void
-isp_put_request_t3e(ispsoftc_t *isp, ispreqt3e_t *src, ispreqt3e_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->req_header, &dst->req_header);
- ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
- ISP_IOXPUT_16(isp, src->req_target, &dst->req_target);
- ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
- ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
- ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
- ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
- ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
- ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
- for (i = 0; i < ASIZE(src->req_cdb); i++) {
- ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
- }
- ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
- for (i = 0; i < ISP_RQDSEG_T3; i++) {
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_basehi, &dst->req_dataseg[i].ds_basehi);
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count);
- }
-}
-
-void
-isp_put_extended_request(ispsoftc_t *isp, ispextreq_t *src, ispextreq_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->req_header, &dst->req_header);
- ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
- if (ISP_IS_SBUS(isp)) {
- ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_target);
- ISP_IOXPUT_8(isp, src->req_target, &dst->req_lun_trn);
- } else {
- ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_lun_trn);
- ISP_IOXPUT_8(isp, src->req_target, &dst->req_target);
- }
- ISP_IOXPUT_16(isp, src->req_cdblen, &dst->req_cdblen);
- ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
- ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
- ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
- for (i = 0; i < ASIZE(src->req_cdb); i++) {
- ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
- }
-}
-
-void
isp_put_request_t7(ispsoftc_t *isp, ispreqt7_t *src, ispreqt7_t *dst)
{
int i;
@@ -936,7 +622,7 @@ isp_put_request_t7(ispsoftc_t *isp, ispreqt7_t *src, ispreqt7_t *dst)
ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved);
a = (uint32_t *) src->req_lun;
b = (uint32_t *) dst->req_lun;
- for (i = 0; i < (ASIZE(src->req_lun) >> 2); i++ ) {
+ for (i = 0; i < (nitems(src->req_lun) >> 2); i++ ) {
*b++ = ISP_SWAP32(isp, *a++);
}
ISP_IOXPUT_8(isp, src->req_alen_datadir, &dst->req_alen_datadir);
@@ -945,7 +631,7 @@ isp_put_request_t7(ispsoftc_t *isp, ispreqt7_t *src, ispreqt7_t *dst)
ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
a = (uint32_t *) src->req_cdb;
b = (uint32_t *) dst->req_cdb;
- for (i = 0; i < (ASIZE(src->req_cdb) >> 2); i++) {
+ for (i = 0; i < (nitems(src->req_cdb) >> 2); i++) {
*b++ = ISP_SWAP32(isp, *a++);
}
ISP_IOXPUT_32(isp, src->req_dl, &dst->req_dl);
@@ -968,22 +654,22 @@ isp_put_24xx_tmf(ispsoftc_t *isp, isp24xx_tmf_t *src, isp24xx_tmf_t *dst)
ISP_IOXPUT_16(isp, src->tmf_nphdl, &dst->tmf_nphdl);
ISP_IOXPUT_16(isp, src->tmf_delay, &dst->tmf_delay);
ISP_IOXPUT_16(isp, src->tmf_timeout, &dst->tmf_timeout);
- for (i = 0; i < ASIZE(src->tmf_reserved0); i++) {
+ for (i = 0; i < nitems(src->tmf_reserved0); i++) {
ISP_IOXPUT_8(isp, src->tmf_reserved0[i], &dst->tmf_reserved0[i]);
}
a = (uint32_t *) src->tmf_lun;
b = (uint32_t *) dst->tmf_lun;
- for (i = 0; i < (ASIZE(src->tmf_lun) >> 2); i++ ) {
+ for (i = 0; i < (nitems(src->tmf_lun) >> 2); i++ ) {
*b++ = ISP_SWAP32(isp, *a++);
}
ISP_IOXPUT_32(isp, src->tmf_flags, &dst->tmf_flags);
- for (i = 0; i < ASIZE(src->tmf_reserved1); i++) {
+ for (i = 0; i < nitems(src->tmf_reserved1); i++) {
ISP_IOXPUT_8(isp, src->tmf_reserved1[i], &dst->tmf_reserved1[i]);
}
ISP_IOXPUT_16(isp, src->tmf_tidlo, &dst->tmf_tidlo);
ISP_IOXPUT_8(isp, src->tmf_tidhi, &dst->tmf_tidhi);
ISP_IOXPUT_8(isp, src->tmf_vpidx, &dst->tmf_vpidx);
- for (i = 0; i < ASIZE(src->tmf_reserved2); i++) {
+ for (i = 0; i < nitems(src->tmf_reserved2); i++) {
ISP_IOXPUT_8(isp, src->tmf_reserved2[i], &dst->tmf_reserved2[i]);
}
}
@@ -998,29 +684,18 @@ isp_put_24xx_abrt(ispsoftc_t *isp, isp24xx_abrt_t *src, isp24xx_abrt_t *dst)
ISP_IOXPUT_16(isp, src->abrt_options, &dst->abrt_options);
ISP_IOXPUT_32(isp, src->abrt_cmd_handle, &dst->abrt_cmd_handle);
ISP_IOXPUT_16(isp, src->abrt_queue_number, &dst->abrt_queue_number);
- for (i = 0; i < ASIZE(src->abrt_reserved); i++) {
+ for (i = 0; i < nitems(src->abrt_reserved); i++) {
ISP_IOXPUT_8(isp, src->abrt_reserved[i], &dst->abrt_reserved[i]);
}
ISP_IOXPUT_16(isp, src->abrt_tidlo, &dst->abrt_tidlo);
ISP_IOXPUT_8(isp, src->abrt_tidhi, &dst->abrt_tidhi);
ISP_IOXPUT_8(isp, src->abrt_vpidx, &dst->abrt_vpidx);
- for (i = 0; i < ASIZE(src->abrt_reserved1); i++) {
+ for (i = 0; i < nitems(src->abrt_reserved1); i++) {
ISP_IOXPUT_8(isp, src->abrt_reserved1[i], &dst->abrt_reserved1[i]);
}
}
void
-isp_put_cont_req(ispsoftc_t *isp, ispcontreq_t *src, ispcontreq_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->req_header, &dst->req_header);
- for (i = 0; i < ISP_CDSEG; i++) {
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);
- ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count);
- }
-}
-
-void
isp_put_cont64_req(ispsoftc_t *isp, ispcontreq64_t *src, ispcontreq64_t *dst)
{
int i;
@@ -1033,43 +708,16 @@ isp_put_cont64_req(ispsoftc_t *isp, ispcontreq64_t *src, ispcontreq64_t *dst)
}
void
-isp_get_response(ispsoftc_t *isp, ispstatusreq_t *src, ispstatusreq_t *dst)
-{
- int i;
- isp_get_hdr(isp, &src->req_header, &dst->req_header);
- ISP_IOXGET_32(isp, &src->req_handle, dst->req_handle);
- ISP_IOXGET_16(isp, &src->req_scsi_status, dst->req_scsi_status);
- ISP_IOXGET_16(isp, &src->req_completion_status, dst->req_completion_status);
- ISP_IOXGET_16(isp, &src->req_state_flags, dst->req_state_flags);
- ISP_IOXGET_16(isp, &src->req_status_flags, dst->req_status_flags);
- ISP_IOXGET_16(isp, &src->req_time, dst->req_time);
- ISP_IOXGET_16(isp, &src->req_sense_len, dst->req_sense_len);
- ISP_IOXGET_32(isp, &src->req_resid, dst->req_resid);
- for (i = 0; i < sizeof (src->req_response); i++) {
- ISP_IOXGET_8(isp, &src->req_response[i], dst->req_response[i]);
- }
- for (i = 0; i < sizeof (src->req_sense_data); i++) {
- ISP_IOXGET_8(isp, &src->req_sense_data[i], dst->req_sense_data[i]);
- }
-}
-
-void
isp_get_cont_response(ispsoftc_t *isp, ispstatus_cont_t *src, ispstatus_cont_t *dst)
{
int i;
+ uint32_t *a, *b;
+
isp_get_hdr(isp, &src->req_header, &dst->req_header);
- if (IS_24XX(isp)) {
- uint32_t *a, *b;
- a = (uint32_t *) src->req_sense_data;
- b = (uint32_t *) dst->req_sense_data;
- for (i = 0; i < (sizeof (src->req_sense_data) / sizeof (uint32_t)); i++) {
- ISP_IOZGET_32(isp, a++, *b++);
- }
- } else {
- for (i = 0; i < sizeof (src->req_sense_data); i++) {
- ISP_IOXGET_8(isp, &src->req_sense_data[i], dst->req_sense_data[i]);
- }
- }
+ a = (uint32_t *) src->req_sense_data;
+ b = (uint32_t *) dst->req_sense_data;
+ for (i = 0; i < (sizeof (src->req_sense_data) / sizeof (uint32_t)); i++)
+ ISP_IOZGET_32(isp, a++, *b++);
}
void
@@ -1092,7 +740,7 @@ isp_get_24xx_response(ispsoftc_t *isp, isp24xx_statusreq_t *src, isp24xx_statusr
ISP_IOXGET_32(isp, &src->req_response_len, dst->req_response_len);
s = (uint32_t *)src->req_rsp_sense;
d = (uint32_t *)dst->req_rsp_sense;
- for (i = 0; i < (ASIZE(src->req_rsp_sense) >> 2); i++) {
+ for (i = 0; i < (nitems(src->req_rsp_sense) >> 2); i++) {
d[i] = ISP_SWAP32(isp, s[i]);
}
}
@@ -1107,120 +755,17 @@ isp_get_24xx_abrt(ispsoftc_t *isp, isp24xx_abrt_t *src, isp24xx_abrt_t *dst)
ISP_IOXGET_16(isp, &src->abrt_options, dst->abrt_options);
ISP_IOXGET_32(isp, &src->abrt_cmd_handle, dst->abrt_cmd_handle);
ISP_IOXGET_16(isp, &src->abrt_queue_number, dst->abrt_queue_number);
- for (i = 0; i < ASIZE(src->abrt_reserved); i++) {
+ for (i = 0; i < nitems(src->abrt_reserved); i++) {
ISP_IOXGET_8(isp, &src->abrt_reserved[i], dst->abrt_reserved[i]);
}
ISP_IOXGET_16(isp, &src->abrt_tidlo, dst->abrt_tidlo);
ISP_IOXGET_8(isp, &src->abrt_tidhi, dst->abrt_tidhi);
ISP_IOXGET_8(isp, &src->abrt_vpidx, dst->abrt_vpidx);
- for (i = 0; i < ASIZE(src->abrt_reserved1); i++) {
+ for (i = 0; i < nitems(src->abrt_reserved1); i++) {
ISP_IOXGET_8(isp, &src->abrt_reserved1[i], dst->abrt_reserved1[i]);
}
}
-
-void
-isp_get_rio1(ispsoftc_t *isp, isp_rio1_t *r1src, isp_rio1_t *r1dst)
-{
- const int lim = sizeof (r1dst->req_handles) / sizeof (r1dst->req_handles[0]);
- int i;
- isp_get_hdr(isp, &r1src->req_header, &r1dst->req_header);
- if (r1dst->req_header.rqs_seqno > lim) {
- r1dst->req_header.rqs_seqno = lim;
- }
- for (i = 0; i < r1dst->req_header.rqs_seqno; i++) {
- ISP_IOXGET_32(isp, &r1src->req_handles[i], r1dst->req_handles[i]);
- }
- while (i < lim) {
- r1dst->req_handles[i++] = 0;
- }
-}
-
-void
-isp_get_rio2(ispsoftc_t *isp, isp_rio2_t *r2src, isp_rio2_t *r2dst)
-{
- const int lim = sizeof (r2dst->req_handles) / sizeof (r2dst->req_handles[0]);
- int i;
-
- isp_get_hdr(isp, &r2src->req_header, &r2dst->req_header);
- if (r2dst->req_header.rqs_seqno > lim) {
- r2dst->req_header.rqs_seqno = lim;
- }
- for (i = 0; i < r2dst->req_header.rqs_seqno; i++) {
- ISP_IOXGET_16(isp, &r2src->req_handles[i], r2dst->req_handles[i]);
- }
- while (i < lim) {
- r2dst->req_handles[i++] = 0;
- }
-}
-
-void
-isp_put_icb(ispsoftc_t *isp, isp_icb_t *src, isp_icb_t *dst)
-{
- int i;
- if (ISP_IS_SBUS(isp)) {
- ISP_IOXPUT_8(isp, src->icb_version, &dst->icb_reserved0);
- ISP_IOXPUT_8(isp, src->icb_reserved0, &dst->icb_version);
- } else {
- ISP_IOXPUT_8(isp, src->icb_version, &dst->icb_version);
- ISP_IOXPUT_8(isp, src->icb_reserved0, &dst->icb_reserved0);
- }
- ISP_IOXPUT_16(isp, src->icb_fwoptions, &dst->icb_fwoptions);
- ISP_IOXPUT_16(isp, src->icb_maxfrmlen, &dst->icb_maxfrmlen);
- ISP_IOXPUT_16(isp, src->icb_maxalloc, &dst->icb_maxalloc);
- ISP_IOXPUT_16(isp, src->icb_execthrottle, &dst->icb_execthrottle);
- if (ISP_IS_SBUS(isp)) {
- ISP_IOXPUT_8(isp, src->icb_retry_count, &dst->icb_retry_delay);
- ISP_IOXPUT_8(isp, src->icb_retry_delay, &dst->icb_retry_count);
- } else {
- ISP_IOXPUT_8(isp, src->icb_retry_count, &dst->icb_retry_count);
- ISP_IOXPUT_8(isp, src->icb_retry_delay, &dst->icb_retry_delay);
- }
- for (i = 0; i < 8; i++) {
- ISP_IOXPUT_8(isp, src->icb_portname[i], &dst->icb_portname[i]);
- }
- ISP_IOXPUT_16(isp, src->icb_hardaddr, &dst->icb_hardaddr);
- if (ISP_IS_SBUS(isp)) {
- ISP_IOXPUT_8(isp, src->icb_iqdevtype, &dst->icb_logintime);
- ISP_IOXPUT_8(isp, src->icb_logintime, &dst->icb_iqdevtype);
- } else {
- ISP_IOXPUT_8(isp, src->icb_iqdevtype, &dst->icb_iqdevtype);
- ISP_IOXPUT_8(isp, src->icb_logintime, &dst->icb_logintime);
- }
- for (i = 0; i < 8; i++) {
- ISP_IOXPUT_8(isp, src->icb_nodename[i], &dst->icb_nodename[i]);
- }
- ISP_IOXPUT_16(isp, src->icb_rqstout, &dst->icb_rqstout);
- ISP_IOXPUT_16(isp, src->icb_rspnsin, &dst->icb_rspnsin);
- ISP_IOXPUT_16(isp, src->icb_rqstqlen, &dst->icb_rqstqlen);
- ISP_IOXPUT_16(isp, src->icb_rsltqlen, &dst->icb_rsltqlen);
- for (i = 0; i < 4; i++) {
- ISP_IOXPUT_16(isp, src->icb_rqstaddr[i], &dst->icb_rqstaddr[i]);
- }
- for (i = 0; i < 4; i++) {
- ISP_IOXPUT_16(isp, src->icb_respaddr[i], &dst->icb_respaddr[i]);
- }
- ISP_IOXPUT_16(isp, src->icb_lunenables, &dst->icb_lunenables);
- if (ISP_IS_SBUS(isp)) {
- ISP_IOXPUT_8(isp, src->icb_ccnt, &dst->icb_icnt);
- ISP_IOXPUT_8(isp, src->icb_icnt, &dst->icb_ccnt);
- } else {
- ISP_IOXPUT_8(isp, src->icb_ccnt, &dst->icb_ccnt);
- ISP_IOXPUT_8(isp, src->icb_icnt, &dst->icb_icnt);
- }
- ISP_IOXPUT_16(isp, src->icb_lunetimeout, &dst->icb_lunetimeout);
- ISP_IOXPUT_16(isp, src->icb_reserved1, &dst->icb_reserved1);
- ISP_IOXPUT_16(isp, src->icb_xfwoptions, &dst->icb_xfwoptions);
- if (ISP_IS_SBUS(isp)) {
- ISP_IOXPUT_8(isp, src->icb_racctimer, &dst->icb_idelaytimer);
- ISP_IOXPUT_8(isp, src->icb_idelaytimer, &dst->icb_racctimer);
- } else {
- ISP_IOXPUT_8(isp, src->icb_racctimer, &dst->icb_racctimer);
- ISP_IOXPUT_8(isp, src->icb_idelaytimer, &dst->icb_idelaytimer);
- }
- ISP_IOXPUT_16(isp, src->icb_zfwoptions, &dst->icb_zfwoptions);
-}
-
void
isp_put_icb_2400(ispsoftc_t *isp, isp_icb_2400_t *src, isp_icb_2400_t *dst)
{
@@ -1309,10 +854,10 @@ isp_get_vp_port_info(ispsoftc_t *isp, vp_port_info_t *src, vp_port_info_t *dst)
ISP_IOXGET_16(isp, &src->vp_port_status, dst->vp_port_status);
ISP_IOXGET_8(isp, &src->vp_port_options, dst->vp_port_options);
ISP_IOXGET_8(isp, &src->vp_port_loopid, dst->vp_port_loopid);
- for (i = 0; i < ASIZE(src->vp_port_portname); i++) {
+ for (i = 0; i < nitems(src->vp_port_portname); i++) {
ISP_IOXGET_8(isp, &src->vp_port_portname[i], dst->vp_port_portname[i]);
}
- for (i = 0; i < ASIZE(src->vp_port_nodename); i++) {
+ for (i = 0; i < nitems(src->vp_port_nodename); i++) {
ISP_IOXGET_8(isp, &src->vp_port_nodename[i], dst->vp_port_nodename[i]);
}
ISP_IOXGET_16(isp, &src->vp_port_portid_lo, dst->vp_port_portid_lo);
@@ -1329,10 +874,10 @@ isp_put_vp_ctrl_info(ispsoftc_t *isp, vp_ctrl_info_t *src, vp_ctrl_info_t *dst)
ISP_IOXPUT_16(isp, src->vp_ctrl_status, &dst->vp_ctrl_status);
ISP_IOXPUT_16(isp, src->vp_ctrl_command, &dst->vp_ctrl_command);
ISP_IOXPUT_16(isp, src->vp_ctrl_vp_count, &dst->vp_ctrl_vp_count);
- for (i = 0; i < ASIZE(src->vp_ctrl_idmap); i++) {
+ for (i = 0; i < nitems(src->vp_ctrl_idmap); i++) {
ISP_IOXPUT_16(isp, src->vp_ctrl_idmap[i], &dst->vp_ctrl_idmap[i]);
}
- for (i = 0; i < ASIZE(src->vp_ctrl_reserved); i++) {
+ for (i = 0; i < nitems(src->vp_ctrl_reserved); i++) {
ISP_IOXPUT_16(isp, src->vp_ctrl_reserved[i], &dst->vp_ctrl_reserved[i]);
}
ISP_IOXPUT_16(isp, src->vp_ctrl_fcf_index, &dst->vp_ctrl_fcf_index);
@@ -1348,10 +893,10 @@ isp_get_vp_ctrl_info(ispsoftc_t *isp, vp_ctrl_info_t *src, vp_ctrl_info_t *dst)
ISP_IOXGET_16(isp, &src->vp_ctrl_status, dst->vp_ctrl_status);
ISP_IOXGET_16(isp, &src->vp_ctrl_command, dst->vp_ctrl_command);
ISP_IOXGET_16(isp, &src->vp_ctrl_vp_count, dst->vp_ctrl_vp_count);
- for (i = 0; i < ASIZE(src->vp_ctrl_idmap); i++) {
+ for (i = 0; i < nitems(src->vp_ctrl_idmap); i++) {
ISP_IOXGET_16(isp, &src->vp_ctrl_idmap[i], dst->vp_ctrl_idmap[i]);
}
- for (i = 0; i < ASIZE(src->vp_ctrl_reserved); i++) {
+ for (i = 0; i < nitems(src->vp_ctrl_reserved); i++) {
ISP_IOXGET_16(isp, &src->vp_ctrl_reserved[i], dst->vp_ctrl_reserved[i]);
}
ISP_IOXGET_16(isp, &src->vp_ctrl_fcf_index, dst->vp_ctrl_fcf_index);
@@ -1369,18 +914,18 @@ isp_put_vp_modify(ispsoftc_t *isp, vp_modify_t *src, vp_modify_t *dst)
ISP_IOXPUT_8(isp, src->vp_mod_cnt, &dst->vp_mod_cnt);
ISP_IOXPUT_8(isp, src->vp_mod_idx0, &dst->vp_mod_idx0);
ISP_IOXPUT_8(isp, src->vp_mod_idx1, &dst->vp_mod_idx1);
- for (i = 0; i < ASIZE(src->vp_mod_ports); i++) {
+ for (i = 0; i < nitems(src->vp_mod_ports); i++) {
ISP_IOXPUT_8(isp, src->vp_mod_ports[i].options, &dst->vp_mod_ports[i].options);
ISP_IOXPUT_8(isp, src->vp_mod_ports[i].loopid, &dst->vp_mod_ports[i].loopid);
ISP_IOXPUT_16(isp, src->vp_mod_ports[i].reserved1, &dst->vp_mod_ports[i].reserved1);
- for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwpn); j++) {
+ for (j = 0; j < nitems(src->vp_mod_ports[i].wwpn); j++) {
ISP_IOXPUT_8(isp, src->vp_mod_ports[i].wwpn[j], &dst->vp_mod_ports[i].wwpn[j]);
}
- for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwnn); j++) {
+ for (j = 0; j < nitems(src->vp_mod_ports[i].wwnn); j++) {
ISP_IOXPUT_8(isp, src->vp_mod_ports[i].wwnn[j], &dst->vp_mod_ports[i].wwnn[j]);
}
}
- for (i = 0; i < ASIZE(src->vp_mod_reserved2); i++) {
+ for (i = 0; i < nitems(src->vp_mod_reserved2); i++) {
ISP_IOXPUT_8(isp, src->vp_mod_reserved2[i], &dst->vp_mod_reserved2[i]);
}
}
@@ -1397,75 +942,23 @@ isp_get_vp_modify(ispsoftc_t *isp, vp_modify_t *src, vp_modify_t *dst)
ISP_IOXGET_8(isp, &src->vp_mod_cnt, dst->vp_mod_cnt);
ISP_IOXGET_8(isp, &src->vp_mod_idx0, dst->vp_mod_idx0);
ISP_IOXGET_8(isp, &src->vp_mod_idx1, dst->vp_mod_idx1);
- for (i = 0; i < ASIZE(src->vp_mod_ports); i++) {
+ for (i = 0; i < nitems(src->vp_mod_ports); i++) {
ISP_IOXGET_8(isp, &src->vp_mod_ports[i].options, dst->vp_mod_ports[i].options);
ISP_IOXGET_8(isp, &src->vp_mod_ports[i].loopid, dst->vp_mod_ports[i].loopid);
ISP_IOXGET_16(isp, &src->vp_mod_ports[i].reserved1, dst->vp_mod_ports[i].reserved1);
- for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwpn); j++) {
+ for (j = 0; j < nitems(src->vp_mod_ports[i].wwpn); j++) {
ISP_IOXGET_8(isp, &src->vp_mod_ports[i].wwpn[j], dst->vp_mod_ports[i].wwpn[j]);
}
- for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwnn); j++) {
+ for (j = 0; j < nitems(src->vp_mod_ports[i].wwnn); j++) {
ISP_IOXGET_8(isp, &src->vp_mod_ports[i].wwnn[j], dst->vp_mod_ports[i].wwnn[j]);
}
}
- for (i = 0; i < ASIZE(src->vp_mod_reserved2); i++) {
+ for (i = 0; i < nitems(src->vp_mod_reserved2); i++) {
ISP_IOXGET_8(isp, &src->vp_mod_reserved2[i], dst->vp_mod_reserved2[i]);
}
}
void
-isp_get_pdb_21xx(ispsoftc_t *isp, isp_pdb_21xx_t *src, isp_pdb_21xx_t *dst)
-{
- int i;
- ISP_IOXGET_16(isp, &src->pdb_options, dst->pdb_options);
- ISP_IOXGET_8(isp, &src->pdb_mstate, dst->pdb_mstate);
- ISP_IOXGET_8(isp, &src->pdb_sstate, dst->pdb_sstate);
- for (i = 0; i < 4; i++) {
- ISP_IOXGET_8(isp, &src->pdb_hardaddr_bits[i], dst->pdb_hardaddr_bits[i]);
- }
- for (i = 0; i < 4; i++) {
- ISP_IOXGET_8(isp, &src->pdb_portid_bits[i], dst->pdb_portid_bits[i]);
- }
- for (i = 0; i < 8; i++) {
- ISP_IOXGET_8(isp, &src->pdb_nodename[i], dst->pdb_nodename[i]);
- }
- for (i = 0; i < 8; i++) {
- ISP_IOXGET_8(isp, &src->pdb_portname[i], dst->pdb_portname[i]);
- }
- ISP_IOXGET_16(isp, &src->pdb_execthrottle, dst->pdb_execthrottle);
- ISP_IOXGET_16(isp, &src->pdb_exec_count, dst->pdb_exec_count);
- ISP_IOXGET_8(isp, &src->pdb_retry_count, dst->pdb_retry_count);
- ISP_IOXGET_8(isp, &src->pdb_retry_delay, dst->pdb_retry_delay);
- ISP_IOXGET_16(isp, &src->pdb_resalloc, dst->pdb_resalloc);
- ISP_IOXGET_16(isp, &src->pdb_curalloc, dst->pdb_curalloc);
- ISP_IOXGET_16(isp, &src->pdb_qhead, dst->pdb_qhead);
- ISP_IOXGET_16(isp, &src->pdb_qtail, dst->pdb_qtail);
- ISP_IOXGET_16(isp, &src->pdb_tl_next, dst->pdb_tl_next);
- ISP_IOXGET_16(isp, &src->pdb_tl_last, dst->pdb_tl_last);
- ISP_IOXGET_16(isp, &src->pdb_features, dst->pdb_features);
- ISP_IOXGET_16(isp, &src->pdb_pconcurrnt, dst->pdb_pconcurrnt);
- ISP_IOXGET_16(isp, &src->pdb_roi, dst->pdb_roi);
- ISP_IOXGET_8(isp, &src->pdb_target, dst->pdb_target);
- ISP_IOXGET_8(isp, &src->pdb_initiator, dst->pdb_initiator);
- ISP_IOXGET_16(isp, &src->pdb_rdsiz, dst->pdb_rdsiz);
- ISP_IOXGET_16(isp, &src->pdb_ncseq, dst->pdb_ncseq);
- ISP_IOXGET_16(isp, &src->pdb_noseq, dst->pdb_noseq);
- ISP_IOXGET_16(isp, &src->pdb_labrtflg, dst->pdb_labrtflg);
- ISP_IOXGET_16(isp, &src->pdb_lstopflg, dst->pdb_lstopflg);
- ISP_IOXGET_16(isp, &src->pdb_sqhead, dst->pdb_sqhead);
- ISP_IOXGET_16(isp, &src->pdb_sqtail, dst->pdb_sqtail);
- ISP_IOXGET_16(isp, &src->pdb_ptimer, dst->pdb_ptimer);
- ISP_IOXGET_16(isp, &src->pdb_nxt_seqid, dst->pdb_nxt_seqid);
- ISP_IOXGET_16(isp, &src->pdb_fcount, dst->pdb_fcount);
- ISP_IOXGET_16(isp, &src->pdb_prli_len, dst->pdb_prli_len);
- ISP_IOXGET_16(isp, &src->pdb_prli_svc0, dst->pdb_prli_svc0);
- ISP_IOXGET_16(isp, &src->pdb_prli_svc3, dst->pdb_prli_svc3);
- ISP_IOXGET_16(isp, &src->pdb_loopid, dst->pdb_loopid);
- ISP_IOXGET_16(isp, &src->pdb_il_ptr, dst->pdb_il_ptr);
- ISP_IOXGET_16(isp, &src->pdb_sl_ptr, dst->pdb_sl_ptr);
-}
-
-void
isp_get_pdb_24xx(ispsoftc_t *isp, isp_pdb_24xx_t *src, isp_pdb_24xx_t *dst)
{
int i;
@@ -1496,23 +989,6 @@ isp_get_pdb_24xx(ispsoftc_t *isp, isp_pdb_24xx_t *src, isp_pdb_24xx_t *dst)
}
void
-isp_get_pnhle_21xx(ispsoftc_t *isp, isp_pnhle_21xx_t *src, isp_pnhle_21xx_t *dst)
-{
-
- ISP_IOXGET_16(isp, &src->pnhle_port_id_lo, dst->pnhle_port_id_lo);
- ISP_IOXGET_16(isp, &src->pnhle_port_id_hi_handle, dst->pnhle_port_id_hi_handle);
-}
-
-void
-isp_get_pnhle_23xx(ispsoftc_t *isp, isp_pnhle_23xx_t *src, isp_pnhle_23xx_t *dst)
-{
-
- ISP_IOXGET_16(isp, &src->pnhle_port_id_lo, dst->pnhle_port_id_lo);
- ISP_IOXGET_16(isp, &src->pnhle_port_id_hi, dst->pnhle_port_id_hi);
- ISP_IOXGET_16(isp, &src->pnhle_handle, dst->pnhle_handle);
-}
-
-void
isp_get_pnhle_24xx(ispsoftc_t *isp, isp_pnhle_24xx_t *src, isp_pnhle_24xx_t *dst)
{
@@ -1522,17 +998,6 @@ isp_get_pnhle_24xx(ispsoftc_t *isp, isp_pnhle_24xx_t *src, isp_pnhle_24xx_t *dst
ISP_IOXGET_16(isp, &src->pnhle_reserved, dst->pnhle_reserved);
}
-void
-isp_get_pnnle(ispsoftc_t *isp, isp_pnnle_t *src, isp_pnnle_t *dst)
-{
- int i;
-
- for (i = 0; i < 8; i++)
- ISP_IOXGET_8(isp, &src->pnnle_name[i], dst->pnnle_name[i]);
- ISP_IOXGET_16(isp, &src->pnnle_handle, dst->pnnle_handle);
- ISP_IOXGET_16(isp, &src->pnnle_reserved, dst->pnnle_reserved);
-}
-
/*
* PLOGI/LOGO IOCB canonicalization
*/
@@ -1629,33 +1094,6 @@ isp_get_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *src, isp_ct_pt_t *dst)
}
void
-isp_get_ms(ispsoftc_t *isp, isp_ms_t *src, isp_ms_t *dst)
-{
- int i;
-
- isp_get_hdr(isp, &src->ms_header, &dst->ms_header);
- ISP_IOXGET_32(isp, &src->ms_handle, dst->ms_handle);
- ISP_IOXGET_16(isp, &src->ms_nphdl, dst->ms_nphdl);
- ISP_IOXGET_16(isp, &src->ms_status, dst->ms_status);
- ISP_IOXGET_16(isp, &src->ms_flags, dst->ms_flags);
- ISP_IOXGET_16(isp, &src->ms_reserved1, dst->ms_reserved1);
- ISP_IOXGET_16(isp, &src->ms_time, dst->ms_time);
- ISP_IOXGET_16(isp, &src->ms_cmd_cnt, dst->ms_cmd_cnt);
- ISP_IOXGET_16(isp, &src->ms_tot_cnt, dst->ms_tot_cnt);
- ISP_IOXGET_8(isp, &src->ms_type, dst->ms_type);
- ISP_IOXGET_8(isp, &src->ms_r_ctl, dst->ms_r_ctl);
- ISP_IOXGET_16(isp, &src->ms_rxid, dst->ms_rxid);
- ISP_IOXGET_16(isp, &src->ms_reserved2, dst->ms_reserved2);
- ISP_IOXGET_32(isp, &src->ms_rsp_bcnt, dst->ms_rsp_bcnt);
- ISP_IOXGET_32(isp, &src->ms_cmd_bcnt, dst->ms_cmd_bcnt);
- for (i = 0; i < 2; i++) {
- ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_base, dst->ms_dataseg[i].ds_base);
- ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_basehi, dst->ms_dataseg[i].ds_basehi);
- ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_count, dst->ms_dataseg[i].ds_count);
- }
-}
-
-void
isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *src, isp_ct_pt_t *dst)
{
int i;
@@ -1683,51 +1121,6 @@ isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *src, isp_ct_pt_t *dst)
}
void
-isp_put_ms(ispsoftc_t *isp, isp_ms_t *src, isp_ms_t *dst)
-{
- int i;
-
- isp_put_hdr(isp, &src->ms_header, &dst->ms_header);
- ISP_IOXPUT_32(isp, src->ms_handle, &dst->ms_handle);
- ISP_IOXPUT_16(isp, src->ms_nphdl, &dst->ms_nphdl);
- ISP_IOXPUT_16(isp, src->ms_status, &dst->ms_status);
- ISP_IOXPUT_16(isp, src->ms_flags, &dst->ms_flags);
- ISP_IOXPUT_16(isp, src->ms_reserved1, &dst->ms_reserved1);
- ISP_IOXPUT_16(isp, src->ms_time, &dst->ms_time);
- ISP_IOXPUT_16(isp, src->ms_cmd_cnt, &dst->ms_cmd_cnt);
- ISP_IOXPUT_16(isp, src->ms_tot_cnt, &dst->ms_tot_cnt);
- ISP_IOXPUT_8(isp, src->ms_type, &dst->ms_type);
- ISP_IOXPUT_8(isp, src->ms_r_ctl, &dst->ms_r_ctl);
- ISP_IOXPUT_16(isp, src->ms_rxid, &dst->ms_rxid);
- ISP_IOXPUT_16(isp, src->ms_reserved2, &dst->ms_reserved2);
- ISP_IOXPUT_32(isp, src->ms_rsp_bcnt, &dst->ms_rsp_bcnt);
- ISP_IOXPUT_32(isp, src->ms_cmd_bcnt, &dst->ms_cmd_bcnt);
- for (i = 0; i < 2; i++) {
- ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_base, &dst->ms_dataseg[i].ds_base);
- ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_basehi, &dst->ms_dataseg[i].ds_basehi);
- ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_count, &dst->ms_dataseg[i].ds_count);
- }
-}
-
-/*
- * Generic SNS request - not particularly useful since the per-command data
- * isn't always 16 bit words.
- */
-void
-isp_put_sns_request(ispsoftc_t *isp, sns_screq_t *src, sns_screq_t *dst)
-{
- int i, nw = (int) src->snscb_sblen;
- ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen);
- for (i = 0; i < 4; i++) {
- ISP_IOXPUT_16(isp, src->snscb_addr[i], &dst->snscb_addr[i]);
- }
- ISP_IOXPUT_16(isp, src->snscb_sblen, &dst->snscb_sblen);
- for (i = 0; i < nw; i++) {
- ISP_IOXPUT_16(isp, src->snscb_data[i], &dst->snscb_data[i]);
- }
-}
-
-void
isp_put_gid_ft_request(ispsoftc_t *isp, sns_gid_ft_req_t *src, sns_gid_ft_req_t *dst)
{
ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen);
@@ -1745,43 +1138,6 @@ isp_put_gid_ft_request(ispsoftc_t *isp, sns_gid_ft_req_t *src, sns_gid_ft_req_t
}
void
-isp_put_gid_pt_request(ispsoftc_t *isp, sns_gid_pt_req_t *src, sns_gid_pt_req_t *dst)
-{
- ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen);
- ISP_IOXPUT_16(isp, src->snscb_reserved0, &dst->snscb_reserved0);
- ISP_IOXPUT_16(isp, src->snscb_addr[0], &dst->snscb_addr[0]);
- ISP_IOXPUT_16(isp, src->snscb_addr[1], &dst->snscb_addr[1]);
- ISP_IOXPUT_16(isp, src->snscb_addr[2], &dst->snscb_addr[2]);
- ISP_IOXPUT_16(isp, src->snscb_addr[3], &dst->snscb_addr[3]);
- ISP_IOXPUT_16(isp, src->snscb_sblen, &dst->snscb_sblen);
- ISP_IOXPUT_16(isp, src->snscb_reserved1, &dst->snscb_reserved1);
- ISP_IOXPUT_16(isp, src->snscb_cmd, &dst->snscb_cmd);
- ISP_IOXPUT_16(isp, src->snscb_mword_div_2, &dst->snscb_mword_div_2);
- ISP_IOXPUT_32(isp, src->snscb_reserved3, &dst->snscb_reserved3);
- ISP_IOXPUT_8(isp, src->snscb_port_type, &dst->snscb_port_type);
- ISP_IOXPUT_8(isp, src->snscb_domain, &dst->snscb_domain);
- ISP_IOXPUT_8(isp, src->snscb_area, &dst->snscb_area);
- ISP_IOXPUT_8(isp, src->snscb_flags, &dst->snscb_flags);
-}
-
-void
-isp_put_gxx_id_request(ispsoftc_t *isp, sns_gxx_id_req_t *src, sns_gxx_id_req_t *dst)
-{
- ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen);
- ISP_IOXPUT_16(isp, src->snscb_reserved0, &dst->snscb_reserved0);
- ISP_IOXPUT_16(isp, src->snscb_addr[0], &dst->snscb_addr[0]);
- ISP_IOXPUT_16(isp, src->snscb_addr[1], &dst->snscb_addr[1]);
- ISP_IOXPUT_16(isp, src->snscb_addr[2], &dst->snscb_addr[2]);
- ISP_IOXPUT_16(isp, src->snscb_addr[3], &dst->snscb_addr[3]);
- ISP_IOXPUT_16(isp, src->snscb_sblen, &dst->snscb_sblen);
- ISP_IOXPUT_16(isp, src->snscb_reserved1, &dst->snscb_reserved1);
- ISP_IOXPUT_16(isp, src->snscb_cmd, &dst->snscb_cmd);
- ISP_IOXPUT_16(isp, src->snscb_mword_div_2, &dst->snscb_mword_div_2);
- ISP_IOXPUT_32(isp, src->snscb_reserved3, &dst->snscb_reserved3);
- ISP_IOXPUT_32(isp, src->snscb_portid, &dst->snscb_portid);
-}
-
-void
isp_get_gid_xx_response(ispsoftc_t *isp, sns_gid_xx_rsp_t *src, sns_gid_xx_rsp_t *dst, int nwords)
{
int i, j;
@@ -1877,70 +1233,6 @@ isp_get_ga_nxt_response(ispsoftc_t *isp, sns_ga_nxt_rsp_t *src, sns_ga_nxt_rsp_t
}
}
-void
-isp_get_els(ispsoftc_t *isp, els_t *src, els_t *dst)
-{
- int i;
-
- isp_get_hdr(isp, &src->els_hdr, &dst->els_hdr);
- ISP_IOXGET_32(isp, &src->els_handle, dst->els_handle);
- ISP_IOXGET_16(isp, &src->els_status, dst->els_status);
- ISP_IOXGET_16(isp, &src->els_nphdl, dst->els_nphdl);
- ISP_IOXGET_16(isp, &src->els_xmit_dsd_count, dst->els_xmit_dsd_count);
- ISP_IOXGET_8(isp, &src->els_vphdl, dst->els_vphdl);
- ISP_IOXGET_8(isp, &src->els_sof, dst->els_sof);
- ISP_IOXGET_32(isp, &src->els_rxid, dst->els_rxid);
- ISP_IOXGET_16(isp, &src->els_recv_dsd_count, dst->els_recv_dsd_count);
- ISP_IOXGET_8(isp, &src->els_opcode, dst->els_opcode);
- ISP_IOXGET_8(isp, &src->els_reserved2, dst->els_reserved1);
- ISP_IOXGET_8(isp, &src->els_did_lo, dst->els_did_lo);
- ISP_IOXGET_8(isp, &src->els_did_mid, dst->els_did_mid);
- ISP_IOXGET_8(isp, &src->els_did_hi, dst->els_did_hi);
- ISP_IOXGET_8(isp, &src->els_reserved2, dst->els_reserved2);
- ISP_IOXGET_16(isp, &src->els_reserved3, dst->els_reserved3);
- ISP_IOXGET_16(isp, &src->els_ctl_flags, dst->els_ctl_flags);
- ISP_IOXGET_32(isp, &src->els_bytecnt, dst->els_bytecnt);
- ISP_IOXGET_32(isp, &src->els_subcode1, dst->els_subcode1);
- ISP_IOXGET_32(isp, &src->els_subcode2, dst->els_subcode2);
- for (i = 0; i < 20; i++) {
- ISP_IOXGET_8(isp, &src->els_reserved4[i], dst->els_reserved4[i]);
- }
-}
-
-void
-isp_put_els(ispsoftc_t *isp, els_t *src, els_t *dst)
-{
- isp_put_hdr(isp, &src->els_hdr, &dst->els_hdr);
- ISP_IOXPUT_32(isp, src->els_handle, &dst->els_handle);
- ISP_IOXPUT_16(isp, src->els_status, &dst->els_status);
- ISP_IOXPUT_16(isp, src->els_nphdl, &dst->els_nphdl);
- ISP_IOXPUT_16(isp, src->els_xmit_dsd_count, &dst->els_xmit_dsd_count);
- ISP_IOXPUT_8(isp, src->els_vphdl, &dst->els_vphdl);
- ISP_IOXPUT_8(isp, src->els_sof, &dst->els_sof);
- ISP_IOXPUT_32(isp, src->els_rxid, &dst->els_rxid);
- ISP_IOXPUT_16(isp, src->els_recv_dsd_count, &dst->els_recv_dsd_count);
- ISP_IOXPUT_8(isp, src->els_opcode, &dst->els_opcode);
- ISP_IOXPUT_8(isp, src->els_reserved2, &dst->els_reserved1);
- ISP_IOXPUT_8(isp, src->els_did_lo, &dst->els_did_lo);
- ISP_IOXPUT_8(isp, src->els_did_mid, &dst->els_did_mid);
- ISP_IOXPUT_8(isp, src->els_did_hi, &dst->els_did_hi);
- ISP_IOXPUT_8(isp, src->els_reserved2, &dst->els_reserved2);
- ISP_IOXPUT_16(isp, src->els_reserved3, &dst->els_reserved3);
- ISP_IOXPUT_16(isp, src->els_ctl_flags, &dst->els_ctl_flags);
- ISP_IOXPUT_32(isp, src->els_recv_bytecnt, &dst->els_recv_bytecnt);
- ISP_IOXPUT_32(isp, src->els_xmit_bytecnt, &dst->els_xmit_bytecnt);
- ISP_IOXPUT_32(isp, src->els_xmit_dsd_length, &dst->els_xmit_dsd_length);
- ISP_IOXPUT_16(isp, src->els_xmit_dsd_a1500, &dst->els_xmit_dsd_a1500);
- ISP_IOXPUT_16(isp, src->els_xmit_dsd_a3116, &dst->els_xmit_dsd_a3116);
- ISP_IOXPUT_16(isp, src->els_xmit_dsd_a4732, &dst->els_xmit_dsd_a4732);
- ISP_IOXPUT_16(isp, src->els_xmit_dsd_a6348, &dst->els_xmit_dsd_a6348);
- ISP_IOXPUT_32(isp, src->els_recv_dsd_length, &dst->els_recv_dsd_length);
- ISP_IOXPUT_16(isp, src->els_recv_dsd_a1500, &dst->els_recv_dsd_a1500);
- ISP_IOXPUT_16(isp, src->els_recv_dsd_a3116, &dst->els_recv_dsd_a3116);
- ISP_IOXPUT_16(isp, src->els_recv_dsd_a4732, &dst->els_recv_dsd_a4732);
- ISP_IOXPUT_16(isp, src->els_recv_dsd_a6348, &dst->els_recv_dsd_a6348);
-}
-
/*
* FC Structure Canonicalization
*/
@@ -2404,10 +1696,6 @@ isp_del_all_wwn_entries(ispsoftc_t *isp, int chan)
fcparam *fcp;
int i;
- if (!IS_FC(isp)) {
- return;
- }
-
/*
* Handle iterations over all channels via recursion
*/
@@ -2479,120 +1767,6 @@ isp_del_wwn_entries(ispsoftc_t *isp, isp_notify_t *mp)
}
void
-isp_put_atio2(ispsoftc_t *isp, at2_entry_t *src, at2_entry_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->at_header, &dst->at_header);
- ISP_IOXPUT_32(isp, src->at_reserved, &dst->at_reserved);
- ISP_IOXPUT_8(isp, src->at_lun, &dst->at_lun);
- ISP_IOXPUT_8(isp, src->at_iid, &dst->at_iid);
- ISP_IOXPUT_16(isp, src->at_rxid, &dst->at_rxid);
- ISP_IOXPUT_16(isp, src->at_flags, &dst->at_flags);
- ISP_IOXPUT_16(isp, src->at_status, &dst->at_status);
- ISP_IOXPUT_8(isp, src->at_crn, &dst->at_crn);
- ISP_IOXPUT_8(isp, src->at_taskcodes, &dst->at_taskcodes);
- ISP_IOXPUT_8(isp, src->at_taskflags, &dst->at_taskflags);
- ISP_IOXPUT_8(isp, src->at_execodes, &dst->at_execodes);
- for (i = 0; i < ATIO2_CDBLEN; i++) {
- ISP_IOXPUT_8(isp, src->at_cdb[i], &dst->at_cdb[i]);
- }
- ISP_IOXPUT_32(isp, src->at_datalen, &dst->at_datalen);
- ISP_IOXPUT_16(isp, src->at_scclun, &dst->at_scclun);
- for (i = 0; i < 4; i++) {
- ISP_IOXPUT_16(isp, src->at_wwpn[i], &dst->at_wwpn[i]);
- }
- for (i = 0; i < 6; i++) {
- ISP_IOXPUT_16(isp, src->at_reserved2[i], &dst->at_reserved2[i]);
- }
- ISP_IOXPUT_16(isp, src->at_oxid, &dst->at_oxid);
-}
-
-void
-isp_put_atio2e(ispsoftc_t *isp, at2e_entry_t *src, at2e_entry_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->at_header, &dst->at_header);
- ISP_IOXPUT_32(isp, src->at_reserved, &dst->at_reserved);
- ISP_IOXPUT_16(isp, src->at_iid, &dst->at_iid);
- ISP_IOXPUT_16(isp, src->at_rxid, &dst->at_rxid);
- ISP_IOXPUT_16(isp, src->at_flags, &dst->at_flags);
- ISP_IOXPUT_16(isp, src->at_status, &dst->at_status);
- ISP_IOXPUT_8(isp, src->at_crn, &dst->at_crn);
- ISP_IOXPUT_8(isp, src->at_taskcodes, &dst->at_taskcodes);
- ISP_IOXPUT_8(isp, src->at_taskflags, &dst->at_taskflags);
- ISP_IOXPUT_8(isp, src->at_execodes, &dst->at_execodes);
- for (i = 0; i < ATIO2_CDBLEN; i++) {
- ISP_IOXPUT_8(isp, src->at_cdb[i], &dst->at_cdb[i]);
- }
- ISP_IOXPUT_32(isp, src->at_datalen, &dst->at_datalen);
- ISP_IOXPUT_16(isp, src->at_scclun, &dst->at_scclun);
- for (i = 0; i < 4; i++) {
- ISP_IOXPUT_16(isp, src->at_wwpn[i], &dst->at_wwpn[i]);
- }
- for (i = 0; i < 6; i++) {
- ISP_IOXPUT_16(isp, src->at_reserved2[i], &dst->at_reserved2[i]);
- }
- ISP_IOXPUT_16(isp, src->at_oxid, &dst->at_oxid);
-}
-
-void
-isp_get_atio2(ispsoftc_t *isp, at2_entry_t *src, at2_entry_t *dst)
-{
- int i;
- isp_get_hdr(isp, &src->at_header, &dst->at_header);
- ISP_IOXGET_32(isp, &src->at_reserved, dst->at_reserved);
- ISP_IOXGET_8(isp, &src->at_lun, dst->at_lun);
- ISP_IOXGET_8(isp, &src->at_iid, dst->at_iid);
- ISP_IOXGET_16(isp, &src->at_rxid, dst->at_rxid);
- ISP_IOXGET_16(isp, &src->at_flags, dst->at_flags);
- ISP_IOXGET_16(isp, &src->at_status, dst->at_status);
- ISP_IOXGET_8(isp, &src->at_crn, dst->at_crn);
- ISP_IOXGET_8(isp, &src->at_taskcodes, dst->at_taskcodes);
- ISP_IOXGET_8(isp, &src->at_taskflags, dst->at_taskflags);
- ISP_IOXGET_8(isp, &src->at_execodes, dst->at_execodes);
- for (i = 0; i < ATIO2_CDBLEN; i++) {
- ISP_IOXGET_8(isp, &src->at_cdb[i], dst->at_cdb[i]);
- }
- ISP_IOXGET_32(isp, &src->at_datalen, dst->at_datalen);
- ISP_IOXGET_16(isp, &src->at_scclun, dst->at_scclun);
- for (i = 0; i < 4; i++) {
- ISP_IOXGET_16(isp, &src->at_wwpn[i], dst->at_wwpn[i]);
- }
- for (i = 0; i < 6; i++) {
- ISP_IOXGET_16(isp, &src->at_reserved2[i], dst->at_reserved2[i]);
- }
- ISP_IOXGET_16(isp, &src->at_oxid, dst->at_oxid);
-}
-
-void
-isp_get_atio2e(ispsoftc_t *isp, at2e_entry_t *src, at2e_entry_t *dst)
-{
- int i;
- isp_get_hdr(isp, &src->at_header, &dst->at_header);
- ISP_IOXGET_32(isp, &src->at_reserved, dst->at_reserved);
- ISP_IOXGET_16(isp, &src->at_iid, dst->at_iid);
- ISP_IOXGET_16(isp, &src->at_rxid, dst->at_rxid);
- ISP_IOXGET_16(isp, &src->at_flags, dst->at_flags);
- ISP_IOXGET_16(isp, &src->at_status, dst->at_status);
- ISP_IOXGET_8(isp, &src->at_crn, dst->at_crn);
- ISP_IOXGET_8(isp, &src->at_taskcodes, dst->at_taskcodes);
- ISP_IOXGET_8(isp, &src->at_taskflags, dst->at_taskflags);
- ISP_IOXGET_8(isp, &src->at_execodes, dst->at_execodes);
- for (i = 0; i < ATIO2_CDBLEN; i++) {
- ISP_IOXGET_8(isp, &src->at_cdb[i], dst->at_cdb[i]);
- }
- ISP_IOXGET_32(isp, &src->at_datalen, dst->at_datalen);
- ISP_IOXGET_16(isp, &src->at_scclun, dst->at_scclun);
- for (i = 0; i < 4; i++) {
- ISP_IOXGET_16(isp, &src->at_wwpn[i], dst->at_wwpn[i]);
- }
- for (i = 0; i < 6; i++) {
- ISP_IOXGET_16(isp, &src->at_reserved2[i], dst->at_reserved2[i]);
- }
- ISP_IOXGET_16(isp, &src->at_oxid, dst->at_oxid);
-}
-
-void
isp_get_atio7(ispsoftc_t *isp, at7_entry_t *src, at7_entry_t *dst)
{
ISP_IOXGET_8(isp, &src->at_type, dst->at_type);
@@ -2604,125 +1778,6 @@ isp_get_atio7(ispsoftc_t *isp, at7_entry_t *src, at7_entry_t *dst)
}
void
-isp_put_ctio2(ispsoftc_t *isp, ct2_entry_t *src, ct2_entry_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->ct_header, &dst->ct_header);
- ISP_IOXPUT_32(isp, src->ct_syshandle, &dst->ct_syshandle);
- ISP_IOXPUT_8(isp, src->ct_lun, &dst->ct_lun);
- ISP_IOXPUT_8(isp, src->ct_iid, &dst->ct_iid);
- ISP_IOXPUT_16(isp, src->ct_rxid, &dst->ct_rxid);
- ISP_IOXPUT_16(isp, src->ct_flags, &dst->ct_flags);
- ISP_IOXPUT_16(isp, src->ct_timeout, &dst->ct_timeout);
- ISP_IOXPUT_16(isp, src->ct_seg_count, &dst->ct_seg_count);
- ISP_IOXPUT_32(isp, src->ct_resid, &dst->ct_resid);
- ISP_IOXPUT_32(isp, src->ct_reloff, &dst->ct_reloff);
- if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) {
- ISP_IOXPUT_32(isp, src->rsp.m0._reserved, &dst->rsp.m0._reserved);
- ISP_IOXPUT_16(isp, src->rsp.m0._reserved2, &dst->rsp.m0._reserved2);
- ISP_IOXPUT_16(isp, src->rsp.m0.ct_scsi_status, &dst->rsp.m0.ct_scsi_status);
- ISP_IOXPUT_32(isp, src->rsp.m0.ct_xfrlen, &dst->rsp.m0.ct_xfrlen);
- if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
- for (i = 0; i < ISP_RQDSEG_T2; i++) {
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_base, &dst->rsp.m0.u.ct_dataseg[i].ds_base);
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_count, &dst->rsp.m0.u.ct_dataseg[i].ds_count);
- }
- } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO3) {
- for (i = 0; i < ISP_RQDSEG_T3; i++) {
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_base, &dst->rsp.m0.u.ct_dataseg64[i].ds_base);
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_basehi, &dst->rsp.m0.u.ct_dataseg64[i].ds_basehi);
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_count, &dst->rsp.m0.u.ct_dataseg64[i].ds_count);
- }
- } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO4) {
- ISP_IOXPUT_16(isp, src->rsp.m0.u.ct_dslist.ds_type, &dst->rsp.m0.u.ct_dslist.ds_type); ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_segment,
- &dst->rsp.m0.u.ct_dslist.ds_segment);
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_base, &dst->rsp.m0.u.ct_dslist.ds_base);
- }
- } else if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) {
- ISP_IOXPUT_16(isp, src->rsp.m1._reserved, &dst->rsp.m1._reserved);
- ISP_IOXPUT_16(isp, src->rsp.m1._reserved2, &dst->rsp.m1._reserved2);
- ISP_IOXPUT_16(isp, src->rsp.m1.ct_senselen, &dst->rsp.m1.ct_senselen);
- ISP_IOXPUT_16(isp, src->rsp.m1.ct_scsi_status, &dst->rsp.m1.ct_scsi_status);
- ISP_IOXPUT_16(isp, src->rsp.m1.ct_resplen, &dst->rsp.m1.ct_resplen);
- for (i = 0; i < MAXRESPLEN; i++) {
- ISP_IOXPUT_8(isp, src->rsp.m1.ct_resp[i], &dst->rsp.m1.ct_resp[i]);
- }
- } else {
- ISP_IOXPUT_32(isp, src->rsp.m2._reserved, &dst->rsp.m2._reserved);
- ISP_IOXPUT_16(isp, src->rsp.m2._reserved2, &dst->rsp.m2._reserved2);
- ISP_IOXPUT_16(isp, src->rsp.m2._reserved3, &dst->rsp.m2._reserved3);
- ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen);
- if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
- ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base, &dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base);
- ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count, &dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count);
- } else {
- ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base);
- ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi);
- ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count);
- }
- }
-}
-
-void
-isp_put_ctio2e(ispsoftc_t *isp, ct2e_entry_t *src, ct2e_entry_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->ct_header, &dst->ct_header);
- ISP_IOXPUT_32(isp, src->ct_syshandle, &dst->ct_syshandle);
- ISP_IOXPUT_16(isp, src->ct_iid, &dst->ct_iid);
- ISP_IOXPUT_16(isp, src->ct_rxid, &dst->ct_rxid);
- ISP_IOXPUT_16(isp, src->ct_flags, &dst->ct_flags);
- ISP_IOXPUT_16(isp, src->ct_timeout, &dst->ct_timeout);
- ISP_IOXPUT_16(isp, src->ct_seg_count, &dst->ct_seg_count);
- ISP_IOXPUT_32(isp, src->ct_resid, &dst->ct_resid);
- ISP_IOXPUT_32(isp, src->ct_reloff, &dst->ct_reloff);
- if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) {
- ISP_IOXPUT_32(isp, src->rsp.m0._reserved, &dst->rsp.m0._reserved);
- ISP_IOXPUT_16(isp, src->rsp.m0._reserved2, &dst->rsp.m0._reserved2);
- ISP_IOXPUT_16(isp, src->rsp.m0.ct_scsi_status, &dst->rsp.m0.ct_scsi_status);
- ISP_IOXPUT_32(isp, src->rsp.m0.ct_xfrlen, &dst->rsp.m0.ct_xfrlen);
- if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
- for (i = 0; i < ISP_RQDSEG_T2; i++) {
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_base, &dst->rsp.m0.u.ct_dataseg[i].ds_base);
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_count, &dst->rsp.m0.u.ct_dataseg[i].ds_count);
- }
- } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO3) {
- for (i = 0; i < ISP_RQDSEG_T3; i++) {
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_base, &dst->rsp.m0.u.ct_dataseg64[i].ds_base);
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_basehi, &dst->rsp.m0.u.ct_dataseg64[i].ds_basehi);
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_count, &dst->rsp.m0.u.ct_dataseg64[i].ds_count);
- }
- } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO4) {
- ISP_IOXPUT_16(isp, src->rsp.m0.u.ct_dslist.ds_type, &dst->rsp.m0.u.ct_dslist.ds_type);
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_segment, &dst->rsp.m0.u.ct_dslist.ds_segment);
- ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_base, &dst->rsp.m0.u.ct_dslist.ds_base);
- }
- } else if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) {
- ISP_IOXPUT_16(isp, src->rsp.m1._reserved, &dst->rsp.m1._reserved);
- ISP_IOXPUT_16(isp, src->rsp.m1._reserved2, &dst->rsp.m1._reserved2);
- ISP_IOXPUT_16(isp, src->rsp.m1.ct_senselen, &dst->rsp.m1.ct_senselen);
- ISP_IOXPUT_16(isp, src->rsp.m1.ct_scsi_status, &dst->rsp.m1.ct_scsi_status);
- ISP_IOXPUT_16(isp, src->rsp.m1.ct_resplen, &dst->rsp.m1.ct_resplen);
- for (i = 0; i < MAXRESPLEN; i++) {
- ISP_IOXPUT_8(isp, src->rsp.m1.ct_resp[i], &dst->rsp.m1.ct_resp[i]);
- }
- } else {
- ISP_IOXPUT_32(isp, src->rsp.m2._reserved, &dst->rsp.m2._reserved);
- ISP_IOXPUT_16(isp, src->rsp.m2._reserved2, &dst->rsp.m2._reserved2);
- ISP_IOXPUT_16(isp, src->rsp.m2._reserved3, &dst->rsp.m2._reserved3);
- ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen);
- if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
- ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base, &dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base);
- ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count, &dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count);
- } else {
- ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base);
- ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi);
- ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count);
- }
- }
-}
-
-void
isp_put_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
{
int i;
@@ -2758,7 +1813,7 @@ isp_put_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
ISP_IOXPUT_16(isp, src->rsp.m1.reserved, &dst->rsp.m1.reserved);
a = (uint32_t *) src->rsp.m1.ct_resp;
b = (uint32_t *) dst->rsp.m1.ct_resp;
- for (i = 0; i < (ASIZE(src->rsp.m1.ct_resp) >> 2); i++) {
+ for (i = 0; i < (nitems(src->rsp.m1.ct_resp) >> 2); i++) {
*b++ = ISP_SWAP32(isp, *a++);
}
} else {
@@ -2772,130 +1827,6 @@ isp_put_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
}
}
-
-void
-isp_get_ctio2(ispsoftc_t *isp, ct2_entry_t *src, ct2_entry_t *dst)
-{
- int i;
-
- isp_get_hdr(isp, &src->ct_header, &dst->ct_header);
- ISP_IOXGET_32(isp, &src->ct_syshandle, dst->ct_syshandle);
- ISP_IOXGET_8(isp, &src->ct_lun, dst->ct_lun);
- ISP_IOXGET_8(isp, &src->ct_iid, dst->ct_iid);
- ISP_IOXGET_16(isp, &src->ct_rxid, dst->ct_rxid);
- ISP_IOXGET_16(isp, &src->ct_flags, dst->ct_flags);
- ISP_IOXGET_16(isp, &src->ct_status, dst->ct_status);
- ISP_IOXGET_16(isp, &src->ct_timeout, dst->ct_timeout);
- ISP_IOXGET_16(isp, &src->ct_seg_count, dst->ct_seg_count);
- ISP_IOXGET_32(isp, &src->ct_reloff, dst->ct_reloff);
- ISP_IOXGET_32(isp, &src->ct_resid, dst->ct_resid);
- if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) {
- ISP_IOXGET_32(isp, &src->rsp.m0._reserved, dst->rsp.m0._reserved);
- ISP_IOXGET_16(isp, &src->rsp.m0._reserved2, dst->rsp.m0._reserved2);
- ISP_IOXGET_16(isp, &src->rsp.m0.ct_scsi_status, dst->rsp.m0.ct_scsi_status);
- ISP_IOXGET_32(isp, &src->rsp.m0.ct_xfrlen, dst->rsp.m0.ct_xfrlen);
- if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
- for (i = 0; i < ISP_RQDSEG_T2; i++) {
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_base, dst->rsp.m0.u.ct_dataseg[i].ds_base);
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_count, dst->rsp.m0.u.ct_dataseg[i].ds_count);
- }
- } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO3) {
- for (i = 0; i < ISP_RQDSEG_T3; i++) {
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_base, dst->rsp.m0.u.ct_dataseg64[i].ds_base);
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_basehi, dst->rsp.m0.u.ct_dataseg64[i].ds_basehi);
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_count, dst->rsp.m0.u.ct_dataseg64[i].ds_count);
- }
- } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO4) {
- ISP_IOXGET_16(isp, &src->rsp.m0.u.ct_dslist.ds_type, dst->rsp.m0.u.ct_dslist.ds_type);
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_segment, dst->rsp.m0.u.ct_dslist.ds_segment);
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_base, dst->rsp.m0.u.ct_dslist.ds_base);
- }
- } else if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) {
- ISP_IOXGET_16(isp, &src->rsp.m1._reserved, dst->rsp.m1._reserved);
- ISP_IOXGET_16(isp, &src->rsp.m1._reserved2, dst->rsp.m1._reserved2);
- ISP_IOXGET_16(isp, &src->rsp.m1.ct_senselen, dst->rsp.m1.ct_senselen);
- ISP_IOXGET_16(isp, &src->rsp.m1.ct_scsi_status, dst->rsp.m1.ct_scsi_status);
- ISP_IOXGET_16(isp, &src->rsp.m1.ct_resplen, dst->rsp.m1.ct_resplen);
- for (i = 0; i < MAXRESPLEN; i++) {
- ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]);
- }
- } else {
- ISP_IOXGET_32(isp, &src->rsp.m2._reserved, dst->rsp.m2._reserved);
- ISP_IOXGET_16(isp, &src->rsp.m2._reserved2, dst->rsp.m2._reserved2);
- ISP_IOXGET_16(isp, &src->rsp.m2._reserved3, dst->rsp.m2._reserved3);
- ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen);
- if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
- ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base, dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base);
- ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count, dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count);
- } else {
- ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base);
- ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi);
- ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count);
- }
- }
-}
-
-void
-isp_get_ctio2e(ispsoftc_t *isp, ct2e_entry_t *src, ct2e_entry_t *dst)
-{
- int i;
-
- isp_get_hdr(isp, &src->ct_header, &dst->ct_header);
- ISP_IOXGET_32(isp, &src->ct_syshandle, dst->ct_syshandle);
- ISP_IOXGET_16(isp, &src->ct_iid, dst->ct_iid);
- ISP_IOXGET_16(isp, &src->ct_rxid, dst->ct_rxid);
- ISP_IOXGET_16(isp, &src->ct_flags, dst->ct_flags);
- ISP_IOXGET_16(isp, &src->ct_status, dst->ct_status);
- ISP_IOXGET_16(isp, &src->ct_timeout, dst->ct_timeout);
- ISP_IOXGET_16(isp, &src->ct_seg_count, dst->ct_seg_count);
- ISP_IOXGET_32(isp, &src->ct_reloff, dst->ct_reloff);
- ISP_IOXGET_32(isp, &src->ct_resid, dst->ct_resid);
- if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) {
- ISP_IOXGET_32(isp, &src->rsp.m0._reserved, dst->rsp.m0._reserved);
- ISP_IOXGET_16(isp, &src->rsp.m0._reserved2, dst->rsp.m0._reserved2);
- ISP_IOXGET_16(isp, &src->rsp.m0.ct_scsi_status, dst->rsp.m0.ct_scsi_status);
- ISP_IOXGET_32(isp, &src->rsp.m0.ct_xfrlen, dst->rsp.m0.ct_xfrlen);
- if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
- for (i = 0; i < ISP_RQDSEG_T2; i++) {
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_base, dst->rsp.m0.u.ct_dataseg[i].ds_base);
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_count, dst->rsp.m0.u.ct_dataseg[i].ds_count);
- }
- } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO3) {
- for (i = 0; i < ISP_RQDSEG_T3; i++) {
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_base, dst->rsp.m0.u.ct_dataseg64[i].ds_base);
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_basehi, dst->rsp.m0.u.ct_dataseg64[i].ds_basehi);
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_count, dst->rsp.m0.u.ct_dataseg64[i].ds_count);
- }
- } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO4) {
- ISP_IOXGET_16(isp, &src->rsp.m0.u.ct_dslist.ds_type, dst->rsp.m0.u.ct_dslist.ds_type);
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_segment, dst->rsp.m0.u.ct_dslist.ds_segment);
- ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_base, dst->rsp.m0.u.ct_dslist.ds_base);
- }
- } else if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) {
- ISP_IOXGET_16(isp, &src->rsp.m1._reserved, dst->rsp.m1._reserved);
- ISP_IOXGET_16(isp, &src->rsp.m1._reserved2, dst->rsp.m1._reserved2);
- ISP_IOXGET_16(isp, &src->rsp.m1.ct_senselen, dst->rsp.m1.ct_senselen);
- ISP_IOXGET_16(isp, &src->rsp.m1.ct_scsi_status, dst->rsp.m1.ct_scsi_status);
- ISP_IOXGET_16(isp, &src->rsp.m1.ct_resplen, dst->rsp.m1.ct_resplen);
- for (i = 0; i < MAXRESPLEN; i++) {
- ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]);
- }
- } else {
- ISP_IOXGET_32(isp, &src->rsp.m2._reserved, dst->rsp.m2._reserved);
- ISP_IOXGET_16(isp, &src->rsp.m2._reserved2, dst->rsp.m2._reserved2);
- ISP_IOXGET_16(isp, &src->rsp.m2._reserved3, dst->rsp.m2._reserved3);
- ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen);
- if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
- ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base, dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base);
- ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count, dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count);
- } else {
- ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base);
- ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi);
- ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count);
- }
- }
-}
-
void
isp_get_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
{
@@ -2935,7 +1866,7 @@ isp_get_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
for (i = 0; i < MAXRESPLEN_24XX; i++) {
ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]);
}
- for (i = 0; i < (ASIZE(src->rsp.m1.ct_resp) >> 2); i++) {
+ for (i = 0; i < (nitems(src->rsp.m1.ct_resp) >> 2); i++) {
*b++ = ISP_SWAP32(isp, *a++);
}
} else {
@@ -2949,33 +1880,6 @@ isp_get_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
}
void
-isp_put_notify_fc(ispsoftc_t *isp, in_fcentry_t *src, in_fcentry_t *dst)
-{
- isp_put_hdr(isp, &src->in_header, &dst->in_header);
- ISP_IOXPUT_32(isp, src->in_reserved, &dst->in_reserved);
- ISP_IOXPUT_8(isp, src->in_lun, &dst->in_lun);
- ISP_IOXPUT_8(isp, src->in_iid, &dst->in_iid);
- ISP_IOXPUT_16(isp, src->in_scclun, &dst->in_scclun);
- ISP_IOXPUT_32(isp, src->in_reserved2, &dst->in_reserved2);
- ISP_IOXPUT_16(isp, src->in_status, &dst->in_status);
- ISP_IOXPUT_16(isp, src->in_task_flags, &dst->in_task_flags);
- ISP_IOXPUT_16(isp, src->in_seqid, &dst->in_seqid);
-}
-
-void
-isp_put_notify_fc_e(ispsoftc_t *isp, in_fcentry_e_t *src, in_fcentry_e_t *dst)
-{
- isp_put_hdr(isp, &src->in_header, &dst->in_header);
- ISP_IOXPUT_32(isp, src->in_reserved, &dst->in_reserved);
- ISP_IOXPUT_16(isp, src->in_iid, &dst->in_iid);
- ISP_IOXPUT_16(isp, src->in_scclun, &dst->in_scclun);
- ISP_IOXPUT_32(isp, src->in_reserved2, &dst->in_reserved2);
- ISP_IOXPUT_16(isp, src->in_status, &dst->in_status);
- ISP_IOXPUT_16(isp, src->in_task_flags, &dst->in_task_flags);
- ISP_IOXPUT_16(isp, src->in_seqid, &dst->in_seqid);
-}
-
-void
isp_put_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *src, in_fcentry_24xx_t *dst)
{
int i;
@@ -2998,7 +1902,7 @@ isp_put_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *src, in_fcentry_24xx_t *
ISP_IOXPUT_8(isp, src->in_nport_id_lo, &dst->in_nport_id_lo);
ISP_IOXPUT_8(isp, src->in_reserved3, &dst->in_reserved3);
ISP_IOXPUT_16(isp, src->in_np_handle, &dst->in_np_handle);
- for (i = 0; i < ASIZE(src->in_reserved4); i++) {
+ for (i = 0; i < nitems(src->in_reserved4); i++) {
ISP_IOXPUT_8(isp, src->in_reserved4[i], &dst->in_reserved4[i]);
}
ISP_IOXPUT_8(isp, src->in_reserved5, &dst->in_reserved5);
@@ -3012,33 +1916,6 @@ isp_put_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *src, in_fcentry_24xx_t *
}
void
-isp_get_notify_fc(ispsoftc_t *isp, in_fcentry_t *src, in_fcentry_t *dst)
-{
- isp_get_hdr(isp, &src->in_header, &dst->in_header);
- ISP_IOXGET_32(isp, &src->in_reserved, dst->in_reserved);
- ISP_IOXGET_8(isp, &src->in_lun, dst->in_lun);
- ISP_IOXGET_8(isp, &src->in_iid, dst->in_iid);
- ISP_IOXGET_16(isp, &src->in_scclun, dst->in_scclun);
- ISP_IOXGET_32(isp, &src->in_reserved2, dst->in_reserved2);
- ISP_IOXGET_16(isp, &src->in_status, dst->in_status);
- ISP_IOXGET_16(isp, &src->in_task_flags, dst->in_task_flags);
- ISP_IOXGET_16(isp, &src->in_seqid, dst->in_seqid);
-}
-
-void
-isp_get_notify_fc_e(ispsoftc_t *isp, in_fcentry_e_t *src, in_fcentry_e_t *dst)
-{
- isp_get_hdr(isp, &src->in_header, &dst->in_header);
- ISP_IOXGET_32(isp, &src->in_reserved, dst->in_reserved);
- ISP_IOXGET_16(isp, &src->in_iid, dst->in_iid);
- ISP_IOXGET_16(isp, &src->in_scclun, dst->in_scclun);
- ISP_IOXGET_32(isp, &src->in_reserved2, dst->in_reserved2);
- ISP_IOXGET_16(isp, &src->in_status, dst->in_status);
- ISP_IOXGET_16(isp, &src->in_task_flags, dst->in_task_flags);
- ISP_IOXGET_16(isp, &src->in_seqid, dst->in_seqid);
-}
-
-void
isp_get_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *src, in_fcentry_24xx_t *dst)
{
int i;
@@ -3061,7 +1938,7 @@ isp_get_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *src, in_fcentry_24xx_t *
ISP_IOXGET_8(isp, &src->in_nport_id_lo, dst->in_nport_id_lo);
ISP_IOXGET_8(isp, &src->in_reserved3, dst->in_reserved3);
ISP_IOXGET_16(isp, &src->in_np_handle, dst->in_np_handle);
- for (i = 0; i < ASIZE(src->in_reserved4); i++) {
+ for (i = 0; i < nitems(src->in_reserved4); i++) {
ISP_IOXGET_8(isp, &src->in_reserved4[i], dst->in_reserved4[i]);
}
ISP_IOXGET_8(isp, &src->in_reserved5, dst->in_reserved5);
@@ -3075,44 +1952,7 @@ isp_get_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *src, in_fcentry_24xx_t *
}
void
-isp_put_notify_ack_fc(ispsoftc_t *isp, na_fcentry_t *src, na_fcentry_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->na_header, &dst->na_header);
- ISP_IOXPUT_32(isp, src->na_reserved, &dst->na_reserved);
- ISP_IOXPUT_8(isp, src->na_reserved1, &dst->na_reserved1);
- ISP_IOXPUT_8(isp, src->na_iid, &dst->na_iid);
- ISP_IOXPUT_16(isp, src->na_response, &dst->na_response);
- ISP_IOXPUT_16(isp, src->na_flags, &dst->na_flags);
- ISP_IOXPUT_16(isp, src->na_reserved2, &dst->na_reserved2);
- ISP_IOXPUT_16(isp, src->na_status, &dst->na_status);
- ISP_IOXPUT_16(isp, src->na_task_flags, &dst->na_task_flags);
- ISP_IOXPUT_16(isp, src->na_seqid, &dst->na_seqid);
- for (i = 0; i < NA2_RSVDLEN; i++) {
- ISP_IOXPUT_16(isp, src->na_reserved3[i], &dst->na_reserved3[i]);
- }
-}
-
-void
-isp_put_notify_ack_fc_e(ispsoftc_t *isp, na_fcentry_e_t *src, na_fcentry_e_t *dst)
-{
- int i;
- isp_put_hdr(isp, &src->na_header, &dst->na_header);
- ISP_IOXPUT_32(isp, src->na_reserved, &dst->na_reserved);
- ISP_IOXPUT_16(isp, src->na_iid, &dst->na_iid);
- ISP_IOXPUT_16(isp, src->na_response, &dst->na_response);
- ISP_IOXPUT_16(isp, src->na_flags, &dst->na_flags);
- ISP_IOXPUT_16(isp, src->na_reserved2, &dst->na_reserved2);
- ISP_IOXPUT_16(isp, src->na_status, &dst->na_status);
- ISP_IOXPUT_16(isp, src->na_task_flags, &dst->na_task_flags);
- ISP_IOXPUT_16(isp, src->na_seqid, &dst->na_seqid);
- for (i = 0; i < NA2_RSVDLEN; i++) {
- ISP_IOXPUT_16(isp, src->na_reserved3[i], &dst->na_reserved3[i]);
- }
-}
-
-void
-isp_put_notify_24xx_ack(ispsoftc_t *isp, na_fcentry_24xx_t *src, na_fcentry_24xx_t *dst)
+isp_put_notify_ack_24xx(ispsoftc_t *isp, na_fcentry_24xx_t *src, na_fcentry_24xx_t *dst)
{
int i;
@@ -3146,43 +1986,6 @@ isp_put_notify_24xx_ack(ispsoftc_t *isp, na_fcentry_24xx_t *src, na_fcentry_24xx
}
void
-isp_get_notify_ack_fc(ispsoftc_t *isp, na_fcentry_t *src, na_fcentry_t *dst)
-{
- int i;
- isp_get_hdr(isp, &src->na_header, &dst->na_header);
- ISP_IOXGET_32(isp, &src->na_reserved, dst->na_reserved);
- ISP_IOXGET_8(isp, &src->na_reserved1, dst->na_reserved1);
- ISP_IOXGET_8(isp, &src->na_iid, dst->na_iid);
- ISP_IOXGET_16(isp, &src->na_response, dst->na_response);
- ISP_IOXGET_16(isp, &src->na_flags, dst->na_flags);
- ISP_IOXGET_16(isp, &src->na_reserved2, dst->na_reserved2);
- ISP_IOXGET_16(isp, &src->na_status, dst->na_status);
- ISP_IOXGET_16(isp, &src->na_task_flags, dst->na_task_flags);
- ISP_IOXGET_16(isp, &src->na_seqid, dst->na_seqid);
- for (i = 0; i < NA2_RSVDLEN; i++) {
- ISP_IOXGET_16(isp, &src->na_reserved3[i], dst->na_reserved3[i]);
- }
-}
-
-void
-isp_get_notify_ack_fc_e(ispsoftc_t *isp, na_fcentry_e_t *src, na_fcentry_e_t *dst)
-{
- int i;
- isp_get_hdr(isp, &src->na_header, &dst->na_header);
- ISP_IOXGET_32(isp, &src->na_reserved, dst->na_reserved);
- ISP_IOXGET_16(isp, &src->na_iid, dst->na_iid);
- ISP_IOXGET_16(isp, &src->na_response, dst->na_response);
- ISP_IOXGET_16(isp, &src->na_flags, dst->na_flags);
- ISP_IOXGET_16(isp, &src->na_reserved2, dst->na_reserved2);
- ISP_IOXGET_16(isp, &src->na_status, dst->na_status);
- ISP_IOXGET_16(isp, &src->na_task_flags, dst->na_task_flags);
- ISP_IOXGET_16(isp, &src->na_seqid, dst->na_seqid);
- for (i = 0; i < NA2_RSVDLEN; i++) {
- ISP_IOXGET_16(isp, &src->na_reserved3[i], dst->na_reserved3[i]);
- }
-}
-
-void
isp_get_notify_ack_24xx(ispsoftc_t *isp, na_fcentry_24xx_t *src, na_fcentry_24xx_t *dst)
{
int i;
diff --git a/sys/dev/isp/isp_library.h b/sys/dev/isp/isp_library.h
index 6e8d8153af51..10098648777f 100644
--- a/sys/dev/isp/isp_library.h
+++ b/sys/dev/isp/isp_library.h
@@ -2,7 +2,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * Copyright (c) 2009-2017 Alexander Motin <mav@FreeBSD.org>
+ * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
*
@@ -87,26 +87,14 @@ void isp_clear_commands(ispsoftc_t *);
void isp_put_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
void isp_get_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
int isp_get_response_type(ispsoftc_t *, isphdr_t *);
-void isp_put_request(ispsoftc_t *, ispreq_t *, ispreq_t *);
-void isp_put_marker(ispsoftc_t *, isp_marker_t *, isp_marker_t *);
void isp_put_marker_24xx(ispsoftc_t *, isp_marker_24xx_t *, isp_marker_24xx_t *);
-void isp_put_request_t2(ispsoftc_t *, ispreqt2_t *, ispreqt2_t *);
-void isp_put_request_t2e(ispsoftc_t *, ispreqt2e_t *, ispreqt2e_t *);
-void isp_put_request_t3(ispsoftc_t *, ispreqt3_t *, ispreqt3_t *);
-void isp_put_request_t3e(ispsoftc_t *, ispreqt3e_t *, ispreqt3e_t *);
-void isp_put_extended_request(ispsoftc_t *, ispextreq_t *, ispextreq_t *);
void isp_put_request_t7(ispsoftc_t *, ispreqt7_t *, ispreqt7_t *);
void isp_put_24xx_tmf(ispsoftc_t *, isp24xx_tmf_t *, isp24xx_tmf_t *);
void isp_put_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *);
-void isp_put_cont_req(ispsoftc_t *, ispcontreq_t *, ispcontreq_t *);
void isp_put_cont64_req(ispsoftc_t *, ispcontreq64_t *, ispcontreq64_t *);
-void isp_get_response(ispsoftc_t *, ispstatusreq_t *, ispstatusreq_t *);
void isp_get_cont_response(ispsoftc_t *, ispstatus_cont_t *, ispstatus_cont_t *);
void isp_get_24xx_response(ispsoftc_t *, isp24xx_statusreq_t *, isp24xx_statusreq_t *);
void isp_get_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *);
-void isp_get_rio1(ispsoftc_t *, isp_rio1_t *, isp_rio1_t *);
-void isp_get_rio2(ispsoftc_t *, isp_rio2_t *, isp_rio2_t *);
-void isp_put_icb(ispsoftc_t *, isp_icb_t *, isp_icb_t *);
void isp_put_icb_2400(ispsoftc_t *, isp_icb_2400_t *, isp_icb_2400_t *);
void isp_put_icb_2400_vpinfo(ispsoftc_t *, isp_icb_2400_vpinfo_t *, isp_icb_2400_vpinfo_t *);
void isp_put_vp_port_info(ispsoftc_t *, vp_port_info_t *, vp_port_info_t *);
@@ -115,30 +103,19 @@ void isp_put_vp_ctrl_info(ispsoftc_t *, vp_ctrl_info_t *, vp_ctrl_info_t *);
void isp_get_vp_ctrl_info(ispsoftc_t *, vp_ctrl_info_t *, vp_ctrl_info_t *);
void isp_put_vp_modify(ispsoftc_t *, vp_modify_t *, vp_modify_t *);
void isp_get_vp_modify(ispsoftc_t *, vp_modify_t *, vp_modify_t *);
-void isp_get_pdb_21xx(ispsoftc_t *, isp_pdb_21xx_t *, isp_pdb_21xx_t *);
void isp_get_pdb_24xx(ispsoftc_t *, isp_pdb_24xx_t *, isp_pdb_24xx_t *);
-void isp_get_pnhle_21xx(ispsoftc_t *, isp_pnhle_21xx_t *, isp_pnhle_21xx_t *);
-void isp_get_pnhle_23xx(ispsoftc_t *, isp_pnhle_23xx_t *, isp_pnhle_23xx_t *);
void isp_get_pnhle_24xx(ispsoftc_t *, isp_pnhle_24xx_t *, isp_pnhle_24xx_t *);
-void isp_get_pnnle(ispsoftc_t *, isp_pnnle_t *, isp_pnnle_t *);
void isp_get_ridacq(ispsoftc_t *, isp_ridacq_t *, isp_ridacq_t *);
void isp_get_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *);
void isp_put_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *);
void isp_get_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
-void isp_get_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *);
void isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
-void isp_put_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *);
-void isp_put_sns_request(ispsoftc_t *, sns_screq_t *, sns_screq_t *);
void isp_put_gid_ft_request(ispsoftc_t *, sns_gid_ft_req_t *, sns_gid_ft_req_t *);
-void isp_put_gid_pt_request(ispsoftc_t *, sns_gid_pt_req_t *, sns_gid_pt_req_t *);
-void isp_put_gxx_id_request(ispsoftc_t *, sns_gxx_id_req_t *, sns_gxx_id_req_t *);
void isp_get_gid_xx_response(ispsoftc_t *, sns_gid_xx_rsp_t *, sns_gid_xx_rsp_t *, int);
void isp_get_gxn_id_response(ispsoftc_t *, sns_gxn_id_rsp_t *, sns_gxn_id_rsp_t *);
void isp_get_gft_id_response(ispsoftc_t *, sns_gft_id_rsp_t *, sns_gft_id_rsp_t *);
void isp_get_gff_id_response(ispsoftc_t *, sns_gff_id_rsp_t *, sns_gff_id_rsp_t *);
void isp_get_ga_nxt_response(ispsoftc_t *, sns_ga_nxt_rsp_t *, sns_ga_nxt_rsp_t *);
-void isp_get_els(ispsoftc_t *, els_t *, els_t *);
-void isp_put_els(ispsoftc_t *, els_t *, els_t *);
void isp_get_fc_hdr(ispsoftc_t *, fc_hdr_t *, fc_hdr_t *);
void isp_put_fc_hdr(ispsoftc_t *, fc_hdr_t *, fc_hdr_t *);
void isp_get_fcp_cmnd_iu(ispsoftc_t *, fcp_cmnd_iu_t *, fcp_cmnd_iu_t *);
@@ -173,29 +150,12 @@ void isp_del_wwn_entry(ispsoftc_t *, int, uint64_t, uint16_t, uint32_t);
void isp_del_all_wwn_entries(ispsoftc_t *, int);
void isp_del_wwn_entries(ispsoftc_t *, isp_notify_t *);
-void isp_put_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
-void isp_put_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
-void isp_get_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
-void isp_get_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
void isp_get_atio7(ispsoftc_t *isp, at7_entry_t *, at7_entry_t *);
-void isp_put_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *);
-void isp_put_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
void isp_put_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
-void isp_get_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *);
-void isp_get_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
void isp_get_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
-void isp_put_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
-void isp_put_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
void isp_put_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
-void isp_get_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
-void isp_get_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
void isp_get_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
-void isp_put_notify_24xx_ack(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *);
-void isp_put_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *);
-void isp_put_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *);
void isp_put_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *);
-void isp_get_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *);
-void isp_get_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *);
void isp_get_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *);
void isp_get_abts(ispsoftc_t *, abts_t *, abts_t *);
void isp_put_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *);
diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c
index 381881d55bac..a1f84341cd21 100644
--- a/sys/dev/isp/isp_pci.c
+++ b/sys/dev/isp/isp_pci.c
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * Copyright (c) 2009-2018 Alexander Motin <mav@FreeBSD.org>
+ * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
* Copyright (c) 1997-2008 by Matthew Jacob
* All rights reserved.
*
@@ -50,94 +50,15 @@ __FBSDID("$FreeBSD$");
#include <sys/uio.h>
#include <dev/isp/isp_freebsd.h>
-static uint32_t isp_pci_rd_reg(ispsoftc_t *, int);
-static void isp_pci_wr_reg(ispsoftc_t *, int, uint32_t);
-static uint32_t isp_pci_rd_reg_1080(ispsoftc_t *, int);
-static void isp_pci_wr_reg_1080(ispsoftc_t *, int, uint32_t);
static uint32_t isp_pci_rd_reg_2400(ispsoftc_t *, int);
static void isp_pci_wr_reg_2400(ispsoftc_t *, int, uint32_t);
static uint32_t isp_pci_rd_reg_2600(ispsoftc_t *, int);
static void isp_pci_wr_reg_2600(ispsoftc_t *, int, uint32_t);
-static void isp_pci_run_isr(ispsoftc_t *);
-static void isp_pci_run_isr_2300(ispsoftc_t *);
static void isp_pci_run_isr_2400(ispsoftc_t *);
static int isp_pci_mbxdma(ispsoftc_t *);
static void isp_pci_mbxdmafree(ispsoftc_t *);
static int isp_pci_dmasetup(ispsoftc_t *, XS_T *, void *);
static int isp_pci_irqsetup(ispsoftc_t *);
-static void isp_pci_dumpregs(ispsoftc_t *, const char *);
-
-static struct ispmdvec mdvec = {
- isp_pci_run_isr,
- isp_pci_rd_reg,
- isp_pci_wr_reg,
- isp_pci_mbxdma,
- isp_pci_dmasetup,
- isp_common_dmateardown,
- isp_pci_irqsetup,
- isp_pci_dumpregs,
- NULL,
- BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64
-};
-
-static struct ispmdvec mdvec_1080 = {
- isp_pci_run_isr,
- isp_pci_rd_reg_1080,
- isp_pci_wr_reg_1080,
- isp_pci_mbxdma,
- isp_pci_dmasetup,
- isp_common_dmateardown,
- isp_pci_irqsetup,
- isp_pci_dumpregs,
- NULL,
- BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64
-};
-
-static struct ispmdvec mdvec_12160 = {
- isp_pci_run_isr,
- isp_pci_rd_reg_1080,
- isp_pci_wr_reg_1080,
- isp_pci_mbxdma,
- isp_pci_dmasetup,
- isp_common_dmateardown,
- isp_pci_irqsetup,
- isp_pci_dumpregs,
- NULL,
- BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64
-};
-
-static struct ispmdvec mdvec_2100 = {
- isp_pci_run_isr,
- isp_pci_rd_reg,
- isp_pci_wr_reg,
- isp_pci_mbxdma,
- isp_pci_dmasetup,
- isp_common_dmateardown,
- isp_pci_irqsetup,
- isp_pci_dumpregs
-};
-
-static struct ispmdvec mdvec_2200 = {
- isp_pci_run_isr,
- isp_pci_rd_reg,
- isp_pci_wr_reg,
- isp_pci_mbxdma,
- isp_pci_dmasetup,
- isp_common_dmateardown,
- isp_pci_irqsetup,
- isp_pci_dumpregs
-};
-
-static struct ispmdvec mdvec_2300 = {
- isp_pci_run_isr_2300,
- isp_pci_rd_reg,
- isp_pci_wr_reg,
- isp_pci_mbxdma,
- isp_pci_dmasetup,
- isp_common_dmateardown,
- isp_pci_irqsetup,
- isp_pci_dumpregs
-};
static struct ispmdvec mdvec_2400 = {
isp_pci_run_isr_2400,
@@ -217,24 +138,10 @@ static struct ispmdvec mdvec_2700 = {
#define PCI_VENDOR_QLOGIC 0x1077
-#define PCI_PRODUCT_QLOGIC_ISP1020 0x1020
-#define PCI_PRODUCT_QLOGIC_ISP1080 0x1080
-#define PCI_PRODUCT_QLOGIC_ISP10160 0x1016
-#define PCI_PRODUCT_QLOGIC_ISP12160 0x1216
-#define PCI_PRODUCT_QLOGIC_ISP1240 0x1240
-#define PCI_PRODUCT_QLOGIC_ISP1280 0x1280
-
-#define PCI_PRODUCT_QLOGIC_ISP2100 0x2100
-#define PCI_PRODUCT_QLOGIC_ISP2200 0x2200
-#define PCI_PRODUCT_QLOGIC_ISP2300 0x2300
-#define PCI_PRODUCT_QLOGIC_ISP2312 0x2312
-#define PCI_PRODUCT_QLOGIC_ISP2322 0x2322
#define PCI_PRODUCT_QLOGIC_ISP2422 0x2422
#define PCI_PRODUCT_QLOGIC_ISP2432 0x2432
#define PCI_PRODUCT_QLOGIC_ISP2532 0x2532
#define PCI_PRODUCT_QLOGIC_ISP5432 0x5432
-#define PCI_PRODUCT_QLOGIC_ISP6312 0x6312
-#define PCI_PRODUCT_QLOGIC_ISP6322 0x6322
#define PCI_PRODUCT_QLOGIC_ISP2031 0x2031
#define PCI_PRODUCT_QLOGIC_ISP8031 0x8031
#define PCI_PRODUCT_QLOGIC_ISP2684 0x2171
@@ -242,29 +149,6 @@ static struct ispmdvec mdvec_2700 = {
#define PCI_PRODUCT_QLOGIC_ISP2714 0x2071
#define PCI_PRODUCT_QLOGIC_ISP2722 0x2261
-#define PCI_QLOGIC_ISP1020 \
- ((PCI_PRODUCT_QLOGIC_ISP1020 << 16) | PCI_VENDOR_QLOGIC)
-#define PCI_QLOGIC_ISP1080 \
- ((PCI_PRODUCT_QLOGIC_ISP1080 << 16) | PCI_VENDOR_QLOGIC)
-#define PCI_QLOGIC_ISP10160 \
- ((PCI_PRODUCT_QLOGIC_ISP10160 << 16) | PCI_VENDOR_QLOGIC)
-#define PCI_QLOGIC_ISP12160 \
- ((PCI_PRODUCT_QLOGIC_ISP12160 << 16) | PCI_VENDOR_QLOGIC)
-#define PCI_QLOGIC_ISP1240 \
- ((PCI_PRODUCT_QLOGIC_ISP1240 << 16) | PCI_VENDOR_QLOGIC)
-#define PCI_QLOGIC_ISP1280 \
- ((PCI_PRODUCT_QLOGIC_ISP1280 << 16) | PCI_VENDOR_QLOGIC)
-
-#define PCI_QLOGIC_ISP2100 \
- ((PCI_PRODUCT_QLOGIC_ISP2100 << 16) | PCI_VENDOR_QLOGIC)
-#define PCI_QLOGIC_ISP2200 \
- ((PCI_PRODUCT_QLOGIC_ISP2200 << 16) | PCI_VENDOR_QLOGIC)
-#define PCI_QLOGIC_ISP2300 \
- ((PCI_PRODUCT_QLOGIC_ISP2300 << 16) | PCI_VENDOR_QLOGIC)
-#define PCI_QLOGIC_ISP2312 \
- ((PCI_PRODUCT_QLOGIC_ISP2312 << 16) | PCI_VENDOR_QLOGIC)
-#define PCI_QLOGIC_ISP2322 \
- ((PCI_PRODUCT_QLOGIC_ISP2322 << 16) | PCI_VENDOR_QLOGIC)
#define PCI_QLOGIC_ISP2422 \
((PCI_PRODUCT_QLOGIC_ISP2422 << 16) | PCI_VENDOR_QLOGIC)
#define PCI_QLOGIC_ISP2432 \
@@ -273,10 +157,6 @@ static struct ispmdvec mdvec_2700 = {
((PCI_PRODUCT_QLOGIC_ISP2532 << 16) | PCI_VENDOR_QLOGIC)
#define PCI_QLOGIC_ISP5432 \
((PCI_PRODUCT_QLOGIC_ISP5432 << 16) | PCI_VENDOR_QLOGIC)
-#define PCI_QLOGIC_ISP6312 \
- ((PCI_PRODUCT_QLOGIC_ISP6312 << 16) | PCI_VENDOR_QLOGIC)
-#define PCI_QLOGIC_ISP6322 \
- ((PCI_PRODUCT_QLOGIC_ISP6322 << 16) | PCI_VENDOR_QLOGIC)
#define PCI_QLOGIC_ISP2031 \
((PCI_PRODUCT_QLOGIC_ISP2031 << 16) | PCI_VENDOR_QLOGIC)
#define PCI_QLOGIC_ISP8031 \
@@ -290,11 +170,6 @@ static struct ispmdvec mdvec_2700 = {
#define PCI_QLOGIC_ISP2722 \
((PCI_PRODUCT_QLOGIC_ISP2722 << 16) | PCI_VENDOR_QLOGIC)
-/*
- * Odd case for some AMI raid cards... We need to *not* attach to this.
- */
-#define AMI_RAID_SUBVENDOR_ID 0x101e
-
#define PCI_DFLT_LTNCY 0x40
#define PCI_DFLT_LNSZ 0x10
@@ -321,7 +196,6 @@ struct isp_pcisoftc {
int rgd1;
int rtp2;
int rgd2;
- int16_t pci_poff[_NREG_BLKS];
bus_dma_tag_t dmat;
int msicount;
};
@@ -348,42 +222,6 @@ static int
isp_pci_probe(device_t dev)
{
switch ((pci_get_device(dev) << 16) | (pci_get_vendor(dev))) {
- case PCI_QLOGIC_ISP1020:
- device_set_desc(dev, "Qlogic ISP 1020/1040 PCI SCSI Adapter");
- break;
- case PCI_QLOGIC_ISP1080:
- device_set_desc(dev, "Qlogic ISP 1080 PCI SCSI Adapter");
- break;
- case PCI_QLOGIC_ISP1240:
- device_set_desc(dev, "Qlogic ISP 1240 PCI SCSI Adapter");
- break;
- case PCI_QLOGIC_ISP1280:
- device_set_desc(dev, "Qlogic ISP 1280 PCI SCSI Adapter");
- break;
- case PCI_QLOGIC_ISP10160:
- device_set_desc(dev, "Qlogic ISP 10160 PCI SCSI Adapter");
- break;
- case PCI_QLOGIC_ISP12160:
- if (pci_get_subvendor(dev) == AMI_RAID_SUBVENDOR_ID) {
- return (ENXIO);
- }
- device_set_desc(dev, "Qlogic ISP 12160 PCI SCSI Adapter");
- break;
- case PCI_QLOGIC_ISP2100:
- device_set_desc(dev, "Qlogic ISP 2100 PCI FC-AL Adapter");
- break;
- case PCI_QLOGIC_ISP2200:
- device_set_desc(dev, "Qlogic ISP 2200 PCI FC-AL Adapter");
- break;
- case PCI_QLOGIC_ISP2300:
- device_set_desc(dev, "Qlogic ISP 2300 PCI FC-AL Adapter");
- break;
- case PCI_QLOGIC_ISP2312:
- device_set_desc(dev, "Qlogic ISP 2312 PCI FC-AL Adapter");
- break;
- case PCI_QLOGIC_ISP2322:
- device_set_desc(dev, "Qlogic ISP 2322 PCI FC-AL Adapter");
- break;
case PCI_QLOGIC_ISP2422:
device_set_desc(dev, "Qlogic ISP 2422 PCI FC-AL Adapter");
break;
@@ -396,12 +234,6 @@ isp_pci_probe(device_t dev)
case PCI_QLOGIC_ISP5432:
device_set_desc(dev, "Qlogic ISP 5432 PCI FC-AL Adapter");
break;
- case PCI_QLOGIC_ISP6312:
- device_set_desc(dev, "Qlogic ISP 6312 PCI FC-AL Adapter");
- break;
- case PCI_QLOGIC_ISP6322:
- device_set_desc(dev, "Qlogic ISP 6322 PCI FC-AL Adapter");
- break;
case PCI_QLOGIC_ISP2031:
device_set_desc(dev, "Qlogic ISP 2031 PCI FC-AL Adapter");
break;
@@ -484,23 +316,12 @@ isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp)
snprintf(name, sizeof(name), "%siid", prefix);
if (resource_int_value(device_get_name(dev), device_get_unit(dev),
name, &tval)) {
- if (IS_FC(isp)) {
- ISP_FC_PC(isp, chan)->default_id = 109 - chan;
- } else {
- ISP_SPI_PC(isp, chan)->iid = 7;
- }
+ ISP_FC_PC(isp, chan)->default_id = 109 - chan;
} else {
- if (IS_FC(isp)) {
- ISP_FC_PC(isp, chan)->default_id = tval - chan;
- } else {
- ISP_SPI_PC(isp, chan)->iid = tval;
- }
+ ISP_FC_PC(isp, chan)->default_id = tval - chan;
isp->isp_confopts |= ISP_CFG_OWNLOOPID;
}
- if (IS_SCSI(isp))
- return;
-
tval = -1;
snprintf(name, sizeof(name), "%srole", prefix);
if (resource_int_value(device_get_name(dev), device_get_unit(dev),
@@ -649,129 +470,37 @@ isp_pci_attach(device_t dev)
pcs->rgd = pcs->rtp = 0;
pcs->pci_dev = dev;
- pcs->pci_poff[BIU_BLOCK >> _BLK_REG_SHFT] = BIU_REGS_OFF;
- pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS_OFF;
- pcs->pci_poff[SXP_BLOCK >> _BLK_REG_SHFT] = PCI_SXP_REGS_OFF;
- pcs->pci_poff[RISC_BLOCK >> _BLK_REG_SHFT] = PCI_RISC_REGS_OFF;
- pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = DMA_REGS_OFF;
-
+ isp->isp_nchan += isp_nvports;
switch (pci_get_devid(dev)) {
- case PCI_QLOGIC_ISP1020:
- did = 0x1040;
- isp->isp_mdvec = &mdvec;
- isp->isp_type = ISP_HA_SCSI_UNKNOWN;
- break;
- case PCI_QLOGIC_ISP1080:
- did = 0x1080;
- isp->isp_mdvec = &mdvec_1080;
- isp->isp_type = ISP_HA_SCSI_1080;
- pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = ISP1080_DMA_REGS_OFF;
- break;
- case PCI_QLOGIC_ISP1240:
- did = 0x1080;
- isp->isp_mdvec = &mdvec_1080;
- isp->isp_type = ISP_HA_SCSI_1240;
- isp->isp_nchan = 2;
- pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = ISP1080_DMA_REGS_OFF;
- break;
- case PCI_QLOGIC_ISP1280:
- did = 0x1080;
- isp->isp_mdvec = &mdvec_1080;
- isp->isp_type = ISP_HA_SCSI_1280;
- pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = ISP1080_DMA_REGS_OFF;
- break;
- case PCI_QLOGIC_ISP10160:
- did = 0x12160;
- isp->isp_mdvec = &mdvec_12160;
- isp->isp_type = ISP_HA_SCSI_10160;
- pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = ISP1080_DMA_REGS_OFF;
- break;
- case PCI_QLOGIC_ISP12160:
- did = 0x12160;
- isp->isp_nchan = 2;
- isp->isp_mdvec = &mdvec_12160;
- isp->isp_type = ISP_HA_SCSI_12160;
- pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = ISP1080_DMA_REGS_OFF;
- break;
- case PCI_QLOGIC_ISP2100:
- did = 0x2100;
- isp->isp_mdvec = &mdvec_2100;
- isp->isp_type = ISP_HA_FC_2100;
- pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2100_OFF;
- if (pci_get_revid(dev) < 3) {
- /*
- * XXX: Need to get the actual revision
- * XXX: number of the 2100 FB. At any rate,
- * XXX: lower cache line size for early revision
- * XXX; boards.
- */
- linesz = 1;
- }
- break;
- case PCI_QLOGIC_ISP2200:
- did = 0x2200;
- isp->isp_mdvec = &mdvec_2200;
- isp->isp_type = ISP_HA_FC_2200;
- pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2100_OFF;
- break;
- case PCI_QLOGIC_ISP2300:
- did = 0x2300;
- isp->isp_mdvec = &mdvec_2300;
- isp->isp_type = ISP_HA_FC_2300;
- pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2300_OFF;
- break;
- case PCI_QLOGIC_ISP2312:
- case PCI_QLOGIC_ISP6312:
- did = 0x2300;
- isp->isp_mdvec = &mdvec_2300;
- isp->isp_type = ISP_HA_FC_2312;
- pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2300_OFF;
- break;
- case PCI_QLOGIC_ISP2322:
- case PCI_QLOGIC_ISP6322:
- did = 0x2322;
- isp->isp_mdvec = &mdvec_2300;
- isp->isp_type = ISP_HA_FC_2322;
- pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2300_OFF;
- break;
case PCI_QLOGIC_ISP2422:
case PCI_QLOGIC_ISP2432:
did = 0x2400;
- isp->isp_nchan += isp_nvports;
isp->isp_mdvec = &mdvec_2400;
isp->isp_type = ISP_HA_FC_2400;
- pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2400_OFF;
break;
case PCI_QLOGIC_ISP2532:
did = 0x2500;
- isp->isp_nchan += isp_nvports;
isp->isp_mdvec = &mdvec_2500;
isp->isp_type = ISP_HA_FC_2500;
- pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2400_OFF;
break;
case PCI_QLOGIC_ISP5432:
did = 0x2500;
isp->isp_mdvec = &mdvec_2500;
isp->isp_type = ISP_HA_FC_2500;
- pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2400_OFF;
break;
case PCI_QLOGIC_ISP2031:
case PCI_QLOGIC_ISP8031:
did = 0x2600;
- isp->isp_nchan += isp_nvports;
isp->isp_mdvec = &mdvec_2600;
isp->isp_type = ISP_HA_FC_2600;
- pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2400_OFF;
break;
case PCI_QLOGIC_ISP2684:
case PCI_QLOGIC_ISP2692:
case PCI_QLOGIC_ISP2714:
case PCI_QLOGIC_ISP2722:
did = 0x2700;
- isp->isp_nchan += isp_nvports;
isp->isp_mdvec = &mdvec_2700;
isp->isp_type = ISP_HA_FC_2700;
- pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2400_OFF;
break;
default:
device_printf(dev, "unknown device type\n");
@@ -816,15 +545,8 @@ isp_pci_attach(device_t dev)
isp->isp_regs = pcs->regs;
isp->isp_regs2 = pcs->regs2;
- if (IS_FC(isp)) {
- psize = sizeof (fcparam);
- xsize = sizeof (struct isp_fc);
- } else {
- psize = sizeof (sdparam);
- xsize = sizeof (struct isp_spi);
- }
- psize *= isp->isp_nchan;
- xsize *= isp->isp_nchan;
+ psize = sizeof(fcparam) * isp->isp_nchan;
+ xsize = sizeof(struct isp_fc) * isp->isp_nchan;
isp->isp_param = malloc(psize, M_DEVBUF, M_NOWAIT | M_ZERO);
if (isp->isp_param == NULL) {
device_printf(dev, "cannot allocate parameter data\n");
@@ -858,15 +580,7 @@ isp_pci_attach(device_t dev)
*/
cmd = pci_read_config(dev, PCIR_COMMAND, 2);
cmd |= PCIM_CMD_SEREN | PCIM_CMD_PERRESPEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_INVEN;
- if (IS_2300(isp)) { /* per QLogic errata */
- cmd &= ~PCIM_CMD_INVEN;
- }
- if (IS_2322(isp) || pci_get_devid(dev) == PCI_QLOGIC_ISP6312) {
- cmd &= ~PCIM_CMD_INTX_DISABLE;
- }
- if (IS_24XX(isp)) {
- cmd &= ~PCIM_CMD_INTX_DISABLE;
- }
+ cmd &= ~PCIM_CMD_INTX_DISABLE;
pci_write_config(dev, PCIR_COMMAND, cmd, 2);
/*
@@ -899,9 +613,7 @@ isp_pci_attach(device_t dev)
/*
* Last minute checks...
*/
- if (IS_23XX(isp) || IS_24XX(isp)) {
- isp->isp_port = pci_get_function(dev);
- }
+ isp->isp_port = pci_get_function(dev);
/*
* Make sure we're in reset state.
@@ -994,10 +706,6 @@ isp_pci_detach(device_t dev)
return (0);
}
-#define IspVirt2Off(a, x) \
- (((struct isp_pcisoftc *)a)->pci_poff[((x) & _BLK_REG_MASK) >> \
- _BLK_REG_SHFT] + ((x) & 0xfff))
-
#define BXR2(isp, off) bus_read_2((isp)->isp_regs, (off))
#define BXW2(isp, off, v) bus_write_2((isp)->isp_regs, (off), (v))
#define BXR4(isp, off) bus_read_4((isp)->isp_regs, (off))
@@ -1005,111 +713,13 @@ isp_pci_detach(device_t dev)
#define B2R4(isp, off) bus_read_4((isp)->isp_regs2, (off))
#define B2W4(isp, off, v) bus_write_4((isp)->isp_regs2, (off), (v))
-static ISP_INLINE uint16_t
-isp_pci_rd_debounced(ispsoftc_t *isp, int off)
-{
- uint16_t val, prev;
-
- val = BXR2(isp, IspVirt2Off(isp, off));
- do {
- prev = val;
- val = BXR2(isp, IspVirt2Off(isp, off));
- } while (val != prev);
- return (val);
-}
-
-static void
-isp_pci_run_isr(ispsoftc_t *isp)
-{
- uint16_t isr, sema, info;
-
- if (IS_2100(isp)) {
- isr = isp_pci_rd_debounced(isp, BIU_ISR);
- sema = isp_pci_rd_debounced(isp, BIU_SEMA);
- } else {
- isr = BXR2(isp, IspVirt2Off(isp, BIU_ISR));
- sema = BXR2(isp, IspVirt2Off(isp, BIU_SEMA));
- }
- isp_prt(isp, ISP_LOGDEBUG3, "ISR 0x%x SEMA 0x%x", isr, sema);
- isr &= INT_PENDING_MASK(isp);
- sema &= BIU_SEMA_LOCK;
- if (isr == 0 && sema == 0)
- return;
- if (sema != 0) {
- if (IS_2100(isp))
- info = isp_pci_rd_debounced(isp, OUTMAILBOX0);
- else
- info = BXR2(isp, IspVirt2Off(isp, OUTMAILBOX0));
- if (info & MBOX_COMMAND_COMPLETE)
- isp_intr_mbox(isp, info);
- else
- isp_intr_async(isp, info);
- if (!IS_FC(isp) && isp->isp_state == ISP_RUNSTATE)
- isp_intr_respq(isp);
- } else
- isp_intr_respq(isp);
- ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
- if (sema)
- ISP_WRITE(isp, BIU_SEMA, 0);
-}
-
-static void
-isp_pci_run_isr_2300(ispsoftc_t *isp)
-{
- uint32_t hccr, r2hisr;
- uint16_t isr, info;
-
- if ((BXR2(isp, IspVirt2Off(isp, BIU_ISR)) & BIU2100_ISR_RISC_INT) == 0)
- return;
- r2hisr = BXR4(isp, IspVirt2Off(isp, BIU_R2HSTSLO));
- isp_prt(isp, ISP_LOGDEBUG3, "RISC2HOST ISR 0x%x", r2hisr);
- if ((r2hisr & BIU_R2HST_INTR) == 0)
- return;
- isr = r2hisr & BIU_R2HST_ISTAT_MASK;
- info = r2hisr >> 16;
- switch (isr) {
- case ISPR2HST_ROM_MBX_OK:
- case ISPR2HST_ROM_MBX_FAIL:
- case ISPR2HST_MBX_OK:
- case ISPR2HST_MBX_FAIL:
- isp_intr_mbox(isp, info);
- break;
- case ISPR2HST_ASYNC_EVENT:
- isp_intr_async(isp, info);
- break;
- case ISPR2HST_RIO_16:
- isp_intr_async(isp, ASYNC_RIO16_1);
- break;
- case ISPR2HST_FPOST:
- isp_intr_async(isp, ASYNC_CMD_CMPLT);
- break;
- case ISPR2HST_FPOST_CTIO:
- isp_intr_async(isp, ASYNC_CTIO_DONE);
- break;
- case ISPR2HST_RSPQ_UPDATE:
- isp_intr_respq(isp);
- break;
- default:
- hccr = ISP_READ(isp, HCCR);
- if (hccr & HCCR_PAUSE) {
- ISP_WRITE(isp, HCCR, HCCR_RESET);
- isp_prt(isp, ISP_LOGERR, "RISC paused at interrupt (%x->%x)", hccr, ISP_READ(isp, HCCR));
- ISP_WRITE(isp, BIU_ICR, 0);
- } else {
- isp_prt(isp, ISP_LOGERR, "unknown interrupt 0x%x\n", r2hisr);
- }
- }
- ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
- ISP_WRITE(isp, BIU_SEMA, 0);
-}
-
static void
isp_pci_run_isr_2400(ispsoftc_t *isp)
{
uint32_t r2hisr;
uint16_t isr, info;
- r2hisr = BXR4(isp, IspVirt2Off(isp, BIU2400_R2HSTSLO));
+ r2hisr = BXR4(isp, BIU2400_R2HSTS);
isp_prt(isp, ISP_LOGDEBUG3, "RISC2HOST ISR 0x%x", r2hisr);
if ((r2hisr & BIU_R2HST_INTR) == 0)
return;
@@ -1147,172 +757,18 @@ isp_pci_run_isr_2400(ispsoftc_t *isp)
}
static uint32_t
-isp_pci_rd_reg(ispsoftc_t *isp, int regoff)
-{
- uint16_t rv;
- int oldconf = 0;
-
- if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
- /*
- * We will assume that someone has paused the RISC processor.
- */
- oldconf = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
- BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oldconf | BIU_PCI_CONF1_SXP);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2, -1);
- }
- rv = BXR2(isp, IspVirt2Off(isp, regoff));
- if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
- BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oldconf);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2, -1);
- }
- return (rv);
-}
-
-static void
-isp_pci_wr_reg(ispsoftc_t *isp, int regoff, uint32_t val)
-{
- int oldconf = 0;
-
- if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
- /*
- * We will assume that someone has paused the RISC processor.
- */
- oldconf = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
- BXW2(isp, IspVirt2Off(isp, BIU_CONF1),
- oldconf | BIU_PCI_CONF1_SXP);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2, -1);
- }
- BXW2(isp, IspVirt2Off(isp, regoff), val);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 2, -1);
- if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
- BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oldconf);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2, -1);
- }
-
-}
-
-static uint32_t
-isp_pci_rd_reg_1080(ispsoftc_t *isp, int regoff)
-{
- uint32_t rv, oc = 0;
-
- if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
- uint32_t tc;
- /*
- * We will assume that someone has paused the RISC processor.
- */
- oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
- tc = oc & ~BIU_PCI1080_CONF1_DMA;
- if (regoff & SXP_BANK1_SELECT)
- tc |= BIU_PCI1080_CONF1_SXP1;
- else
- tc |= BIU_PCI1080_CONF1_SXP0;
- BXW2(isp, IspVirt2Off(isp, BIU_CONF1), tc);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2, -1);
- } else if ((regoff & _BLK_REG_MASK) == DMA_BLOCK) {
- oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
- BXW2(isp, IspVirt2Off(isp, BIU_CONF1),
- oc | BIU_PCI1080_CONF1_DMA);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2, -1);
- }
- rv = BXR2(isp, IspVirt2Off(isp, regoff));
- if (oc) {
- BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oc);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2, -1);
- }
- return (rv);
-}
-
-static void
-isp_pci_wr_reg_1080(ispsoftc_t *isp, int regoff, uint32_t val)
-{
- int oc = 0;
-
- if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
- uint32_t tc;
- /*
- * We will assume that someone has paused the RISC processor.
- */
- oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
- tc = oc & ~BIU_PCI1080_CONF1_DMA;
- if (regoff & SXP_BANK1_SELECT)
- tc |= BIU_PCI1080_CONF1_SXP1;
- else
- tc |= BIU_PCI1080_CONF1_SXP0;
- BXW2(isp, IspVirt2Off(isp, BIU_CONF1), tc);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2, -1);
- } else if ((regoff & _BLK_REG_MASK) == DMA_BLOCK) {
- oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
- BXW2(isp, IspVirt2Off(isp, BIU_CONF1),
- oc | BIU_PCI1080_CONF1_DMA);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2, -1);
- }
- BXW2(isp, IspVirt2Off(isp, regoff), val);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 2, -1);
- if (oc) {
- BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oc);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2, -1);
- }
-}
-
-static uint32_t
isp_pci_rd_reg_2400(ispsoftc_t *isp, int regoff)
{
- uint32_t rv;
int block = regoff & _BLK_REG_MASK;
switch (block) {
case BIU_BLOCK:
- break;
+ return (BXR4(isp, regoff));
case MBOX_BLOCK:
- return (BXR2(isp, IspVirt2Off(isp, regoff)));
- case SXP_BLOCK:
- isp_prt(isp, ISP_LOGERR, "SXP_BLOCK read at 0x%x", regoff);
- return (0xffffffff);
- case RISC_BLOCK:
- isp_prt(isp, ISP_LOGERR, "RISC_BLOCK read at 0x%x", regoff);
- return (0xffffffff);
- case DMA_BLOCK:
- isp_prt(isp, ISP_LOGERR, "DMA_BLOCK read at 0x%x", regoff);
- return (0xffffffff);
- default:
- isp_prt(isp, ISP_LOGERR, "unknown block read at 0x%x", regoff);
- return (0xffffffff);
+ return (BXR2(isp, regoff));
}
-
- switch (regoff) {
- case BIU2400_FLASH_ADDR:
- case BIU2400_FLASH_DATA:
- case BIU2400_ICR:
- case BIU2400_ISR:
- case BIU2400_CSR:
- case BIU2400_REQINP:
- case BIU2400_REQOUTP:
- case BIU2400_RSPINP:
- case BIU2400_RSPOUTP:
- case BIU2400_PRI_REQINP:
- case BIU2400_PRI_REQOUTP:
- case BIU2400_ATIO_RSPINP:
- case BIU2400_ATIO_RSPOUTP:
- case BIU2400_HCCR:
- case BIU2400_GPIOD:
- case BIU2400_GPIOE:
- case BIU2400_HSEMA:
- rv = BXR4(isp, IspVirt2Off(isp, regoff));
- break;
- case BIU2400_R2HSTSLO:
- rv = BXR4(isp, IspVirt2Off(isp, regoff));
- break;
- case BIU2400_R2HSTSHI:
- rv = BXR4(isp, IspVirt2Off(isp, regoff)) >> 16;
- break;
- default:
- isp_prt(isp, ISP_LOGERR, "unknown register read at 0x%x",
- regoff);
- rv = 0xffffffff;
- break;
- }
- return (rv);
+ isp_prt(isp, ISP_LOGERR, "unknown block read at 0x%x", regoff);
+ return (0xffffffff);
}
static void
@@ -1322,60 +778,23 @@ isp_pci_wr_reg_2400(ispsoftc_t *isp, int regoff, uint32_t val)
switch (block) {
case BIU_BLOCK:
- break;
- case MBOX_BLOCK:
- BXW2(isp, IspVirt2Off(isp, regoff), val);
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 2, -1);
- return;
- case SXP_BLOCK:
- isp_prt(isp, ISP_LOGERR, "SXP_BLOCK write at 0x%x", regoff);
- return;
- case RISC_BLOCK:
- isp_prt(isp, ISP_LOGERR, "RISC_BLOCK write at 0x%x", regoff);
- return;
- case DMA_BLOCK:
- isp_prt(isp, ISP_LOGERR, "DMA_BLOCK write at 0x%x", regoff);
- return;
- default:
- isp_prt(isp, ISP_LOGERR, "unknown block write at 0x%x", regoff);
- break;
- }
-
- switch (regoff) {
- case BIU2400_FLASH_ADDR:
- case BIU2400_FLASH_DATA:
- case BIU2400_ICR:
- case BIU2400_ISR:
- case BIU2400_CSR:
- case BIU2400_REQINP:
- case BIU2400_REQOUTP:
- case BIU2400_RSPINP:
- case BIU2400_RSPOUTP:
- case BIU2400_PRI_REQINP:
- case BIU2400_PRI_REQOUTP:
- case BIU2400_ATIO_RSPINP:
- case BIU2400_ATIO_RSPOUTP:
- case BIU2400_HCCR:
- case BIU2400_GPIOD:
- case BIU2400_GPIOE:
- case BIU2400_HSEMA:
- BXW4(isp, IspVirt2Off(isp, regoff), val);
+ BXW4(isp, regoff, val);
#ifdef MEMORYBARRIERW
if (regoff == BIU2400_REQINP ||
regoff == BIU2400_RSPOUTP ||
regoff == BIU2400_PRI_REQINP ||
regoff == BIU2400_ATIO_RSPOUTP)
- MEMORYBARRIERW(isp, SYNC_REG,
- IspVirt2Off(isp, regoff), 4, -1)
+ MEMORYBARRIERW(isp, SYNC_REG, regoff, 4, -1)
else
#endif
- MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 4, -1);
- break;
- default:
- isp_prt(isp, ISP_LOGERR, "unknown register write at 0x%x",
- regoff);
- break;
+ MEMORYBARRIER(isp, SYNC_REG, regoff, 4, -1);
+ return;
+ case MBOX_BLOCK:
+ BXW2(isp, regoff, val);
+ MEMORYBARRIER(isp, SYNC_REG, regoff, 2, -1);
+ return;
}
+ isp_prt(isp, ISP_LOGERR, "unknown block write at 0x%x", regoff);
}
static uint32_t
@@ -1470,12 +889,11 @@ static int
isp_pci_mbxdma(ispsoftc_t *isp)
{
caddr_t base;
- uint32_t len, nsegs;
+ uint32_t len;
int i, error, cmap = 0;
bus_size_t slim; /* segment size */
- bus_addr_t llim; /* low limit of unavailable dma */
- bus_addr_t hlim; /* high limit of unavailable dma */
struct imush im;
+ isp_ecmd_t *ecmd;
/* Already been here? If so, leave... */
if (isp->isp_xflist != NULL)
@@ -1486,24 +904,14 @@ isp_pci_mbxdma(ispsoftc_t *isp)
if (isp->isp_rquest != NULL)
goto gotmaxcmds;
- hlim = BUS_SPACE_MAXADDR;
- if (IS_ULTRA2(isp) || IS_FC(isp) || IS_1240(isp)) {
- if (sizeof (bus_size_t) > 4)
- slim = (bus_size_t) (1ULL << 32);
- else
- slim = (bus_size_t) (1UL << 31);
- llim = BUS_SPACE_MAXADDR;
- } else {
- slim = (1UL << 24);
- llim = BUS_SPACE_MAXADDR_32BIT;
- }
if (sizeof (bus_size_t) > 4)
- nsegs = ISP_NSEG64_MAX;
+ slim = (bus_size_t) (1ULL << 32);
else
- nsegs = ISP_NSEG_MAX;
-
- if (bus_dma_tag_create(bus_get_dma_tag(ISP_PCD(isp)), 1,
- slim, llim, hlim, NULL, NULL, BUS_SPACE_MAXSIZE, nsegs, slim, 0,
+ slim = (bus_size_t) (1UL << 31);
+ if (bus_dma_tag_create(bus_get_dma_tag(ISP_PCD(isp)), 1, slim,
+ BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL,
+ (ISP_NSEG64_MAX - 1) * PAGE_SIZE, ISP_NSEG64_MAX,
+ (ISP_NSEG64_MAX - 1) * PAGE_SIZE, 0,
busdma_lock_mutex, &isp->isp_lock, &isp->isp_osinfo.dmat)) {
ISP_LOCK(isp);
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
@@ -1515,7 +923,7 @@ isp_pci_mbxdma(ispsoftc_t *isp)
*/
len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp));
if (bus_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim,
- BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+ BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL,
len, 1, len, 0, NULL, NULL, &isp->isp_osinfo.reqdmat)) {
isp_prt(isp, ISP_LOGERR, "cannot create request DMA tag");
goto bad;
@@ -1541,41 +949,37 @@ isp_pci_mbxdma(ispsoftc_t *isp)
/*
* Allocate region for external DMA addressable command/status structures.
*/
- if (isp->isp_type >= ISP_HA_FC_2200) {
- isp_ecmd_t *ecmd;
-
- len = N_XCMDS * XCMD_SIZE;
- if (bus_dma_tag_create(isp->isp_osinfo.dmat, XCMD_SIZE, slim,
- BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
- len, 1, len, 0, NULL, NULL, &isp->isp_osinfo.ecmd_dmat)) {
- isp_prt(isp, ISP_LOGERR, "cannot create ECMD DMA tag");
- goto bad;
- }
- if (bus_dmamem_alloc(isp->isp_osinfo.ecmd_dmat, (void **)&base,
- BUS_DMA_COHERENT, &isp->isp_osinfo.ecmd_map) != 0) {
- isp_prt(isp, ISP_LOGERR, "cannot allocate ECMD DMA memory");
- bus_dma_tag_destroy(isp->isp_osinfo.reqdmat);
- goto bad;
- }
- isp->isp_osinfo.ecmd_base = (isp_ecmd_t *)base;
- im.error = 0;
- if (bus_dmamap_load(isp->isp_osinfo.ecmd_dmat, isp->isp_osinfo.ecmd_map,
- base, len, imc, &im, BUS_DMA_NOWAIT) || im.error) {
- isp_prt(isp, ISP_LOGERR, "error loading ECMD DMA map %d", im.error);
- goto bad;
- }
- isp_prt(isp, ISP_LOGDEBUG0, "ecmd area @ 0x%jx/0x%jx",
- (uintmax_t)im.maddr, (uintmax_t)len);
-
- isp->isp_osinfo.ecmd_dma = im.maddr;
- isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)base;
- for (ecmd = isp->isp_osinfo.ecmd_free;
- ecmd < &isp->isp_osinfo.ecmd_free[N_XCMDS]; ecmd++) {
- if (ecmd == &isp->isp_osinfo.ecmd_free[N_XCMDS - 1])
- ecmd->next = NULL;
- else
- ecmd->next = ecmd + 1;
- }
+ len = N_XCMDS * XCMD_SIZE;
+ if (bus_dma_tag_create(isp->isp_osinfo.dmat, XCMD_SIZE, slim,
+ BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL,
+ len, 1, len, 0, NULL, NULL, &isp->isp_osinfo.ecmd_dmat)) {
+ isp_prt(isp, ISP_LOGERR, "cannot create ECMD DMA tag");
+ goto bad;
+ }
+ if (bus_dmamem_alloc(isp->isp_osinfo.ecmd_dmat, (void **)&base,
+ BUS_DMA_COHERENT, &isp->isp_osinfo.ecmd_map) != 0) {
+ isp_prt(isp, ISP_LOGERR, "cannot allocate ECMD DMA memory");
+ bus_dma_tag_destroy(isp->isp_osinfo.reqdmat);
+ goto bad;
+ }
+ isp->isp_osinfo.ecmd_base = (isp_ecmd_t *)base;
+ im.error = 0;
+ if (bus_dmamap_load(isp->isp_osinfo.ecmd_dmat, isp->isp_osinfo.ecmd_map,
+ base, len, imc, &im, BUS_DMA_NOWAIT) || im.error) {
+ isp_prt(isp, ISP_LOGERR, "error loading ECMD DMA map %d", im.error);
+ goto bad;
+ }
+ isp_prt(isp, ISP_LOGDEBUG0, "ecmd area @ 0x%jx/0x%jx",
+ (uintmax_t)im.maddr, (uintmax_t)len);
+
+ isp->isp_osinfo.ecmd_dma = im.maddr;
+ isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)base;
+ for (ecmd = isp->isp_osinfo.ecmd_free;
+ ecmd < &isp->isp_osinfo.ecmd_free[N_XCMDS]; ecmd++) {
+ if (ecmd == &isp->isp_osinfo.ecmd_free[N_XCMDS - 1])
+ ecmd->next = NULL;
+ else
+ ecmd->next = ecmd + 1;
}
#endif
@@ -1584,7 +988,7 @@ isp_pci_mbxdma(ispsoftc_t *isp)
*/
len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
if (bus_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim,
- BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+ BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL,
len, 1, len, 0, NULL, NULL, &isp->isp_osinfo.respdmat)) {
isp_prt(isp, ISP_LOGERR, "cannot create response DMA tag");
goto bad;
@@ -1610,86 +1014,80 @@ isp_pci_mbxdma(ispsoftc_t *isp)
/*
* Allocate and map ATIO queue on 24xx with target mode.
*/
- if (IS_24XX(isp)) {
- len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
- if (bus_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim,
- BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
- len, 1, len, 0, NULL, NULL, &isp->isp_osinfo.atiodmat)) {
- isp_prt(isp, ISP_LOGERR, "cannot create ATIO DMA tag");
- goto bad;
- }
- if (bus_dmamem_alloc(isp->isp_osinfo.atiodmat, (void **)&base,
- BUS_DMA_COHERENT, &isp->isp_osinfo.atiomap) != 0) {
- isp_prt(isp, ISP_LOGERR, "cannot allocate ATIO DMA memory");
- bus_dma_tag_destroy(isp->isp_osinfo.atiodmat);
- goto bad;
- }
- isp->isp_atioq = base;
- im.error = 0;
- if (bus_dmamap_load(isp->isp_osinfo.atiodmat, isp->isp_osinfo.atiomap,
- base, len, imc, &im, BUS_DMA_NOWAIT) || im.error) {
- isp_prt(isp, ISP_LOGERR, "error loading ATIO DMA map %d", im.error);
- goto bad;
- }
- isp_prt(isp, ISP_LOGDEBUG0, "ATIO area @ 0x%jx/0x%jx",
- (uintmax_t)im.maddr, (uintmax_t)len);
- isp->isp_atioq_dma = im.maddr;
+ len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
+ if (bus_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim,
+ BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL,
+ len, 1, len, 0, NULL, NULL, &isp->isp_osinfo.atiodmat)) {
+ isp_prt(isp, ISP_LOGERR, "cannot create ATIO DMA tag");
+ goto bad;
+ }
+ if (bus_dmamem_alloc(isp->isp_osinfo.atiodmat, (void **)&base,
+ BUS_DMA_COHERENT, &isp->isp_osinfo.atiomap) != 0) {
+ isp_prt(isp, ISP_LOGERR, "cannot allocate ATIO DMA memory");
+ bus_dma_tag_destroy(isp->isp_osinfo.atiodmat);
+ goto bad;
}
+ isp->isp_atioq = base;
+ im.error = 0;
+ if (bus_dmamap_load(isp->isp_osinfo.atiodmat, isp->isp_osinfo.atiomap,
+ base, len, imc, &im, BUS_DMA_NOWAIT) || im.error) {
+ isp_prt(isp, ISP_LOGERR, "error loading ATIO DMA map %d", im.error);
+ goto bad;
+ }
+ isp_prt(isp, ISP_LOGDEBUG0, "ATIO area @ 0x%jx/0x%jx",
+ (uintmax_t)im.maddr, (uintmax_t)len);
+ isp->isp_atioq_dma = im.maddr;
#endif
- if (IS_FC(isp)) {
- if (bus_dma_tag_create(isp->isp_osinfo.dmat, 64, slim,
- BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL,
- 2*QENTRY_LEN, 1, 2*QENTRY_LEN, 0, NULL, NULL,
- &isp->isp_osinfo.iocbdmat)) {
- goto bad;
- }
- if (bus_dmamem_alloc(isp->isp_osinfo.iocbdmat,
- (void **)&base, BUS_DMA_COHERENT, &isp->isp_osinfo.iocbmap) != 0)
+ if (bus_dma_tag_create(isp->isp_osinfo.dmat, 64, slim,
+ BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL,
+ 2*QENTRY_LEN, 1, 2*QENTRY_LEN, 0, NULL, NULL,
+ &isp->isp_osinfo.iocbdmat)) {
+ goto bad;
+ }
+ if (bus_dmamem_alloc(isp->isp_osinfo.iocbdmat,
+ (void **)&base, BUS_DMA_COHERENT, &isp->isp_osinfo.iocbmap) != 0)
+ goto bad;
+ isp->isp_iocb = base;
+ im.error = 0;
+ if (bus_dmamap_load(isp->isp_osinfo.iocbdmat, isp->isp_osinfo.iocbmap,
+ base, 2*QENTRY_LEN, imc, &im, BUS_DMA_NOWAIT) || im.error)
+ goto bad;
+ isp->isp_iocb_dma = im.maddr;
+
+ if (bus_dma_tag_create(isp->isp_osinfo.dmat, 64, slim,
+ BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL,
+ ISP_FC_SCRLEN, 1, ISP_FC_SCRLEN, 0, NULL, NULL,
+ &isp->isp_osinfo.scdmat))
+ goto bad;
+ for (cmap = 0; cmap < isp->isp_nchan; cmap++) {
+ struct isp_fc *fc = ISP_FC_PC(isp, cmap);
+ if (bus_dmamem_alloc(isp->isp_osinfo.scdmat,
+ (void **)&base, BUS_DMA_COHERENT, &fc->scmap) != 0)
goto bad;
- isp->isp_iocb = base;
+ FCPARAM(isp, cmap)->isp_scratch = base;
im.error = 0;
- if (bus_dmamap_load(isp->isp_osinfo.iocbdmat, isp->isp_osinfo.iocbmap,
- base, 2*QENTRY_LEN, imc, &im, BUS_DMA_NOWAIT) || im.error)
+ if (bus_dmamap_load(isp->isp_osinfo.scdmat, fc->scmap,
+ base, ISP_FC_SCRLEN, imc, &im, BUS_DMA_NOWAIT) ||
+ im.error) {
+ bus_dmamem_free(isp->isp_osinfo.scdmat,
+ base, fc->scmap);
+ FCPARAM(isp, cmap)->isp_scratch = NULL;
goto bad;
- isp->isp_iocb_dma = im.maddr;
-
- if (bus_dma_tag_create(isp->isp_osinfo.dmat, 64, slim,
- BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL,
- ISP_FC_SCRLEN, 1, ISP_FC_SCRLEN, 0, NULL, NULL,
- &isp->isp_osinfo.scdmat))
- goto bad;
- for (cmap = 0; cmap < isp->isp_nchan; cmap++) {
- struct isp_fc *fc = ISP_FC_PC(isp, cmap);
- if (bus_dmamem_alloc(isp->isp_osinfo.scdmat,
- (void **)&base, BUS_DMA_COHERENT, &fc->scmap) != 0)
- goto bad;
- FCPARAM(isp, cmap)->isp_scratch = base;
- im.error = 0;
- if (bus_dmamap_load(isp->isp_osinfo.scdmat, fc->scmap,
- base, ISP_FC_SCRLEN, imc, &im, BUS_DMA_NOWAIT) ||
- im.error) {
- bus_dmamem_free(isp->isp_osinfo.scdmat,
- base, fc->scmap);
- FCPARAM(isp, cmap)->isp_scratch = NULL;
- goto bad;
- }
- FCPARAM(isp, cmap)->isp_scdma = im.maddr;
- if (!IS_2100(isp)) {
- for (i = 0; i < INITIAL_NEXUS_COUNT; i++) {
- struct isp_nexus *n = malloc(sizeof (struct isp_nexus), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (n == NULL) {
- while (fc->nexus_free_list) {
- n = fc->nexus_free_list;
- fc->nexus_free_list = n->next;
- free(n, M_DEVBUF);
- }
- goto bad;
- }
- n->next = fc->nexus_free_list;
- fc->nexus_free_list = n;
+ }
+ FCPARAM(isp, cmap)->isp_scdma = im.maddr;
+ for (i = 0; i < INITIAL_NEXUS_COUNT; i++) {
+ struct isp_nexus *n = malloc(sizeof (struct isp_nexus), M_DEVBUF, M_NOWAIT | M_ZERO);
+ if (n == NULL) {
+ while (fc->nexus_free_list) {
+ n = fc->nexus_free_list;
+ fc->nexus_free_list = n->next;
+ free(n, M_DEVBUF);
}
+ goto bad;
}
+ n->next = fc->nexus_free_list;
+ fc->nexus_free_list = n;
}
}
@@ -1753,50 +1151,46 @@ isp_pci_mbxdmafree(ispsoftc_t *isp)
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
isp->isp_osinfo.pcmd_pool = NULL;
}
- if (IS_FC(isp)) {
- for (i = 0; i < isp->isp_nchan; i++) {
- struct isp_fc *fc = ISP_FC_PC(isp, i);
- if (FCPARAM(isp, i)->isp_scdma != 0) {
- bus_dmamap_unload(isp->isp_osinfo.scdmat,
- fc->scmap);
- FCPARAM(isp, i)->isp_scdma = 0;
- }
- if (FCPARAM(isp, i)->isp_scratch != NULL) {
- bus_dmamem_free(isp->isp_osinfo.scdmat,
- FCPARAM(isp, i)->isp_scratch, fc->scmap);
- FCPARAM(isp, i)->isp_scratch = NULL;
- }
- while (fc->nexus_free_list) {
- struct isp_nexus *n = fc->nexus_free_list;
- fc->nexus_free_list = n->next;
- free(n, M_DEVBUF);
- }
+ for (i = 0; i < isp->isp_nchan; i++) {
+ struct isp_fc *fc = ISP_FC_PC(isp, i);
+ if (FCPARAM(isp, i)->isp_scdma != 0) {
+ bus_dmamap_unload(isp->isp_osinfo.scdmat,
+ fc->scmap);
+ FCPARAM(isp, i)->isp_scdma = 0;
}
- if (isp->isp_iocb_dma != 0) {
- bus_dma_tag_destroy(isp->isp_osinfo.scdmat);
- bus_dmamap_unload(isp->isp_osinfo.iocbdmat,
- isp->isp_osinfo.iocbmap);
- isp->isp_iocb_dma = 0;
+ if (FCPARAM(isp, i)->isp_scratch != NULL) {
+ bus_dmamem_free(isp->isp_osinfo.scdmat,
+ FCPARAM(isp, i)->isp_scratch, fc->scmap);
+ FCPARAM(isp, i)->isp_scratch = NULL;
}
- if (isp->isp_iocb != NULL) {
- bus_dmamem_free(isp->isp_osinfo.iocbdmat,
- isp->isp_iocb, isp->isp_osinfo.iocbmap);
- bus_dma_tag_destroy(isp->isp_osinfo.iocbdmat);
+ while (fc->nexus_free_list) {
+ struct isp_nexus *n = fc->nexus_free_list;
+ fc->nexus_free_list = n->next;
+ free(n, M_DEVBUF);
}
}
+ if (isp->isp_iocb_dma != 0) {
+ bus_dma_tag_destroy(isp->isp_osinfo.scdmat);
+ bus_dmamap_unload(isp->isp_osinfo.iocbdmat,
+ isp->isp_osinfo.iocbmap);
+ isp->isp_iocb_dma = 0;
+ }
+ if (isp->isp_iocb != NULL) {
+ bus_dmamem_free(isp->isp_osinfo.iocbdmat,
+ isp->isp_iocb, isp->isp_osinfo.iocbmap);
+ bus_dma_tag_destroy(isp->isp_osinfo.iocbdmat);
+ }
#ifdef ISP_TARGET_MODE
- if (IS_24XX(isp)) {
- if (isp->isp_atioq_dma != 0) {
- bus_dmamap_unload(isp->isp_osinfo.atiodmat,
- isp->isp_osinfo.atiomap);
- isp->isp_atioq_dma = 0;
- }
- if (isp->isp_atioq != NULL) {
- bus_dmamem_free(isp->isp_osinfo.atiodmat, isp->isp_atioq,
- isp->isp_osinfo.atiomap);
- bus_dma_tag_destroy(isp->isp_osinfo.atiodmat);
- isp->isp_atioq = NULL;
- }
+ if (isp->isp_atioq_dma != 0) {
+ bus_dmamap_unload(isp->isp_osinfo.atiodmat,
+ isp->isp_osinfo.atiomap);
+ isp->isp_atioq_dma = 0;
+ }
+ if (isp->isp_atioq != NULL) {
+ bus_dmamem_free(isp->isp_osinfo.atiodmat, isp->isp_atioq,
+ isp->isp_osinfo.atiomap);
+ bus_dma_tag_destroy(isp->isp_osinfo.atiodmat);
+ isp->isp_atioq = NULL;
}
#endif
if (isp->isp_result_dma != 0) {
@@ -1903,12 +1297,8 @@ isp_pci_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff)
mp->error = 0;
error = bus_dmamap_load_ccb(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap,
- (union ccb *)csio, dma2, mp, 0);
- if (error == EINPROGRESS) {
- bus_dmamap_unload(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap);
- mp->error = EINVAL;
- isp_prt(isp, ISP_LOGERR, "deferred dma allocation not supported");
- } else if (error && mp->error == 0) {
+ (union ccb *)csio, dma2, mp, BUS_DMA_NOWAIT);
+ if (error && mp->error == 0) {
#ifdef DIAGNOSTIC
isp_prt(isp, ISP_LOGERR, "error %d in dma mapping code", error);
#endif
@@ -1994,42 +1384,3 @@ isp_pci_irqsetup(ispsoftc_t *isp)
return (isp->isp_nirq == 0);
}
-
-static void
-isp_pci_dumpregs(ispsoftc_t *isp, const char *msg)
-{
- struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp;
- if (msg)
- printf("%s: %s\n", device_get_nameunit(isp->isp_dev), msg);
- else
- printf("%s:\n", device_get_nameunit(isp->isp_dev));
- if (IS_SCSI(isp))
- printf(" biu_conf1=%x", ISP_READ(isp, BIU_CONF1));
- else
- printf(" biu_csr=%x", ISP_READ(isp, BIU2100_CSR));
- printf(" biu_icr=%x biu_isr=%x biu_sema=%x ", ISP_READ(isp, BIU_ICR),
- ISP_READ(isp, BIU_ISR), ISP_READ(isp, BIU_SEMA));
- printf("risc_hccr=%x\n", ISP_READ(isp, HCCR));
-
-
- if (IS_SCSI(isp)) {
- ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
- printf(" cdma_conf=%x cdma_sts=%x cdma_fifostat=%x\n",
- ISP_READ(isp, CDMA_CONF), ISP_READ(isp, CDMA_STATUS),
- ISP_READ(isp, CDMA_FIFO_STS));
- printf(" ddma_conf=%x ddma_sts=%x ddma_fifostat=%x\n",
- ISP_READ(isp, DDMA_CONF), ISP_READ(isp, DDMA_STATUS),
- ISP_READ(isp, DDMA_FIFO_STS));
- printf(" sxp_int=%x sxp_gross=%x sxp(scsi_ctrl)=%x\n",
- ISP_READ(isp, SXP_INTERRUPT),
- ISP_READ(isp, SXP_GROSS_ERR),
- ISP_READ(isp, SXP_PINS_CTRL));
- ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
- }
- printf(" mbox regs: %x %x %x %x %x\n",
- ISP_READ(isp, OUTMAILBOX0), ISP_READ(isp, OUTMAILBOX1),
- ISP_READ(isp, OUTMAILBOX2), ISP_READ(isp, OUTMAILBOX3),
- ISP_READ(isp, OUTMAILBOX4));
- printf(" PCI Status Command/Status=%x\n",
- pci_read_config(pcs->pci_dev, PCIR_COMMAND, 1));
-}
diff --git a/sys/dev/isp/isp_target.c b/sys/dev/isp/isp_target.c
index 046010cc713b..4e98518bc1b0 100644
--- a/sys/dev/isp/isp_target.c
+++ b/sys/dev/isp/isp_target.c
@@ -1,6 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
+ * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
*
@@ -28,7 +29,7 @@
*
*/
/*
- * Machine and OS Independent Target Mode Code for the Qlogic SCSI/FC adapters.
+ * Machine and OS Independent Target Mode Code for the Qlogic FC adapters.
*/
/*
* Bug fixes gratefully acknowledged from:
@@ -54,17 +55,11 @@ __FBSDID("$FreeBSD$");
#endif
#ifdef ISP_TARGET_MODE
-static const char atiocope[] = "ATIO returned for LUN %x because it was in the middle of Bus Device Reset on bus %d";
-static const char atior[] = "ATIO returned for LUN %x from handle 0x%x because a Bus Reset occurred on bus %d";
static const char rqo[] = "%s: Request Queue Overflow";
-static void isp_got_msg_fc(ispsoftc_t *, in_fcentry_t *);
static void isp_got_tmf_24xx(ispsoftc_t *, at7_entry_t *);
static void isp_handle_abts(ispsoftc_t *, abts_t *);
-static void isp_handle_atio2(ispsoftc_t *, at2_entry_t *);
-static void isp_handle_ctio2(ispsoftc_t *, ct2_entry_t *);
static void isp_handle_ctio7(ispsoftc_t *, ct7_entry_t *);
-static void isp_handle_notify(ispsoftc_t *, in_fcentry_t *);
static void isp_handle_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *);
/*
@@ -117,40 +112,20 @@ int
isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
{
union {
- at2_entry_t *at2iop;
- at2e_entry_t *at2eiop;
at7_entry_t *at7iop;
- ct2_entry_t *ct2iop;
- ct2e_entry_t *ct2eiop;
ct7_entry_t *ct7iop;
- lun_entry_t *lunenp;
- in_fcentry_t *inot_fcp;
- in_fcentry_e_t *inote_fcp;
in_fcentry_24xx_t *inot_24xx;
- na_fcentry_t *nack_fcp;
- na_fcentry_e_t *nacke_fcp;
na_fcentry_24xx_t *nack_24xx;
isphdr_t *hp;
abts_t *abts;
abts_rsp_t *abts_rsp;
- els_t *els;
void * *vp;
-#define at2iop unp.at2iop
-#define at2eiop unp.at2eiop
#define at7iop unp.at7iop
-#define ct2iop unp.ct2iop
-#define ct2eiop unp.ct2eiop
#define ct7iop unp.ct7iop
-#define lunenp unp.lunenp
-#define inot_fcp unp.inot_fcp
-#define inote_fcp unp.inote_fcp
#define inot_24xx unp.inot_24xx
-#define nack_fcp unp.nack_fcp
-#define nacke_fcp unp.nacke_fcp
#define nack_24xx unp.nack_24xx
#define abts unp.abts
#define abts_rsp unp.abts_rsp
-#define els unp.els
#define hdrp unp.hp
} unp;
uint8_t local[QENTRY_LEN];
@@ -191,71 +166,27 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
isp_async(isp, ISPASYNC_TARGET_ACTION, local);
break;
- case RQSTYPE_ATIO2:
- if (ISP_CAP_2KLOGIN(isp)) {
- isp_get_atio2e(isp, at2eiop, (at2e_entry_t *) local);
- } else {
- isp_get_atio2(isp, at2iop, (at2_entry_t *) local);
- }
- isp_handle_atio2(isp, (at2_entry_t *) local);
- break;
-
- case RQSTYPE_CTIO3:
- case RQSTYPE_CTIO2:
- if (ISP_CAP_2KLOGIN(isp)) {
- isp_get_ctio2e(isp, ct2eiop, (ct2e_entry_t *) local);
- } else {
- isp_get_ctio2(isp, ct2iop, (ct2_entry_t *) local);
- }
- isp_handle_ctio2(isp, (ct2_entry_t *) local);
- break;
-
case RQSTYPE_CTIO7:
isp_get_ctio7(isp, ct7iop, (ct7_entry_t *) local);
isp_handle_ctio7(isp, (ct7_entry_t *) local);
break;
case RQSTYPE_NOTIFY:
- if (IS_24XX(isp)) {
- isp_get_notify_24xx(isp, inot_24xx, (in_fcentry_24xx_t *)local);
- isp_handle_notify_24xx(isp, (in_fcentry_24xx_t *)local);
- break;
- }
- if (ISP_CAP_2KLOGIN(isp))
- isp_get_notify_fc_e(isp, inote_fcp, (in_fcentry_e_t *)local);
- else
- isp_get_notify_fc(isp, inot_fcp, (in_fcentry_t *)local);
- isp_handle_notify(isp, (in_fcentry_t *)local);
- break;
+ isp_get_notify_24xx(isp, inot_24xx, (in_fcentry_24xx_t *)local);
+ isp_handle_notify_24xx(isp, (in_fcentry_24xx_t *)local);
case RQSTYPE_NOTIFY_ACK:
/*
* The ISP is acknowledging our acknowledgement of an
* Immediate Notify entry for some asynchronous event.
*/
- if (IS_24XX(isp)) {
- isp_get_notify_ack_24xx(isp, nack_24xx, (na_fcentry_24xx_t *) local);
- nack_24xx = (na_fcentry_24xx_t *) local;
- if (nack_24xx->na_status != NA_OK) {
- level = ISP_LOGINFO;
- } else {
- level = ISP_LOGTDEBUG1;
- }
- isp_prt(isp, level, "Notify Ack Status=0x%x; Subcode 0x%x seqid=0x%x", nack_24xx->na_status, nack_24xx->na_status_subcode, nack_24xx->na_rxid);
- } else {
- if (ISP_CAP_2KLOGIN(isp)) {
- isp_get_notify_ack_fc_e(isp, nacke_fcp, (na_fcentry_e_t *)local);
- } else {
- isp_get_notify_ack_fc(isp, nack_fcp, (na_fcentry_t *)local);
- }
- nack_fcp = (na_fcentry_t *)local;
- if (nack_fcp->na_status != NA_OK) {
- level = ISP_LOGINFO;
- } else {
- level = ISP_LOGTDEBUG1;
- }
- isp_prt(isp, level, "Notify Ack Status=0x%x seqid 0x%x", nack_fcp->na_status, nack_fcp->na_seqid);
- }
+ isp_get_notify_ack_24xx(isp, nack_24xx, (na_fcentry_24xx_t *) local);
+ nack_24xx = (na_fcentry_24xx_t *) local;
+ if (nack_24xx->na_status != NA_OK)
+ level = ISP_LOGINFO;
+ else
+ level = ISP_LOGTDEBUG1;
+ isp_prt(isp, level, "Notify Ack Status=0x%x; Subcode 0x%x seqid=0x%x", nack_24xx->na_status, nack_24xx->na_status_subcode, nack_24xx->na_rxid);
break;
case RQSTYPE_ABTS_RCVD:
@@ -265,11 +196,10 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
case RQSTYPE_ABTS_RSP:
isp_get_abts_rsp(isp, abts_rsp, (abts_rsp_t *)local);
abts_rsp = (abts_rsp_t *) local;
- if (abts_rsp->abts_rsp_status) {
+ if (abts_rsp->abts_rsp_status)
level = ISP_LOGINFO;
- } else {
+ else
level = ISP_LOGTDEBUG0;
- }
isp_prt(isp, level, "ABTS RSP response[0x%x]: status=0x%x sub=(0x%x 0x%x)", abts_rsp->abts_rsp_rxid_task, abts_rsp->abts_rsp_status,
abts_rsp->abts_rsp_payload.rsp.subcode1, abts_rsp->abts_rsp_payload.rsp.subcode2);
break;
@@ -278,26 +208,12 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
rval = 0;
break;
}
-#undef atiop
-#undef at2iop
-#undef at2eiop
#undef at7iop
-#undef ctiop
-#undef ct2iop
-#undef ct2eiop
#undef ct7iop
-#undef lunenp
-#undef inotp
-#undef inot_fcp
-#undef inote_fcp
#undef inot_24xx
-#undef nackp
-#undef nack_fcp
-#undef nacke_fcp
#undef hack_24xx
#undef abts
#undef abts_rsp
-#undef els
#undef hdrp
return (rval);
}
@@ -315,30 +231,8 @@ isp_target_put_entry(ispsoftc_t *isp, void *ap)
}
switch (etype) {
case RQSTYPE_NOTIFY_ACK:
- if (IS_24XX(isp))
- isp_put_notify_24xx_ack(isp, (na_fcentry_24xx_t *)ap,
- (na_fcentry_24xx_t *)outp);
- else if (ISP_CAP_2KLOGIN(isp))
- isp_put_notify_ack_fc_e(isp, (na_fcentry_e_t *)ap,
- (na_fcentry_e_t *)outp);
- else
- isp_put_notify_ack_fc(isp, ap, (na_fcentry_t *)outp);
- break;
- case RQSTYPE_ATIO2:
- if (ISP_CAP_2KLOGIN(isp))
- isp_put_atio2e(isp, (at2e_entry_t *)ap,
- (at2e_entry_t *)outp);
- else
- isp_put_atio2(isp, (at2_entry_t *)ap,
- (at2_entry_t *)outp);
- break;
- case RQSTYPE_CTIO2:
- if (ISP_CAP_2KLOGIN(isp))
- isp_put_ctio2e(isp, (ct2e_entry_t *)ap,
- (ct2e_entry_t *)outp);
- else
- isp_put_ctio2(isp, (ct2_entry_t *)ap,
- (ct2_entry_t *)outp);
+ isp_put_notify_ack_24xx(isp, (na_fcentry_24xx_t *)ap,
+ (na_fcentry_24xx_t *)outp);
break;
case RQSTYPE_CTIO7:
isp_put_ctio7(isp, (ct7_entry_t *)ap, (ct7_entry_t *)outp);
@@ -355,33 +249,6 @@ isp_target_put_entry(ispsoftc_t *isp, void *ap)
return (0);
}
-int
-isp_target_put_atio(ispsoftc_t *isp, void *arg)
-{
- at2_entry_t *aep = arg;
- union {
- at2_entry_t _atio2;
- at2e_entry_t _atio2e;
- } atun;
-
- ISP_MEMZERO(&atun, sizeof atun);
- atun._atio2.at_header.rqs_entry_type = RQSTYPE_ATIO2;
- atun._atio2.at_header.rqs_entry_count = 1;
- if (ISP_CAP_SCCFW(isp)) {
- atun._atio2.at_scclun = aep->at_scclun;
- } else {
- atun._atio2.at_lun = (uint8_t) aep->at_lun;
- }
- if (ISP_CAP_2KLOGIN(isp)) {
- atun._atio2e.at_iid = ((at2e_entry_t *)aep)->at_iid;
- } else {
- atun._atio2.at_iid = aep->at_iid;
- }
- atun._atio2.at_rxid = aep->at_rxid;
- atun._atio2.at_status = CT_OK;
- return (isp_target_put_entry(isp, &atun));
-}
-
/*
* Command completion- both for handling cases of no resources or
* no blackhole driver, or other cases where we have to, inline,
@@ -405,120 +272,65 @@ isp_endcmd(ispsoftc_t *isp, ...)
{
uint32_t code, hdl;
uint8_t sts;
- union {
- ct2_entry_t _ctio2;
- ct2e_entry_t _ctio2e;
- ct7_entry_t _ctio7;
- } un;
+ at7_entry_t *aep;
+ ct7_entry_t _ctio7, *cto = &_ctio7;
va_list ap;
int vpidx, nphdl;
- ISP_MEMZERO(&un, sizeof un);
-
- if (IS_24XX(isp)) {
- at7_entry_t *aep;
- ct7_entry_t *cto = &un._ctio7;
-
- va_start(ap, isp);
- aep = va_arg(ap, at7_entry_t *);
- nphdl = va_arg(ap, int);
- /*
- * Note that vpidx may equal 0xff (unknown) here
- */
- vpidx = va_arg(ap, int);
- code = va_arg(ap, uint32_t);
- hdl = va_arg(ap, uint32_t);
- va_end(ap);
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: [RX_ID 0x%x] chan %d code %x", __func__, aep->at_rxid, vpidx, code);
-
- sts = code & 0xff;
- cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
- cto->ct_header.rqs_entry_count = 1;
- cto->ct_nphdl = nphdl;
- cto->ct_rxid = aep->at_rxid;
- cto->ct_iid_lo = (aep->at_hdr.s_id[1] << 8) | aep->at_hdr.s_id[2];
- cto->ct_iid_hi = aep->at_hdr.s_id[0];
- cto->ct_oxid = aep->at_hdr.ox_id;
- cto->ct_scsi_status = sts;
- cto->ct_vpidx = vpidx;
- cto->ct_flags = CT7_NOACK;
- if (code & ECMD_TERMINATE) {
- cto->ct_flags |= CT7_TERMINATE;
- } else if (code & ECMD_SVALID) {
- cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
- cto->ct_scsi_status |= (FCP_SNSLEN_VALID << 8);
- cto->ct_senselen = min(16, MAXRESPLEN_24XX);
- ISP_MEMZERO(cto->rsp.m1.ct_resp, sizeof (cto->rsp.m1.ct_resp));
- cto->rsp.m1.ct_resp[0] = 0xf0;
- cto->rsp.m1.ct_resp[2] = (code >> 12) & 0xf;
- cto->rsp.m1.ct_resp[7] = 8;
- cto->rsp.m1.ct_resp[12] = (code >> 16) & 0xff;
- cto->rsp.m1.ct_resp[13] = (code >> 24) & 0xff;
- } else if (code & ECMD_RVALID) {
- cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
- cto->ct_scsi_status |= (FCP_RSPLEN_VALID << 8);
- cto->rsp.m1.ct_resplen = 4;
- ISP_MEMZERO(cto->rsp.m1.ct_resp, sizeof (cto->rsp.m1.ct_resp));
- cto->rsp.m1.ct_resp[0] = (code >> 12) & 0xf;
- cto->rsp.m1.ct_resp[1] = (code >> 16) & 0xff;
- cto->rsp.m1.ct_resp[2] = (code >> 24) & 0xff;
- cto->rsp.m1.ct_resp[3] = 0;
- } else {
- cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
- }
- if (aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl != 0) {
- cto->ct_resid = aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl;
- cto->ct_scsi_status |= (FCP_RESID_UNDERFLOW << 8);
- }
- cto->ct_syshandle = hdl;
+ va_start(ap, isp);
+ aep = va_arg(ap, at7_entry_t *);
+ nphdl = va_arg(ap, int);
+ /*
+ * Note that vpidx may equal 0xff (unknown) here
+ */
+ vpidx = va_arg(ap, int);
+ code = va_arg(ap, uint32_t);
+ hdl = va_arg(ap, uint32_t);
+ va_end(ap);
+ isp_prt(isp, ISP_LOGTDEBUG0, "%s: [RX_ID 0x%x] chan %d code %x", __func__, aep->at_rxid, vpidx, code);
+
+ sts = code & 0xff;
+ ISP_MEMZERO(cto, sizeof(*cto));
+ cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
+ cto->ct_header.rqs_entry_count = 1;
+ cto->ct_nphdl = nphdl;
+ cto->ct_rxid = aep->at_rxid;
+ cto->ct_iid_lo = (aep->at_hdr.s_id[1] << 8) | aep->at_hdr.s_id[2];
+ cto->ct_iid_hi = aep->at_hdr.s_id[0];
+ cto->ct_oxid = aep->at_hdr.ox_id;
+ cto->ct_scsi_status = sts;
+ cto->ct_vpidx = vpidx;
+ cto->ct_flags = CT7_NOACK;
+ if (code & ECMD_TERMINATE) {
+ cto->ct_flags |= CT7_TERMINATE;
+ } else if (code & ECMD_SVALID) {
+ cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
+ cto->ct_scsi_status |= (FCP_SNSLEN_VALID << 8);
+ cto->ct_senselen = min(16, MAXRESPLEN_24XX);
+ ISP_MEMZERO(cto->rsp.m1.ct_resp, sizeof (cto->rsp.m1.ct_resp));
+ cto->rsp.m1.ct_resp[0] = 0xf0;
+ cto->rsp.m1.ct_resp[2] = (code >> 12) & 0xf;
+ cto->rsp.m1.ct_resp[7] = 8;
+ cto->rsp.m1.ct_resp[12] = (code >> 16) & 0xff;
+ cto->rsp.m1.ct_resp[13] = (code >> 24) & 0xff;
+ } else if (code & ECMD_RVALID) {
+ cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
+ cto->ct_scsi_status |= (FCP_RSPLEN_VALID << 8);
+ cto->rsp.m1.ct_resplen = 4;
+ ISP_MEMZERO(cto->rsp.m1.ct_resp, sizeof (cto->rsp.m1.ct_resp));
+ cto->rsp.m1.ct_resp[0] = (code >> 12) & 0xf;
+ cto->rsp.m1.ct_resp[1] = (code >> 16) & 0xff;
+ cto->rsp.m1.ct_resp[2] = (code >> 24) & 0xff;
+ cto->rsp.m1.ct_resp[3] = 0;
} else {
- at2_entry_t *aep;
- ct2_entry_t *cto = &un._ctio2;
-
- va_start(ap, isp);
- aep = va_arg(ap, at2_entry_t *);
- /* nphdl and vpidx are unused here. */
- nphdl = va_arg(ap, int);
- vpidx = va_arg(ap, int);
- code = va_arg(ap, uint32_t);
- hdl = va_arg(ap, uint32_t);
- va_end(ap);
-
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: [RX_ID 0x%x] code %x", __func__, aep->at_rxid, code);
-
- sts = code & 0xff;
- cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
- cto->ct_header.rqs_entry_count = 1;
- if (ISP_CAP_SCCFW(isp) == 0) {
- cto->ct_lun = aep->at_lun;
- }
- if (ISP_CAP_2KLOGIN(isp)) {
- un._ctio2e.ct_iid = ((at2e_entry_t *)aep)->at_iid;
- } else {
- cto->ct_iid = aep->at_iid;
- }
- cto->ct_rxid = aep->at_rxid;
- cto->rsp.m1.ct_scsi_status = sts;
- cto->ct_flags = CT2_SENDSTATUS | CT2_NO_DATA | CT2_FLAG_MODE1;
- if (hdl == 0) {
- cto->ct_flags |= CT2_CCINCR;
- }
- if (aep->at_datalen) {
- cto->ct_resid = aep->at_datalen;
- cto->rsp.m1.ct_scsi_status |= CT2_DATA_UNDER;
- }
- if (sts == SCSI_CHECK && (code & ECMD_SVALID)) {
- cto->rsp.m1.ct_resp[0] = 0xf0;
- cto->rsp.m1.ct_resp[2] = (code >> 12) & 0xf;
- cto->rsp.m1.ct_resp[7] = 8;
- cto->rsp.m1.ct_resp[12] = (code >> 24) & 0xff;
- cto->rsp.m1.ct_resp[13] = (code >> 16) & 0xff;
- cto->rsp.m1.ct_senselen = 16;
- cto->rsp.m1.ct_scsi_status |= CT2_SNSLEN_VALID;
- }
- cto->ct_syshandle = hdl;
+ cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
}
- return (isp_target_put_entry(isp, &un));
+ if (aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl != 0) {
+ cto->ct_resid = aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl;
+ cto->ct_scsi_status |= (FCP_RESID_UNDERFLOW << 8);
+ }
+ cto->ct_syshandle = hdl;
+ return (isp_target_put_entry(isp, cto));
}
/*
@@ -573,100 +385,12 @@ isp_target_async(ispsoftc_t *isp, int bus, int event)
notify.nt_ncode = NT_TARGET_RESET;
isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
break;
- case ASYNC_CTIO_DONE:
- {
- uint8_t storage[QENTRY_LEN];
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO DONE", __func__);
- memset(storage, 0, QENTRY_LEN);
- if (IS_24XX(isp)) {
- ct7_entry_t *ct = (ct7_entry_t *) storage;
- ct->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
- ct->ct_nphdl = CT7_OK;
- ct->ct_syshandle = bus;
- ct->ct_flags = CT7_SENDSTATUS;
- } else {
- /* This should also suffice for 2K login code */
- ct2_entry_t *ct = (ct2_entry_t *) storage;
- ct->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
- ct->ct_status = CT_OK;
- ct->ct_syshandle = bus;
- ct->ct_flags = CT2_SENDSTATUS|CT2_FASTPOST;
- }
- isp_async(isp, ISPASYNC_TARGET_ACTION, storage);
- break;
- }
default:
isp_prt(isp, ISP_LOGERR, "%s: unknown event 0x%x", __func__, event);
break;
}
}
-/*
- * Synthesize a message from the task management flags in a FCP_CMND_IU.
- */
-static void
-isp_got_msg_fc(ispsoftc_t *isp, in_fcentry_t *inp)
-{
- isp_notify_t notify;
- static const char f1[] = "%s from N-port handle 0x%x lun %jx seq 0x%x";
- static const char f2[] = "unknown %s 0x%x lun %jx N-Port handle 0x%x task flags 0x%x seq 0x%x\n";
- uint16_t seqid, nphdl;
-
- ISP_MEMZERO(&notify, sizeof (isp_notify_t));
- notify.nt_hba = isp;
- notify.nt_wwn = INI_ANY;
- if (ISP_CAP_2KLOGIN(isp)) {
- notify.nt_nphdl = ((in_fcentry_e_t *)inp)->in_iid;
- nphdl = ((in_fcentry_e_t *)inp)->in_iid;
- seqid = ((in_fcentry_e_t *)inp)->in_seqid;
- } else {
- notify.nt_nphdl = inp->in_iid;
- nphdl = inp->in_iid;
- seqid = inp->in_seqid;
- }
- notify.nt_sid = PORT_ANY;
- notify.nt_did = PORT_ANY;
-
- /* nt_tgt set in outer layers */
- if (ISP_CAP_SCCFW(isp)) {
- notify.nt_lun = inp->in_scclun;
- } else {
- notify.nt_lun = inp->in_lun;
- }
- notify.nt_tagval = seqid;
- notify.nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32);
- notify.nt_need_ack = 1;
- notify.nt_lreserved = inp;
-
- if (inp->in_status != IN_MSG_RECEIVED) {
- isp_prt(isp, ISP_LOGINFO, f2, "immediate notify status", inp->in_status, notify.nt_lun, nphdl, inp->in_task_flags, inp->in_seqid);
- isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
- return;
- }
-
- if (inp->in_task_flags & TASK_FLAGS_ABORT_TASK_SET) {
- isp_prt(isp, ISP_LOGINFO, f1, "ABORT TASK SET", nphdl, notify.nt_lun, inp->in_seqid);
- notify.nt_ncode = NT_ABORT_TASK_SET;
- } else if (inp->in_task_flags & TASK_FLAGS_CLEAR_TASK_SET) {
- isp_prt(isp, ISP_LOGINFO, f1, "CLEAR TASK SET", nphdl, notify.nt_lun, inp->in_seqid);
- notify.nt_ncode = NT_CLEAR_TASK_SET;
- } else if (inp->in_task_flags & TASK_FLAGS_LUN_RESET) {
- isp_prt(isp, ISP_LOGINFO, f1, "LUN RESET", nphdl, notify.nt_lun, inp->in_seqid);
- notify.nt_ncode = NT_LUN_RESET;
- } else if (inp->in_task_flags & TASK_FLAGS_TARGET_RESET) {
- isp_prt(isp, ISP_LOGINFO, f1, "TARGET RESET", nphdl, notify.nt_lun, inp->in_seqid);
- notify.nt_ncode = NT_TARGET_RESET;
- } else if (inp->in_task_flags & TASK_FLAGS_CLEAR_ACA) {
- isp_prt(isp, ISP_LOGINFO, f1, "CLEAR ACA", nphdl, notify.nt_lun, inp->in_seqid);
- notify.nt_ncode = NT_CLEAR_ACA;
- } else {
- isp_prt(isp, ISP_LOGWARN, f2, "task flag", inp->in_status, notify.nt_lun, nphdl, inp->in_task_flags, inp->in_seqid);
- isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
- return;
- }
- isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
-}
-
static void
isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep)
{
@@ -740,80 +464,47 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep)
int
isp_notify_ack(ispsoftc_t *isp, void *arg)
{
- char storage[QENTRY_LEN];
+ na_fcentry_24xx_t _na, *na = &_na;
/*
* This is in case a Task Management Function ends up here.
*/
- if (IS_24XX(isp) && ((isphdr_t *)arg)->rqs_entry_type == RQSTYPE_ATIO) {
- at7_entry_t *aep = arg;
- return (isp_endcmd(isp, aep, NIL_HANDLE, 0, 0, 0));
- }
-
- ISP_MEMZERO(storage, QENTRY_LEN);
- if (IS_24XX(isp)) {
- in_fcentry_24xx_t *in = arg;
- na_fcentry_24xx_t *na = (na_fcentry_24xx_t *) storage;
-
- na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK;
- na->na_header.rqs_entry_count = 1;
- na->na_nphdl = in->in_nphdl;
- na->na_flags = in->in_flags;
- na->na_status = in->in_status;
- na->na_status_subcode = in->in_status_subcode;
- na->na_fwhandle = in->in_fwhandle;
- na->na_rxid = in->in_rxid;
- na->na_oxid = in->in_oxid;
- na->na_vpidx = in->in_vpidx;
- if (in->in_status == IN24XX_SRR_RCVD) {
- na->na_srr_rxid = in->in_srr_rxid;
- na->na_srr_reloff_hi = in->in_srr_reloff_hi;
- na->na_srr_reloff_lo = in->in_srr_reloff_lo;
- na->na_srr_iu = in->in_srr_iu;
- /*
- * Whether we're accepting the SRR or rejecting
- * it is determined by looking at the in_reserved
- * field in the original notify structure.
- */
- if (in->in_reserved) {
- na->na_srr_flags = 1;
- na->na_srr_reject_vunique = 0;
- /* Unable to perform this command at this time. */
- na->na_srr_reject_code = 9;
- /* Unable to supply the requested data. */
- na->na_srr_reject_explanation = 0x2a;
- }
- }
- } else {
- in_fcentry_t *in = arg;
- na_fcentry_t *na = (na_fcentry_t *) storage;
- int iid;
-
- ISP_MEMCPY(storage, arg, sizeof (isphdr_t));
- if (ISP_CAP_2KLOGIN(isp)) {
- iid = ((in_fcentry_e_t *)in)->in_iid;
- ((na_fcentry_e_t *)na)->na_iid = iid;
- } else {
- iid = in->in_iid;
- na->na_iid = iid;
- }
- na->na_task_flags = in->in_task_flags & TASK_FLAGS_RESERVED_MASK;
- na->na_seqid = in->in_seqid;
- na->na_status = in->in_status;
- na->na_flags = NAFC_RCOUNT;
- /* We do not modify resource counts for LIP resets */
- if (in->in_status == IN_RESET)
- na->na_flags = NAFC_RST_CLRD;
- if (in->in_status == IN_MSG_RECEIVED) {
- na->na_flags |= NAFC_TVALID;
- na->na_response = 0; /* XXX SUCCEEDED XXX */
+ if (((isphdr_t *)arg)->rqs_entry_type == RQSTYPE_ATIO)
+ return (isp_endcmd(isp, arg, NIL_HANDLE, 0, 0, 0));
+
+ in_fcentry_24xx_t *in = arg;
+
+ ISP_MEMZERO(na, sizeof(*na));
+ na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK;
+ na->na_header.rqs_entry_count = 1;
+ na->na_nphdl = in->in_nphdl;
+ na->na_flags = in->in_flags;
+ na->na_status = in->in_status;
+ na->na_status_subcode = in->in_status_subcode;
+ na->na_fwhandle = in->in_fwhandle;
+ na->na_rxid = in->in_rxid;
+ na->na_oxid = in->in_oxid;
+ na->na_vpidx = in->in_vpidx;
+ if (in->in_status == IN24XX_SRR_RCVD) {
+ na->na_srr_rxid = in->in_srr_rxid;
+ na->na_srr_reloff_hi = in->in_srr_reloff_hi;
+ na->na_srr_reloff_lo = in->in_srr_reloff_lo;
+ na->na_srr_iu = in->in_srr_iu;
+ /*
+ * Whether we're accepting the SRR or rejecting
+ * it is determined by looking at the in_reserved
+ * field in the original notify structure.
+ */
+ if (in->in_reserved) {
+ na->na_srr_flags = 1;
+ na->na_srr_reject_vunique = 0;
+ /* Unable to perform this command at this time. */
+ na->na_srr_reject_code = 9;
+ /* Unable to supply the requested data. */
+ na->na_srr_reject_explanation = 0x2a;
}
- na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK;
- na->na_header.rqs_entry_count = 1;
- isp_prt(isp, ISP_LOGTDEBUG0, "notify ack handle %x seqid %x flags %x tflags %x response %x", iid, na->na_seqid,
- na->na_flags, na->na_task_flags, na->na_response);
}
- return (isp_target_put_entry(isp, &storage));
+ return (isp_target_put_entry(isp, na));
}
int
@@ -825,11 +516,6 @@ isp_acknak_abts(ispsoftc_t *isp, void *arg, int errno)
abts_t *abts = arg;
abts_rsp_t *rsp = (abts_rsp_t *) storage;
- if (!IS_24XX(isp)) {
- isp_prt(isp, ISP_LOGERR, "%s: called for non-24XX card", __func__);
- return (0);
- }
-
if (abts->abts_header.rqs_entry_type != RQSTYPE_ABTS_RCVD) {
isp_prt(isp, ISP_LOGERR, "%s: called for non-ABTS entry (0x%x)", __func__, abts->abts_header.rqs_entry_type);
return (0);
@@ -928,264 +614,6 @@ isp_handle_abts(ispsoftc_t *isp, abts_t *abts)
}
static void
-isp_handle_atio2(ispsoftc_t *isp, at2_entry_t *aep)
-{
- fcportdb_t *lp;
- int lun, iid;
-
- if (ISP_CAP_SCCFW(isp)) {
- lun = aep->at_scclun;
- } else {
- lun = aep->at_lun;
- }
-
- if (ISP_CAP_2KLOGIN(isp)) {
- iid = ((at2e_entry_t *)aep)->at_iid;
- } else {
- iid = aep->at_iid;
- }
-
- /*
- * The firmware status (except for the QLTM_SVALID bit) indicates
- * why this ATIO was sent to us.
- *
- * If QLTM_SVALID is set, the firware has recommended Sense Data.
- *
- * If the DISCONNECTS DISABLED bit is set in the flags field,
- * we're still connected on the SCSI bus - i.e. the initiator
- * did not set DiscPriv in the identify message. We don't care
- * about this so it's ignored.
- */
-
- switch (aep->at_status & ~QLTM_SVALID) {
- case AT_PATH_INVALID:
- /*
- * ATIO rejected by the firmware due to disabled lun.
- */
- isp_prt(isp, ISP_LOGERR, "rejected ATIO2 for disabled lun %x", lun);
- break;
- case AT_NOCAP:
- /*
- * Requested Capability not available
- * We sent an ATIO that overflowed the firmware's
- * command resource count.
- */
- isp_prt(isp, ISP_LOGERR, "rejected ATIO2 for lun %x- command count overflow", lun);
- break;
-
- case AT_BDR_MSG:
- /*
- * If we send an ATIO to the firmware to increment
- * its command resource count, and the firmware is
- * recovering from a Bus Device Reset, it returns
- * the ATIO with this status. We set the command
- * resource count in the Enable Lun entry and no
- * not increment it. Therefore we should never get
- * this status here.
- */
- isp_prt(isp, ISP_LOGERR, atiocope, lun, 0);
- break;
-
- case AT_CDB: /* Got a CDB */
-
- /* Make sure we have this inititor in port database. */
- if (!IS_2100(isp) &&
- (isp_find_pdb_by_handle(isp, 0, iid, &lp) == 0 ||
- lp->state == FC_PORTDB_STATE_ZOMBIE)) {
- fcparam *fcp = FCPARAM(isp, 0);
- uint64_t wwpn =
- (((uint64_t) aep->at_wwpn[0]) << 48) |
- (((uint64_t) aep->at_wwpn[1]) << 32) |
- (((uint64_t) aep->at_wwpn[2]) << 16) |
- (((uint64_t) aep->at_wwpn[3]) << 0);
- isp_add_wwn_entry(isp, 0, wwpn, INI_NONE,
- iid, PORT_ANY, 0);
- if (fcp->isp_loopstate > LOOP_LTEST_DONE)
- fcp->isp_loopstate = LOOP_LTEST_DONE;
- isp_async(isp, ISPASYNC_CHANGE_NOTIFY, 0,
- ISPASYNC_CHANGE_PDB, iid, 0x06, 0xff);
- }
-
- /* Punt to platform specific layer. */
- isp_async(isp, ISPASYNC_TARGET_ACTION, aep);
- break;
-
- case AT_RESET:
- /*
- * A bus reset came along an blew away this command. Why
- * they do this in addition the async event code stuff,
- * I dunno.
- *
- * Ignore it because the async event will clear things
- * up for us.
- */
- isp_prt(isp, ISP_LOGERR, atior, lun, iid, 0);
- break;
-
-
- default:
- isp_prt(isp, ISP_LOGERR, "Unknown ATIO2 status 0x%x from handle %d for lun %x", aep->at_status, iid, lun);
- (void) isp_target_put_atio(isp, aep);
- break;
- }
-}
-
-static void
-isp_handle_ctio2(ispsoftc_t *isp, ct2_entry_t *ct)
-{
- void *xs;
- int pl = ISP_LOGTDEBUG2;
- char *fmsg = NULL;
-
- if (ct->ct_syshandle) {
- xs = isp_find_xs(isp, ct->ct_syshandle);
- if (xs == NULL) {
- pl = ISP_LOGALL;
- }
- } else {
- xs = NULL;
- }
-
- switch (ct->ct_status & ~QLTM_SVALID) {
- case CT_BUS_ERROR:
- isp_prt(isp, ISP_LOGERR, "PCI DMA Bus Error");
- /* FALL Through */
- case CT_DATA_OVER:
- case CT_DATA_UNDER:
- case CT_OK:
- /*
- * There are generally 2 possibilities as to why we'd get
- * this condition:
- * We sent or received data.
- * We sent status & command complete.
- */
-
- break;
-
- case CT_BDR_MSG:
- /*
- * Target Reset function received.
- *
- * The firmware generates an async mailbox interrupt to
- * notify us of this and returns outstanding CTIOs with this
- * status. These CTIOs are handled in that same way as
- * CT_ABORTED ones, so just fall through here.
- */
- fmsg = "TARGET RESET";
- /*FALLTHROUGH*/
- case CT_RESET:
- if (fmsg == NULL)
- fmsg = "LIP Reset";
- /*FALLTHROUGH*/
- case CT_ABORTED:
- /*
- * When an Abort message is received the firmware goes to
- * Bus Free and returns all outstanding CTIOs with the status
- * set, then sends us an Immediate Notify entry.
- */
- if (fmsg == NULL) {
- fmsg = "ABORT";
- }
-
- isp_prt(isp, ISP_LOGTDEBUG0, "CTIO2 destroyed by %s: RX_ID=0x%x", fmsg, ct->ct_rxid);
- break;
-
- case CT_INVAL:
- /*
- * CTIO rejected by the firmware - invalid data direction.
- */
- isp_prt(isp, ISP_LOGERR, "CTIO2 had wrong data direction");
- break;
-
- case CT_RSELTMO:
- fmsg = "failure to reconnect to initiator";
- /*FALLTHROUGH*/
- case CT_TIMEOUT:
- if (fmsg == NULL)
- fmsg = "command";
- isp_prt(isp, ISP_LOGWARN, "Firmware timed out on %s", fmsg);
- break;
-
- case CT_ERR:
- fmsg = "Completed with Error";
- /*FALLTHROUGH*/
- case CT_LOGOUT:
- if (fmsg == NULL)
- fmsg = "Port Logout";
- /*FALLTHROUGH*/
- case CT_PORTUNAVAIL:
- if (fmsg == NULL)
- fmsg = "Port not available";
- /*FALLTHROUGH*/
- case CT_PORTCHANGED:
- if (fmsg == NULL)
- fmsg = "Port Changed";
- /*FALLTHROUGH*/
- case CT_NOACK:
- if (fmsg == NULL)
- fmsg = "unacknowledged Immediate Notify pending";
- isp_prt(isp, ISP_LOGWARN, "CTIO returned by f/w- %s", fmsg);
- break;
-
- case CT_INVRXID:
- /*
- * CTIO rejected by the firmware because an invalid RX_ID.
- * Just print a message.
- */
- isp_prt(isp, ISP_LOGWARN, "CTIO2 completed with Invalid RX_ID 0x%x", ct->ct_rxid);
- break;
-
- default:
- isp_prt(isp, ISP_LOGERR, "Unknown CTIO2 status 0x%x", ct->ct_status & ~QLTM_SVALID);
- break;
- }
-
- if (xs == NULL) {
- /*
- * There may be more than one CTIO for a data transfer,
- * or this may be a status CTIO we're not monitoring.
- *
- * The assumption is that they'll all be returned in the
- * order we got them.
- */
- if (ct->ct_syshandle == 0) {
- if ((ct->ct_flags & CT2_SENDSTATUS) == 0) {
- isp_prt(isp, pl, "intermediate CTIO completed ok");
- } else {
- isp_prt(isp, pl, "unmonitored CTIO completed ok");
- }
- } else {
- isp_prt(isp, pl, "NO xs for CTIO (handle 0x%x) status 0x%x", ct->ct_syshandle, ct->ct_status & ~QLTM_SVALID);
- }
- } else {
- if ((ct->ct_flags & CT2_DATAMASK) != CT2_NO_DATA) {
- ISP_DMAFREE(isp, xs, ct->ct_syshandle);
- }
- if (ct->ct_flags & CT2_SENDSTATUS) {
- /*
- * Sent status and command complete.
- *
- * We're now really done with this command, so we
- * punt to the platform dependent layers because
- * only there can we do the appropriate command
- * complete thread synchronization.
- */
- isp_prt(isp, pl, "status CTIO complete");
- } else {
- /*
- * Final CTIO completed. Release DMA resources and
- * notify platform dependent layers.
- */
- isp_prt(isp, pl, "data CTIO complete");
- }
- isp_async(isp, ISPASYNC_TARGET_ACTION, ct);
- /*
- * The platform layer will destroy the handle if appropriate.
- */
- }
-}
-
-static void
isp_handle_ctio7(ispsoftc_t *isp, ct7_entry_t *ct)
{
void *xs;
@@ -1330,83 +758,6 @@ isp_handle_ctio7(ispsoftc_t *isp, ct7_entry_t *ct)
}
static void
-isp_handle_notify(ispsoftc_t *isp, in_fcentry_t *inp)
-{
- fcportdb_t *lp;
- uint64_t wwn;
- uint32_t sid;
- uint16_t nphdl, status;
- isp_notify_t notify;
-
- status = inp->in_status;
- isp_prt(isp, ISP_LOGTDEBUG0, "Immediate Notify, status=0x%x seqid=0x%x",
- status, inp->in_seqid);
- switch (status) {
- case IN_MSG_RECEIVED:
- case IN_IDE_RECEIVED:
- isp_got_msg_fc(isp, inp);
- return;
- case IN_RSRC_UNAVAIL:
- isp_prt(isp, ISP_LOGINFO, "Firmware out of ATIOs");
- isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
- return;
- }
-
- if (ISP_CAP_2KLOGIN(isp))
- nphdl = ((in_fcentry_e_t *)inp)->in_iid;
- else
- nphdl = inp->in_iid;
- if (isp_find_pdb_by_handle(isp, 0, nphdl, &lp)) {
- wwn = lp->port_wwn;
- sid = lp->portid;
- } else {
- wwn = INI_ANY;
- sid = PORT_ANY;
- }
-
- ISP_MEMZERO(&notify, sizeof (isp_notify_t));
- notify.nt_hba = isp;
- notify.nt_wwn = wwn;
- notify.nt_tgt = FCPARAM(isp, 0)->isp_wwpn;
- notify.nt_nphdl = nphdl;
- notify.nt_sid = sid;
- notify.nt_did = PORT_ANY;
- if (ISP_CAP_SCCFW(isp))
- notify.nt_lun = inp->in_scclun;
- else
- notify.nt_lun = inp->in_lun;
- notify.nt_tagval = inp->in_seqid;
- notify.nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32);
- notify.nt_need_ack = 1;
- notify.nt_channel = 0;
- notify.nt_lreserved = inp;
-
- switch (status) {
- case IN_RESET:
- notify.nt_ncode = NT_BUS_RESET;
- break;
- case IN_PORT_LOGOUT:
- notify.nt_ncode = NT_LOGOUT;
- break;
- case IN_ABORT_TASK:
- notify.nt_ncode = NT_ABORT_TASK;
- break;
- case IN_GLOBAL_LOGO:
- notify.nt_ncode = NT_GLOBAL_LOGOUT;
- break;
- case IN_PORT_CHANGED:
- notify.nt_ncode = NT_CHANGED;
- break;
- default:
- isp_prt(isp, ISP_LOGINFO, "%s: unhandled status (0x%x)",
- __func__, status);
- isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
- return;
- }
- isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
-}
-
-static void
isp_handle_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *inot)
{
uint8_t chan;
diff --git a/sys/dev/isp/ispmbox.h b/sys/dev/isp/ispmbox.h
index 0b46e1cffc26..7d07fc7fc834 100644
--- a/sys/dev/isp/ispmbox.h
+++ b/sys/dev/isp/ispmbox.h
@@ -2,7 +2,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * Copyright (c) 2009-2018 Alexander Motin <mav@FreeBSD.org>
+ * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
*
@@ -243,7 +243,7 @@
#define ASYNC_SYSTEM_ERROR 0x8002
#define ASYNC_RQS_XFER_ERR 0x8003
#define ASYNC_RSP_XFER_ERR 0x8004
-#define ASYNC_QWAKEUP 0x8005
+#define ASYNC_ATIO_XFER_ERR 0x8005
#define ASYNC_TIMEOUT_RESET 0x8006
#define ASYNC_DEVICE_RESET 0x8007
#define ASYNC_EXTMSG_UNDERRUN 0x800A
@@ -340,24 +340,10 @@
typedef struct {
uint32_t ds_base;
- uint32_t ds_count;
-} ispds_t;
-
-typedef struct {
- uint32_t ds_base;
uint32_t ds_basehi;
uint32_t ds_count;
} ispds64_t;
-#define DSTYPE_32BIT 0
-#define DSTYPE_64BIT 1
-typedef struct {
- uint16_t ds_type; /* 0-> ispds_t, 1-> ispds64_t */
- uint32_t ds_segment; /* unused */
- uint32_t ds_base; /* 32 bit address of DSD list */
-} ispdslist_t;
-
-
typedef struct {
uint8_t rqs_entry_type;
uint8_t rqs_entry_count;
@@ -418,34 +404,6 @@ typedef struct {
#define RQSTYPE_ABTS_RCVD 0x54 /* 24XX only */
#define RQSTYPE_ABTS_RSP 0x55 /* 24XX only */
-
-#define ISP_RQDSEG 4
-typedef struct {
- isphdr_t req_header;
- uint32_t req_handle;
- uint8_t req_lun_trn;
- uint8_t req_target;
- uint16_t req_cdblen;
- uint16_t req_flags;
- uint16_t req_reserved;
- uint16_t req_time;
- uint16_t req_seg_count;
- uint8_t req_cdb[12];
- ispds_t req_dataseg[ISP_RQDSEG];
-} ispreq_t;
-#define ISP_RQDSEG_A64 2
-
-typedef struct {
- isphdr_t mrk_header;
- uint32_t mrk_handle;
- uint8_t mrk_reserved0;
- uint8_t mrk_target;
- uint16_t mrk_modifier;
- uint16_t mrk_flags;
- uint16_t mrk_lun;
- uint8_t mrk_reserved1[48];
-} isp_marker_t;
-
typedef struct {
isphdr_t mrk_header;
uint32_t mrk_handle;
@@ -458,113 +416,12 @@ typedef struct {
uint8_t mrk_lun[8];
uint8_t mrk_reserved3[40];
} isp_marker_24xx_t;
-
#define SYNC_DEVICE 0
#define SYNC_TARGET 1
#define SYNC_ALL 2
#define SYNC_LIP 3
-#define ISP_RQDSEG_T2 3
-typedef struct {
- isphdr_t req_header;
- uint32_t req_handle;
- uint8_t req_lun_trn;
- uint8_t req_target;
- uint16_t req_scclun;
- uint16_t req_flags;
- uint8_t req_crn;
- uint8_t req_reserved;
- uint16_t req_time;
- uint16_t req_seg_count;
- uint8_t req_cdb[16];
- uint32_t req_totalcnt;
- ispds_t req_dataseg[ISP_RQDSEG_T2];
-} ispreqt2_t;
-
-typedef struct {
- isphdr_t req_header;
- uint32_t req_handle;
- uint16_t req_target;
- uint16_t req_scclun;
- uint16_t req_flags;
- uint8_t req_crn;
- uint8_t req_reserved;
- uint16_t req_time;
- uint16_t req_seg_count;
- uint8_t req_cdb[16];
- uint32_t req_totalcnt;
- ispds_t req_dataseg[ISP_RQDSEG_T2];
-} ispreqt2e_t;
-
-#define ISP_RQDSEG_T3 2
-typedef struct {
- isphdr_t req_header;
- uint32_t req_handle;
- uint8_t req_lun_trn;
- uint8_t req_target;
- uint16_t req_scclun;
- uint16_t req_flags;
- uint8_t req_crn;
- uint8_t req_reserved;
- uint16_t req_time;
- uint16_t req_seg_count;
- uint8_t req_cdb[16];
- uint32_t req_totalcnt;
- ispds64_t req_dataseg[ISP_RQDSEG_T3];
-} ispreqt3_t;
-#define ispreq64_t ispreqt3_t /* same as.... */
-
-typedef struct {
- isphdr_t req_header;
- uint32_t req_handle;
- uint16_t req_target;
- uint16_t req_scclun;
- uint16_t req_flags;
- uint8_t req_crn;
- uint8_t req_reserved;
- uint16_t req_time;
- uint16_t req_seg_count;
- uint8_t req_cdb[16];
- uint32_t req_totalcnt;
- ispds64_t req_dataseg[ISP_RQDSEG_T3];
-} ispreqt3e_t;
-
-/* req_flag values */
-#define REQFLAG_NODISCON 0x0001
-#define REQFLAG_HTAG 0x0002
-#define REQFLAG_OTAG 0x0004
-#define REQFLAG_STAG 0x0008
-#define REQFLAG_TARGET_RTN 0x0010
-
-#define REQFLAG_NODATA 0x0000
-#define REQFLAG_DATA_IN 0x0020
-#define REQFLAG_DATA_OUT 0x0040
-#define REQFLAG_DATA_UNKNOWN 0x0060
-
-#define REQFLAG_DISARQ 0x0100
-#define REQFLAG_FRC_ASYNC 0x0200
-#define REQFLAG_FRC_SYNC 0x0400
-#define REQFLAG_FRC_WIDE 0x0800
-#define REQFLAG_NOPARITY 0x1000
-#define REQFLAG_STOPQ 0x2000
-#define REQFLAG_XTRASNS 0x4000
-#define REQFLAG_PRIORITY 0x8000
-
-typedef struct {
- isphdr_t req_header;
- uint32_t req_handle;
- uint8_t req_lun_trn;
- uint8_t req_target;
- uint16_t req_cdblen;
- uint16_t req_flags;
- uint16_t req_reserved;
- uint16_t req_time;
- uint16_t req_seg_count;
- uint8_t req_cdb[44];
-} ispextreq_t;
-
-
/*
* ISP24XX structures
*/
@@ -632,34 +489,12 @@ typedef struct {
#define ISP24XX_ABRT_OKAY 0x00 /* in nphdl on return */
#define ISP24XX_ABRT_ENXIO 0x31 /* in nphdl on return */
-#define ISP_CDSEG 7
-typedef struct {
- isphdr_t req_header;
- uint32_t req_reserved;
- ispds_t req_dataseg[ISP_CDSEG];
-} ispcontreq_t;
-
#define ISP_CDSEG64 5
typedef struct {
isphdr_t req_header;
ispds64_t req_dataseg[ISP_CDSEG64];
} ispcontreq64_t;
-typedef struct {
- isphdr_t req_header;
- uint32_t req_handle;
- uint16_t req_scsi_status;
- uint16_t req_completion_status;
- uint16_t req_state_flags;
- uint16_t req_status_flags;
- uint16_t req_time;
-#define req_response_len req_time /* FC only */
- uint16_t req_sense_len;
- uint32_t req_resid;
- uint8_t req_response[8]; /* FC only */
- uint8_t req_sense_data[32];
-} ispstatusreq_t;
-
/*
* Status Continuation
*/
@@ -718,29 +553,6 @@ typedef struct {
ispds64_t ctp_dataseg[2];
} isp_ct_pt_t;
-/*
- * MS Passthru IOCB
- */
-typedef struct {
- isphdr_t ms_header;
- uint32_t ms_handle;
- uint16_t ms_nphdl; /* handle in high byte for !2k f/w */
- uint16_t ms_status;
- uint16_t ms_flags;
- uint16_t ms_reserved1; /* low 8 bits */
- uint16_t ms_time;
- uint16_t ms_cmd_cnt; /* Command DSD count */
- uint16_t ms_tot_cnt; /* Total DSD Count */
- uint8_t ms_type; /* MS type */
- uint8_t ms_r_ctl; /* R_CTL */
- uint16_t ms_rxid; /* RX_ID */
- uint16_t ms_reserved2;
- uint32_t ms_handle2;
- uint32_t ms_rsp_bcnt; /* Response byte count */
- uint32_t ms_cmd_bcnt; /* Command byte count */
- ispds64_t ms_dataseg[2];
-} isp_ms_t;
-
/*
* Completion Status Codes.
*/
@@ -848,20 +660,8 @@ typedef struct {
#endif
/*
- * About Firmware returns an 'attribute' word in mailbox 6.
- * These attributes are for 2200 and 2300.
+ * About Firmware returns an 'attribute' word.
*/
-#define ISP_FW_ATTR_TMODE 0x0001
-#define ISP_FW_ATTR_SCCLUN 0x0002
-#define ISP_FW_ATTR_FABRIC 0x0004
-#define ISP_FW_ATTR_CLASS2 0x0008
-#define ISP_FW_ATTR_FCTAPE 0x0010
-#define ISP_FW_ATTR_IP 0x0020
-#define ISP_FW_ATTR_VI 0x0040
-#define ISP_FW_ATTR_VI_SOLARIS 0x0080
-#define ISP_FW_ATTR_2KLOGINS 0x0100 /* just a guess... */
-
-/* and these are for the 2400 */
#define ISP2400_FW_ATTR_CLASS2 0x0001
#define ISP2400_FW_ATTR_IP 0x0002
#define ISP2400_FW_ATTR_MULTIID 0x0004
@@ -885,151 +685,30 @@ typedef struct {
#define ISP2400_FW_ATTR_ATIOMQ 0x0400000000
/*
- * These are either manifestly true or are dependent on f/w attributes
- */
-#define ISP_CAP_TMODE(isp) \
- (IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_TMODE))
-#define ISP_CAP_SCCFW(isp) \
- (IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_SCCLUN))
-#define ISP_CAP_2KLOGIN(isp) \
- (IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_2KLOGINS))
-
-/*
* This is only true for 24XX cards with this f/w attribute
*/
#define ISP_CAP_MULTI_ID(isp) \
- (IS_24XX(isp)? (isp->isp_fwattr & ISP2400_FW_ATTR_MULTIID) : 0)
+ (isp->isp_fwattr & ISP2400_FW_ATTR_MULTIID)
#define ISP_GET_VPIDX(isp, tag) \
(ISP_CAP_MULTI_ID(isp) ? tag : 0)
#define ISP_CAP_MSIX(isp) \
- (IS_24XX(isp)? (isp->isp_fwattr & ISP2400_FW_ATTR_MSIX) : 0)
+ (isp->isp_fwattr & ISP2400_FW_ATTR_MSIX)
#define ISP_CAP_VP0(isp) \
- (IS_24XX(isp)? (isp->isp_fwattr & ISP2400_FW_ATTR_VP0) : 0)
-
-/*
- * This is true manifestly or is dependent on a f/w attribute
- * but may or may not actually be *enabled*. In any case, it
- * is enabled on a per-channel basis.
- */
-#define ISP_CAP_FCTAPE(isp) \
- (IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_FCTAPE))
+ (isp->isp_fwattr & ISP2400_FW_ATTR_VP0)
#define ISP_FCTAPE_ENABLED(isp, chan) \
- (IS_24XX(isp)? (FCPARAM(isp, chan)->isp_xfwoptions & ICB2400_OPT2_FCTAPE) != 0 : (FCPARAM(isp, chan)->isp_xfwoptions & ICBXOPT_FCTAPE) != 0)
-
-/*
- * Reduced Interrupt Operation Response Queue Entries
- */
-
-typedef struct {
- isphdr_t req_header;
- uint32_t req_handles[15];
-} isp_rio1_t;
-
-typedef struct {
- isphdr_t req_header;
- uint16_t req_handles[30];
-} isp_rio2_t;
+ ((FCPARAM(isp, chan)->isp_xfwoptions & ICB2400_OPT2_FCTAPE) != 0)
/*
- * FC (ISP2100/ISP2200/ISP2300/ISP2400) specific data structures
+ * FC specific data structures
*/
/*
* Initialization Control Block
- *
- * Version One (prime) format.
*/
-typedef struct {
- uint8_t icb_version;
- uint8_t icb_reserved0;
- uint16_t icb_fwoptions;
- uint16_t icb_maxfrmlen;
- uint16_t icb_maxalloc;
- uint16_t icb_execthrottle;
- uint8_t icb_retry_count;
- uint8_t icb_retry_delay;
- uint8_t icb_portname[8];
- uint16_t icb_hardaddr;
- uint8_t icb_iqdevtype;
- uint8_t icb_logintime;
- uint8_t icb_nodename[8];
- uint16_t icb_rqstout;
- uint16_t icb_rspnsin;
- uint16_t icb_rqstqlen;
- uint16_t icb_rsltqlen;
- uint16_t icb_rqstaddr[4];
- uint16_t icb_respaddr[4];
- uint16_t icb_lunenables;
- uint8_t icb_ccnt;
- uint8_t icb_icnt;
- uint16_t icb_lunetimeout;
- uint16_t icb_reserved1;
- uint16_t icb_xfwoptions;
- uint8_t icb_racctimer;
- uint8_t icb_idelaytimer;
- uint16_t icb_zfwoptions;
- uint16_t icb_reserved2[13];
-} isp_icb_t;
#define ICB_VERSION1 1
-#define ICBOPT_EXTENDED 0x8000
-#define ICBOPT_BOTH_WWNS 0x4000
-#define ICBOPT_FULL_LOGIN 0x2000
-#define ICBOPT_STOP_ON_QFULL 0x1000 /* 2200/2100 only */
-#define ICBOPT_PREV_ADDRESS 0x0800
-#define ICBOPT_SRCHDOWN 0x0400
-#define ICBOPT_NOLIP 0x0200
-#define ICBOPT_PDBCHANGE_AE 0x0100
-#define ICBOPT_TGT_TYPE 0x0080
-#define ICBOPT_INI_ADISC 0x0040
-#define ICBOPT_INI_DISABLE 0x0020
-#define ICBOPT_TGT_ENABLE 0x0010
-#define ICBOPT_FAST_POST 0x0008
-#define ICBOPT_FULL_DUPLEX 0x0004
-#define ICBOPT_FAIRNESS 0x0002
-#define ICBOPT_HARD_ADDRESS 0x0001
-
-#define ICBXOPT_NO_LOGOUT 0x8000 /* no logout on link failure */
-#define ICBXOPT_FCTAPE_CCQ 0x4000 /* FC-Tape Command Queueing */
-#define ICBXOPT_FCTAPE_CONFIRM 0x2000
-#define ICBXOPT_FCTAPE 0x1000
-#define ICBXOPT_CLASS2_ACK0 0x0200
-#define ICBXOPT_CLASS2 0x0100
-#define ICBXOPT_NO_PLAY 0x0080 /* don't play if can't get hard addr */
-#define ICBXOPT_TOPO_MASK 0x0070
-#define ICBXOPT_LOOP_ONLY 0x0000
-#define ICBXOPT_PTP_ONLY 0x0010
-#define ICBXOPT_LOOP_2_PTP 0x0020
-#define ICBXOPT_PTP_2_LOOP 0x0030
-/*
- * The lower 4 bits of the xfwoptions field are the OPERATION MODE bits.
- * RIO is not defined for the 23XX cards (just 2200)
- */
-#define ICBXOPT_RIO_OFF 0
-#define ICBXOPT_RIO_16BIT 1
-#define ICBXOPT_RIO_32BIT 2
-#define ICBXOPT_RIO_16BIT_IOCB 3
-#define ICBXOPT_RIO_32BIT_IOCB 4
-#define ICBXOPT_ZIO 5
-#define ICBXOPT_TIMER_MASK 0x7
-
-#define ICBZOPT_RATE_MASK 0xC000
-#define ICBZOPT_RATE_1GB 0x0000
-#define ICBZOPT_RATE_AUTO 0x8000
-#define ICBZOPT_RATE_2GB 0x4000
-#define ICBZOPT_50_OHM 0x2000
-#define ICBZOPT_NO_LOCAL_PLOGI 0x0080
-#define ICBZOPT_ENA_OOF 0x0040 /* out of order frame handling */
-#define ICBZOPT_RSPSZ_MASK 0x0030
-#define ICBZOPT_RSPSZ_24 0x0000
-#define ICBZOPT_RSPSZ_12 0x0010
-#define ICBZOPT_RSPSZ_24A 0x0020
-#define ICBZOPT_RSPSZ_32 0x0030
-#define ICBZOPT_SOFTID 0x0002
-#define ICBZOPT_ENA_RDXFR_RDY 0x0001
-
/* 2400 F/W options */
#define ICB2400_OPT1_BOTH_WWNS 0x00004000
#define ICB2400_OPT1_FULL_LOGIN 0x00002000
@@ -1278,69 +957,9 @@ typedef struct {
* Port Data Base Element
*/
-typedef struct {
- uint16_t pdb_options;
- uint8_t pdb_mstate;
- uint8_t pdb_sstate;
- uint8_t pdb_hardaddr_bits[4];
- uint8_t pdb_portid_bits[4];
- uint8_t pdb_nodename[8];
- uint8_t pdb_portname[8];
- uint16_t pdb_execthrottle;
- uint16_t pdb_exec_count;
- uint8_t pdb_retry_count;
- uint8_t pdb_retry_delay;
- uint16_t pdb_resalloc;
- uint16_t pdb_curalloc;
- uint16_t pdb_qhead;
- uint16_t pdb_qtail;
- uint16_t pdb_tl_next;
- uint16_t pdb_tl_last;
- uint16_t pdb_features; /* PLOGI, Common Service */
- uint16_t pdb_pconcurrnt; /* PLOGI, Common Service */
- uint16_t pdb_roi; /* PLOGI, Common Service */
- uint8_t pdb_target;
- uint8_t pdb_initiator; /* PLOGI, Class 3 Control Flags */
- uint16_t pdb_rdsiz; /* PLOGI, Class 3 */
- uint16_t pdb_ncseq; /* PLOGI, Class 3 */
- uint16_t pdb_noseq; /* PLOGI, Class 3 */
- uint16_t pdb_labrtflg;
- uint16_t pdb_lstopflg;
- uint16_t pdb_sqhead;
- uint16_t pdb_sqtail;
- uint16_t pdb_ptimer;
- uint16_t pdb_nxt_seqid;
- uint16_t pdb_fcount;
- uint16_t pdb_prli_len;
- uint16_t pdb_prli_svc0;
- uint16_t pdb_prli_svc3;
- uint16_t pdb_loopid;
- uint16_t pdb_il_ptr;
- uint16_t pdb_sl_ptr;
-} isp_pdb_21xx_t;
-
-#define PDB_OPTIONS_XMITTING (1<<11)
-#define PDB_OPTIONS_LNKXMIT (1<<10)
-#define PDB_OPTIONS_ABORTED (1<<9)
-#define PDB_OPTIONS_ADISC (1<<1)
-
-#define PDB_STATE_DISCOVERY 0
-#define PDB_STATE_WDISC_ACK 1
-#define PDB_STATE_PLOGI 2
-#define PDB_STATE_PLOGI_ACK 3
-#define PDB_STATE_PRLI 4
-#define PDB_STATE_PRLI_ACK 5
-#define PDB_STATE_LOGGED_IN 6
-#define PDB_STATE_PORT_UNAVAIL 7
-#define PDB_STATE_PRLO 8
-#define PDB_STATE_PRLO_ACK 9
-#define PDB_STATE_PLOGO 10
-#define PDB_STATE_PLOG_ACK 11
-
#define SVC3_ROLE_MASK 0x30
#define SVC3_ROLE_SHIFT 4
-#define BITS2WORD(x) ((x)[0] << 16 | (x)[3] << 8 | (x)[2])
#define BITS2WORD_24XX(x) ((x)[0] << 16 | (x)[1] << 8 | (x)[2])
/*
@@ -1393,34 +1012,10 @@ typedef struct {
} isp_pdb_t;
/*
- * Port/Node Name List Element
- */
-typedef struct {
- uint8_t pnnle_name[8];
- uint16_t pnnle_handle;
- uint16_t pnnle_reserved;
-} isp_pnnle_t;
-
-#define PNNL_OPTIONS_NODE_NAMES (1<<0)
-#define PNNL_OPTIONS_PORT_DATA (1<<2)
-#define PNNL_OPTIONS_INITIATORS (1<<3)
-
-/*
* Port and N-Port Handle List Element
*/
typedef struct {
uint16_t pnhle_port_id_lo;
- uint16_t pnhle_port_id_hi_handle;
-} isp_pnhle_21xx_t;
-
-typedef struct {
- uint16_t pnhle_port_id_lo;
- uint16_t pnhle_port_id_hi;
- uint16_t pnhle_handle;
-} isp_pnhle_23xx_t;
-
-typedef struct {
- uint16_t pnhle_port_id_lo;
uint16_t pnhle_port_id_hi;
uint16_t pnhle_handle;
uint16_t pnhle_reserved;
@@ -1764,157 +1359,8 @@ typedef struct {
} els_t;
/*
- * A handy package structure for running FC-SCSI commands internally
- */
-typedef struct {
- uint16_t handle;
- uint16_t lun;
- uint32_t
- channel : 8,
- portid : 24;
- uint32_t timeout;
- union {
- struct {
- uint32_t data_length;
- uint32_t
- no_wait : 1,
- do_read : 1;
- uint8_t cdb[16];
- void *data_ptr;
- } beg;
- struct {
- uint32_t data_residual;
- uint8_t status;
- uint8_t pad;
- uint16_t sense_length;
- uint8_t sense_data[32];
- } end;
- } fcd;
-} isp_xcmd_t;
-
-/*
* Target Mode related definitions
*/
-#define QLTM_SENSELEN 18 /* non-FC cards only */
-#define QLTM_SVALID 0x80
-
-/*
- * Structure for Enable Lun and Modify Lun queue entries
- */
-typedef struct {
- isphdr_t le_header;
- uint32_t le_reserved;
- uint8_t le_lun;
- uint8_t le_rsvd;
- uint8_t le_ops; /* Modify LUN only */
- uint8_t le_tgt; /* Not for FC */
- uint32_t le_flags; /* Not for FC */
- uint8_t le_status;
- uint8_t le_reserved2;
- uint8_t le_cmd_count;
- uint8_t le_in_count;
- uint8_t le_cdb6len; /* Not for FC */
- uint8_t le_cdb7len; /* Not for FC */
- uint16_t le_timeout;
- uint16_t le_reserved3[20];
-} lun_entry_t;
-
-/*
- * le_flags values
- */
-#define LUN_TQAE 0x00000002 /* bit1 Tagged Queue Action Enable */
-#define LUN_DSSM 0x01000000 /* bit24 Disable Sending SDP Message */
-#define LUN_DISAD 0x02000000 /* bit25 Disable autodisconnect */
-#define LUN_DM 0x40000000 /* bit30 Disconnects Mandatory */
-
-/*
- * le_ops values
- */
-#define LUN_CCINCR 0x01 /* increment command count */
-#define LUN_CCDECR 0x02 /* decrement command count */
-#define LUN_ININCR 0x40 /* increment immed. notify count */
-#define LUN_INDECR 0x80 /* decrement immed. notify count */
-
-/*
- * le_status values
- */
-#define LUN_OK 0x01 /* we be rockin' */
-#define LUN_ERR 0x04 /* request completed with error */
-#define LUN_INVAL 0x06 /* invalid request */
-#define LUN_NOCAP 0x16 /* can't provide requested capability */
-#define LUN_ENABLED 0x3E /* LUN already enabled */
-
-/*
- * Immediate Notify Entry structure
- */
-#define IN_MSGLEN 8 /* 8 bytes */
-#define IN_RSVDLEN 8 /* 8 words */
-typedef struct {
- isphdr_t in_header;
- uint32_t in_reserved;
- uint8_t in_lun; /* lun */
- uint8_t in_iid; /* initiator */
- uint8_t in_reserved2;
- uint8_t in_tgt; /* target */
- uint32_t in_flags;
- uint8_t in_status;
- uint8_t in_rsvd2;
- uint8_t in_tag_val; /* tag value */
- uint8_t in_tag_type; /* tag type */
- uint16_t in_seqid; /* sequence id */
- uint8_t in_msg[IN_MSGLEN]; /* SCSI message bytes */
- uint16_t in_reserved3[IN_RSVDLEN];
- uint8_t in_sense[QLTM_SENSELEN];/* suggested sense data */
-} in_entry_t;
-
-typedef struct {
- isphdr_t in_header;
- uint32_t in_reserved;
- uint8_t in_lun; /* lun */
- uint8_t in_iid; /* initiator */
- uint16_t in_scclun;
- uint32_t in_reserved2;
- uint16_t in_status;
- uint16_t in_task_flags;
- uint16_t in_seqid; /* sequence id */
-} in_fcentry_t;
-
-typedef struct {
- isphdr_t in_header;
- uint32_t in_reserved;
- uint16_t in_iid; /* initiator */
- uint16_t in_scclun;
- uint32_t in_reserved2;
- uint16_t in_status;
- uint16_t in_task_flags;
- uint16_t in_seqid; /* sequence id */
-} in_fcentry_e_t;
-
-/*
- * Values for the in_status field
- */
-#define IN_REJECT 0x0D /* Message Reject message received */
-#define IN_RESET 0x0E /* Bus Reset occurred */
-#define IN_NO_RCAP 0x16 /* requested capability not available */
-#define IN_IDE_RECEIVED 0x33 /* Initiator Detected Error msg received */
-#define IN_RSRC_UNAVAIL 0x34 /* resource unavailable */
-#define IN_MSG_RECEIVED 0x36 /* SCSI message received */
-#define IN_ABORT_TASK 0x20 /* task named in RX_ID is being aborted (FC) */
-#define IN_PORT_LOGOUT 0x29 /* port has logged out (FC) */
-#define IN_PORT_CHANGED 0x2A /* port changed */
-#define IN_GLOBAL_LOGO 0x2E /* all ports logged out */
-#define IN_NO_NEXUS 0x3B /* Nexus not established */
-#define IN_SRR_RCVD 0x45 /* SRR received */
-
-/*
- * Values for the in_task_flags field- should only get one at a time!
- */
-#define TASK_FLAGS_RESERVED_MASK (0xe700)
-#define TASK_FLAGS_CLEAR_ACA (1<<14)
-#define TASK_FLAGS_TARGET_RESET (1<<13)
-#define TASK_FLAGS_LUN_RESET (1<<12)
-#define TASK_FLAGS_CLEAR_TASK_SET (1<<10)
-#define TASK_FLAGS_ABORT_TASK_SET (1<<9)
/*
* ISP24XX Immediate Notify
@@ -2016,66 +1462,9 @@ typedef struct {
#define IN24XX_PORT_CHANGED_PORT_CHANGE 0x05
/*
- * Notify Acknowledge Entry structure
- */
-#define NA_RSVDLEN 22
-typedef struct {
- isphdr_t na_header;
- uint32_t na_reserved;
- uint8_t na_lun; /* lun */
- uint8_t na_iid; /* initiator */
- uint8_t na_reserved2;
- uint8_t na_tgt; /* target */
- uint32_t na_flags;
- uint8_t na_status;
- uint8_t na_event;
- uint16_t na_seqid; /* sequence id */
- uint16_t na_reserved3[NA_RSVDLEN];
-} na_entry_t;
-
-/*
- * Value for the na_event field
- */
-#define NA_RST_CLRD 0x80 /* Clear an async event notification */
-#define NA_OK 0x01 /* Notify Acknowledge Succeeded */
-#define NA_INVALID 0x06 /* Invalid Notify Acknowledge */
-
-#define NA2_RSVDLEN 21
-typedef struct {
- isphdr_t na_header;
- uint32_t na_reserved;
- uint8_t na_reserved1;
- uint8_t na_iid; /* initiator loop id */
- uint16_t na_response;
- uint16_t na_flags;
- uint16_t na_reserved2;
- uint16_t na_status;
- uint16_t na_task_flags;
- uint16_t na_seqid; /* sequence id */
- uint16_t na_reserved3[NA2_RSVDLEN];
-} na_fcentry_t;
-
-typedef struct {
- isphdr_t na_header;
- uint32_t na_reserved;
- uint16_t na_iid; /* initiator loop id */
- uint16_t na_response; /* response code */
- uint16_t na_flags;
- uint16_t na_reserved2;
- uint16_t na_status;
- uint16_t na_task_flags;
- uint16_t na_seqid; /* sequence id */
- uint16_t na_reserved3[NA2_RSVDLEN];
-} na_fcentry_e_t;
-
-#define NAFC_RCOUNT 0x80 /* increment resource count */
-#define NAFC_RST_CLRD 0x20 /* Clear LIP Reset */
-#define NAFC_TVALID 0x10 /* task mangement response code is valid */
-
-/*
* ISP24XX Notify Acknowledge
*/
-
+#define NA_OK 0x01 /* Notify Acknowledge Succeeded */
typedef struct {
isphdr_t na_header;
uint32_t na_handle;
@@ -2103,159 +1492,6 @@ typedef struct {
} na_fcentry_24xx_t;
/*
- * Accept Target I/O Entry structure
- */
-#define ATIO_CDBLEN 26
-
-typedef struct {
- isphdr_t at_header;
- uint16_t at_reserved;
- uint16_t at_handle;
- uint8_t at_lun; /* lun */
- uint8_t at_iid; /* initiator */
- uint8_t at_cdblen; /* cdb length */
- uint8_t at_tgt; /* target */
- uint32_t at_flags;
- uint8_t at_status; /* firmware status */
- uint8_t at_scsi_status; /* scsi status */
- uint8_t at_tag_val; /* tag value */
- uint8_t at_tag_type; /* tag type */
- uint8_t at_cdb[ATIO_CDBLEN]; /* received CDB */
- uint8_t at_sense[QLTM_SENSELEN];/* suggested sense data */
-} at_entry_t;
-
-/*
- * at_flags values
- */
-#define AT_NODISC 0x00008000 /* disconnect disabled */
-#define AT_TQAE 0x00000002 /* Tagged Queue Action enabled */
-
-/*
- * at_status values
- */
-#define AT_PATH_INVALID 0x07 /* ATIO sent to firmware for disabled lun */
-#define AT_RESET 0x0E /* SCSI Bus Reset Occurred */
-#define AT_PHASE_ERROR 0x14 /* Bus phase sequence error */
-#define AT_NOCAP 0x16 /* Requested capability not available */
-#define AT_BDR_MSG 0x17 /* Bus Device Reset msg received */
-#define AT_CDB 0x3D /* CDB received */
-/*
- * Macros to create and fetch and test concatenated handle and tag value macros
- * (SPI only)
- */
-#define AT_MAKE_TAGID(tid, aep) \
- tid = aep->at_handle; \
- if (aep->at_flags & AT_TQAE) { \
- tid |= (aep->at_tag_val << 16); \
- tid |= (1 << 24); \
- }
-
-#define CT_MAKE_TAGID(tid, ct) \
- tid = ct->ct_fwhandle; \
- if (ct->ct_flags & CT_TQAE) { \
- tid |= (ct->ct_tag_val << 16); \
- tid |= (1 << 24); \
- }
-
-#define AT_HAS_TAG(val) ((val) & (1 << 24))
-#define AT_GET_TAG(val) (((val) >> 16) & 0xff)
-#define AT_GET_HANDLE(val) ((val) & 0xffff)
-
-#define IN_MAKE_TAGID(tid, inp) \
- tid = inp->in_seqid; \
- tid |= (inp->in_tag_val << 16); \
- tid |= (1 << 24)
-
-/*
- * Accept Target I/O Entry structure, Type 2
- */
-#define ATIO2_CDBLEN 16
-
-typedef struct {
- isphdr_t at_header;
- uint32_t at_reserved;
- uint8_t at_lun; /* lun or reserved */
- uint8_t at_iid; /* initiator */
- uint16_t at_rxid; /* response ID */
- uint16_t at_flags;
- uint16_t at_status; /* firmware status */
- uint8_t at_crn; /* command reference number */
- uint8_t at_taskcodes;
- uint8_t at_taskflags;
- uint8_t at_execodes;
- uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */
- uint32_t at_datalen; /* allocated data len */
- uint16_t at_scclun; /* SCC Lun or reserved */
- uint16_t at_wwpn[4]; /* WWPN of initiator */
- uint16_t at_reserved2[6];
- uint16_t at_oxid;
-} at2_entry_t;
-
-typedef struct {
- isphdr_t at_header;
- uint32_t at_reserved;
- uint16_t at_iid; /* initiator */
- uint16_t at_rxid; /* response ID */
- uint16_t at_flags;
- uint16_t at_status; /* firmware status */
- uint8_t at_crn; /* command reference number */
- uint8_t at_taskcodes;
- uint8_t at_taskflags;
- uint8_t at_execodes;
- uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */
- uint32_t at_datalen; /* allocated data len */
- uint16_t at_scclun; /* SCC Lun or reserved */
- uint16_t at_wwpn[4]; /* WWPN of initiator */
- uint16_t at_reserved2[6];
- uint16_t at_oxid;
-} at2e_entry_t;
-
-#define ATIO2_WWPN_OFFSET 0x2A
-#define ATIO2_OXID_OFFSET 0x3E
-
-#define ATIO2_TC_ATTR_MASK 0x7
-#define ATIO2_TC_ATTR_SIMPLEQ 0
-#define ATIO2_TC_ATTR_HEADOFQ 1
-#define ATIO2_TC_ATTR_ORDERED 2
-#define ATIO2_TC_ATTR_ACAQ 4
-#define ATIO2_TC_ATTR_UNTAGGED 5
-
-#define ATIO2_EX_WRITE 0x1
-#define ATIO2_EX_READ 0x2
-/*
- * Macros to create and fetch and test concatenated handle and tag value macros
- */
-#define AT2_MAKE_TAGID(tid, bus, inst, aep) \
- tid = aep->at_rxid; \
- tid |= (((uint64_t)inst) << 32); \
- tid |= (((uint64_t)bus) << 48)
-
-#define CT2_MAKE_TAGID(tid, bus, inst, ct) \
- tid = ct->ct_rxid; \
- tid |= (((uint64_t)inst) << 32); \
- tid |= (((uint64_t)(bus & 0xff)) << 48)
-
-#define AT2_HAS_TAG(val) 1
-#define AT2_GET_TAG(val) ((val) & 0xffffffff)
-#define AT2_GET_INST(val) (((val) >> 32) & 0xffff)
-#define AT2_GET_HANDLE AT2_GET_TAG
-#define AT2_GET_BUS(val) (((val) >> 48) & 0xff)
-
-#define FC_HAS_TAG AT2_HAS_TAG
-#define FC_GET_TAG AT2_GET_TAG
-#define FC_GET_INST AT2_GET_INST
-#define FC_GET_HANDLE AT2_GET_HANDLE
-
-#define IN_FC_MAKE_TAGID(tid, bus, inst, seqid) \
- tid = seqid; \
- tid |= (((uint64_t)inst) << 32); \
- tid |= (((uint64_t)(bus & 0xff)) << 48)
-
-#define FC_TAG_INSERT_INST(tid, inst) \
- tid &= ~0x0000ffff00000000ull; \
- tid |= (((uint64_t)inst) << 32)
-
-/*
* 24XX ATIO Definition
*
* This is *quite* different from other entry types.
@@ -2282,246 +1518,9 @@ typedef struct {
} at7_entry_t;
#define AT7_NORESRC_RXID 0xffffffff
-
-/*
- * Continue Target I/O Entry structure
- * Request from driver. The response from the
- * ISP firmware is the same except that the last 18
- * bytes are overwritten by suggested sense data if
- * the 'autosense valid' bit is set in the status byte.
- */
-typedef struct {
- isphdr_t ct_header;
- uint16_t ct_syshandle;
- uint16_t ct_fwhandle; /* required by f/w */
- uint8_t ct_lun; /* lun */
- uint8_t ct_iid; /* initiator id */
- uint8_t ct_reserved2;
- uint8_t ct_tgt; /* our target id */
- uint32_t ct_flags;
- uint8_t ct_status; /* isp status */
- uint8_t ct_scsi_status; /* scsi status */
- uint8_t ct_tag_val; /* tag value */
- uint8_t ct_tag_type; /* tag type */
- uint32_t ct_xfrlen; /* transfer length */
- uint32_t ct_resid; /* residual length */
- uint16_t ct_timeout;
- uint16_t ct_seg_count;
- ispds_t ct_dataseg[ISP_RQDSEG];
-} ct_entry_t;
-
-/*
- * For some of the dual port SCSI adapters, port (bus #) is reported
- * in the MSbit of ct_iid. Bit fields are a bit too awkward here.
- *
- * Note that this does not apply to FC adapters at all which can and
- * do report IIDs between 0x81 && 0xfe (or 0x7ff) which represent devices
- * that have logged in across a SCSI fabric.
- */
-#define GET_IID_VAL(x) (x & 0x3f)
-#define GET_BUS_VAL(x) ((x >> 7) & 0x1)
-#define SET_IID_VAL(y, x) y = ((y & ~0x3f) | (x & 0x3f))
-#define SET_BUS_VAL(y, x) y = ((y & 0x3f) | ((x & 0x1) << 7))
-
-/*
- * ct_flags values
- */
-#define CT_TQAE 0x00000002 /* bit 1, Tagged Queue Action enable */
-#define CT_DATA_IN 0x00000040 /* bits 6&7, Data direction - *to* initiator */
-#define CT_DATA_OUT 0x00000080 /* bits 6&7, Data direction - *from* initiator */
-#define CT_NO_DATA 0x000000C0 /* bits 6&7, Data direction */
-#define CT_CCINCR 0x00000100 /* bit 8, autoincrement atio count */
-#define CT_DATAMASK 0x000000C0 /* bits 6&7, Data direction */
-#define CT_INISYNCWIDE 0x00004000 /* bit 14, Do Sync/Wide Negotiation */
-#define CT_NODISC 0x00008000 /* bit 15, Disconnects disabled */
-#define CT_DSDP 0x01000000 /* bit 24, Disable Save Data Pointers */
-#define CT_SENDRDP 0x04000000 /* bit 26, Send Restore Pointers msg */
-#define CT_SENDSTATUS 0x80000000 /* bit 31, Send SCSI status byte */
-
-/*
- * ct_status values
- * - set by the firmware when it returns the CTIO
- */
-#define CT_OK 0x01 /* completed without error */
-#define CT_ABORTED 0x02 /* aborted by host */
-#define CT_ERR 0x04 /* see sense data for error */
-#define CT_INVAL 0x06 /* request for disabled lun */
-#define CT_NOPATH 0x07 /* invalid ITL nexus */
-#define CT_INVRXID 0x08 /* (FC only) Invalid RX_ID */
-#define CT_DATA_OVER 0x09 /* (FC only) Data Overrun */
-#define CT_RSELTMO 0x0A /* reselection timeout after 2 tries */
-#define CT_TIMEOUT 0x0B /* timed out */
-#define CT_RESET 0x0E /* SCSI Bus Reset occurred */
-#define CT_PARITY 0x0F /* Uncorrectable Parity Error */
-#define CT_BUS_ERROR 0x10 /* (FC Only) DMA PCI Error */
-#define CT_PANIC 0x13 /* Unrecoverable Error */
-#define CT_PHASE_ERROR 0x14 /* Bus phase sequence error */
-#define CT_DATA_UNDER 0x15 /* (FC only) Data Underrun */
-#define CT_BDR_MSG 0x17 /* Bus Device Reset msg received */
-#define CT_TERMINATED 0x19 /* due to Terminate Transfer mbox cmd */
-#define CT_PORTUNAVAIL 0x28 /* port not available */
-#define CT_LOGOUT 0x29 /* port logout */
-#define CT_PORTCHANGED 0x2A /* port changed */
-#define CT_IDE 0x33 /* Initiator Detected Error */
-#define CT_NOACK 0x35 /* Outstanding Immed. Notify. entry */
-#define CT_SRR 0x45 /* SRR Received */
-#define CT_LUN_RESET 0x48 /* Lun Reset Received */
-
#define CT_HBA_RESET 0xffff /* pseudo error - command destroyed by HBA reset*/
/*
- * When the firmware returns a CTIO entry, it may overwrite the last
- * part of the structure with sense data. This starts at offset 0x2E
- * into the entry, which is in the middle of ct_dataseg[1]. Rather
- * than define a new struct for this, I'm just using the sense data
- * offset.
- */
-#define CTIO_SENSE_OFFSET 0x2E
-
-/*
- * Entry length in u_longs. All entries are the same size so
- * any one will do as the numerator.
- */
-#define UINT32_ENTRY_SIZE (sizeof(at_entry_t)/sizeof(uint32_t))
-
-/*
- * QLA2100 CTIO (type 2) entry
- */
-#define MAXRESPLEN 26
-typedef struct {
- isphdr_t ct_header;
- uint32_t ct_syshandle;
- uint8_t ct_lun; /* lun */
- uint8_t ct_iid; /* initiator id */
- uint16_t ct_rxid; /* response ID */
- uint16_t ct_flags;
- uint16_t ct_status; /* isp status */
- uint16_t ct_timeout;
- uint16_t ct_seg_count;
- uint32_t ct_reloff; /* relative offset */
- uint32_t ct_resid; /* residual length */
- union {
- /*
- * The three different modes that the target driver
- * can set the CTIO{2,3,4} up as.
- *
- * The first is for sending FCP_DATA_IUs as well as
- * (optionally) sending a terminal SCSI status FCP_RSP_IU.
- *
- * The second is for sending SCSI sense data in an FCP_RSP_IU.
- * Note that no FCP_DATA_IUs will be sent.
- *
- * The third is for sending FCP_RSP_IUs as built specifically
- * in system memory as located by the isp_dataseg.
- */
- struct {
- uint32_t _reserved;
- uint16_t _reserved2;
- uint16_t ct_scsi_status;
- uint32_t ct_xfrlen;
- union {
- ispds_t ct_dataseg[ISP_RQDSEG_T2];
- ispds64_t ct_dataseg64[ISP_RQDSEG_T3];
- ispdslist_t ct_dslist;
- } u;
- } m0;
- struct {
- uint16_t _reserved;
- uint16_t _reserved2;
- uint16_t ct_senselen;
- uint16_t ct_scsi_status;
- uint16_t ct_resplen;
- uint8_t ct_resp[MAXRESPLEN];
- } m1;
- struct {
- uint32_t _reserved;
- uint16_t _reserved2;
- uint16_t _reserved3;
- uint32_t ct_datalen;
- union {
- ispds_t ct_fcp_rsp_iudata_32;
- ispds64_t ct_fcp_rsp_iudata_64;
- } u;
- } m2;
- } rsp;
-} ct2_entry_t;
-
-typedef struct {
- isphdr_t ct_header;
- uint32_t ct_syshandle;
- uint16_t ct_iid; /* initiator id */
- uint16_t ct_rxid; /* response ID */
- uint16_t ct_flags;
- uint16_t ct_status; /* isp status */
- uint16_t ct_timeout;
- uint16_t ct_seg_count;
- uint32_t ct_reloff; /* relative offset */
- uint32_t ct_resid; /* residual length */
- union {
- struct {
- uint32_t _reserved;
- uint16_t _reserved2;
- uint16_t ct_scsi_status;
- uint32_t ct_xfrlen;
- union {
- ispds_t ct_dataseg[ISP_RQDSEG_T2];
- ispds64_t ct_dataseg64[ISP_RQDSEG_T3];
- ispdslist_t ct_dslist;
- } u;
- } m0;
- struct {
- uint16_t _reserved;
- uint16_t _reserved2;
- uint16_t ct_senselen;
- uint16_t ct_scsi_status;
- uint16_t ct_resplen;
- uint8_t ct_resp[MAXRESPLEN];
- } m1;
- struct {
- uint32_t _reserved;
- uint16_t _reserved2;
- uint16_t _reserved3;
- uint32_t ct_datalen;
- union {
- ispds_t ct_fcp_rsp_iudata_32;
- ispds64_t ct_fcp_rsp_iudata_64;
- } u;
- } m2;
- } rsp;
-} ct2e_entry_t;
-
-/*
- * ct_flags values for CTIO2
- */
-#define CT2_FLAG_MODE0 0x0000
-#define CT2_FLAG_MODE1 0x0001
-#define CT2_FLAG_MODE2 0x0002
-#define CT2_FLAG_MMASK 0x0003
-#define CT2_DATA_IN 0x0040 /* *to* initiator */
-#define CT2_DATA_OUT 0x0080 /* *from* initiator */
-#define CT2_NO_DATA 0x00C0
-#define CT2_DATAMASK 0x00C0
-#define CT2_CCINCR 0x0100
-#define CT2_FASTPOST 0x0200
-#define CT2_CONFIRM 0x2000
-#define CT2_TERMINATE 0x4000
-#define CT2_SENDSTATUS 0x8000
-
-/*
- * ct_status values are (mostly) the same as that for ct_entry.
- */
-
-/*
- * ct_scsi_status values- the low 8 bits are the normal SCSI status
- * we know and love. The upper 8 bits are validity markers for FCP_RSP_IU
- * fields.
- */
-#define CT2_RSPLEN_VALID 0x0100
-#define CT2_SNSLEN_VALID 0x0200
-#define CT2_DATA_OVER 0x0400
-#define CT2_DATA_UNDER 0x0800
-
-/*
* ISP24XX CTIO
*/
#define MAXRESPLEN_24XX 24
@@ -2708,11 +1707,10 @@ typedef struct {
* can deal with based not on the size of the segment counter
* (which is 16 bits), but on the size of the number of
* queue entries field (which is 8 bits). We assume no
- * segments in the first queue entry, so we can either
- * have 7 dma segments per continuation entry or 5
- * (for 64 bit dma).. multiplying out by 254....
+ * segments in the first queue entry, so we can have
+ * have 5 dma segments per continuation entry...
+ * multiplying out by 254....
*/
-#define ISP_NSEG_MAX 1778
#define ISP_NSEG64_MAX 1270
#endif /* _ISPMBOX_H */
diff --git a/sys/dev/isp/ispreg.h b/sys/dev/isp/ispreg.h
index 0d72b94f207c..556626e3bafb 100644
--- a/sys/dev/isp/ispreg.h
+++ b/sys/dev/isp/ispreg.h
@@ -2,6 +2,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
+ * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
*
@@ -51,79 +52,15 @@
*/
/*
- * Offsets for various register blocks.
- *
- * Sad but true, different architectures have different offsets.
- *
- * Don't be alarmed if none of this makes sense. The original register
- * layout set some defines in a certain pattern. Everything else has been
- * grafted on since. For example, the ISP1080 manual will state that DMA
- * registers start at 0x80 from the base of the register address space.
- * That's true, but for our purposes, we define DMA_REGS_OFF for the 1080
- * to start at offset 0x60 because the DMA registers are all defined to
- * be DMA_BLOCK+0x20 and so on. Clear?
- */
-
-#define BIU_REGS_OFF 0x00
-
-#define PCI_MBOX_REGS_OFF 0x70
-#define PCI_MBOX_REGS2100_OFF 0x10
-#define PCI_MBOX_REGS2300_OFF 0x40
-#define PCI_MBOX_REGS2400_OFF 0x80
-#define SBUS_MBOX_REGS_OFF 0x80
-
-#define PCI_SXP_REGS_OFF 0x80
-#define SBUS_SXP_REGS_OFF 0x200
-
-#define PCI_RISC_REGS_OFF 0x80
-#define SBUS_RISC_REGS_OFF 0x400
-
-/* Bless me! Chip designers have putzed it again! */
-#define ISP1080_DMA_REGS_OFF 0x60
-#define DMA_REGS_OFF 0x00 /* same as BIU block */
-
-#define SBUS_REGSIZE 0x450
-#define PCI_REGSIZE 0x100
-
-/*
* NB: The *_BLOCK definitions have no specific hardware meaning.
* They serve simply to note to the MD layer which block of
* registers offsets are being accessed.
*/
-#define _NREG_BLKS 5
-#define _BLK_REG_SHFT 13
-#define _BLK_REG_MASK (7 << _BLK_REG_SHFT)
+#define _NREG_BLKS 2
+#define _BLK_REG_SHFT 7
+#define _BLK_REG_MASK (1 << _BLK_REG_SHFT)
#define BIU_BLOCK (0 << _BLK_REG_SHFT)
#define MBOX_BLOCK (1 << _BLK_REG_SHFT)
-#define SXP_BLOCK (2 << _BLK_REG_SHFT)
-#define RISC_BLOCK (3 << _BLK_REG_SHFT)
-#define DMA_BLOCK (4 << _BLK_REG_SHFT)
-
-/*
- * Bus Interface Block Register Offsets
- */
-
-#define BIU_ID_LO (BIU_BLOCK+0x0) /* R : Bus ID, Low */
-#define BIU2100_FLASH_ADDR (BIU_BLOCK+0x0)
-#define BIU_ID_HI (BIU_BLOCK+0x2) /* R : Bus ID, High */
-#define BIU2100_FLASH_DATA (BIU_BLOCK+0x2)
-#define BIU_CONF0 (BIU_BLOCK+0x4) /* R : Bus Configuration #0 */
-#define BIU_CONF1 (BIU_BLOCK+0x6) /* R : Bus Configuration #1 */
-#define BIU2100_CSR (BIU_BLOCK+0x6)
-#define BIU_ICR (BIU_BLOCK+0x8) /* RW : Bus Interface Ctrl */
-#define BIU_ISR (BIU_BLOCK+0xA) /* R : Bus Interface Status */
-#define BIU_SEMA (BIU_BLOCK+0xC) /* RW : Bus Semaphore */
-#define BIU_NVRAM (BIU_BLOCK+0xE) /* RW : Bus NVRAM */
-/*
- * These are specific to the 2300.
- */
-#define BIU_REQINP (BIU_BLOCK+0x10) /* Request Queue In */
-#define BIU_REQOUTP (BIU_BLOCK+0x12) /* Request Queue Out */
-#define BIU_RSPINP (BIU_BLOCK+0x14) /* Response Queue In */
-#define BIU_RSPOUTP (BIU_BLOCK+0x16) /* Response Queue Out */
-
-#define BIU_R2HSTSLO (BIU_BLOCK+0x18)
-#define BIU_R2HSTSHI (BIU_BLOCK+0x1A)
#define BIU_R2HST_INTR (1 << 15) /* RISC to Host Interrupt */
#define BIU_R2HST_PAUSED (1 << 8) /* RISC paused */
@@ -142,210 +79,6 @@
#define ISPR2HST_ATIO_RSPQ_UPDATE 0x1D /* ATIO & Request Update */
#define ISPR2HST_ATIO_UPDATE2 0x1E /* ATIO Queue Update */
-/* fifo command stuff- mostly for SPI */
-#define DFIFO_COMMAND (BIU_BLOCK+0x60) /* RW : Command FIFO Port */
-#define RDMA2100_CONTROL DFIFO_COMMAND
-#define DFIFO_DATA (BIU_BLOCK+0x62) /* RW : Data FIFO Port */
-
-/*
- * Putzed DMA register layouts.
- */
-#define CDMA_CONF (DMA_BLOCK+0x20) /* RW*: DMA Configuration */
-#define CDMA2100_CONTROL CDMA_CONF
-#define CDMA_CONTROL (DMA_BLOCK+0x22) /* RW*: DMA Control */
-#define CDMA_STATUS (DMA_BLOCK+0x24) /* R : DMA Status */
-#define CDMA_FIFO_STS (DMA_BLOCK+0x26) /* R : DMA FIFO Status */
-#define CDMA_COUNT (DMA_BLOCK+0x28) /* RW*: DMA Transfer Count */
-#define CDMA_ADDR0 (DMA_BLOCK+0x2C) /* RW*: DMA Address, Word 0 */
-#define CDMA_ADDR1 (DMA_BLOCK+0x2E) /* RW*: DMA Address, Word 1 */
-#define CDMA_ADDR2 (DMA_BLOCK+0x30) /* RW*: DMA Address, Word 2 */
-#define CDMA_ADDR3 (DMA_BLOCK+0x32) /* RW*: DMA Address, Word 3 */
-
-#define DDMA_CONF (DMA_BLOCK+0x40) /* RW*: DMA Configuration */
-#define TDMA2100_CONTROL DDMA_CONF
-#define DDMA_CONTROL (DMA_BLOCK+0x42) /* RW*: DMA Control */
-#define DDMA_STATUS (DMA_BLOCK+0x44) /* R : DMA Status */
-#define DDMA_FIFO_STS (DMA_BLOCK+0x46) /* R : DMA FIFO Status */
-#define DDMA_COUNT_LO (DMA_BLOCK+0x48) /* RW*: DMA Xfer Count, Low */
-#define DDMA_COUNT_HI (DMA_BLOCK+0x4A) /* RW*: DMA Xfer Count, High */
-#define DDMA_ADDR0 (DMA_BLOCK+0x4C) /* RW*: DMA Address, Word 0 */
-#define DDMA_ADDR1 (DMA_BLOCK+0x4E) /* RW*: DMA Address, Word 1 */
-/* these are for the 1040A cards */
-#define DDMA_ADDR2 (DMA_BLOCK+0x50) /* RW*: DMA Address, Word 2 */
-#define DDMA_ADDR3 (DMA_BLOCK+0x52) /* RW*: DMA Address, Word 3 */
-
-
-/*
- * Bus Interface Block Register Definitions
- */
-/* BUS CONFIGURATION REGISTER #0 */
-#define BIU_CONF0_HW_MASK 0x000F /* Hardware revision mask */
-/* BUS CONFIGURATION REGISTER #1 */
-
-#define BIU_SBUS_CONF1_PARITY 0x0100 /* Enable parity checking */
-#define BIU_SBUS_CONF1_FCODE_MASK 0x00F0 /* Fcode cycle mask */
-
-#define BIU_PCI_CONF1_FIFO_128 0x0040 /* 128 bytes FIFO threshold */
-#define BIU_PCI_CONF1_FIFO_64 0x0030 /* 64 bytes FIFO threshold */
-#define BIU_PCI_CONF1_FIFO_32 0x0020 /* 32 bytes FIFO threshold */
-#define BIU_PCI_CONF1_FIFO_16 0x0010 /* 16 bytes FIFO threshold */
-#define BIU_BURST_ENABLE 0x0004 /* Global enable Bus bursts */
-#define BIU_SBUS_CONF1_FIFO_64 0x0003 /* 64 bytes FIFO threshold */
-#define BIU_SBUS_CONF1_FIFO_32 0x0002 /* 32 bytes FIFO threshold */
-#define BIU_SBUS_CONF1_FIFO_16 0x0001 /* 16 bytes FIFO threshold */
-#define BIU_SBUS_CONF1_FIFO_8 0x0000 /* 8 bytes FIFO threshold */
-#define BIU_SBUS_CONF1_BURST8 0x0008 /* Enable 8-byte bursts */
-#define BIU_PCI_CONF1_SXP 0x0008 /* SXP register select */
-
-#define BIU_PCI1080_CONF1_SXP0 0x0100 /* SXP bank #1 select */
-#define BIU_PCI1080_CONF1_SXP1 0x0200 /* SXP bank #2 select */
-#define BIU_PCI1080_CONF1_DMA 0x0300 /* DMA bank select */
-
-/* ISP2100 Bus Control/Status Register */
-
-#define BIU2100_ICSR_REGBSEL 0x30 /* RW: register bank select */
-#define BIU2100_RISC_REGS (0 << 4) /* RISC Regs */
-#define BIU2100_FB_REGS (1 << 4) /* FrameBuffer Regs */
-#define BIU2100_FPM0_REGS (2 << 4) /* FPM 0 Regs */
-#define BIU2100_FPM1_REGS (3 << 4) /* FPM 1 Regs */
-#define BIU2100_NVRAM_OFFSET (1 << 14)
-#define BIU2100_FLASH_UPPER_64K 0x04 /* RW: Upper 64K Bank Select */
-#define BIU2100_FLASH_ENABLE 0x02 /* RW: Enable Flash RAM */
-#define BIU2100_SOFT_RESET 0x01
-/* SOFT RESET FOR ISP2100 is same bit, but in this register, not ICR */
-
-
-/* BUS CONTROL REGISTER */
-#define BIU_ICR_ENABLE_DMA_INT 0x0020 /* Enable DMA interrupts */
-#define BIU_ICR_ENABLE_CDMA_INT 0x0010 /* Enable CDMA interrupts */
-#define BIU_ICR_ENABLE_SXP_INT 0x0008 /* Enable SXP interrupts */
-#define BIU_ICR_ENABLE_RISC_INT 0x0004 /* Enable Risc interrupts */
-#define BIU_ICR_ENABLE_ALL_INTS 0x0002 /* Global enable all inter */
-#define BIU_ICR_SOFT_RESET 0x0001 /* Soft Reset of ISP */
-
-#define BIU_IMASK (BIU_ICR_ENABLE_RISC_INT|BIU_ICR_ENABLE_ALL_INTS)
-
-#define BIU2100_ICR_ENABLE_ALL_INTS 0x8000
-#define BIU2100_ICR_ENA_FPM_INT 0x0020
-#define BIU2100_ICR_ENA_FB_INT 0x0010
-#define BIU2100_ICR_ENA_RISC_INT 0x0008
-#define BIU2100_ICR_ENA_CDMA_INT 0x0004
-#define BIU2100_ICR_ENABLE_RXDMA_INT 0x0002
-#define BIU2100_ICR_ENABLE_TXDMA_INT 0x0001
-#define BIU2100_ICR_DISABLE_ALL_INTS 0x0000
-
-#define BIU2100_IMASK (BIU2100_ICR_ENA_RISC_INT|BIU2100_ICR_ENABLE_ALL_INTS)
-
-/* BUS STATUS REGISTER */
-#define BIU_ISR_DMA_INT 0x0020 /* DMA interrupt pending */
-#define BIU_ISR_CDMA_INT 0x0010 /* CDMA interrupt pending */
-#define BIU_ISR_SXP_INT 0x0008 /* SXP interrupt pending */
-#define BIU_ISR_RISC_INT 0x0004 /* Risc interrupt pending */
-#define BIU_ISR_IPEND 0x0002 /* Global interrupt pending */
-
-#define BIU2100_ISR_INT_PENDING 0x8000 /* Global interrupt pending */
-#define BIU2100_ISR_FPM_INT 0x0020 /* FPM interrupt pending */
-#define BIU2100_ISR_FB_INT 0x0010 /* FB interrupt pending */
-#define BIU2100_ISR_RISC_INT 0x0008 /* Risc interrupt pending */
-#define BIU2100_ISR_CDMA_INT 0x0004 /* CDMA interrupt pending */
-#define BIU2100_ISR_RXDMA_INT_PENDING 0x0002 /* Global interrupt pending */
-#define BIU2100_ISR_TXDMA_INT_PENDING 0x0001 /* Global interrupt pending */
-
-#define INT_PENDING_MASK(isp) \
- (IS_FC(isp)? (IS_24XX(isp)? BIU2400_ISR_RISC_INT : BIU2100_ISR_RISC_INT) : \
- (BIU_ISR_RISC_INT))
-
-/* BUS SEMAPHORE REGISTER */
-#define BIU_SEMA_STATUS 0x0002 /* Semaphore Status Bit */
-#define BIU_SEMA_LOCK 0x0001 /* Semaphore Lock Bit */
-
-/* NVRAM SEMAPHORE REGISTER */
-#define BIU_NVRAM_CLOCK 0x0001
-#define BIU_NVRAM_SELECT 0x0002
-#define BIU_NVRAM_DATAOUT 0x0004
-#define BIU_NVRAM_DATAIN 0x0008
-#define BIU_NVRAM_BUSY 0x0080 /* 2322/24xx only */
-#define ISP_NVRAM_READ 6
-
-/* COMNMAND && DATA DMA CONFIGURATION REGISTER */
-#define DMA_ENABLE_SXP_DMA 0x0008 /* Enable SXP to DMA Data */
-#define DMA_ENABLE_INTS 0x0004 /* Enable interrupts to RISC */
-#define DMA_ENABLE_BURST 0x0002 /* Enable Bus burst trans */
-#define DMA_DMA_DIRECTION 0x0001 /*
- * Set DMA direction:
- * 0 - DMA FIFO to host
- * 1 - Host to DMA FIFO
- */
-
-/* COMMAND && DATA DMA CONTROL REGISTER */
-#define DMA_CNTRL_SUSPEND_CHAN 0x0010 /* Suspend DMA transfer */
-#define DMA_CNTRL_CLEAR_CHAN 0x0008 /*
- * Clear FIFO and DMA Channel,
- * reset DMA registers
- */
-#define DMA_CNTRL_CLEAR_FIFO 0x0004 /* Clear DMA FIFO */
-#define DMA_CNTRL_RESET_INT 0x0002 /* Clear DMA interrupt */
-#define DMA_CNTRL_STROBE 0x0001 /* Start DMA transfer */
-
-/*
- * Variants of same for 2100
- */
-#define DMA_CNTRL2100_CLEAR_CHAN 0x0004
-#define DMA_CNTRL2100_RESET_INT 0x0002
-
-
-
-/* DMA STATUS REGISTER */
-#define DMA_SBUS_STATUS_PIPE_MASK 0x00C0 /* DMA Pipeline status mask */
-#define DMA_SBUS_STATUS_CHAN_MASK 0x0030 /* Channel status mask */
-#define DMA_SBUS_STATUS_BUS_PARITY 0x0008 /* Parity Error on bus */
-#define DMA_SBUS_STATUS_BUS_ERR 0x0004 /* Error Detected on bus */
-#define DMA_SBUS_STATUS_TERM_COUNT 0x0002 /* DMA Transfer Completed */
-#define DMA_SBUS_STATUS_INTERRUPT 0x0001 /* Enable DMA channel inter */
-
-#define DMA_PCI_STATUS_INTERRUPT 0x8000 /* Enable DMA channel inter */
-#define DMA_PCI_STATUS_RETRY_STAT 0x4000 /* Retry status */
-#define DMA_PCI_STATUS_CHAN_MASK 0x3000 /* Channel status mask */
-#define DMA_PCI_STATUS_FIFO_OVR 0x0100 /* DMA FIFO overrun cond */
-#define DMA_PCI_STATUS_FIFO_UDR 0x0080 /* DMA FIFO underrun cond */
-#define DMA_PCI_STATUS_BUS_ERR 0x0040 /* Error Detected on bus */
-#define DMA_PCI_STATUS_BUS_PARITY 0x0020 /* Parity Error on bus */
-#define DMA_PCI_STATUS_CLR_PEND 0x0010 /* DMA clear pending */
-#define DMA_PCI_STATUS_TERM_COUNT 0x0008 /* DMA Transfer Completed */
-#define DMA_PCI_STATUS_DMA_SUSP 0x0004 /* DMA suspended */
-#define DMA_PCI_STATUS_PIPE_MASK 0x0003 /* DMA Pipeline status mask */
-
-/* DMA Status Register, pipeline status bits */
-#define DMA_SBUS_PIPE_FULL 0x00C0 /* Both pipeline stages full */
-#define DMA_SBUS_PIPE_OVERRUN 0x0080 /* Pipeline overrun */
-#define DMA_SBUS_PIPE_STAGE1 0x0040 /*
- * Pipeline stage 1 Loaded,
- * stage 2 empty
- */
-#define DMA_PCI_PIPE_FULL 0x0003 /* Both pipeline stages full */
-#define DMA_PCI_PIPE_OVERRUN 0x0002 /* Pipeline overrun */
-#define DMA_PCI_PIPE_STAGE1 0x0001 /*
- * Pipeline stage 1 Loaded,
- * stage 2 empty
- */
-#define DMA_PIPE_EMPTY 0x0000 /* All pipeline stages empty */
-
-/* DMA Status Register, channel status bits */
-#define DMA_SBUS_CHAN_SUSPEND 0x0030 /* Channel error or suspended */
-#define DMA_SBUS_CHAN_TRANSFER 0x0020 /* Chan transfer in progress */
-#define DMA_SBUS_CHAN_ACTIVE 0x0010 /* Chan trans to host active */
-#define DMA_PCI_CHAN_TRANSFER 0x3000 /* Chan transfer in progress */
-#define DMA_PCI_CHAN_SUSPEND 0x2000 /* Channel error or suspended */
-#define DMA_PCI_CHAN_ACTIVE 0x1000 /* Chan trans to host active */
-#define ISP_DMA_CHAN_IDLE 0x0000 /* Chan idle (normal comp) */
-
-
-/* DMA FIFO STATUS REGISTER */
-#define DMA_FIFO_STATUS_OVERRUN 0x0200 /* FIFO Overrun Condition */
-#define DMA_FIFO_STATUS_UNDERRUN 0x0100 /* FIFO Underrun Condition */
-#define DMA_FIFO_SBUS_COUNT_MASK 0x007F /* FIFO Byte count mask */
-#define DMA_FIFO_PCI_COUNT_MASK 0x00FF /* FIFO Byte count mask */
-
/*
* 2400 Interface Offsets and Register Definitions
*
@@ -353,11 +86,11 @@
* It is getting to be a genuine pain and challenge to keep the same model
* for all.
*/
-#define BIU2400_FLASH_ADDR (BIU_BLOCK+0x00)
-#define BIU2400_FLASH_DATA (BIU_BLOCK+0x04)
-#define BIU2400_CSR (BIU_BLOCK+0x08)
-#define BIU2400_ICR (BIU_BLOCK+0x0C)
-#define BIU2400_ISR (BIU_BLOCK+0x10)
+#define BIU2400_FLASH_ADDR (BIU_BLOCK+0x00) /* Flash Access Address */
+#define BIU2400_FLASH_DATA (BIU_BLOCK+0x04) /* Flash Data */
+#define BIU2400_CSR (BIU_BLOCK+0x08) /* ISP Control/Status */
+#define BIU2400_ICR (BIU_BLOCK+0x0C) /* ISP to PCI Interrupt Control */
+#define BIU2400_ISR (BIU_BLOCK+0x10) /* ISP to PCI Interrupt Status */
#define BIU2400_REQINP (BIU_BLOCK+0x1C) /* Request Queue In */
#define BIU2400_REQOUTP (BIU_BLOCK+0x20) /* Request Queue Out */
@@ -370,13 +103,13 @@
#define BIU2400_ATIO_RSPINP (BIU_BLOCK+0x3C) /* ATIO Queue In */
#define BIU2400_ATIO_RSPOUTP (BIU_BLOCK+0x40) /* ATIO Queue Out */
-#define BIU2400_R2HSTSLO (BIU_BLOCK+0x44)
-#define BIU2400_R2HSTSHI (BIU_BLOCK+0x46)
+#define BIU2400_R2HSTS (BIU_BLOCK+0x44) /* RISC to Host Status */
-#define BIU2400_HCCR (BIU_BLOCK+0x48)
-#define BIU2400_GPIOD (BIU_BLOCK+0x4C)
-#define BIU2400_GPIOE (BIU_BLOCK+0x50)
-#define BIU2400_HSEMA (BIU_BLOCK+0x58)
+#define BIU2400_HCCR (BIU_BLOCK+0x48) /* Host Command and Control Status */
+#define BIU2400_GPIOD (BIU_BLOCK+0x4C) /* General Purpose I/O Data */
+#define BIU2400_GPIOE (BIU_BLOCK+0x50) /* General Purpose I/O Enable */
+#define BIU2400_IOBBA (BIU_BLOCK+0x54) /* I/O Bus Base Address */
+#define BIU2400_HSEMA (BIU_BLOCK+0x58) /* Host-to-Host Semaphore */
/* BIU2400_FLASH_ADDR definitions */
#define BIU2400_FLASH_DFLAG (1 << 30)
@@ -399,7 +132,6 @@
#define BIU2400_ISR_RISC_INT 0x8
/* BIU2400_HCCR definitions */
-
#define HCCR_2400_CMD_NOP 0x00000000
#define HCCR_2400_CMD_RESET 0x10000000
#define HCCR_2400_CMD_CLEAR_RESET 0x20000000
@@ -417,7 +149,6 @@
/*
* Mailbox Block Register Offsets
*/
-
#define INMAILBOX0 (MBOX_BLOCK+0x0)
#define INMAILBOX1 (MBOX_BLOCK+0x2)
#define INMAILBOX2 (MBOX_BLOCK+0x4)
@@ -436,17 +167,10 @@
#define OUTMAILBOX6 (MBOX_BLOCK+0xC)
#define OUTMAILBOX7 (MBOX_BLOCK+0xE)
-/*
- * Strictly speaking, it's
- * SCSI && 2100 : 8 MBOX registers
- * 2200: 24 MBOX registers
- * 2300/2400: 32 MBOX registers
- */
#define MBOX_OFF(n) (MBOX_BLOCK + ((n) << 1))
-#define ISP_NMBOX(isp) ((IS_24XX(isp) || IS_23XX(isp))? 32 : (IS_2200(isp) ? 24 : 8))
-#define ISP_NMBOX_BMASK(isp) \
- ((IS_24XX(isp) || IS_23XX(isp))? 0xffffffff : (IS_2200(isp)? 0x00ffffff : 0xff))
+#define ISP_NMBOX(isp) 32
#define MAX_MAILBOX 32
+
/* if timeout == 0, then default timeout is picked */
#define MBCMD_DEFAULT_TIMEOUT 100000 /* 100 ms */
typedef struct {
@@ -470,644 +194,22 @@ typedef struct {
(mbxp)->logval = loglev; \
(mbxp)->timeout = timo
-
-/*
- * Fibre Protocol Module and Frame Buffer Register Offsets/Definitions (2X00).
- * NB: The RISC processor must be paused and the appropriate register
- * bank selected via BIU2100_CSR bits.
- */
-
-#define FPM_DIAG_CONFIG (BIU_BLOCK + 0x96)
-#define FPM_SOFT_RESET 0x0100
-
-#define FBM_CMD (BIU_BLOCK + 0xB8)
-#define FBMCMD_FIFO_RESET_ALL 0xA000
-
-
-/*
- * SXP Block Register Offsets
- */
-#define SXP_PART_ID (SXP_BLOCK+0x0) /* R : Part ID Code */
-#define SXP_CONFIG1 (SXP_BLOCK+0x2) /* RW*: Configuration Reg #1 */
-#define SXP_CONFIG2 (SXP_BLOCK+0x4) /* RW*: Configuration Reg #2 */
-#define SXP_CONFIG3 (SXP_BLOCK+0x6) /* RW*: Configuration Reg #2 */
-#define SXP_INSTRUCTION (SXP_BLOCK+0xC) /* RW*: Instruction Pointer */
-#define SXP_RETURN_ADDR (SXP_BLOCK+0x10) /* RW*: Return Address */
-#define SXP_COMMAND (SXP_BLOCK+0x14) /* RW*: Command */
-#define SXP_INTERRUPT (SXP_BLOCK+0x18) /* R : Interrupt */
-#define SXP_SEQUENCE (SXP_BLOCK+0x1C) /* RW*: Sequence */
-#define SXP_GROSS_ERR (SXP_BLOCK+0x1E) /* R : Gross Error */
-#define SXP_EXCEPTION (SXP_BLOCK+0x20) /* RW*: Exception Enable */
-#define SXP_OVERRIDE (SXP_BLOCK+0x24) /* RW*: Override */
-#define SXP_LIT_BASE (SXP_BLOCK+0x28) /* RW*: Literal Base */
-#define SXP_USER_FLAGS (SXP_BLOCK+0x2C) /* RW*: User Flags */
-#define SXP_USER_EXCEPT (SXP_BLOCK+0x30) /* RW*: User Exception */
-#define SXP_BREAKPOINT (SXP_BLOCK+0x34) /* RW*: Breakpoint */
-#define SXP_SCSI_ID (SXP_BLOCK+0x40) /* RW*: SCSI ID */
-#define SXP_DEV_CONFIG1 (SXP_BLOCK+0x42) /* RW*: Device Config Reg #1 */
-#define SXP_DEV_CONFIG2 (SXP_BLOCK+0x44) /* RW*: Device Config Reg #2 */
-#define SXP_PHASE_PTR (SXP_BLOCK+0x48) /* RW*: SCSI Phase Pointer */
-#define SXP_BUF_PTR (SXP_BLOCK+0x4C) /* RW*: SCSI Buffer Pointer */
-#define SXP_BUF_CTR (SXP_BLOCK+0x50) /* RW*: SCSI Buffer Counter */
-#define SXP_BUFFER (SXP_BLOCK+0x52) /* RW*: SCSI Buffer */
-#define SXP_BUF_BYTE (SXP_BLOCK+0x54) /* RW*: SCSI Buffer Byte */
-#define SXP_BUF_WD (SXP_BLOCK+0x56) /* RW*: SCSI Buffer Word */
-#define SXP_BUF_WD_TRAN (SXP_BLOCK+0x58) /* RW*: SCSI Buffer Wd xlate */
-#define SXP_FIFO (SXP_BLOCK+0x5A) /* RW*: SCSI FIFO */
-#define SXP_FIFO_STATUS (SXP_BLOCK+0x5C) /* RW*: SCSI FIFO Status */
-#define SXP_FIFO_TOP (SXP_BLOCK+0x5E) /* RW*: SCSI FIFO Top Resid */
-#define SXP_FIFO_BOTTOM (SXP_BLOCK+0x60) /* RW*: SCSI FIFO Bot Resid */
-#define SXP_TRAN_REG (SXP_BLOCK+0x64) /* RW*: SCSI Transferr Reg */
-#define SXP_TRAN_CNT_LO (SXP_BLOCK+0x68) /* RW*: SCSI Trans Count */
-#define SXP_TRAN_CNT_HI (SXP_BLOCK+0x6A) /* RW*: SCSI Trans Count */
-#define SXP_TRAN_CTR_LO (SXP_BLOCK+0x6C) /* RW*: SCSI Trans Counter */
-#define SXP_TRAN_CTR_HI (SXP_BLOCK+0x6E) /* RW*: SCSI Trans Counter */
-#define SXP_ARB_DATA (SXP_BLOCK+0x70) /* R : SCSI Arb Data */
-#define SXP_PINS_CTRL (SXP_BLOCK+0x72) /* RW*: SCSI Control Pins */
-#define SXP_PINS_DATA (SXP_BLOCK+0x74) /* RW*: SCSI Data Pins */
-#define SXP_PINS_DIFF (SXP_BLOCK+0x76) /* RW*: SCSI Diff Pins */
-
-/* for 1080/1280/1240 only */
-#define SXP_BANK1_SELECT 0x100
-
-
-/* SXP CONF1 REGISTER */
-#define SXP_CONF1_ASYNCH_SETUP 0xF000 /* Asynchronous setup time */
-#define SXP_CONF1_SELECTION_UNIT 0x0000 /* Selection time unit */
-#define SXP_CONF1_SELECTION_TIMEOUT 0x0600 /* Selection timeout */
-#define SXP_CONF1_CLOCK_FACTOR 0x00E0 /* Clock factor */
-#define SXP_CONF1_SCSI_ID 0x000F /* SCSI id */
-
-/* SXP CONF2 REGISTER */
-#define SXP_CONF2_DISABLE_FILTER 0x0040 /* Disable SCSI rec filters */
-#define SXP_CONF2_REQ_ACK_PULLUPS 0x0020 /* Enable req/ack pullups */
-#define SXP_CONF2_DATA_PULLUPS 0x0010 /* Enable data pullups */
-#define SXP_CONF2_CONFIG_AUTOLOAD 0x0008 /* Enable dev conf auto-load */
-#define SXP_CONF2_RESELECT 0x0002 /* Enable reselection */
-#define SXP_CONF2_SELECT 0x0001 /* Enable selection */
-
-/* SXP INTERRUPT REGISTER */
-#define SXP_INT_PARITY_ERR 0x8000 /* Parity error detected */
-#define SXP_INT_GROSS_ERR 0x4000 /* Gross error detected */
-#define SXP_INT_FUNCTION_ABORT 0x2000 /* Last cmd aborted */
-#define SXP_INT_CONDITION_FAILED 0x1000 /* Last cond failed test */
-#define SXP_INT_FIFO_EMPTY 0x0800 /* SCSI FIFO is empty */
-#define SXP_INT_BUF_COUNTER_ZERO 0x0400 /* SCSI buf count == zero */
-#define SXP_INT_XFER_ZERO 0x0200 /* SCSI trans count == zero */
-#define SXP_INT_INT_PENDING 0x0080 /* SXP interrupt pending */
-#define SXP_INT_CMD_RUNNING 0x0040 /* SXP is running a command */
-#define SXP_INT_INT_RETURN_CODE 0x000F /* Interrupt return code */
-
-
-/* SXP GROSS ERROR REGISTER */
-#define SXP_GROSS_OFFSET_RESID 0x0040 /* Req/Ack offset not zero */
-#define SXP_GROSS_OFFSET_UNDERFLOW 0x0020 /* Req/Ack offset underflow */
-#define SXP_GROSS_OFFSET_OVERFLOW 0x0010 /* Req/Ack offset overflow */
-#define SXP_GROSS_FIFO_UNDERFLOW 0x0008 /* SCSI FIFO underflow */
-#define SXP_GROSS_FIFO_OVERFLOW 0x0004 /* SCSI FIFO overflow */
-#define SXP_GROSS_WRITE_ERR 0x0002 /* SXP and RISC wrote to reg */
-#define SXP_GROSS_ILLEGAL_INST 0x0001 /* Bad inst loaded into SXP */
-
-/* SXP EXCEPTION REGISTER */
-#define SXP_EXCEPT_USER_0 0x8000 /* Enable user exception #0 */
-#define SXP_EXCEPT_USER_1 0x4000 /* Enable user exception #1 */
-#define PCI_SXP_EXCEPT_SCAM 0x0400 /* SCAM Selection enable */
-#define SXP_EXCEPT_BUS_FREE 0x0200 /* Enable Bus Free det */
-#define SXP_EXCEPT_TARGET_ATN 0x0100 /* Enable TGT mode atten det */
-#define SXP_EXCEPT_RESELECTED 0x0080 /* Enable ReSEL exc handling */
-#define SXP_EXCEPT_SELECTED 0x0040 /* Enable SEL exc handling */
-#define SXP_EXCEPT_ARBITRATION 0x0020 /* Enable ARB exc handling */
-#define SXP_EXCEPT_GROSS_ERR 0x0010 /* Enable gross error except */
-#define SXP_EXCEPT_BUS_RESET 0x0008 /* Enable Bus Reset except */
-
- /* SXP OVERRIDE REGISTER */
-#define SXP_ORIDE_EXT_TRIGGER 0x8000 /* Enable external trigger */
-#define SXP_ORIDE_STEP 0x4000 /* Enable single step mode */
-#define SXP_ORIDE_BREAKPOINT 0x2000 /* Enable breakpoint reg */
-#define SXP_ORIDE_PIN_WRITE 0x1000 /* Enable write to SCSI pins */
-#define SXP_ORIDE_FORCE_OUTPUTS 0x0800 /* Force SCSI outputs on */
-#define SXP_ORIDE_LOOPBACK 0x0400 /* Enable SCSI loopback mode */
-#define SXP_ORIDE_PARITY_TEST 0x0200 /* Enable parity test mode */
-#define SXP_ORIDE_TRISTATE_ENA_PINS 0x0100 /* Tristate SCSI enable pins */
-#define SXP_ORIDE_TRISTATE_PINS 0x0080 /* Tristate SCSI pins */
-#define SXP_ORIDE_FIFO_RESET 0x0008 /* Reset SCSI FIFO */
-#define SXP_ORIDE_CMD_TERMINATE 0x0004 /* Terminate cur SXP com */
-#define SXP_ORIDE_RESET_REG 0x0002 /* Reset SXP registers */
-#define SXP_ORIDE_RESET_MODULE 0x0001 /* Reset SXP module */
-
-/* SXP COMMANDS */
-#define SXP_RESET_BUS_CMD 0x300b
-
-/* SXP SCSI ID REGISTER */
-#define SXP_SELECTING_ID 0x0F00 /* (Re)Selecting id */
-#define SXP_SELECT_ID 0x000F /* Select id */
-
-/* SXP DEV CONFIG1 REGISTER */
-#define SXP_DCONF1_SYNC_HOLD 0x7000 /* Synchronous data hold */
-#define SXP_DCONF1_SYNC_SETUP 0x0F00 /* Synchronous data setup */
-#define SXP_DCONF1_SYNC_OFFSET 0x000F /* Synchronous data offset */
-
-
-/* SXP DEV CONFIG2 REGISTER */
-#define SXP_DCONF2_FLAGS_MASK 0xF000 /* Device flags */
-#define SXP_DCONF2_WIDE 0x0400 /* Enable wide SCSI */
-#define SXP_DCONF2_PARITY 0x0200 /* Enable parity checking */
-#define SXP_DCONF2_BLOCK_MODE 0x0100 /* Enable blk mode xfr count */
-#define SXP_DCONF2_ASSERTION_MASK 0x0007 /* Assersion period mask */
-
-
-/* SXP PHASE POINTER REGISTER */
-#define SXP_PHASE_STATUS_PTR 0x1000 /* Status buffer offset */
-#define SXP_PHASE_MSG_IN_PTR 0x0700 /* Msg in buffer offset */
-#define SXP_PHASE_COM_PTR 0x00F0 /* Command buffer offset */
-#define SXP_PHASE_MSG_OUT_PTR 0x0007 /* Msg out buffer offset */
-
-
-/* SXP FIFO STATUS REGISTER */
-#define SXP_FIFO_TOP_RESID 0x8000 /* Top residue reg full */
-#define SXP_FIFO_ACK_RESID 0x4000 /* Wide transfers odd resid */
-#define SXP_FIFO_COUNT_MASK 0x001C /* Words in SXP FIFO */
-#define SXP_FIFO_BOTTOM_RESID 0x0001 /* Bottom residue reg full */
-
-
-/* SXP CONTROL PINS REGISTER */
-#define SXP_PINS_CON_PHASE 0x8000 /* Scsi phase valid */
-#define SXP_PINS_CON_PARITY_HI 0x0400 /* Parity pin */
-#define SXP_PINS_CON_PARITY_LO 0x0200 /* Parity pin */
-#define SXP_PINS_CON_REQ 0x0100 /* SCSI bus REQUEST */
-#define SXP_PINS_CON_ACK 0x0080 /* SCSI bus ACKNOWLEDGE */
-#define SXP_PINS_CON_RST 0x0040 /* SCSI bus RESET */
-#define SXP_PINS_CON_BSY 0x0020 /* SCSI bus BUSY */
-#define SXP_PINS_CON_SEL 0x0010 /* SCSI bus SELECT */
-#define SXP_PINS_CON_ATN 0x0008 /* SCSI bus ATTENTION */
-#define SXP_PINS_CON_MSG 0x0004 /* SCSI bus MESSAGE */
-#define SXP_PINS_CON_CD 0x0002 /* SCSI bus COMMAND */
-#define SXP_PINS_CON_IO 0x0001 /* SCSI bus INPUT */
-
-/*
- * Set the hold time for the SCSI Bus Reset to be 250 ms
- */
-#define SXP_SCSI_BUS_RESET_HOLD_TIME 250
-
-/* SXP DIFF PINS REGISTER */
-#define SXP_PINS_DIFF_SENSE 0x0200 /* DIFFSENS sig on SCSI bus */
-#define SXP_PINS_DIFF_MODE 0x0100 /* DIFFM signal */
-#define SXP_PINS_DIFF_ENABLE_OUTPUT 0x0080 /* Enable SXP SCSI data drv */
-#define SXP_PINS_DIFF_PINS_MASK 0x007C /* Differential control pins */
-#define SXP_PINS_DIFF_TARGET 0x0002 /* Enable SXP target mode */
-#define SXP_PINS_DIFF_INITIATOR 0x0001 /* Enable SXP initiator mode */
-
-/* Ultra2 only */
-#define SXP_PINS_LVD_MODE 0x1000
-#define SXP_PINS_HVD_MODE 0x0800
-#define SXP_PINS_SE_MODE 0x0400
-#define SXP_PINS_MODE_MASK (SXP_PINS_LVD_MODE|SXP_PINS_HVD_MODE|SXP_PINS_SE_MODE)
-
-/* The above have to be put together with the DIFFM pin to make sense */
-#define ISP1080_LVD_MODE (SXP_PINS_LVD_MODE)
-#define ISP1080_HVD_MODE (SXP_PINS_HVD_MODE|SXP_PINS_DIFF_MODE)
-#define ISP1080_SE_MODE (SXP_PINS_SE_MODE)
-#define ISP1080_MODE_MASK (SXP_PINS_MODE_MASK|SXP_PINS_DIFF_MODE)
-
-/*
- * RISC and Host Command and Control Block Register Offsets
- */
-
-#define RISC_ACC RISC_BLOCK+0x0 /* RW*: Accumulator */
-#define RISC_R1 RISC_BLOCK+0x2 /* RW*: GP Reg R1 */
-#define RISC_R2 RISC_BLOCK+0x4 /* RW*: GP Reg R2 */
-#define RISC_R3 RISC_BLOCK+0x6 /* RW*: GP Reg R3 */
-#define RISC_R4 RISC_BLOCK+0x8 /* RW*: GP Reg R4 */
-#define RISC_R5 RISC_BLOCK+0xA /* RW*: GP Reg R5 */
-#define RISC_R6 RISC_BLOCK+0xC /* RW*: GP Reg R6 */
-#define RISC_R7 RISC_BLOCK+0xE /* RW*: GP Reg R7 */
-#define RISC_R8 RISC_BLOCK+0x10 /* RW*: GP Reg R8 */
-#define RISC_R9 RISC_BLOCK+0x12 /* RW*: GP Reg R9 */
-#define RISC_R10 RISC_BLOCK+0x14 /* RW*: GP Reg R10 */
-#define RISC_R11 RISC_BLOCK+0x16 /* RW*: GP Reg R11 */
-#define RISC_R12 RISC_BLOCK+0x18 /* RW*: GP Reg R12 */
-#define RISC_R13 RISC_BLOCK+0x1a /* RW*: GP Reg R13 */
-#define RISC_R14 RISC_BLOCK+0x1c /* RW*: GP Reg R14 */
-#define RISC_R15 RISC_BLOCK+0x1e /* RW*: GP Reg R15 */
-#define RISC_PSR RISC_BLOCK+0x20 /* RW*: Processor Status */
-#define RISC_IVR RISC_BLOCK+0x22 /* RW*: Interrupt Vector */
-#define RISC_PCR RISC_BLOCK+0x24 /* RW*: Processor Ctrl */
-#define RISC_RAR0 RISC_BLOCK+0x26 /* RW*: Ram Address #0 */
-#define RISC_RAR1 RISC_BLOCK+0x28 /* RW*: Ram Address #1 */
-#define RISC_LCR RISC_BLOCK+0x2a /* RW*: Loop Counter */
-#define RISC_PC RISC_BLOCK+0x2c /* R : Program Counter */
-#define RISC_MTR RISC_BLOCK+0x2e /* RW*: Memory Timing */
-#define RISC_MTR2100 RISC_BLOCK+0x30
-
-#define RISC_EMB RISC_BLOCK+0x30 /* RW*: Ext Mem Boundary */
-#define DUAL_BANK 8
-#define RISC_SP RISC_BLOCK+0x32 /* RW*: Stack Pointer */
-#define RISC_HRL RISC_BLOCK+0x3e /* R *: Hardware Rev Level */
-#define HCCR RISC_BLOCK+0x40 /* RW : Host Command & Ctrl */
-#define BP0 RISC_BLOCK+0x42 /* RW : Processor Brkpt #0 */
-#define BP1 RISC_BLOCK+0x44 /* RW : Processor Brkpt #1 */
-#define TCR RISC_BLOCK+0x46 /* W : Test Control */
-#define TMR RISC_BLOCK+0x48 /* W : Test Mode */
-
-
-/* PROCESSOR STATUS REGISTER */
-#define RISC_PSR_FORCE_TRUE 0x8000
-#define RISC_PSR_LOOP_COUNT_DONE 0x4000
-#define RISC_PSR_RISC_INT 0x2000
-#define RISC_PSR_TIMER_ROLLOVER 0x1000
-#define RISC_PSR_ALU_OVERFLOW 0x0800
-#define RISC_PSR_ALU_MSB 0x0400
-#define RISC_PSR_ALU_CARRY 0x0200
-#define RISC_PSR_ALU_ZERO 0x0100
-
-#define RISC_PSR_PCI_ULTRA 0x0080
-#define RISC_PSR_SBUS_ULTRA 0x0020
-
-#define RISC_PSR_DMA_INT 0x0010
-#define RISC_PSR_SXP_INT 0x0008
-#define RISC_PSR_HOST_INT 0x0004
-#define RISC_PSR_INT_PENDING 0x0002
-#define RISC_PSR_FORCE_FALSE 0x0001
-
-
-/* Host Command and Control */
-#define HCCR_CMD_NOP 0x0000 /* NOP */
-#define HCCR_CMD_RESET 0x1000 /* Reset RISC */
-#define HCCR_CMD_PAUSE 0x2000 /* Pause RISC */
-#define HCCR_CMD_RELEASE 0x3000 /* Release Paused RISC */
-#define HCCR_CMD_STEP 0x4000 /* Single Step RISC */
-#define HCCR_2X00_DISABLE_PARITY_PAUSE 0x4001 /*
- * Disable RISC pause on FPM
- * parity error.
- */
-#define HCCR_CMD_SET_HOST_INT 0x5000 /* Set Host Interrupt */
-#define HCCR_CMD_CLEAR_HOST_INT 0x6000 /* Clear Host Interrupt */
-#define HCCR_CMD_CLEAR_RISC_INT 0x7000 /* Clear RISC interrupt */
-#define HCCR_CMD_BREAKPOINT 0x8000 /* Change breakpoint enables */
-#define PCI_HCCR_CMD_BIOS 0x9000 /* Write BIOS (disable) */
-#define PCI_HCCR_CMD_PARITY 0xA000 /* Write parity enable */
-#define PCI_HCCR_CMD_PARITY_ERR 0xE000 /* Generate parity error */
-#define HCCR_CMD_TEST_MODE 0xF000 /* Set Test Mode */
-
-
-#define ISP2100_HCCR_PARITY_ENABLE_2 0x0400
-#define ISP2100_HCCR_PARITY_ENABLE_1 0x0200
-#define ISP2100_HCCR_PARITY_ENABLE_0 0x0100
-#define ISP2100_HCCR_PARITY 0x0001
-
-#define PCI_HCCR_PARITY 0x0400 /* Parity error flag */
-#define PCI_HCCR_PARITY_ENABLE_1 0x0200 /* Parity enable bank 1 */
-#define PCI_HCCR_PARITY_ENABLE_0 0x0100 /* Parity enable bank 0 */
-
-#define HCCR_HOST_INT 0x0080 /* R : Host interrupt set */
-#define HCCR_RESET 0x0040 /* R : reset in progress */
-#define HCCR_PAUSE 0x0020 /* R : RISC paused */
-
-#define PCI_HCCR_BIOS 0x0001 /* W : BIOS enable */
-
/*
* Defines for Interrupts
*/
#define ISP_INTS_ENABLED(isp) \
- ((IS_SCSI(isp))? \
- (ISP_READ(isp, BIU_ICR) & BIU_IMASK) : \
- (IS_24XX(isp)? (ISP_READ(isp, BIU2400_ICR) & BIU2400_IMASK) : \
- (ISP_READ(isp, BIU_ICR) & BIU2100_IMASK)))
+ (ISP_READ(isp, BIU2400_ICR) & BIU2400_IMASK)
#define ISP_ENABLE_INTS(isp) \
- (IS_SCSI(isp) ? \
- ISP_WRITE(isp, BIU_ICR, BIU_IMASK) : \
- (IS_24XX(isp) ? \
- (ISP_WRITE(isp, BIU2400_ICR, BIU2400_IMASK)) : \
- (ISP_WRITE(isp, BIU_ICR, BIU2100_IMASK))))
+ ISP_WRITE(isp, BIU2400_ICR, BIU2400_IMASK)
#define ISP_DISABLE_INTS(isp) \
- IS_24XX(isp)? ISP_WRITE(isp, BIU2400_ICR, 0) : ISP_WRITE(isp, BIU_ICR, 0)
+ ISP_WRITE(isp, BIU2400_ICR, 0)
/*
* NVRAM Definitions (PCI cards only)
*/
-#define ISPBSMX(c, byte, shift, mask) \
- (((c)[(byte)] >> (shift)) & (mask))
-/*
- * Qlogic 1020/1040 NVRAM is an array of 128 bytes.
- *
- * Some portion of the front of this is for general host adapter properties
- * This is followed by an array of per-target parameters, and is tailed off
- * with a checksum xor byte at offset 127. For non-byte entities data is
- * stored in Little Endian order.
- */
-
-#define ISP_NVRAM_SIZE 128
-
-#define ISP_NVRAM_VERSION(c) (c)[4]
-#define ISP_NVRAM_FIFO_THRESHOLD(c) ISPBSMX(c, 5, 0, 0x03)
-#define ISP_NVRAM_BIOS_DISABLE(c) ISPBSMX(c, 5, 2, 0x01)
-#define ISP_NVRAM_HBA_ENABLE(c) ISPBSMX(c, 5, 3, 0x01)
-#define ISP_NVRAM_INITIATOR_ID(c) ISPBSMX(c, 5, 4, 0x0f)
-#define ISP_NVRAM_BUS_RESET_DELAY(c) (c)[6]
-#define ISP_NVRAM_BUS_RETRY_COUNT(c) (c)[7]
-#define ISP_NVRAM_BUS_RETRY_DELAY(c) (c)[8]
-#define ISP_NVRAM_ASYNC_DATA_SETUP_TIME(c) ISPBSMX(c, 9, 0, 0x0f)
-#define ISP_NVRAM_REQ_ACK_ACTIVE_NEGATION(c) ISPBSMX(c, 9, 4, 0x01)
-#define ISP_NVRAM_DATA_LINE_ACTIVE_NEGATION(c) ISPBSMX(c, 9, 5, 0x01)
-#define ISP_NVRAM_DATA_DMA_BURST_ENABLE(c) ISPBSMX(c, 9, 6, 0x01)
-#define ISP_NVRAM_CMD_DMA_BURST_ENABLE(c) ISPBSMX(c, 9, 7, 0x01)
-#define ISP_NVRAM_TAG_AGE_LIMIT(c) (c)[10]
-#define ISP_NVRAM_LOWTRM_ENABLE(c) ISPBSMX(c, 11, 0, 0x01)
-#define ISP_NVRAM_HITRM_ENABLE(c) ISPBSMX(c, 11, 1, 0x01)
-#define ISP_NVRAM_PCMC_BURST_ENABLE(c) ISPBSMX(c, 11, 2, 0x01)
-#define ISP_NVRAM_ENABLE_60_MHZ(c) ISPBSMX(c, 11, 3, 0x01)
-#define ISP_NVRAM_SCSI_RESET_DISABLE(c) ISPBSMX(c, 11, 4, 0x01)
-#define ISP_NVRAM_ENABLE_AUTO_TERM(c) ISPBSMX(c, 11, 5, 0x01)
-#define ISP_NVRAM_FIFO_THRESHOLD_128(c) ISPBSMX(c, 11, 6, 0x01)
-#define ISP_NVRAM_AUTO_TERM_SUPPORT(c) ISPBSMX(c, 11, 7, 0x01)
-#define ISP_NVRAM_SELECTION_TIMEOUT(c) (((c)[12]) | ((c)[13] << 8))
-#define ISP_NVRAM_MAX_QUEUE_DEPTH(c) (((c)[14]) | ((c)[15] << 8))
-#define ISP_NVRAM_SCSI_BUS_SIZE(c) ISPBSMX(c, 16, 0, 0x01)
-#define ISP_NVRAM_SCSI_BUS_TYPE(c) ISPBSMX(c, 16, 1, 0x01)
-#define ISP_NVRAM_ADAPTER_CLK_SPEED(c) ISPBSMX(c, 16, 2, 0x01)
-#define ISP_NVRAM_SOFT_TERM_SUPPORT(c) ISPBSMX(c, 16, 3, 0x01)
-#define ISP_NVRAM_FLASH_ONBOARD(c) ISPBSMX(c, 16, 4, 0x01)
-#define ISP_NVRAM_FAST_MTTR_ENABLE(c) ISPBSMX(c, 22, 0, 0x01)
-
-#define ISP_NVRAM_TARGOFF 28
-#define ISP_NVRAM_TARGSIZE 6
-#define _IxT(tgt, tidx) \
- (ISP_NVRAM_TARGOFF + (ISP_NVRAM_TARGSIZE * (tgt)) + (tidx))
-#define ISP_NVRAM_TGT_RENEG(c, t) ISPBSMX(c, _IxT(t, 0), 0, 0x01)
-#define ISP_NVRAM_TGT_QFRZ(c, t) ISPBSMX(c, _IxT(t, 0), 1, 0x01)
-#define ISP_NVRAM_TGT_ARQ(c, t) ISPBSMX(c, _IxT(t, 0), 2, 0x01)
-#define ISP_NVRAM_TGT_TQING(c, t) ISPBSMX(c, _IxT(t, 0), 3, 0x01)
-#define ISP_NVRAM_TGT_SYNC(c, t) ISPBSMX(c, _IxT(t, 0), 4, 0x01)
-#define ISP_NVRAM_TGT_WIDE(c, t) ISPBSMX(c, _IxT(t, 0), 5, 0x01)
-#define ISP_NVRAM_TGT_PARITY(c, t) ISPBSMX(c, _IxT(t, 0), 6, 0x01)
-#define ISP_NVRAM_TGT_DISC(c, t) ISPBSMX(c, _IxT(t, 0), 7, 0x01)
-#define ISP_NVRAM_TGT_EXEC_THROTTLE(c, t) ISPBSMX(c, _IxT(t, 1), 0, 0xff)
-#define ISP_NVRAM_TGT_SYNC_PERIOD(c, t) ISPBSMX(c, _IxT(t, 2), 0, 0xff)
-#define ISP_NVRAM_TGT_SYNC_OFFSET(c, t) ISPBSMX(c, _IxT(t, 3), 0, 0x0f)
-#define ISP_NVRAM_TGT_DEVICE_ENABLE(c, t) ISPBSMX(c, _IxT(t, 3), 4, 0x01)
-#define ISP_NVRAM_TGT_LUN_DISABLE(c, t) ISPBSMX(c, _IxT(t, 3), 5, 0x01)
-
-/*
- * Qlogic 1080/1240 NVRAM is an array of 256 bytes.
- *
- * Some portion of the front of this is for general host adapter properties
- * This is followed by an array of per-target parameters, and is tailed off
- * with a checksum xor byte at offset 256. For non-byte entities data is
- * stored in Little Endian order.
- */
-
-#define ISP1080_NVRAM_SIZE 256
-
-#define ISP1080_NVRAM_VERSION(c) ISP_NVRAM_VERSION(c)
-
-/* Offset 5 */
-/*
- uint8_t bios_configuration_mode :2;
- uint8_t bios_disable :1;
- uint8_t selectable_scsi_boot_enable :1;
- uint8_t cd_rom_boot_enable :1;
- uint8_t disable_loading_risc_code :1;
- uint8_t enable_64bit_addressing :1;
- uint8_t unused_7 :1;
- */
-
-/* Offsets 6, 7 */
-/*
- uint8_t boot_lun_number :5;
- uint8_t scsi_bus_number :1;
- uint8_t unused_6 :1;
- uint8_t unused_7 :1;
- uint8_t boot_target_number :4;
- uint8_t unused_12 :1;
- uint8_t unused_13 :1;
- uint8_t unused_14 :1;
- uint8_t unused_15 :1;
- */
-
-#define ISP1080_NVRAM_HBA_ENABLE(c) ISPBSMX(c, 16, 3, 0x01)
-
-#define ISP1080_NVRAM_BURST_ENABLE(c) ISPBSMX(c, 16, 1, 0x01)
-#define ISP1080_NVRAM_FIFO_THRESHOLD(c) ISPBSMX(c, 16, 4, 0x0f)
-
-#define ISP1080_NVRAM_AUTO_TERM_SUPPORT(c) ISPBSMX(c, 17, 7, 0x01)
-#define ISP1080_NVRAM_BUS0_TERM_MODE(c) ISPBSMX(c, 17, 0, 0x03)
-#define ISP1080_NVRAM_BUS1_TERM_MODE(c) ISPBSMX(c, 17, 2, 0x03)
-
-#define ISP1080_ISP_PARAMETER(c) \
- (((c)[18]) | ((c)[19] << 8))
-
-#define ISP1080_FAST_POST(c) ISPBSMX(c, 20, 0, 0x01)
-#define ISP1080_REPORT_LVD_TRANSITION(c) ISPBSMX(c, 20, 1, 0x01)
-
-#define ISP1080_BUS1_OFF 112
-
-#define ISP1080_NVRAM_INITIATOR_ID(c, b) \
- ISPBSMX(c, ((b == 0)? 0 : ISP1080_BUS1_OFF) + 24, 0, 0x0f)
-#define ISP1080_NVRAM_BUS_RESET_DELAY(c, b) \
- (c)[((b == 0)? 0 : ISP1080_BUS1_OFF) + 25]
-#define ISP1080_NVRAM_BUS_RETRY_COUNT(c, b) \
- (c)[((b == 0)? 0 : ISP1080_BUS1_OFF) + 26]
-#define ISP1080_NVRAM_BUS_RETRY_DELAY(c, b) \
- (c)[((b == 0)? 0 : ISP1080_BUS1_OFF) + 27]
-
-#define ISP1080_NVRAM_ASYNC_DATA_SETUP_TIME(c, b) \
- ISPBSMX(c, ((b == 0)? 0 : ISP1080_BUS1_OFF) + 28, 0, 0x0f)
-#define ISP1080_NVRAM_REQ_ACK_ACTIVE_NEGATION(c, b) \
- ISPBSMX(c, ((b == 0)? 0 : ISP1080_BUS1_OFF) + 28, 4, 0x01)
-#define ISP1080_NVRAM_DATA_LINE_ACTIVE_NEGATION(c, b) \
- ISPBSMX(c, ((b == 0)? 0 : ISP1080_BUS1_OFF) + 28, 5, 0x01)
-#define ISP1080_NVRAM_SELECTION_TIMEOUT(c, b) \
- (((c)[((b == 0)? 0 : ISP1080_BUS1_OFF) + 30]) | \
- ((c)[((b == 0)? 0 : ISP1080_BUS1_OFF) + 31] << 8))
-#define ISP1080_NVRAM_MAX_QUEUE_DEPTH(c, b) \
- (((c)[((b == 0)? 0 : ISP1080_BUS1_OFF) + 32]) | \
- ((c)[((b == 0)? 0 : ISP1080_BUS1_OFF) + 33] << 8))
-
-#define ISP1080_NVRAM_TARGOFF(b) \
- ((b == 0)? 40: (40 + ISP1080_BUS1_OFF))
-#define ISP1080_NVRAM_TARGSIZE 6
-#define _IxT8(tgt, tidx, b) \
- (ISP1080_NVRAM_TARGOFF((b)) + (ISP1080_NVRAM_TARGSIZE * (tgt)) + (tidx))
-
-#define ISP1080_NVRAM_TGT_RENEG(c, t, b) \
- ISPBSMX(c, _IxT8(t, 0, (b)), 0, 0x01)
-#define ISP1080_NVRAM_TGT_QFRZ(c, t, b) \
- ISPBSMX(c, _IxT8(t, 0, (b)), 1, 0x01)
-#define ISP1080_NVRAM_TGT_ARQ(c, t, b) \
- ISPBSMX(c, _IxT8(t, 0, (b)), 2, 0x01)
-#define ISP1080_NVRAM_TGT_TQING(c, t, b) \
- ISPBSMX(c, _IxT8(t, 0, (b)), 3, 0x01)
-#define ISP1080_NVRAM_TGT_SYNC(c, t, b) \
- ISPBSMX(c, _IxT8(t, 0, (b)), 4, 0x01)
-#define ISP1080_NVRAM_TGT_WIDE(c, t, b) \
- ISPBSMX(c, _IxT8(t, 0, (b)), 5, 0x01)
-#define ISP1080_NVRAM_TGT_PARITY(c, t, b) \
- ISPBSMX(c, _IxT8(t, 0, (b)), 6, 0x01)
-#define ISP1080_NVRAM_TGT_DISC(c, t, b) \
- ISPBSMX(c, _IxT8(t, 0, (b)), 7, 0x01)
-#define ISP1080_NVRAM_TGT_EXEC_THROTTLE(c, t, b) \
- ISPBSMX(c, _IxT8(t, 1, (b)), 0, 0xff)
-#define ISP1080_NVRAM_TGT_SYNC_PERIOD(c, t, b) \
- ISPBSMX(c, _IxT8(t, 2, (b)), 0, 0xff)
-#define ISP1080_NVRAM_TGT_SYNC_OFFSET(c, t, b) \
- ISPBSMX(c, _IxT8(t, 3, (b)), 0, 0x0f)
-#define ISP1080_NVRAM_TGT_DEVICE_ENABLE(c, t, b) \
- ISPBSMX(c, _IxT8(t, 3, (b)), 4, 0x01)
-#define ISP1080_NVRAM_TGT_LUN_DISABLE(c, t, b) \
- ISPBSMX(c, _IxT8(t, 3, (b)), 5, 0x01)
-
-#define ISP12160_NVRAM_HBA_ENABLE ISP1080_NVRAM_HBA_ENABLE
-#define ISP12160_NVRAM_BURST_ENABLE ISP1080_NVRAM_BURST_ENABLE
-#define ISP12160_NVRAM_FIFO_THRESHOLD ISP1080_NVRAM_FIFO_THRESHOLD
-#define ISP12160_NVRAM_AUTO_TERM_SUPPORT ISP1080_NVRAM_AUTO_TERM_SUPPORT
-#define ISP12160_NVRAM_BUS0_TERM_MODE ISP1080_NVRAM_BUS0_TERM_MODE
-#define ISP12160_NVRAM_BUS1_TERM_MODE ISP1080_NVRAM_BUS1_TERM_MODE
-#define ISP12160_ISP_PARAMETER ISP12160_ISP_PARAMETER
-#define ISP12160_FAST_POST ISP1080_FAST_POST
-#define ISP12160_REPORT_LVD_TRANSITION ISP1080_REPORT_LVD_TRANSTION
-
-#define ISP12160_NVRAM_INITIATOR_ID \
- ISP1080_NVRAM_INITIATOR_ID
-#define ISP12160_NVRAM_BUS_RESET_DELAY \
- ISP1080_NVRAM_BUS_RESET_DELAY
-#define ISP12160_NVRAM_BUS_RETRY_COUNT \
- ISP1080_NVRAM_BUS_RETRY_COUNT
-#define ISP12160_NVRAM_BUS_RETRY_DELAY \
- ISP1080_NVRAM_BUS_RETRY_DELAY
-#define ISP12160_NVRAM_ASYNC_DATA_SETUP_TIME \
- ISP1080_NVRAM_ASYNC_DATA_SETUP_TIME
-#define ISP12160_NVRAM_REQ_ACK_ACTIVE_NEGATION \
- ISP1080_NVRAM_REQ_ACK_ACTIVE_NEGATION
-#define ISP12160_NVRAM_DATA_LINE_ACTIVE_NEGATION \
- ISP1080_NVRAM_DATA_LINE_ACTIVE_NEGATION
-#define ISP12160_NVRAM_SELECTION_TIMEOUT \
- ISP1080_NVRAM_SELECTION_TIMEOUT
-#define ISP12160_NVRAM_MAX_QUEUE_DEPTH \
- ISP1080_NVRAM_MAX_QUEUE_DEPTH
-
-
-#define ISP12160_BUS0_OFF 24
-#define ISP12160_BUS1_OFF 136
-
-#define ISP12160_NVRAM_TARGOFF(b) \
- (((b == 0)? ISP12160_BUS0_OFF : ISP12160_BUS1_OFF) + 16)
-
-#define ISP12160_NVRAM_TARGSIZE 6
-#define _IxT16(tgt, tidx, b) \
- (ISP12160_NVRAM_TARGOFF((b))+(ISP12160_NVRAM_TARGSIZE * (tgt))+(tidx))
-
-#define ISP12160_NVRAM_TGT_RENEG(c, t, b) \
- ISPBSMX(c, _IxT16(t, 0, (b)), 0, 0x01)
-#define ISP12160_NVRAM_TGT_QFRZ(c, t, b) \
- ISPBSMX(c, _IxT16(t, 0, (b)), 1, 0x01)
-#define ISP12160_NVRAM_TGT_ARQ(c, t, b) \
- ISPBSMX(c, _IxT16(t, 0, (b)), 2, 0x01)
-#define ISP12160_NVRAM_TGT_TQING(c, t, b) \
- ISPBSMX(c, _IxT16(t, 0, (b)), 3, 0x01)
-#define ISP12160_NVRAM_TGT_SYNC(c, t, b) \
- ISPBSMX(c, _IxT16(t, 0, (b)), 4, 0x01)
-#define ISP12160_NVRAM_TGT_WIDE(c, t, b) \
- ISPBSMX(c, _IxT16(t, 0, (b)), 5, 0x01)
-#define ISP12160_NVRAM_TGT_PARITY(c, t, b) \
- ISPBSMX(c, _IxT16(t, 0, (b)), 6, 0x01)
-#define ISP12160_NVRAM_TGT_DISC(c, t, b) \
- ISPBSMX(c, _IxT16(t, 0, (b)), 7, 0x01)
-
-#define ISP12160_NVRAM_TGT_EXEC_THROTTLE(c, t, b) \
- ISPBSMX(c, _IxT16(t, 1, (b)), 0, 0xff)
-#define ISP12160_NVRAM_TGT_SYNC_PERIOD(c, t, b) \
- ISPBSMX(c, _IxT16(t, 2, (b)), 0, 0xff)
-
-#define ISP12160_NVRAM_TGT_SYNC_OFFSET(c, t, b) \
- ISPBSMX(c, _IxT16(t, 3, (b)), 0, 0x1f)
-#define ISP12160_NVRAM_TGT_DEVICE_ENABLE(c, t, b) \
- ISPBSMX(c, _IxT16(t, 3, (b)), 5, 0x01)
-
-#define ISP12160_NVRAM_PPR_OPTIONS(c, t, b) \
- ISPBSMX(c, _IxT16(t, 4, (b)), 0, 0x0f)
-#define ISP12160_NVRAM_PPR_WIDTH(c, t, b) \
- ISPBSMX(c, _IxT16(t, 4, (b)), 4, 0x03)
-#define ISP12160_NVRAM_PPR_ENABLE(c, t, b) \
- ISPBSMX(c, _IxT16(t, 4, (b)), 7, 0x01)
-
-/*
- * Qlogic 2100 thru 2300 NVRAM is an array of 256 bytes.
- *
- * Some portion of the front of this is for general RISC engine parameters,
- * mostly reflecting the state of the last INITIALIZE FIRMWARE mailbox command.
- *
- * This is followed by some general host adapter parameters, and ends with
- * a checksum xor byte at offset 255. For non-byte entities data is stored
- * in Little Endian order.
- */
-#define ISP2100_NVRAM_SIZE 256
-/* ISP_NVRAM_VERSION is in same overall place */
-#define ISP2100_NVRAM_RISCVER(c) (c)[6]
-#define ISP2100_NVRAM_OPTIONS(c) ((c)[8] | ((c)[9] << 8))
-#define ISP2100_NVRAM_MAXFRAMELENGTH(c) (((c)[10]) | ((c)[11] << 8))
-#define ISP2100_NVRAM_MAXIOCBALLOCATION(c) (((c)[12]) | ((c)[13] << 8))
-#define ISP2100_NVRAM_EXECUTION_THROTTLE(c) (((c)[14]) | ((c)[15] << 8))
-#define ISP2100_NVRAM_RETRY_COUNT(c) (c)[16]
-#define ISP2100_NVRAM_RETRY_DELAY(c) (c)[17]
-
-#define ISP2100_NVRAM_PORT_NAME(c) (\
- (((uint64_t)(c)[18]) << 56) | \
- (((uint64_t)(c)[19]) << 48) | \
- (((uint64_t)(c)[20]) << 40) | \
- (((uint64_t)(c)[21]) << 32) | \
- (((uint64_t)(c)[22]) << 24) | \
- (((uint64_t)(c)[23]) << 16) | \
- (((uint64_t)(c)[24]) << 8) | \
- (((uint64_t)(c)[25]) << 0))
-
-#define ISP2100_NVRAM_HARDLOOPID(c) ((c)[26] | ((c)[27] << 8))
-#define ISP2100_NVRAM_TOV(c) ((c)[29])
-
-#define ISP2100_NVRAM_NODE_NAME(c) (\
- (((uint64_t)(c)[30]) << 56) | \
- (((uint64_t)(c)[31]) << 48) | \
- (((uint64_t)(c)[32]) << 40) | \
- (((uint64_t)(c)[33]) << 32) | \
- (((uint64_t)(c)[34]) << 24) | \
- (((uint64_t)(c)[35]) << 16) | \
- (((uint64_t)(c)[36]) << 8) | \
- (((uint64_t)(c)[37]) << 0))
-
-#define ISP2100_XFW_OPTIONS(c) ((c)[38] | ((c)[39] << 8))
-
-#define ISP2100_RACC_TIMER(c) (c)[40]
-#define ISP2100_IDELAY_TIMER(c) (c)[41]
-
-#define ISP2100_ZFW_OPTIONS(c) ((c)[42] | ((c)[43] << 8))
-
-#define ISP2100_SERIAL_LINK(c) ((c)[68] | ((c)[69] << 8))
-
-#define ISP2100_NVRAM_HBA_OPTIONS(c) ((c)[70] | ((c)[71] << 8))
-#define ISP2100_NVRAM_HBA_DISABLE(c) ISPBSMX(c, 70, 0, 0x01)
-#define ISP2100_NVRAM_BIOS_DISABLE(c) ISPBSMX(c, 70, 1, 0x01)
-#define ISP2100_NVRAM_LUN_DISABLE(c) ISPBSMX(c, 70, 2, 0x01)
-#define ISP2100_NVRAM_ENABLE_SELECT_BOOT(c) ISPBSMX(c, 70, 3, 0x01)
-#define ISP2100_NVRAM_DISABLE_CODELOAD(c) ISPBSMX(c, 70, 4, 0x01)
-#define ISP2100_NVRAM_SET_CACHELINESZ(c) ISPBSMX(c, 70, 5, 0x01)
-
-#define ISP2100_NVRAM_BOOT_NODE_NAME(c) (\
- (((uint64_t)(c)[72]) << 56) | \
- (((uint64_t)(c)[73]) << 48) | \
- (((uint64_t)(c)[74]) << 40) | \
- (((uint64_t)(c)[75]) << 32) | \
- (((uint64_t)(c)[76]) << 24) | \
- (((uint64_t)(c)[77]) << 16) | \
- (((uint64_t)(c)[78]) << 8) | \
- (((uint64_t)(c)[79]) << 0))
-
-#define ISP2100_NVRAM_BOOT_LUN(c) (c)[80]
-#define ISP2100_RESET_DELAY(c) (c)[81]
-
-#define ISP2100_HBA_FEATURES(c) ((c)[232] | ((c)[233] << 8))
-
/*
* Qlogic 2400 NVRAM is an array of 512 bytes with a 32 bit checksum.
*/
@@ -1153,25 +255,4 @@ typedef struct {
#define ISP2400_NVRAM_FIRMWARE_OPTIONS3(c) \
((c)[52] | ((c)[53] << 8) | ((c)[54] << 16) | ((c)[55] << 24))
-/*
- * Firmware Crash Dump
- *
- * QLogic needs specific information format when they look at firmware crashes.
- *
- * This is incredibly kernel memory consumptive (to say the least), so this
- * code is only compiled in when needed.
- */
-
-#define QLA2200_RISC_IMAGE_DUMP_SIZE \
- (1 * sizeof (uint16_t)) + /* 'used' flag (also HBA type) */ \
- (352 * sizeof (uint16_t)) + /* RISC registers */ \
- (61440 * sizeof (uint16_t)) /* RISC SRAM (offset 0x1000..0xffff) */
-#define QLA2300_RISC_IMAGE_DUMP_SIZE \
- (1 * sizeof (uint16_t)) + /* 'used' flag (also HBA type) */ \
- (464 * sizeof (uint16_t)) + /* RISC registers */ \
- (63488 * sizeof (uint16_t)) + /* RISC SRAM (0x0800..0xffff) */ \
- (4096 * sizeof (uint16_t)) + /* RISC SRAM (0x10000..0x10FFF) */ \
- (61440 * sizeof (uint16_t)) /* RISC SRAM (0x11000..0x1FFFF) */
-/* the larger of the two */
-#define ISP_CRASH_IMAGE_SIZE QLA2300_RISC_IMAGE_DUMP_SIZE
#endif /* _ISPREG_H */
diff --git a/sys/dev/isp/ispvar.h b/sys/dev/isp/ispvar.h
index 5ff34e829eb3..fe19a729d36e 100644
--- a/sys/dev/isp/ispvar.h
+++ b/sys/dev/isp/ispvar.h
@@ -2,7 +2,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * Copyright (c) 2009-2018 Alexander Motin <mav@FreeBSD.org>
+ * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
*
@@ -70,8 +70,6 @@ struct ispmdvec {
int (*dv_irqsetup) (ispsoftc_t *);
void (*dv_dregs) (ispsoftc_t *, const char *);
const void * dv_ispfw; /* ptr to f/w */
- uint16_t dv_conf1;
- uint16_t dv_clock; /* clock frequency */
};
/*
@@ -81,8 +79,7 @@ struct ispmdvec {
#ifndef MAX_FC_TARG
#define MAX_FC_TARG 1024
#endif
-#define ISP_MAX_TARGETS(isp) (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS)
-#define ISP_MAX_LUNS(isp) (isp)->isp_maxluns
+#define ISP_MAX_TARGETS(isp) MAX_FC_TARG
#define ISP_MAX_IRQS 3
/*
@@ -159,94 +156,17 @@ struct ispmdvec {
#define ISP_ADD_REQUEST(isp, nxti) \
MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN, -1); \
- ISP_WRITE(isp, isp->isp_rqstinrp, nxti); \
+ ISP_WRITE(isp, BIU2400_REQINP, nxti); \
isp->isp_reqidx = nxti
#define ISP_SYNC_REQUEST(isp) \
MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN, -1); \
isp->isp_reqidx = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)); \
- ISP_WRITE(isp, isp->isp_rqstinrp, isp->isp_reqidx)
-
-/*
- * SCSI Specific Host Adapter Parameters- per bus, per target
- */
-typedef struct {
- uint32_t : 8,
- update : 1,
- sendmarker : 1,
- isp_req_ack_active_neg : 1,
- isp_data_line_active_neg: 1,
- isp_cmd_dma_burst_enable: 1,
- isp_data_dma_burst_enabl: 1,
- isp_fifo_threshold : 3,
- isp_ptisp : 1,
- isp_ultramode : 1,
- isp_diffmode : 1,
- isp_lvdmode : 1,
- isp_fast_mttr : 1, /* fast sram */
- isp_initiator_id : 4,
- isp_async_data_setup : 4;
- uint16_t isp_selection_timeout;
- uint16_t isp_max_queue_depth;
- uint8_t isp_tag_aging;
- uint8_t isp_bus_reset_delay;
- uint8_t isp_retry_count;
- uint8_t isp_retry_delay;
- struct {
- uint32_t
- exc_throttle : 8,
- : 1,
- dev_enable : 1, /* ignored */
- dev_update : 1,
- dev_refresh : 1,
- actv_offset : 4,
- goal_offset : 4,
- nvrm_offset : 4;
- uint8_t actv_period; /* current sync period */
- uint8_t goal_period; /* goal sync period */
- uint8_t nvrm_period; /* nvram sync period */
- uint16_t actv_flags; /* current device flags */
- uint16_t goal_flags; /* goal device flags */
- uint16_t nvrm_flags; /* nvram device flags */
- } isp_devparam[MAX_TARGETS];
-} sdparam;
-
-/*
- * Device Flags
- */
-#define DPARM_DISC 0x8000
-#define DPARM_PARITY 0x4000
-#define DPARM_WIDE 0x2000
-#define DPARM_SYNC 0x1000
-#define DPARM_TQING 0x0800
-#define DPARM_ARQ 0x0400
-#define DPARM_QFRZ 0x0200
-#define DPARM_RENEG 0x0100
-#define DPARM_NARROW 0x0080
-#define DPARM_ASYNC 0x0040
-#define DPARM_PPR 0x0020
-#define DPARM_DEFAULT (0xFF00 & ~DPARM_QFRZ)
-#define DPARM_SAFE_DFLT (DPARM_DEFAULT & ~(DPARM_WIDE|DPARM_SYNC|DPARM_TQING))
-
-/* technically, not really correct, as they need to be rated based upon clock */
-#define ISP_80M_SYNCPARMS 0x0c09
-#define ISP_40M_SYNCPARMS 0x0c0a
-#define ISP_20M_SYNCPARMS 0x0c0c
-#define ISP_20M_SYNCPARMS_1040 0x080c
-#define ISP_10M_SYNCPARMS 0x0c19
-#define ISP_08M_SYNCPARMS 0x0c25
-#define ISP_05M_SYNCPARMS 0x0c32
-#define ISP_04M_SYNCPARMS 0x0c41
+ ISP_WRITE(isp, BIU2400_REQINP, isp->isp_reqidx)
/*
* Fibre Channel Specifics
*/
-/* These are for non-2K Login Firmware cards */
-#define FL_ID 0x7e /* FL_Port Special ID */
-#define SNS_ID 0x80 /* SNS Server Special ID */
-#define NPH_MAX 0xfe
-
-/* These are for 2K Login Firmware cards */
#define NPH_RESERVED 0x7F0 /* begin of reserved N-port handles */
#define NPH_MGT_ID 0x7FA /* Management Server Special ID */
#define NPH_SNS_ID 0x7FC /* SNS Server Special ID */
@@ -543,27 +463,19 @@ struct ispsoftc {
uint8_t isp_revision; /* HBA Chip H/W Revision */
uint8_t isp_nirq; /* number of IRQs */
uint16_t isp_nchan; /* number of channels */
- uint32_t isp_maxluns; /* maximum luns supported */
uint32_t isp_clock : 8, /* input clock */
: 5,
isp_port : 1, /* 23XX/24XX only */
- isp_bustype : 1, /* SBus or PCI */
isp_loaded_fw : 1, /* loaded firmware */
isp_dblev : 16; /* debug log mask */
uint32_t isp_confopts; /* config options */
- uint32_t isp_rqstinrp; /* register for REQINP */
- uint32_t isp_rqstoutrp; /* register for REQOUTP */
- uint32_t isp_respinrp; /* register for RESINP */
- uint32_t isp_respoutrp; /* register for RESOUTP */
-
/*
* Volatile state
*/
-
volatile u_int isp_mboxbsy; /* mailbox command active */
volatile u_int isp_state;
volatile mbreg_t isp_curmbx; /* currently active mailbox command */
@@ -604,20 +516,13 @@ struct ispsoftc {
#endif
};
-#define SDPARAM(isp, chan) (&((sdparam *)(isp)->isp_param)[(chan)])
#define FCPARAM(isp, chan) (&((fcparam *)(isp)->isp_param)[(chan)])
#define ISP_SET_SENDMARKER(isp, chan, val) \
- if (IS_FC(isp)) { \
- FCPARAM(isp, chan)->sendmarker = val; \
- } else { \
- SDPARAM(isp, chan)->sendmarker = val; \
- }
+ FCPARAM(isp, chan)->sendmarker = val \
#define ISP_TST_SENDMARKER(isp, chan) \
- (IS_FC(isp)? \
- FCPARAM(isp, chan)->sendmarker != 0 : \
- SDPARAM(isp, chan)->sendmarker != 0)
+ (FCPARAM(isp, chan)->sendmarker != 0)
/*
* ISP Driver Run States
@@ -713,69 +618,13 @@ struct ispsoftc {
(ISP_FW_REVX((i)->isp_fwrev) < ISP_FW_REV(major, minor, micro))
/*
- * Bus (implementation) types
- */
-#define ISP_BT_PCI 0 /* PCI Implementations */
-#define ISP_BT_SBUS 1 /* SBus Implementations */
-
-/*
- * If we have not otherwise defined SBus support away make sure
- * it is defined here such that the code is included as default
- */
-#ifndef ISP_SBUS_SUPPORTED
-#define ISP_SBUS_SUPPORTED 1
-#endif
-
-/*
* Chip Types
*/
-#define ISP_HA_SCSI 0xf
-#define ISP_HA_SCSI_UNKNOWN 0x1
-#define ISP_HA_SCSI_1020 0x2
-#define ISP_HA_SCSI_1020A 0x3
-#define ISP_HA_SCSI_1040 0x4
-#define ISP_HA_SCSI_1040A 0x5
-#define ISP_HA_SCSI_1040B 0x6
-#define ISP_HA_SCSI_1040C 0x7
-#define ISP_HA_SCSI_1240 0x8
-#define ISP_HA_SCSI_1080 0x9
-#define ISP_HA_SCSI_1280 0xa
-#define ISP_HA_SCSI_10160 0xb
-#define ISP_HA_SCSI_12160 0xc
-#define ISP_HA_FC 0xf0
-#define ISP_HA_FC_2100 0x10
-#define ISP_HA_FC_2200 0x20
-#define ISP_HA_FC_2300 0x30
-#define ISP_HA_FC_2312 0x40
-#define ISP_HA_FC_2322 0x50
-#define ISP_HA_FC_2400 0x60
-#define ISP_HA_FC_2500 0x70
-#define ISP_HA_FC_2600 0x80
-#define ISP_HA_FC_2700 0x90
-
-#define IS_SCSI(isp) (isp->isp_type & ISP_HA_SCSI)
-#define IS_1020(isp) (isp->isp_type < ISP_HA_SCSI_1240)
-#define IS_1240(isp) (isp->isp_type == ISP_HA_SCSI_1240)
-#define IS_1080(isp) (isp->isp_type == ISP_HA_SCSI_1080)
-#define IS_1280(isp) (isp->isp_type == ISP_HA_SCSI_1280)
-#define IS_10160(isp) (isp->isp_type == ISP_HA_SCSI_10160)
-#define IS_12160(isp) (isp->isp_type == ISP_HA_SCSI_12160)
-
-#define IS_12X0(isp) (IS_1240(isp) || IS_1280(isp))
-#define IS_1X160(isp) (IS_10160(isp) || IS_12160(isp))
-#define IS_DUALBUS(isp) (IS_12X0(isp) || IS_12160(isp))
-#define IS_ULTRA2(isp) (IS_1080(isp) || IS_1280(isp) || IS_1X160(isp))
-#define IS_ULTRA3(isp) (IS_1X160(isp))
-
-#define IS_FC(isp) ((isp)->isp_type & ISP_HA_FC)
-#define IS_2100(isp) ((isp)->isp_type == ISP_HA_FC_2100)
-#define IS_2200(isp) ((isp)->isp_type == ISP_HA_FC_2200)
-#define IS_23XX(isp) ((isp)->isp_type >= ISP_HA_FC_2300 && \
- (isp)->isp_type < ISP_HA_FC_2400)
-#define IS_2300(isp) ((isp)->isp_type == ISP_HA_FC_2300)
-#define IS_2312(isp) ((isp)->isp_type == ISP_HA_FC_2312)
-#define IS_2322(isp) ((isp)->isp_type == ISP_HA_FC_2322)
-#define IS_24XX(isp) ((isp)->isp_type >= ISP_HA_FC_2400)
+#define ISP_HA_FC_2400 0x04
+#define ISP_HA_FC_2500 0x05
+#define ISP_HA_FC_2600 0x06
+#define ISP_HA_FC_2700 0x07
+
#define IS_25XX(isp) ((isp)->isp_type >= ISP_HA_FC_2500)
#define IS_26XX(isp) ((isp)->isp_type >= ISP_HA_FC_2600)
#define IS_27XX(isp) ((isp)->isp_type >= ISP_HA_FC_2700)
@@ -868,8 +717,6 @@ void isp_done(XS_T *);
* Send a LIP on this channel
* ... ISPCTL_GET_NAMES, int channel, int np, uint64_t *wwnn, uint64_t *wwpn)
* Get a WWNN/WWPN for this N-port handle on this channel
- * ... ISPCTL_RUN_MBOXCMD, mbreg_t *mbp)
- * Run this mailbox command
* ... ISPCTL_GET_PDB, int channel, int nphandle, isp_pdb_t *pdb)
* Get PDB on this channel for this N-port handle
* ... ISPCTL_PLOGX, isp_plcmd_t *)
@@ -895,7 +742,6 @@ typedef enum {
ISPCTL_PDB_SYNC,
ISPCTL_SEND_LIP,
ISPCTL_GET_NAMES,
- ISPCTL_RUN_MBOXCMD,
ISPCTL_GET_PDB,
ISPCTL_PLOGX,
ISPCTL_CHANGE_ROLE
@@ -907,7 +753,6 @@ int isp_control(ispsoftc_t *, ispctl_t, ...);
*/
typedef enum {
- ISPASYNC_NEW_TGT_PARAMS, /* SPI New Target Parameters */
ISPASYNC_BUS_RESET, /* All Bus Was Reset */
ISPASYNC_LOOP_DOWN, /* FC Loop Down */
ISPASYNC_LOOP_UP, /* FC Loop Up */
@@ -1014,9 +859,7 @@ void isp_async(ispsoftc_t *, ispasync_t, ...);
*
* XS_T Platform SCSI transaction type (i.e., command for HBA)
* XS_DMA_ADDR_T Platform PCI DMA Address Type
- * XS_GET_DMA_SEG(..) Get 32 bit dma segment list value
* XS_GET_DMA64_SEG(..) Get 64 bit dma segment list value
- * XS_NEED_DMA64_SEG(..) dma segment needs 64 bit storage
* XS_ISP(xs) gets an instance out of an XS_T
* XS_CHANNEL(xs) gets the channel (bus # for DUALBUS cards) ""
* XS_TGT(xs) gets the target ""
@@ -1062,7 +905,6 @@ void isp_async(ispsoftc_t *, ispasync_t, ...);
* DEFAULT_EXEC_THROTTLE(ispsoftc_t *) Default Execution Throttle
*
* DEFAULT_ROLE(ispsoftc_t *, int) Get Default Role for a channel
- * DEFAULT_IID(ispsoftc_t *, int) Default SCSI initiator ID
* DEFAULT_LOOPID(ispsoftc_t *, int) Default FC Loop ID
*
* These establish reasonable defaults for each platform.
@@ -1124,14 +966,6 @@ int isp_acknak_abts(ispsoftc_t *, void *, int);
int isp_target_put_entry(ispsoftc_t *isp, void *);
/*
- * General routine to put back an ATIO entry-
- * used for replenishing f/w resource counts.
- * The argument is a pointer to a source ATIO
- * or ATIO2.
- */
-int isp_target_put_atio(ispsoftc_t *, void *);
-
-/*
* General routine to send a final CTIO for a command- used mostly for
* local responses.
*/