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
This commit is contained in:
Alexander Motin 2020-11-20 01:15:48 +00:00
parent b33ba83470
commit 1b760be482
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367857
29 changed files with 1510 additions and 46149 deletions

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 2009-2018 Alexander Motin <mav@FreeBSD.org>
.\" Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
.\" Copyright (c) 2006 Marcus Alves Grando
.\" Copyright (c) 1998-2001 Matthew Jacob, for NASA/Ames Research Center
.\"
@ -26,12 +26,12 @@
.\"
.\" $FreeBSD$
.\"
.Dd February 28, 2019
.Dd November 19, 2020
.Dt ISP 4
.Os
.Sh NAME
.Nm isp
.Nd Qlogic based SPI and FibreChannel SCSI Host Adapters
.Nd Qlogic FibreChannel SCSI Host Adapters driver
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following lines in your
@ -51,23 +51,16 @@ ispfw_load="YES"
.Ed
.Sh DESCRIPTION
This driver provides access to
.Tn SPI
or
.Tn FibreChannel
SCSI devices.
.Pp
SPI supports initiator mode for Ultra SCSI and wide mode transactions for
.Tn SCSI ,
Ultra2 LVD (1080, 1280), and Ultra3 LVD (10160, 12160).
.Pp
Fibre Channel supports initiator and target modes of FCP SCSI profile,
utilizing Class 3 and Class 2 (2200 and later) connections.
It supports initiator and target modes of FCP SCSI profile,
utilizing Class 3 and Class 2 connections.
Support is available for Public and Private loops, Point-to-Point
and Fabric connections.
.Pp
FC-Tape is supported on 4Gb (2400) and newer controllers.
FC-Tape is highly recommended for connections to tape drives that support
it.
Supported FC-Tape functionality is highly recommended for connections
to tape drives that support it.
It encompasses four elements from the T-10 FCP-4 specification:
.Bl -bullet -offset indent
.It
@ -100,39 +93,8 @@ Cards supported by the
.Nm
driver include:
.Bl -tag -width xxxxxx -offset indent
.It Qlogic 1000
Fast Wide, Ultra Fast Wide cards, Single Ended or Differential SBus cards.
.It Qlogic 1020
Fast Wide and Differential Fast Wide SCSI PCI cards.
.It Qlogic 1040
Ultra Wide and Differential Ultra Wide SCSI PCI cards.
Also known as the DEC KZPBA-CA (single ended) and KZPBA-CB (HVD differential).
.It Qlogic 1080
LVD Ultra2 Wide SCSI PCI cards.
.It Qlogic 10160
LVD Ultra3 Wide SCSI PCI cards.
.It Qlogic 1240
Dual Bus Ultra Wide and Differential Ultra Wide SCSI PCI cards.
.It Qlogic 1280
Dual Bus LVD Ultra2 Wide SCSI PCI cards.
.It Qlogic 12160
Dual Bus LVD Ultra3 Wide SCSI PCI cards.
.It Qlogic 210X
Copper and Optical Fibre Channel Arbitrated Loop PCI cards (single, dual).
.It Qlogic 220X
Copper and Optical Fibre Channel Arbitrated Loop PCI cards (single, dual, quad).
.It Qlogic 2300
Optical 2Gb Fibre Channel PCI cards.
.It Qlogic 2312
Optical 2Gb Fibre Channel PCI cards.
.It Qlogic 234X
Optical 2Gb Fibre Channel PCI cards (2312 chipset, single and dual attach).
.It Qlogic 2322
Optical 2Gb Fibre Channel PCIe cards.
.It Qlogic 200
Dell branded version of the QLogic 2312.
.It Qlogic 2422
Optical 4Gb Fibre Channel PCI cards.
Optical 4Gb Fibre Channel PCI-X cards.
.It Qlogic 246x (aka 2432)
Optical 4Gb Fibre Channel PCIe cards.
.It Qlogic 256x (aka 2532)
@ -260,6 +222,3 @@ Later improvement was done by
.An Alexander Motin Aq Mt mav@FreeBSD.org .
.Sh BUGS
The driver currently ignores some NVRAM settings.
.Pp
Fabric support for 2100 cards has been so problematic, and these cards are so
old now that it is just not worth your time to try it.

View File

@ -1,5 +1,5 @@
.\" Copyright (c) 2000
.\" Matthew Jacob
.\" Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
.\" Copyright (c) 2000 Matthew Jacob
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@ -22,12 +22,12 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 30, 2015
.Dd November 19, 2020
.Dt ISPFW 4
.Os
.Sh NAME
.Nm ispfw
.Nd "Firmware for Qlogic based SPI and FibreChannel SCSI Host Adapters"
.Nd "Firmware for Qlogic FibreChannel SCSI Host Adapters"
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following line in your
@ -44,7 +44,7 @@ ispfw_load="YES"
.Ed
.Sh DESCRIPTION
This trivial driver provides access to firmware sets for the Qlogic
based SPI and FibreChannel SCSI Host Adapters.
FibreChannel SCSI Host Adapters.
It may either be
statically linked into the kernel, or loaded as a module.
In either
@ -58,3 +58,5 @@ This will kick the f/w into getting unstuck.
.Sh AUTHORS
This driver was written by
.An Matthew Jacob .
Later improvement was done by
.An Alexander Motin Aq Mt mav@FreeBSD.org .

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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
@ -548,8 +496,10 @@ default: \
(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))
((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)
@ -696,10 +624,6 @@ extern int isp_loop_down_limit;
extern int isp_gone_device_time;
extern int isp_quickboot_time;
/*
* Platform private flags
*/
/*
* Platform Library Functions
*/
@ -726,10 +650,6 @@ int isp_fcp_next_crn(ispsoftc_t *, uint8_t *, XS_T *);
xpt_print(p, __VA_ARGS__); \
}
/*
* Platform specific inline functions
*/
/*
* ISP General Library functions
*/

File diff suppressed because it is too large Load Diff

View File

@ -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 *);

View File

@ -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;
}
} else {
if (IS_FC(isp)) {
ISP_FC_PC(isp, chan)->default_id = tval - chan;
} else {
ISP_SPI_PC(isp, chan)->iid = tval;
}
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;
}
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);
}
/*
* 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;
@ -1146,173 +756,19 @@ isp_pci_run_isr_2400(ispsoftc_t *isp)
ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_RISC_INT);
}
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:
return (BXR2(isp, regoff));
}
isp_prt(isp, ISP_LOGERR, "unknown block read at 0x%x", regoff);
return (0xffffffff);
}
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);
}
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;
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,
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,12 +949,9 @@ 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,
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;
@ -1576,7 +981,6 @@ isp_pci_mbxdma(ispsoftc_t *isp)
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,10 +1014,9 @@ 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,
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;
@ -1634,10 +1037,8 @@ isp_pci_mbxdma(ispsoftc_t *isp)
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,
@ -1675,7 +1076,6 @@ isp_pci_mbxdma(ispsoftc_t *isp)
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) {
@ -1690,8 +1090,6 @@ isp_pci_mbxdma(ispsoftc_t *isp)
fc->nexus_free_list = n;
}
}
}
}
if (isp->isp_maxcmds == 0) {
ISP_LOCK(isp);
@ -1753,7 +1151,6 @@ 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) {
@ -1783,9 +1180,7 @@ isp_pci_mbxdmafree(ispsoftc_t *isp)
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);
@ -1797,7 +1192,6 @@ isp_pci_mbxdmafree(ispsoftc_t *isp)
bus_dma_tag_destroy(isp->isp_osinfo.atiodmat);
isp->isp_atioq = NULL;
}
}
#endif
if (isp->isp_result_dma != 0) {
bus_dmamap_unload(isp->isp_osinfo.respdmat,
@ -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));
}

View File

@ -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;
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) {
if (nack_24xx->na_status != NA_OK)
level = ISP_LOGINFO;
} else {
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);
}
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,
isp_put_notify_ack_24xx(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);
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,20 +272,11 @@ 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);
@ -432,6 +290,7 @@ isp_endcmd(ispsoftc_t *isp, ...)
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;
@ -471,54 +330,7 @@ isp_endcmd(ispsoftc_t *isp, ...)
cto->ct_scsi_status |= (FCP_RESID_UNDERFLOW << 8);
}
cto->ct_syshandle = hdl;
} 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;
}
return (isp_target_put_entry(isp, &un));
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,21 +464,17 @@ 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));
}
if (((isphdr_t *)arg)->rqs_entry_type == RQSTYPE_ATIO)
return (isp_endcmd(isp, arg, 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;
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;
@ -784,36 +504,7 @@ isp_notify_ack(ispsoftc_t *isp, void *arg)
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 */
}
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);
@ -927,264 +613,6 @@ isp_handle_abts(ispsoftc_t *isp, abts_t *abts)
isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
}
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)
{
@ -1329,83 +757,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)
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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
@ -712,70 +617,14 @@ struct ispsoftc {
#define ISP_FW_OLDER_THAN(i, major, minor, micro) \
(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 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_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 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.
@ -1123,14 +965,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.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -39,16 +39,6 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#if defined(ISP_ALL) || !defined(KLD_MODULE)
#define ISP_1040 1
#define ISP_1040_IT 1
#define ISP_1080 1
#define ISP_1080_IT 1
#define ISP_12160 1
#define ISP_12160_IT 1
#define ISP_2100 1
#define ISP_2200 1
#define ISP_2300 1
#define ISP_2322 1
#define ISP_2400 1
#define ISP_2500 1
#endif
@ -57,27 +47,6 @@ __FBSDID("$FreeBSD$");
#define MODULE_NAME "ispfw"
#endif
#if defined(ISP_1040) || defined(ISP_1040_IT)
#include <dev/ispfw/asm_1040.h>
#endif
#if defined(ISP_1080) || defined(ISP_1080_IT)
#include <dev/ispfw/asm_1080.h>
#endif
#if defined(ISP_12160) || defined(ISP_12160_IT)
#include <dev/ispfw/asm_12160.h>
#endif
#if defined(ISP_2100)
#include <dev/ispfw/asm_2100.h>
#endif
#if defined(ISP_2200)
#include <dev/ispfw/asm_2200.h>
#endif
#if defined(ISP_2300)
#include <dev/ispfw/asm_2300.h>
#endif
#if defined(ISP_2322)
#include <dev/ispfw/asm_2322.h>
#endif
#if defined(ISP_2400)
#include <dev/ispfw/asm_2400.h>
#endif
@ -85,27 +54,6 @@ __FBSDID("$FreeBSD$");
#include <dev/ispfw/asm_2500.h>
#endif
#if defined(ISP_1040)
static int isp_1040_loaded;
#endif
#if defined(ISP_1080)
static int isp_1080_loaded;
#endif
#if defined(ISP_12160)
static int isp_12160_loaded;
#endif
#if defined(ISP_2100)
static int isp_2100_loaded;
#endif
#if defined(ISP_2200)
static int isp_2200_loaded;
#endif
#if defined(ISP_2300)
static int isp_2300_loaded;
#endif
#if defined(ISP_2322)
static int isp_2322_loaded;
#endif
#if defined(ISP_2400)
static int isp_2400_loaded;
#endif
@ -139,27 +87,6 @@ static int
do_load_fw(void)
{
#if defined(ISP_1040)
RMACRO(isp_1040);
#endif
#if defined(ISP_1080)
RMACRO(isp_1080);
#endif
#if defined(ISP_12160)
RMACRO(isp_12160);
#endif
#if defined(ISP_2100)
RMACRO(isp_2100);
#endif
#if defined(ISP_2200)
RMACRO(isp_2200);
#endif
#if defined(ISP_2300)
RMACRO(isp_2300);
#endif
#if defined(ISP_2322)
RMACRO(isp_2322);
#endif
#if defined(ISP_2400)
RMACRO(isp_2400);
#endif
@ -174,27 +101,6 @@ do_unload_fw(void)
{
int error = 0;
#if defined(ISP_1040)
UMACRO(isp_1040);
#endif
#if defined(ISP_1080)
UMACRO(isp_1080);
#endif
#if defined(ISP_12160)
UMACRO(isp_12160);
#endif
#if defined(ISP_2100)
UMACRO(isp_2100);
#endif
#if defined(ISP_2200)
UMACRO(isp_2200);
#endif
#if defined(ISP_2300)
UMACRO(isp_2300);
#endif
#if defined(ISP_2322)
UMACRO(isp_2322);
#endif
#if defined(ISP_2400)
UMACRO(isp_2400);
#endif
@ -221,20 +127,6 @@ static moduledata_t ispfw_mod = {
};
#if defined(ISP_ALL) || !defined(KLD_MODULE)
DECLARE_MODULE(ispfw, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_1040)
DECLARE_MODULE(isp_1040, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_1080)
DECLARE_MODULE(isp_1080, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_12160)
DECLARE_MODULE(isp_12160, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_2100)
DECLARE_MODULE(isp_2100, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_2200)
DECLARE_MODULE(isp_2200, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_2300)
DECLARE_MODULE(isp_2300, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_2322)
DECLARE_MODULE(isp_2322, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_2400)
DECLARE_MODULE(isp_2400, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_2500)

View File

@ -28,13 +28,6 @@
SUBDIR = ispfw
SUBDIR += isp_1040
SUBDIR += isp_1080
SUBDIR += isp_12160
SUBDIR += isp_2100
SUBDIR += isp_2200
SUBDIR += isp_2300
SUBDIR += isp_2322
SUBDIR += isp_2400
SUBDIR += isp_2500

View File

@ -1,36 +0,0 @@
#-
# Copyright (c) 2006 by Matthew Jacob
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice immediately at the beginning of the file, without modification,
# this list of conditions, and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/ispfw
KMOD= isp_1000
SRCS= ispfw.c
CFLAGS += -DISP_1000 -DMODULE_NAME=\"${KMOD}\"
.include <bsd.kmod.mk>

View File

@ -1,36 +0,0 @@
#-
# Copyright (c) 2006 by Matthew Jacob
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice immediately at the beginning of the file, without modification,
# this list of conditions, and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/ispfw
KMOD= isp_1040
SRCS= ispfw.c
CFLAGS += -DISP_1040 -DMODULE_NAME=\"${KMOD}\"
.include <bsd.kmod.mk>

View File

@ -1,36 +0,0 @@
#-
# Copyright (c) 2006 by Matthew Jacob
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice immediately at the beginning of the file, without modification,
# this list of conditions, and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/ispfw
KMOD= isp_1080
SRCS= ispfw.c
CFLAGS += -DISP_1080 -DMODULE_NAME=\"${KMOD}\"
.include <bsd.kmod.mk>

View File

@ -1,36 +0,0 @@
#-
# Copyright (c) 2006 by Matthew Jacob
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice immediately at the beginning of the file, without modification,
# this list of conditions, and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/ispfw
KMOD= isp_12160
SRCS= ispfw.c
CFLAGS += -DISP_12160 -DMODULE_NAME=\"${KMOD}\"
.include <bsd.kmod.mk>

View File

@ -1,36 +0,0 @@
#-
# Copyright (c) 2006 by Matthew Jacob
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice immediately at the beginning of the file, without modification,
# this list of conditions, and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/ispfw
KMOD= isp_2100
SRCS= ispfw.c
CFLAGS += -DISP_2100 -DMODULE_NAME=\"${KMOD}\"
.include <bsd.kmod.mk>

View File

@ -1,36 +0,0 @@
#-
# Copyright (c) 2006 by Matthew Jacob
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice immediately at the beginning of the file, without modification,
# this list of conditions, and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/ispfw
KMOD= isp_2200
SRCS= ispfw.c
CFLAGS += -DISP_2200 -DMODULE_NAME=\"${KMOD}\"
.include <bsd.kmod.mk>

View File

@ -1,36 +0,0 @@
#-
# Copyright (c) 2006 by Matthew Jacob
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice immediately at the beginning of the file, without modification,
# this list of conditions, and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/ispfw
KMOD= isp_2300
SRCS= ispfw.c
CFLAGS += -DISP_2300 -DMODULE_NAME=\"${KMOD}\"
.include <bsd.kmod.mk>

View File

@ -1,36 +0,0 @@
#-
# Copyright (c) 2006 by Matthew Jacob
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice immediately at the beginning of the file, without modification,
# this list of conditions, and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/ispfw
KMOD= isp_2322
SRCS= ispfw.c
CFLAGS += -DISP_2322 -DMODULE_NAME=\"${KMOD}\"
.include <bsd.kmod.mk>