History log of /freebsd-current/sys/dev/isp/isp_pci.c
Revision Date Author Comments
# 10ed63fc 27-Oct-2023 Joerg Pulz <Joerg.Pulz@frm2.tum.de>

isp(4): Rework firmware handling/loading

Correctly identify the active firmware in flash on adapters with
primary and secondary firmware region in flash.
Correctly identify the active NVRAM on adapters with primary
and secondary NVRAM region in flash.

Loading ispfw(4) moved from isp_pci_attach() to isp_reset().
Drop the reference to ispfw(4) after using it so one can kldunload(8) it.
New isp_load_ram() function to load either ispfw(4) or flash firmware
into RISC's RAM.
New functions to read data from flash. The old ones will be removed later.
A bunch of new helper functions to identify and validate active flash
regions for firmware, auxiliary and NVRAM.
Overhaul ISP_FW_* macros and make use of it when comparing firmware
versions. We can handle firmware versions up to 255.255.255.

Firmware load priority slightly changed:
For 27xx and newer adapters:
- load ispfw(4) firmware
- request (active) flash firmware information
- compare version numbers of ispfw(4) and flash firmware
- load firmware with highest version into RISC's RAM
- if loading ispfw(4) is disabled or failed - load firmware from flash
- if everything else fails use MBOX_LOAD_FLASH_FIRMWARE as fallback

For 26xx and older adapters nothing changed:
- load ispfw(4) firmware and load it into RISC's RAM
- if loading ispfw(4) is disabled or failed use MBOX_EXEC_FIRMWARE
- for 26xx a preceding MBOX_LOAD_FLASH_FIRMWARE is used

New read only sysctl(8)'s:
dev.isp.N.fw_version_run: the firmware version actually running
dev.isp.N.fw_version_ispfw: the firmware version provided by ispfw(4)
dev.isp.N.fw_version_flash: the (active) firmware version in flash

While here:
- firmware attribute handling/parsing reworked
+ renamed defines from ISP2400_FW_ATTR_* to ISP_FW_ATTR_*
+ changed values to match new handling/parsing
+ added some more attributes
- enable FLT support on 26xx based adapters
- log level adjustments
- new function return status codes (some for now, some for later use)
- some minor style changes

Tested and approved to work on real hardware with:
- Qlogic ISP 2532 (QLogic QLE2560 8Gb FC Adapter)
- Qlogic ISP 2031 (QLogic QLE2662 16Gbit 2Port FC Adapter)
- Qlogic ISP 2722 (QLogic QLE2690 16Gb FC Adapter)
- Qlogic ISP 2812 (QLogic QLE2772 32Gbit 2Port FC Adapter)

PR: 273263
Reviewed by: mav
Pull Request: https://github.com/freebsd/freebsd-src/pull/877
MFC after: 1 month
Sponsored by: Technical University of Munich


# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 407abff6 07-Jul-2023 Joerg Pulz <Joerg.Pulz@frm2.tum.de>

isp(4): Add support for QLogic 28xx devices

This covers the following HBAs:
ISP2812-based 64/32G Fibre Channel to PCIe Controller:
QLE2770 Single Port 32GFC PCIe Gen4 x8 Adapter
QLE2772 Dual Port 32GFC PCIe Gen4 x8 Adapter
QLE2870 Single Port 64GFC PCIe Gen4 x8 Adapter
QLE2872 Dual Port 64GFC PCIe Gen4 x8 Adapter

ISP2814-based 64/32G Fibre Channel to PCIe Controller:
QLE2774 Quad Port 32GFC PCIe Gen4 x16 Adapter
QLE2874 Quad Port 64GFC PCIe Gen4 x16 Adapter

While here, add required bits to support 64GB FC.

Default framesize is set to 2048 for ISP28xx based HBAs for now.

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# d1a9e9b9 20-Apr-2022 John Baldwin <jhb@FreeBSD.org>

isp: Remove unused devclass argument to DRIVER_MODULE.


# bafe4cee 09-Apr-2022 Gordon Bergling <gbe@FreeBSD.org>

ips(4): Remove a double word in a few source code comments

- s/for for/for/

MFC after: 3 days


# a6222dd7 24-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Remove more legacy of parallel SCSI.


# 0b19f90a 21-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Make handlers and atpds overflows unlikely.

- Allocate 256 handlers more than payload commands for management purposes.
- Increase maximum number of handlers from 8K to 16K by tuning the format.
- Just to be safe limit the number of payload commands to 16K - 256.
- Limit number of target exchanges in mixed mode to the number of atpds.
- If we still somehow get out of atpds -- return BUSY, since we really are.


# 254c652b 21-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Do not parent all busdma tags to the payload tag.

There is not much to inherit any more, may create more problems than solve.
Instead parent them all directly to upstream.

While there, add missed payload tag and tune scratch tag destructions.


# b8e2395e 20-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Increase queue depths from 1024/256 to 8192/1024 IOCBs.

Qlogic chips store S/G lists in the same queue as requests themselves. In
the worst case 1MB I/O may require up to 52 IOCBs, that means queue of 1024
IOCBs can store only 19 of such requests. The increase reduces chances of
overflow, while we should be able to afford additional 512KB of RAM per HBA.
The Linux driver uses comparable numbers.

While there, decouple ATIO queue size from response queue size. There is
no reason for them to be equal.


# f6854a0c 20-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Cleanup DMA handling.

- Make isp_start() to set all the IOCB fields aside of S/G list, removing
extra information from isp_send_cmd(), now only doing S/G lists and sending.
- Turn DMA setup/free from being card and PCI-specific into OS-specific,
instead add new card-specific method for isp_send_cmd(). Previously this
function was a monster handling all the cards.
- Remove double error code translation.


# dae0ba75 19-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Fix r367857 build without ISP_TARGET_MODE.


# 1b760be4 19-Nov-2020 Alexander Motin <mav@FreeBSD.org>

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


# cf770ba3 17-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Move ecmd memory allocation itto separate DMA tag.

Ecmd memory is not directly related to the request queue, only referenced
from it sometimes in target mode. Separate allocation should be easier
in case of fragmented memory and can be skipped when target is not built.

MFC after: 1 month


# 9cca0e7e 17-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Remove bus_dma locking/sleeping when not needed.

MFC after: 1 month


# 58aa35d4 03-Feb-2020 Warner Losh <imp@FreeBSD.org>

Remove sparc64 kernel support

Remove all sparc64 specific files
Remove all sparc64 ifdefs
Removee indireeect sparc64 ifdefs


# e52fba21 28-Apr-2019 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make isp(4) suggest loading ispfw(4) when it fails to attach.
It cannot load it automatically at boot, because the root filesystem
is not there yet. An alternative would be adding ispfw(4) to GENERIC,
but it's an additional 1MB.

Reviewed by: mav
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D19369


# 1f8c4546 28-Feb-2019 Alexander Motin <mav@FreeBSD.org>

Limit 24xx adapters to only MSI interrupts by default.

This was actually the known good configuration we used before.
Single MSI-X configuration doesn't even work there on my tests, just due
to lack of documentation not sure whether by design or I am doing something
wrong.

PR: 233654
MFC after: 1 week


# 8ebb14b1 28-Feb-2019 Alexander Motin <mav@FreeBSD.org>

Limit 24xx adapters to only one MSI-X interrupt by default.

These are 4Gb/s and pretty old and slow now, so I see no reason to fight
for their performance over stability.

PR: 233654
MFC after: 1 week
Sponsored by: iXsystems, Inc.


# 17ec7746 28-Feb-2019 Alexander Motin <mav@FreeBSD.org>

Add to isp(4) tunables to limit MSI/MSI-X usage.

There are some problem reports possibly related to the new driver use of
multiple interrupts on older cards. Hopefully this allow to workaround
them.

MFC after: 1 week
Sponsored by: iXsystems, Inc.


# 14e084ad 28-Feb-2018 Alexander Motin <mav@FreeBSD.org>

Add support for Enhanced Gen 5 (16Gb) and Gen 6 (32Gb) QLogic FC HBAs.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# 7e31684e 24-Mar-2017 Alexander Motin <mav@FreeBSD.org>

Unify initiator and target DMA setup and command sending.

The code is so alike that it is pointless to keep it separate.

MFC after: 2 weeks


# cf824289 21-Mar-2017 Alexander Motin <mav@FreeBSD.org>

Remove another remnants left after r246713.

MFC after: 2 weeks


# 97dfdd4e 21-Mar-2017 Alexander Motin <mav@FreeBSD.org>

Remove some dead code left after r246713.

MFC after: 2 weeks


# 13d9c921 21-Mar-2017 Alexander Motin <mav@FreeBSD.org>

Clean/unify some macro usage.

MFC after: 2 weeks


# abdc2e31 21-Mar-2017 Alexander Motin <mav@FreeBSD.org>

Addition to r315579: drop the lock while allocating IRQs.

MFC after: 12 days


# 08826086 19-Mar-2017 Alexander Motin <mav@FreeBSD.org>

Add initial support for multiple MSI-X vectors.

For 24xx and above use 2 vectors (default and response queue).
For 26xx and above use 3 vectors (default, response and ATIO queues).
Due to global lock interrupt hardlers never run simultaneously now, but
at least this allows to save one regitster read per interrupt.

MFC after: 2 weeks


# 0e6bc811 15-Mar-2017 Alexander Motin <mav@FreeBSD.org>

Refactor interrupt handling.

Instead of single isp_intr() function doing all possible magic, introduce
four different functions to handle mailbox operation completions, async
events, response and ATIO queues. The goal is to isolate different code
paths to make code more readable, and to make easier support for multiple
interrupt vectors. Even oldest hardware in many cases can identify what
code path it should run on interrupt. Contemporary hardware can assign
them to different interrupt vectors.

MFC after: 2 weeks


# b0a66d29 15-Mar-2017 Alexander Motin <mav@FreeBSD.org>

Fix ancient bug from r84597, which broke 23xx after r315234.

MFC after: 13 days


# a1fa0267 14-Mar-2017 Alexander Motin <mav@FreeBSD.org>

Improvements around attach, reset and detach.

This change fixes DMA resource leak on driver unload. Also it removes
DMA resources allocation for hardcoded number of requests before fetching
the real number from firmware. Also it prepares ground for more flexible
IRQs allocation according to firmware capabilities.

MFC after: 2 weeks


# 4d24901a 19-Feb-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: Replace zero with NULL for pointers.

Makes things easier to read, plus architectures may set NULL to something
different than zero.

Found with: devel/coccinelle
MFC after: 3 weeks


# 08167db8 20-Dec-2016 Kenneth D. Merry <ken@FreeBSD.org>

Turn on FC-Tape by default in the isp(4) driver.

FC-Tape provides additional link level error recovery, and is
highly recommended for tape devices. It will only be turned on for
a given target if the target supports it.

Without this setting, we default to whatever FC-Tape setting is in
NVRAM on the card.

This can be overridden by setting the following loader tunable, for
example for isp0:

hint.isp.0.nofctape=1

sys/conf/options:
Add a new kernel config option, ISP_FCTAPE_OFF, that
defaults the FC-Tape configuration to off.

sys/dev/isp/isp_pci.c:
If ISP_FCTAPE_OFF is defined, turn off FC-Tape. Otherwise,
turn it on if the card supports it.

share/man/man4/isp.4:
Add a description of FC-Tape to the isp(4) man page.

Add descriptions of the fctape and nofctape options, as well as the
ISP_FCTAPE_OFF kernel configuration option.

Add the ispfw module and kernel drivers to the suggested
configurations at the top of the man page so that users are less
likely to leave it out. The driver works well with the included
firmware, but may not work at all with whatever firmware the user
has flashed on their card.

MFC after: 3 days
Sponsored by: Spectra Logic


# dd49c936 15-May-2016 Edward Tomasz Napierala <trasz@FreeBSD.org>

Remove NULL checks after M_WAITOK allocations from isp(4).

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# 4ff970c4 12-Apr-2016 Alexander Motin <mav@FreeBSD.org>

Allocate separate DMA area for synchronous IOCB execution.

Usually IOCBs should be put on queue for asynchronous processing and should
not require additional DMA memory. But there are some cases like aborts and
resets that for external reasons has to be synchronous. Give those cases
separate 2*64 byte DMA area to decouple them from other DMA scratch area
users, using it for asynchronous requests.


# 14849e2c 26-Dec-2015 Alexander Motin <mav@FreeBSD.org>

Split DMA buffers for request, response and ATIO queues.


# 7d191fdb 26-Dec-2015 Alexander Motin <mav@FreeBSD.org>

Use single DMA tag for scratch areas of all virtual ports.


# 970ceb2f 25-Dec-2015 Alexander Motin <mav@FreeBSD.org>

Unify handles allocation for initiator and target IOCBs.

I am not sure why this was split long ago, but I see no reason for it.
At this point this unification just slightly reduces memory usage, but
as next step I plan to reuse shared handle space for other IOCB types.


# d876d6c3 14-Dec-2015 Alexander Motin <mav@FreeBSD.org>

Add MSI-X support for 26XX cards.

Unlike previous, this generation does not support regular MSIs any more.


# 67eeadd2 09-Dec-2015 Alexander Motin <mav@FreeBSD.org>

Add PCI ID for 16G QLogic chips in FCoE mode.

I haven't tested FCoE really yet, but the driver attaches fine.


# cd201b7b 04-Dec-2015 Alexander Motin <mav@FreeBSD.org>

Make 16Gig chips to use new queue pointer registers.

While 24xx-style ATIO and reply queue registers seems like still working,
request queue doesn't. So instead of that use registers from PCI BAR(4).


# 218be0b2 02-Dec-2015 Alexander Motin <mav@FreeBSD.org>

Add initial support for 16Gbps FC QLogic chips.

I still don't know how to read NVRAM there, so WWNs and other parameters
are incorrect, but other then that driver seems like attaching normally.


# e561aa79 26-Nov-2015 Alexander Motin <mav@FreeBSD.org>

One more round of port scanner rewrite.

- Make scan aborted by event restart immediately and infinitely.
- Improve handling of some loop events from firmware.
- Remove loop down timer, adding its functionality to scanner thread.
- Some more unification and simplification.


# e3a0bc58 23-Nov-2015 Alexander Motin <mav@FreeBSD.org>

Remove "disable" hint, which duplicates system-wide "disabled".


# a4ccb5d6 23-Nov-2015 Alexander Motin <mav@FreeBSD.org>

Fix target mode support for Qlogic 2200 FC adapters.

Now target mode works for all supported FC adapters except ancient 2100,
which is not tested.


# 3e6deb33 23-Nov-2015 Alexander Motin <mav@FreeBSD.org>

Rip off target mode support for parallel SCSI QLogic adapters.

Hacks to enable target mode there complicated code, while didn't really
work. And for outdated hardware fixing it is not really interesting.

Initiator mode tested with Qlogic 1080 adapter is still working fine.


# ffe6ea05 21-Nov-2015 Alexander Motin <mav@FreeBSD.org>

Increase maximal value of vports tunable to 254.

I am not sure this value is really viable yet, but that is what chips
officially support in NPIV mode (in loop mode maximum is 125).


# dfd24649 25-Oct-2015 Alexander Motin <mav@FreeBSD.org>

Formalize/unify chip (re-)inits.


# c07b9e07 23-Oct-2015 Alexander Motin <mav@FreeBSD.org>

Disable full bus scan by CAM for FC adapters.

FC port database code already notifies CAM about all devices. Additional
full scan is just a waste of time, that by definition won't find anything
that is not present in port database.


# 6ce548a1 23-Oct-2015 Alexander Motin <mav@FreeBSD.org>

Some polishing and unification in ISR code.


# 21c2207f 19-Oct-2015 Alexander Motin <mav@FreeBSD.org>

Update firmware images for Qlogic 24xx/25xx from 5.5.0 to 7.3.0.

This also removes separate "_multi" images, since this funcationality is
now in base, and there is simply no new images without it for years.


# 07f56f1c 23-Jun-2015 Alexander Motin <mav@FreeBSD.org>

Add dev.isp.X.role sysctl in addition to tunable.

It (mostly) allows to enable/disable initiator mode in run time.
Target mode control is blocked here to force coordination with CTL.

While there, add separate tunables/sysctls for virtual channels.


# aced5239 13-Jun-2014 John Baldwin <jhb@FreeBSD.org>

Add missing calls to bus_dmamap_unload() when freeing static DMA
allocations.

Reviewed by: scottl


# 07d925fa 10-Nov-2013 Alexander Motin <mav@FreeBSD.org>

Use relaxed (write-only) memory barriers when writing some of queue index
registers (for now on ISP2400+). We never read those registers back and
AFAIK their semantics does not require any immediate reaction on write.


# c68534f1 12-Aug-2013 Scott Long <scottl@FreeBSD.org>

Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI
command register. The lazy BAR allocation code in FreeBSD sometimes
disables this bit when it detects a range conflict, and will re-enable
it on demand when a driver allocates the BAR. Thus, the bit is no longer
a reliable indication of capability, and should not be checked. This
results in the elimination of a lot of code from drivers, and also gives
the opportunity to simplify a lot of drivers to use a helper API to set
the busmaster enable bit.

This changes fixes some recent reports of disk controllers and their
associated drives/enclosures disappearing during boot.

Submitted by: jhb
Reviewed by: jfv, marius, achadd, achim
MFC after: 1 day


# dd0b4fb6 12-Feb-2013 Konstantin Belousov <kib@FreeBSD.org>

Reform the busdma API so that new types may be added without modifying
every architecture's busdma_machdep.c. It is done by unifying the
bus_dmamap_load_buffer() routines so that they may be called from MI
code. The MD busdma is then given a chance to do any final processing
in the complete() callback.

The cam changes unify the bus_dmamap_load* handling in cam drivers.

The arm and mips implementations are updated to track virtual
addresses for sync(). Previously this was done in a type specific
way. Now it is done in a generic way by recording the list of
virtuals in the map.

Submitted by: jeff (sponsored by EMC/Isilon)
Reviewed by: kan (previous version), scottl,
mjacob (isp(4), no objections for target mode changes)
Discussed with: ian (arm changes)
Tested by: marius (sparc64), mips (jmallet), isci(4) on x86 (jharris),
amd64 (Fabian Keil <freebsd-listen@fabiankeil.de>)


# 8e1b6e7a 02-Nov-2012 Matt Jacob <mjacob@FreeBSD.org>

Don't allow for more than one segment for the control space since
we're not set up to deal with that.

MFC after: 1 week


# 10bf42c2 07-Sep-2012 Matt Jacob <mjacob@FreeBSD.org>

Remove useless extra test.

Pointed out by: Sascha of DragonFly BSD
MFC after: 2 weeks


# 662daadd 21-Aug-2012 Matt Jacob <mjacob@FreeBSD.org>

Remove dependence on MAXPHYS.

MFC after: 1 month


# 405b7a29 12-Aug-2012 Matt Jacob <mjacob@FreeBSD.org>

Fix an oops where we wiped out DMA maps. Don't allocate extended
command space for anything less than a 2300.

MFC after: 1 month
X-MFC: 238869


# de0627d0 03-Aug-2012 Matt Jacob <mjacob@FreeBSD.org>

Oops. We only do allocate room for extended commands
and responses for 2300 cards are newer.

Sponsored by: Spectralogic
Noticed by: Our Friend Manfred
MFC after: 1 month
X-MFC: 238869


# 387d8239 28-Jul-2012 Matt Jacob <mjacob@FreeBSD.org>

-----------
MISC CHANGES

Add a new async event- ISP_TARGET_NOTIFY_ACK, that will guarantee
eventual delivery of a NOTIFY ACK. This is tons better than just
ignoring the return from isp_notify_ack and hoping for the best.

Clean up the lower level lun enable code to be a bit more sensible.

Fix a botch in isp_endcmd which was messing up the sense data.

Fix notify ack for SRR to use a sensible error code in the case
of a reject.

Clean up and make clear what kind of firmware we've loaded and
what capabilities it has.
-----------
FULL (252 byte) SENSE DATA

In CTIOs for the ISP, there's only a limimted amount of space
to load SENSE DATA for associated CHECK CONDITIONS (24 or 26
bytes). This makes it difficult to send full SENSE DATA that can
be up to 252 bytes.

Implement MODE 2 responses which have us build the FCP Response
in system memory which the ISP will put onto the wire directly.

On the initiator side, the same problem occurs in that a command
status response only has a limited amount of space for SENSE DATA.
This data is supplemented by status continuation responses that
the ISP pushes onto the response queue after the status response.
We now pull them all together so that full sense data can be
returned to the periph driver.

This is supported on 23XX, 24XX and 25XX cards.

This is also preparation for doing >16 byte CDBs.

-----------
FC TAPE

Implement full FC-TAPE on both initiator and target mode side. This
capability is driven by firmware loaded, board type, board NVRAM
settings, or hint configuration options to enable or disable. This
is supported for 23XX, 24XX and 25XX cards.

On the initiator side, we pretty much just have to generate a command
reference number for each command we send out. This is FCP-4 compliant
in that we do this per ITL nexus to generate the allowed 1 thru 255
CRN.

In order to support the target side of FC-TAPE, we now pay attention
to more of the PRLI word 3 parameters which will tell us whether
an initiator wants confirmed responses. While we're at it, we'll
pay attention to the initiator view too and report it.

On sending back CTIOs, we will notice whether the initiator wants
confirmed responses and we'll set up flags to do so.

If a response or data frame is lost the initiator sends us an SRR
(Sequence Retransmit Request) ELS which shows up as an SRR notify
and all outstanding CTIOs are nuked with SRR Received status. The
SRR notify contains the offset that the initiator wants us to restart
the data transfer from or to retransmit the response frame.

If the ISP driver still has the CCB around for which the data segment
or response applies, it will retransmit.

However, we typically don't know about a lost data frame until we
send the FCP Response and the initiator totes up counters for data
moved and notices missing segments. In this case we've already
completed the data CCBs already and sent themn back up to the periph
driver. Because there's no really clean mechanism yet in CAM to
handle this, a hack has been put into place to complete the CTIO
CCB with the CAM_MESSAGE_RECV status which will have a MODIFY DATA
POINTER extended message in it. The internal ISP target groks this
and ctl(8) will be modified to deal with this as well.

At any rate, the data is retransmitted and an an FCP response is
sent. The whole point here is to successfully complete a command
so that you don't have to depend on ULP (SCSI) to have to recover,
which in the case of tape is not really possible (hence the name
FC-TAPE).

Sponsored by: Spectralogic
MFC after: 1 month


# 9e7d423d 24-Jun-2012 Matt Jacob <mjacob@FreeBSD.org>

Clean up multi-id mode so it's driven by the f/w loaded,
not by some hint setting. Do more preparations for FC-Tape.
Clean up resource counting for 24XX or later chipsets so
we find out after EXEC_FIRMWARE what is actually supported.
Set target mode exchange count based upon whether or not
we are supporting simultaneous target/initiator mode. Clean
up some old (pre-24XX) xfwoption and zfwoption issues.

Sponsored by: Spectralogic
MFC after: 3 days


# ad0ab753 17-Jun-2012 Matt Jacob <mjacob@FreeBSD.org>

Prepare for FC-Tape support. This involved doing a lot of little cleanups
and crosschecks against firmware documentation. We now check and report
FC firmware attributes and at least are now prepared for the upper 48 bits
of f/w attributes (which are probably for the 8100 or later cards). This
involed changing how inbits and outbits are calculated for varios commands,
hopefully clearer and cleaner. This also caused me to clean up the actual
mailbox register usage. Finally, we are now unconditionally using a CRN
for initiator mode.

A longstanding issue with the 2400/2500 is that they do *not* support
a "Prefer PTP followed by loop", which explains why enabling that
caused the f/w to crash.

A slightly more invasive change is to let the firmware load entirely
drive whether multi_id support is enabled or not.

Sponsored by: Spectralogic
MFC after: 1 week


# 2c82e3bb 15-Jun-2012 Matt Jacob <mjacob@FreeBSD.org>

If debug values were set, the default from tval floated
down and triggered an attempt to set multiple virtual
ports whether you wanted them or not.

MFC after: 3 days


# d45ce511 31-May-2012 Eitan Adler <eadler@FreeBSD.org>

Adding missing dependancies for loading hptiop(4), hptmv(4) and isp(4) as modules.

PR: kern/166239
Submitted by: Pavel Timofeev <timp87@gmail.com>
Discussed on: -stable, -scsi
Reviewed by: scottl
No objection from: mjacob
Approved by: cperciva
MFC after: 3 days


# 7d3cea31 15-Nov-2011 Matt Jacob <mjacob@FreeBSD.org>

Was chasing down a failure to load f/w on a 2400. It turns out that the card
is actually broken, or needs a BIOS upgrade for 64 bit loads, but this uncovered
a couple of misplaced opcode definitions and some missing continual mbox command
cases, so might as well update them here.


# e95725cb 13-Aug-2011 Matt Jacob <mjacob@FreeBSD.org>

Most of these changes to isp are to allow for isp.ko unloading.
We also revive loop down freezes. We also externaliz within isp
isp_prt_endcmd so something outside the core module can print
something about a command completing. Also some work in progress to
assist in handling timed out commands better.

Partially Sponsored by: Panasas
Approved by: re (kib)
MFC after: 1 month


# a959d921 10-Mar-2011 Matt Jacob <mjacob@FreeBSD.org>

Add support QLE220 card- an 2500 lookalike.

Obtained mostly from: Roman && Konstantin
MFC after: 1 week


# 37bb79f1 14-Feb-2011 Marius Strobl <marius@FreeBSD.org>

- Use the correct DMA tag/map pair for synchronize the FC scratch area.
- Allocate coherent DMA memory for the request/response queue area and
and the FC scratch area.

These changes allow isp(4) to work properly on sparc64 with usage of the
IOMMU streaming buffers enabled.

Approved by: mjacob
MFC after: 2 weeks


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# a035b0af 02-Jun-2010 Matt Jacob <mjacob@FreeBSD.org>

Various minor and not so minor fixes suggested by Coverity.
In at least one case, it's amazing that target mode worked at all.

Found by: Coverity.
MFC after: 2 weeks


# d526c88f 10-May-2010 Marius Strobl <marius@FreeBSD.org>

MFC: r207570

On sparc64 obtain the initiator ID from the Open Firmware device tree
in order to match what the PROM built-in driver uses.


# 17bc427d 03-May-2010 Marius Strobl <marius@FreeBSD.org>

On sparc64 obtain the initiator ID from the Open Firmware device tree
in order to match what the PROM built-in driver uses.

Approved by: mjacob


# fbcd5da2 24-Apr-2010 Matt Jacob <mjacob@FreeBSD.org>

This is an MFC of 205236

Put gone device timer into a structure tag that can hold more than 32 seconds. Oops.

Untangle some of the confusion about what role means when it's in the FCPARAM/SDPARAM
or isp_fc/isp_spi structures. This fixed a problem about seeing targets appear if you've
turned off autologin and find them, or rather don't, via camcontrol rescan.


# 4ecb1d4a 16-Mar-2010 Matt Jacob <mjacob@FreeBSD.org>

Put gone device timer into a structure tag that can hold more than 32 seconds. Oops.

Untangle some of the confusion about what role means when it's in the FCPARAM/SDPARAM
or isp_fc/isp_spi structures. This fixed a problem about seeing targets appear if you've
turned off autologin and find them, or rather don't, via camcontrol rescan.

MFC after: 1 month


# 87aa0933 01-Mar-2010 Matt Jacob <mjacob@FreeBSD.org>

MFC of 204397: fix problems with fast posting handles


# c5fc7d96 27-Feb-2010 Matt Jacob <mjacob@FreeBSD.org>

MFC of 204384: Fix misallocation error in target mode


# 443e752d 26-Feb-2010 Matt Jacob <mjacob@FreeBSD.org>

Revamp the pieces of some of the stuff I forgot to do when shifting to
32 bit handles. The RIO (reduced interrupt operation) and fast posting
for the parallel SCSI cards were all 16 bit handles. Furthermore,
target mode parallel SCSI only can have 16 bit handles.

Use part of a supplied patch to switch over to using 32 bit handles.
Be a bit more conservative here and only do this for parallel SCSI
for the 12160 (Ultra3) cards. There were a lot of marginal Ultra2
cards, and, frankly, few are findable now for testing.

Fix the target handle routine to only do 16 bit handles for parallel
SCSI cards. This is okay because the upper sixteen bits of the new
32 bit handles is a sequence number to help protect against duplicate
completions. This would be very unlikely to happen with parallel
SCSI target mode, and wasn't present before, so we're no worse off
than we used to be.

While we're at it, finally split the async mailbox completion handlers
into FC and parallel SCSI functions. This makes it much cleaner and
easier to figure out what is or isn't a legal async mailbox completion
code for different card classes.

PR: kern/144250
Submitted partially by: Charles D
MFC after: 1 week


# 32b3ec7d 26-Feb-2010 Matt Jacob <mjacob@FreeBSD.org>

Fix misallocation error in target mode.

MFC after: 1 day


# 7733cf8f 11-Feb-2010 Matt Jacob <mjacob@FreeBSD.org>

MFC a number of changes from head for ISP (203478,203463,203444,202418,201758,
201408,201325,200089,198822,197373,197372,197214,196162). Since one of those
changes was a semicolon cleanup from somebody else, this touches a lot more.


# c8b8a2c4 03-Feb-2010 Matt Jacob <mjacob@FreeBSD.org>

Redo how commands handles are created and managed and implement sequence
numbers and handle types in rational way. This will better protect from
(unwittingly) dealing with stale handles/commands.

Fix the watchdog timeout code to better protect itself from mistakes.

If we run an abort on a putatively timed out command, the command
may in fact get completed, so check to make sure the command we're
timing it out is still around. If the abort succeeds, btw, the command
should get returned via a different path.


# 2df76c16 31-Jul-2009 Matt Jacob <mjacob@FreeBSD.org>

Add 8Gb support (isp_2500). Fix a fair number of configuration and
firmware loading bugs.

Target mode support has received some serious attention to make it
more usable and stable.

Some backward compatible additions to CAM have been made that make
target mode async events easier to deal with have also been put
into place.

Further refinement and better support for NP-IV (N-port Virtualization)
is now in place.

Code for release prior to RELENG_7 has been stripped away for code clarity.

Sponsored by: Copan Systems

Reviewed by: scottl, ken, jung-uk kim
Approved by: re


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# baa219ed 26-Jun-2007 Matt Jacob <mjacob@FreeBSD.org>

Pointy hat to me. Committed with building.

Approved by: re (ken, implicit)


# 458570f7 26-Jun-2007 Matt Jacob <mjacob@FreeBSD.org>

Extension of previous commit- when we have 2k login firmware, we need to
put out a ispreqt2e_t structure onto the request queue- not a ispreqt2_t
structure. I forgot that the 23XX can use a t2 structure.

Approved by: re (ken, implicitly)
MFC after: 3 days


# 16dbcac0 25-Jun-2007 Matt Jacob <mjacob@FreeBSD.org>

Yet another bug- when we have 2k login firmware, we need
to put out a ispreqt3e_t structure onto the request queue-
not a ispreqt3_t structure. We weren't. This turns out only
to really matter for big endian machines.

Approved by: re (ken)
MFC after: 3 days


# 9b434ede 11-Jun-2007 Matt Jacob <mjacob@FreeBSD.org>

Only try and set a segment lim size to 1 << 32 iff bus_size_t > 4.


# 0230a28b 11-May-2007 Matt Jacob <mjacob@FreeBSD.org>

Fix pointy-hat problem with BUS_DMA_ROOTARG macro that caused problems for sparc64.
Candidate for immediate MFC.

Noticed by: Everyone-maxim contacted.


# 0a70657f 05-May-2007 Matt Jacob <mjacob@FreeBSD.org>

Make this an MP safe driver but also still be multi-release.
Seems to work on RELENG_4 through -current and also on sparc64
now. There may still be some issues with the auto attach/detach
code to sort out.

MFC after: 3 days


# 9a1b0d43 01-Apr-2007 Matt Jacob <mjacob@FreeBSD.org>

Temporarily desupport simultaneous target and initiator mode.

When the linux port changes were imported which split the
target command list to be separate from the initiator command
list and the handle format changed to encode a type in the handle
the implications to the function isp_handle_index (which only
the NetBSD/OpenBSD/FreeBSD ports use) were overlooked.

The fault is twofold: first, the index into the DMA maps
in isp_pci is wrong because a target command handle with
the type bit left in place caused a bad index (and panic)
into dma map. Secondly, the assumption of the array
of DMA maps in either PCS or SBUS attachment structures is
that there is a linear mapping between handle index and
DMA map index. This can no longer be true if there are
overlapping index spaces for initiator mode and target
mode commands.

These changes bandaid around the problem by forcing us
to not have simultaneous dual roles and doing the appropriate
masking to make sure things are indexed correctly. A longer
term fix is being devloped.


# 5f634111 22-Mar-2007 Matt Jacob <mjacob@FreeBSD.org>

MFP4: a) Some constification from NetBSD (gcc 4.1.2)
b) Split default param fetching/setting into scsi and fibre functions
and retry the fibre fetch more than once.

MFC after: 1 week


# 6a7d12e1 13-Mar-2007 Matt Jacob <mjacob@FreeBSD.org>

Move bus_space_tag and bus_space_handle register access
tokens into the common isp_osinfo structure instead of being
in bus specific structures. This allows us to implement
a SYNC_REG MEMORYBARRIER call (using bus_space_barrier)
and also reduce the amount of bus specific wrapper structure
usages in isp_pci && isp_sbus.

MFC after: 3 days


# 70273f90 11-Mar-2007 Matt Jacob <mjacob@FreeBSD.org>

Fix compilation issues found in RELENG_4 port and merge the
diffs back to -current to keep versions identical.


# e48b2487 09-Mar-2007 Matt Jacob <mjacob@FreeBSD.org>

Fix some stupid copyright mistakes that have been there for quite some time.


# 5f538376 23-Feb-2007 Matt Jacob <mjacob@FreeBSD.org>

Redo previous newbus related change to be kinder to
multi-release support.


# ef544f63 22-Feb-2007 Paolo Pisati <piso@FreeBSD.org>

o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@


# 336b5612 22-Feb-2007 Matt Jacob <mjacob@FreeBSD.org>

There is a problem in setting/getting 'options'- if we check things
early, we haven't set board type, so we can't correctly check for
some options. Fix this by splitting option setting/getting into
generic, pci and then later board specific, option setting/getting.

This was noticed when setting 'iid' (or 'hard loop id') didn't work
all of a sudden.

Noticed by: Mike Drangula (thanks!) via Jung-uk Kim (thanks!)


# 392695e0 09-Feb-2007 Matt Jacob <mjacob@FreeBSD.org>

add a missing piece for 2432


# 41675df0 09-Feb-2007 Matt Jacob <mjacob@FreeBSD.org>

Putative untested 2432 (PCI-E) support.


# f9734398 22-Jan-2007 Matt Jacob <mjacob@FreeBSD.org>

Clean up some of the various platform and release specific dma tag
stuff so it is centralized in isp_freebsd.h.

Take out PCI posting flushed in qla2100/2200 register reads except for
2100s.


# 5ccae6a5 05-Jan-2007 Matt Jacob <mjacob@FreeBSD.org>

error print cleanup && turn off ints if RISC is paused


# 06cacb29 18-Dec-2006 Matt Jacob <mjacob@FreeBSD.org>

Restore revision 1.126 that got accidentally nuked.


# 3bda7a83 15-Dec-2006 Matt Jacob <mjacob@FreeBSD.org>

Implement ISP_RESET0 for PCI and SBUS attachments- isp_reset has
been modified to call ISP_RESET0 if it fails to do a reset. This
gives us a chance to disable interrupts.


# 3cce220c 09-Dec-2006 Matt Jacob <mjacob@FreeBSD.org>

Remove dependency on ispfw and firmware as modules.
Either they're there early and the ispfw sets have
registered themselves, or they're not.

The module dependency stuff isn't quite what we want
anyway. If the user doesn't want the load placed on
system memory by loading the firmware, they don't
specify it to be loaded (either by being linked in
or via being a module to be loaded and then hooked
in with firmware(9)). It doesn't then make sense to
then override what they want by pulling it in anyway.

This might be able to work if we were able to pull in
just exactly what we needed for the card we have- but
that's an optimization left for the future.


# 04697f7a 17-Nov-2006 Matt Jacob <mjacob@FreeBSD.org>

Make the SAN login/logout stuff more common between different chipsets
and provied an isp_control entry point so that the outer layers can
do PLOGI/LOGO explicitly. Add MS IOCB support. This completes the cycle
for base support for SMI-S.


# 6301ffe5 17-Nov-2006 Matt Jacob <mjacob@FreeBSD.org>

Disable code to set max read byte count on the 2400.

It caused a panic in writing the config register on a system. Turn
it off until we take the time to understand it.

Reported by and Testing by: Anton


# f7c631bc 14-Nov-2006 Matt Jacob <mjacob@FreeBSD.org>

Push things closer to path failover by implementing loop down and
gone device timers and zombie state entries. There are tunables
that can be used to select a number of parameters.

loop_down_limit - how long to wait for loop to come back up before
declaring
all devices dead (default 300 seconds)

gone_device_time- how long to wait for a device that has appeared
to leave the loop or fabric to reappear (default 30 seconds)

Internal tunables include (which should be externalized):

quick_boot_time- how long to wait when booting for loop to come up

change_is_bad- whether or not to accept devices with the same
WWNN/WWPN that reappear at a different PortID as being the 'same'
device.

Keen students of some of the subtle issues here will ask how
one can keep devices from being re-accepted at all (the answer
is to set a gone_device_time to zero- that effectively would
be the same thing).


# 10365e5a 01-Nov-2006 Matt Jacob <mjacob@FreeBSD.org>

Add 4Gb (24XX) support and lay the foundation for a lot of new stuff.


# 198b3358 02-Sep-2006 Matt Jacob <mjacob@FreeBSD.org>

Restore multi-version cleanliness.


# 378f231e 02-Sep-2006 John-Mark Gurney <jmg@FreeBSD.org>

add a newbus method for obtaining the bus's bus_dma_tag_t... This is
required by arches like sparc64 (not yet implemented) and sun4v where there
are seperate IOMMU's for each PCI bus... For all other arches, it will
end up returning NULL, which makes it a no-op...

Convert a few drivers (the ones we've been working w/ on sun4v) to the
new convection... Eventually all drivers will need to replace the parent
tag of NULL, w/ bus_get_dma_tag(dev), though dev is usually different for
each driver, and will require hand inspection...

Reviewed by: scottl (earlier version)


# 8070de63 31-Aug-2006 Matt Jacob <mjacob@FreeBSD.org>

More ispfwfunc definitions funnies which break pre-7.0 builds.


# 2298c14c 20-Aug-2006 Matt Jacob <mjacob@FreeBSD.org>

Fix RELENG_4 code version- isp_roles wasn't getting initialized so
it ended up defaulting to ISP_ROLE_NONE. My testing hadn't caught it
because I was deliberatly setting role via ioctl.

Thanks to user Toni for lending me an alpha to test this on.

MFC after: 0 days


# 4cc9e3e7 13-Aug-2006 Matt Jacob <mjacob@FreeBSD.org>

The register offset is within 4K, not 256 bytes, for some QLogic cards.


# 799881e0 16-Jul-2006 Matt Jacob <mjacob@FreeBSD.org>

Some rearrangement of headers to minimize diffs with outside of
FreeBSD repository and to clean up the license header so as to
not pollute the license with file function.

Zero all mailbox structures prior to use (just in case). Change
the outgoing mailbox count for INIT_FIRMWARE to be correct.


# a887f1a6 13-Jul-2006 Matt Jacob <mjacob@FreeBSD.org>

Don't attach 2422's yet. It just confuses everyone.


# 9a5af410 09-Jul-2006 Matt Jacob <mjacob@FreeBSD.org>

Convert isp(4) and ispfw(4) to use firmware(9) to manage firmware
loading for the QLogic cards.

Because isp(4) exists before the root is mounted, it's not really
possible for us to use the kernel's linker to load modules directly
from disk- that's really too bad.

However, the this is still a net win in in that the firmware has
been split up on a per chip (and in some cases, functionality)
basis, so the amount of stuff loaded *can* be substantially less
than the 1.5MB of firmware images that ispfw now manages. That is,
each specific f/w set is now also built as a module. For example,
QLogic 2322 f/w is built as isp_2322.ko and Initiator/Target 1080
firmware is built as isp_1080_it.ko.

For compatibility purposes (i.e., to perturb folks the least), we
also still build all of the firmware as one ispfw.ko module.

This allows us to let 'ispfw_LOAD' keep on working in existing
loader.conf files. If you now want to strip this down to just
the firmware for your h/w, you can then change loader.conf to
load the f/w you specifically want.

We also still allow for ispfw to be statically built (e.g., for
PAE and sparc64).

Future changes will look at f/w unloading and also role switching
that then uses the kernel linker to load different ips f/w sets.
MFC after: 2 months


# 8a97c03a 03-Jul-2006 Matt Jacob <mjacob@FreeBSD.org>

Do various fixes to support firmware loading for the 2322
(and by extension, the 2422).

One peculiar thing I've found with the 2322 is that if you
don't force it to do Hard LoopID acquisition, the firmware
crashes. This took a while to figure out.

While we're at it, fix various bugs having to do with NVRAM
reading and option setting with respect to pieces of NVRAM.


# 09934867 22-May-2006 Matt Jacob <mjacob@FreeBSD.org>

Remove bzero/bcopy vestiges

Be cognizant as to whether we're running 2KLogin f/w in target mode and
do the appropriate loopid load based upon that.

Do a first cut (seems to work, at least for amd64) at 64 bit target
mode for fibre channel cards. We could probably also do it for SPI
cards, but that's not supported right now.


# 9cd7268e 21-Apr-2006 Matt Jacob <mjacob@FreeBSD.org>

Some more gratuitous format and name changes.

Pull in some target mode changes from a private branch.
Pull in some more RELENG_4 compilation changes.

A lot of lines changed, but not much content change yet.


# 1dae40eb 14-Feb-2006 Matt Jacob <mjacob@FreeBSD.org>

a) clean up some declaration stuff (i.e., make more modern with respect
to getting rid u_int for uint and so on).

b) Turn back on 64 bit DAC support. Cheeze it a bit in that we have two
DMA callback functions- one when we have bus_addr_t > 4 bits in width and
the other which should be normal. Even Cheezier in that we turn off setting
up DMA maps to be BUS_SPACE_MAXADDR if we're in ISP_TARGET_MODE. More work
on this in a week or so.

c) Tested under amd64 and 1MB DFLTPHYS, sparc64, i386 (PAE, but insufficient
memory to really test > 4GB). LINT check under amd64.

MFC after: 1 month


# 51effc8c 04-Feb-2006 Matt Jacob <mjacob@FreeBSD.org>

Actually, no, I had it wrong in 1.109. The arguments to bus_dma_create_tag
are bus_addr_t, not bus_size_t.

In any case, turn off DAC support entirely until it is revamped to actually
work *correctly* for 64 bit platforms (not using a PAE definition and for
both initiator and target mode).


# 4b2dc3c4 03-Feb-2006 Scott Long <scottl@FreeBSD.org>

i386/PAE defines bus_size_t to be 32-bits when it likely should be 64-bits.
Fixing it is left for another day, so just hack around it for now.


# 53af7d22 02-Feb-2006 Matt Jacob <mjacob@FreeBSD.org>

Remove use of inlines and use the functions as a library.

Larger code space, possibly performance hit, but more portable.
Certainly less questionable use of inlining.

Suggested by: des


# 6c426685 25-Jan-2006 Matt Jacob <mjacob@FreeBSD.org>

oops


# 8872e3d7 25-Jan-2006 Matt Jacob <mjacob@FreeBSD.org>

Put in at least an attempt to ID the 2422 (4Gb part)


# e5265237 22-Jan-2006 Matt Jacob <mjacob@FreeBSD.org>

First of several commits as this driver is dusted off and maybe brought
up to date. Principle changes for this reelase is to support 2K Port Login
firmware. This allows us to support the 2322 (and 2422 4Gb) cards which only
come with the 2K Port Login firmware. The 2322 should now work- but we don't
have firmware sets for it in ispfw (as the change to load 2K Port Login f/w
hasn't been made- that f/w is so big it has to be loaded in more than one
chunk).

Other changes are the beginnings of cleaning up some long standing target
mode issues. The next changes here will incorporate a lot of bug fixes
from others.

Finally, some copyright cleanup and attempts to make the parts of the
driver that are FreeBSD specific start conforming more to FreeBSD style.

MFC after: 1 month


# 74a96f43 15-Dec-2005 John Baldwin <jhb@FreeBSD.org>

Use uintmax_t and %j to print bus dma segment members rather than casting
to long long and using %ll.


# d4fcf3cb 28-May-2005 Yoshihiro Takahashi <nyan@FreeBSD.org>

Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64. The optimization is a trivial on recent machines.

Reviewed by: -arch (imp, marcel, dfr)


# b49c4674 10-May-2005 Matt Jacob <mjacob@FreeBSD.org>

Fix some incorrectly swapped fields in an ICB.
Access a PCI register with correct width.

Obtained from: Dmitry Valeryevich Trikoz


# b77e575e 05-Mar-2005 Warner Losh <imp@FreeBSD.org>

Use BUS_PROBE_DEFAULT for pci probe return value


# dd1419ab 22-Jan-2005 Matt Jacob <mjacob@FreeBSD.org>

Support the DELL OEM 2312 cards (1077,6312).

Many thanks to Stormweb for making the h/w available for testing.

MFC after: 2 days


# 69767099 22-Sep-2004 Matt Jacob <mjacob@FreeBSD.org>

PAE support changes that included at least some minimal actual testing
with a kernel that booted.


# 6de9bf77 07-Sep-2004 Matt Jacob <mjacob@FreeBSD.org>

Do the small amount of tweaking to support PAE for at least initiator mode.
I was unable to test this as the PAE kernel crashed with a "cannot copy
LDT" before coming up. When this gets a bit more testing, I'll fix the PAE
conf file to allow isp devices.

PR: 59728


# 51e23558 24-May-2004 Nate Lawson <njl@FreeBSD.org>

Store the target handles in a separate list from normal commands. Add a
CTIO fast post routine to handle CTIO completions.

Submitted by: mjacob


# 5f96beb9 17-Mar-2004 Nate Lawson <njl@FreeBSD.org>

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


# 87ab7d39 06-Feb-2004 Matt Jacob <mjacob@FreeBSD.org>

If we're defined to have a default role for target mode, make it
just ISP_ROLE_TARGET- not both.

MFC after: 1 week


# aad970f1 24-Aug-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID().
Also some minor style cleanups.


# 77e6a3b2 22-Aug-2003 Warner Losh <imp@FreeBSD.org>

Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.


# f6b1c44d 01-Jul-2003 Scott Long <scottl@FreeBSD.org>

Mega busdma API commit.

Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma. At the moment, this is used for the
asynchronous busdma_swi and callback mechanism. Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg. dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create(). The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms. The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by: tmm, gibbs


# a163d034 18-Feb-2003 Warner Losh <imp@FreeBSD.org>

Back out M_* changes, per decision of the TRB.

Approved by: trb


# 44956c98 21-Jan-2003 Alfred Perlstein <alfred@FreeBSD.org>

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


# 76514802 01-Jan-2003 Matt Jacob <mjacob@FreeBSD.org>

Make compiles (LINT and/or ISP_TARGET_MODE options) happier by making sure
printf type format args and actual args match.

Reviewed by: Sam Leffler <sam@errno.com>


# f556e83b 11-Oct-2002 Matt Jacob <mjacob@FreeBSD.org>

This should enable 10160 support. As best as I can tell, the same
f/w as 12160 is used, and otherwise, this is just a single channel
variant of the 10160.

MFC after: 0 days


# 435a9337 22-Sep-2002 Matt Jacob <mjacob@FreeBSD.org>

Re-specify the bus space creation such that if we have ISP_DAC_SUPPORTED
defined, we set the address space limitation to BUS_SPACE_UNRESTRICTED,
otherwise to BUS_SPACE_MAXADDR_32BIT.

If we have a 1240, ULTRA2 or better, or an FC card, the boundary limit
is BUS_SPACE_UNRESTRICTED and segment limit is BUS_SPACE_MAXADDR_32BIT.

The older 1020/1040 cards have boundary and segment limits of
BUS_SPACE_MAXADDR_24BIT.


# fc3bbaaa 17-Aug-2002 Matt Jacob <mjacob@FreeBSD.org>

Fix the incorrect parsing of the Risc2Host isr. For RIO_16,
fast posting command completion, and fast post CTIO completion,
the upper half of Risc2Host is a copy of mailbox #1- *not*
mailbox #0.

MFC after: 1 day


# 43722a42 25-Jul-2002 Matt Jacob <mjacob@FreeBSD.org>

Don't test against default_iid being zero as a test for whether we
set something- iid 0 is valid.


# 72429e49 25-Jul-2002 Matt Jacob <mjacob@FreeBSD.org>

Make sure that if are in fact using 'full SMP', make the interrupt
flags include INTR_MPSAFE. Put the flags in a common place so that
both isp_sbus && isp_pci DTRT.

In isp_mbxdma setup, drop any locks prior to calling things like
bus_dmatag_create. This gets rid of these obnoxious WITNESS messages
about 'sleeping with locks held' blah blah blah blah blah.


# 73030e03 10-Jul-2002 Matt Jacob <mjacob@FreeBSD.org>

'Support' for ISP SBus cards.

This code does not imply that SBus cards work yet. They hang for me.
But I can't netboot the latest snapshot on my ultra1e, and things
hang at bus_setup_intr time.

Since I'm offline for a while, I thought I'd toss this in in case somebody
else who has a bit better luck wants to fart around with it. Please try
and wait until I get back to check things in.


# ed753e82 08-Jul-2002 Matt Jacob <mjacob@FreeBSD.org>

Add override so that we can force set our hard loopdid.

MFC after: 1 week


# fc087171 15-Jun-2002 Matt Jacob <mjacob@FreeBSD.org>

Set all 23XX cards as 'touched' (we have trouble, unpredictably, about
running ABOUT FIRMWARE with some that were started by BIOS downloads).

Redo CTIO2 dma mapping- use continuation segments instead of multiple
CTIO2s. Thanks to Veritas for sponsoring this work (in a different
context).

MFC after: 1 week


# 029f13c6 04-Apr-2002 Matt Jacob <mjacob@FreeBSD.org>

Fix bus dma segment count to be based off of MAXPHYS, not BUS_SPACE_MAXSIZE.
Grumble. I've seen better documented architectures out of Redmond.

Redo fabric evaluation to not use GET ALL NEXT (GA_NXT). Switches seem
to be trying to wriggle out of supporting this well. Instead, use
GID_FT to get a list of Port IDs and then use GPN_ID/GNN_ID to find the
port and node wwn. This should make working on fabrics a bit cleaner and
more stable.

This also caused some cleanup of SNS subcommand canonicalization so that
we can actually check for FS_ACC and FS_RJT, and if we get an FS_RJT,
print out the reason and explanation codes.

We'll keep the old GA_NXT method around if people want to uncomment a
controlling definition in ispvar.h.

This also had us clean up ISPASYNC_FABRICDEV to use a local lportdb argument
and to have the caller explicitly say that a device is at the end of the
fabric list.

MFC after: 1 week


# 6008862b 04-Apr-2002 John Baldwin <jhb@FreeBSD.org>

Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on: i386, alpha, sparc64


# 1923f739 02-Apr-2002 Matt Jacob <mjacob@FreeBSD.org>

Redo stuff for sparc64- primarily fix bus dma implementation. The endian
stuff was right, but the busdma stuff was massively not right.

Didn't really test on ia64 or i386- don't have the former h/w and my
FreeBSD-current disk is unwell right now. Hope that this is okay.

MFC after: 1 week


# d134aa0b 17-Feb-2002 Matt Jacob <mjacob@FreeBSD.org>

More for f/w crash dumps (bug fixing and adding ioctl entry points
and hints to enable for specific units)

MFC after: 1 week


# 3f02619f 16-Feb-2002 Matt Jacob <mjacob@FreeBSD.org>

Hints for WWN are now WWNN and/or WWPN.

MFC after: 1 week


# 75c1e828 04-Feb-2002 Matt Jacob <mjacob@FreeBSD.org>

+ A variety of 23XX changes:
disable MWI on 2300

based on function code, set an 'isp_port' for the 2312- it's a
separate instance, but the NVRAM is shared, and the second port's
NVRAM is at offset 256.

+ Enable RIO operation for LVD SCSI cards. This makes a *big* difference
as even under reasonable load we get batched completions of about 30
commands at a time on, say, an ISP1080.

+ Do 'continuation' mailbox commands- this allows us to specify a work
area within the softc and 'continue' repeated mailbox commands. This is
more or less on an ad hoc basis and is currently only used for firmware
loading (which f/w now loads substantially faster becuase the calling
thread is only woken when all the f/w words are loaded- not for each
one of the 40000 f/w words that gets loaded).

+ If we're about to return from isp_intr with a 'bogus interrupt' indication,
and we're not a 23XX card, check to see whether the semaphore register is
currently *2* (not *1* as it should be) and whether there's an async completion
sitting in outgoing mailbox0. This seems to capture cases of lost fast posting
and RIO interrupts that the 12160 && 1080 have been known to pump out under
extreme load (extreme, as in > 250 active commands).

+ FC_SCRATCH_ACQUIRE/FC_SCRATCH_RELEASE macros.

+ Endian correct swizzle/unswizzle of an ATIO2 that has a WWPN in it.

MFC after: 1 week


# 4fd13c1b 10-Dec-2001 Matt Jacob <mjacob@FreeBSD.org>

Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.

The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it). It also has to handle the SBus cards (for
platforms that have them) which, while on a Big Endian machine, do *not*
require *most* of the request/response queue entry fields to be swizzled
or unswizzled.

One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.

Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.

Additional changes:

Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.

Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).

MFC after: 2 weeks


# 3bd40330 06-Oct-2001 Matt Jacob <mjacob@FreeBSD.org>

Whups- remember to zero the isr pointer arg.


# db4fa023 06-Oct-2001 Matt Jacob <mjacob@FreeBSD.org>

Respect QLogic's errata- read BIU_ISR even on the 2300
to see if there's an interrupt (avoids PCI parity errors
which can occur on the 2312 if you access some registers
from the host at the same time the RISC on the 2312 is
C accessing them).

MFC after: 1 day


# b96934e8 04-Sep-2001 Matt Jacob <mjacob@FreeBSD.org>

If we're on an interrupt stack, mark things so that we don't try
and cv_wait for mailbox commands to complete if we start them from
here.

Fix residuals for target mode such that we only check the residual and
set it in the CTIO if this is the last CTIO (when we're sending status).

MFC after: 4 weeks


# 126ec864 31-Aug-2001 Matt Jacob <mjacob@FreeBSD.org>

Add 2 Gigabit Fibre Channel support (2300 && 2312 cards). This required
some reworking (and consequent cleanup) of the interrupt service code.

Also begin to start a cleanup of target mode support that will (eventually)
not require more inforamtion routed with the ATIO to come back with the
CTIO other than tag.

MFC after: 4 weeks


# 559a1ad2 04-Jul-2001 Matt Jacob <mjacob@FreeBSD.org>

Some possibly helpful casts.


# 22941bd7 14-Jun-2001 Peter Wemm <peter@FreeBSD.org>

Fix warnings:
554: passing arg 4 of `resource_string_value' from incompatible pointer type
576: passing arg 4 of `resource_string_value' from incompatible pointer type
593: passing arg 4 of `resource_string_value' from incompatible pointer type


# 5d571944 28-May-2001 Matt Jacob <mjacob@FreeBSD.org>

Spring MegaChange #1.

----

Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).

----

Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.

The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.

These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.

---

Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.

--

Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.

Do some more substantial target mode cleanups.

MFC after: 8 weeks


# e9a2738a 04-Apr-2001 Matt Jacob <mjacob@FreeBSD.org>

Complete some Ansification. Check to make sure, in tdma_mk, that we won't
overflow the request queue. The reason we want to do this is that we
now push out completed CTIOs as we complete them- this gets the QLogic
working on them quicker. So we need to know whether we can put the entire
burrito out before we start.

We now support conjoint status with data for the last CTIO for both Fibre
Channel and SCSI. Leave the old code in place in case we need to go back
(minor 3 line ifdef).

Ultra-ultra important- *don't* set rq->req_seg_count for non-data
target mode requests in isp_pci_dmasetup. D'oh- this is actually
the tag value area for a CTIO. What *was* I thinking? Boy howdy
does both aic7xxx and sym get awfully unhappy when on reconnect
you give them a constant '1' for a tag value.


# b72b1569 20-Mar-2001 Matt Jacob <mjacob@FreeBSD.org>

For parallel SCSI, let us now do status with the final CTIO. For the 1080,
I was hanging after sending a xfer CTIO and a status CTIO for a non-discon
INQUIRY- the xfer CTIO was returned as completed OK, but the status CTIO
was dropped on the floor. All the fields looked good. I don't know why
it got dropped. But allowing status to go back with data xfer seemed to
work. I also noticed that with a non-disconnecting command that the
firmware handle in the ATIO is zero- this leads me to believe that the
f/w really can only handle one CTIO at a time in the discon case, and
it had no idea what to do with the second (status) CTIO.


# d8d5f2ad 04-Mar-2001 Matt Jacob <mjacob@FreeBSD.org>

more 32 to 16 bit handle conversions


# 5f5aafe1 01-Mar-2001 Matt Jacob <mjacob@FreeBSD.org>

Switch to using 16 bit handles instead of 32 bit handles.
This is a pretty invasive change, but there are three good
reasons to do this:

1. We'll never have > 16 bits of handle.
2. We can (eventually) enable the RIO (Reduced Interrupt Operation)
bits which return multiple completing 16 bit handles in mailbox
registers.
3. The !)$*)$*~)@$*~)$* Qlogic target mode for parallel SCSI spec
changed such that at_reserved (which was 32 bits) was split into
two pieces- and one of which was a 16 bit handle id that functions
like the at_rxid for Fibre Channel (a tag for the f/w to correlate
CTIOs with a particular command). Since we had to muck with that
and this changed the whole handler architecture, we might as well...

Propagate new at_handle on through int ct_fwhandle. Follow
implications of changing to 16 bit handles.

These above changes at least get Qlogic 1040 cards working in target
mode again. 1080/12160 cards don't work yet.

In isp.c:
Prepare for doing all loop management in outer layers.


# ed34d0ad 01-Mar-2001 Mark Murray <markm@FreeBSD.org>

Turn on interrupt-entropy harvesting for all/any mass storage devices
I could find. I have no doubt missed a couple.

Interrupt entropy harvesting is still conditional on the
kern.random.sys.harvest_interrupt sysctl.


# 6e5c5328 28-Feb-2001 Matt Jacob <mjacob@FreeBSD.org>

Eliminate the use of the getenv_int stuff we'd been using (with a bitmap
for selecting unit). Instead, use the resource hints mechanism.

One unfortunate situation here is that there is no resource_quad_value
function- which is what I needed for WWN boot time replacement. Worse-
you can't store the hint as just plain

hint.isp.0.nodewwn="0x50000000aaaa0001"

because this gets interpreted as an int- incorrectly because it can't
be converted to an int. I can't even get this as a string. To work
around this particular case for nodewwn && portwwn setting, this
rather grotesque form will be used:

hint.isp.0.nodewwn="w50000000aaaa0001"
hint.isp.0.portwwn="w50000000aaaa0002"

At the same time, if we have no hinted WWN, set the default WWN (which, btw,
gets overridden if the card has valid NVRAM, which is usual) to
0x400000007F000009ull (which translates to NAA == IPv4, 127.0.0.9).

Eliminate more printf's and replace them either with device_printf or
isp_prt calls.


# b9b599fe 10-Feb-2001 Matt Jacob <mjacob@FreeBSD.org>

Shuffle around how we do isp_disable management- make sure we return 0 so
the unit number doesn't get reused.

Make sure that if we've compiled for ISP_TARGET_MODE we set the
default role to be ISP_ROLE_INITIATOR|ISP_ROLE_TARGET.

Do some misc other cleanups.


# df1590c0 15-Jan-2001 Matt Jacob <mjacob@FreeBSD.org>

Set default adapter role.


# 3486bfe0 08-Jan-2001 Matt Jacob <mjacob@FreeBSD.org>

add missing length argument


# f09b1922 29-Dec-2000 Matt Jacob <mjacob@FreeBSD.org>

Set up to do a local interrupt fielding before calling common code-
allows us to grab lock as we should.


# 7cc0979f 08-Dec-2000 David Malone <dwmalone@FreeBSD.org>

Convert more malloc+bzero to malloc+M_ZERO.

Submitted by: josh@zipperup.org
Submitted by: Robert Drehmel <robd@gmx.net>


# f7dddf8a 05-Dec-2000 Matt Jacob <mjacob@FreeBSD.org>

Remove more printfs and use either isp_prt or device_printf. Remember
to set ISP_LOGINFO if bootverbose is set.


# 3395b056 24-Oct-2000 Matt Jacob <mjacob@FreeBSD.org>

Whoops! Forgot to commit this when I committed the other (turnin on locks)
change. Sorry about that.


# db7e3af1 15-Oct-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Remove unneeded #include <machine/clock.h>


# aa57fd6f 21-Sep-2000 Matt Jacob <mjacob@FreeBSD.org>

some copyright cleanups


# e11a1ee8 07-Sep-2000 Matt Jacob <mjacob@FreeBSD.org>

Per msmith's request, don't attach to Qlogic 12160 id'd cards that have
a certain SubVendorID.


# 21c3015a 28-Aug-2000 Doug Rabson <dfr@FreeBSD.org>

* Completely rewrite the alpha busspace to hide the implementation from
the drivers.
* Remove legacy inx/outx support from chipset and replace with macros
which call busspace.
* Rework pci config accesses to route through the pcib device instead of
calling a MD function directly.

With these changes it is possible to cleanly support machines which have
more than one independantly numbered PCI busses. As a bonus, the new
busspace implementation should be measurably faster than the old one.


# 84267b9e 27-Aug-2000 Matt Jacob <mjacob@FreeBSD.org>

remove clause 3 licence


# d02373f1 31-Jul-2000 Matt Jacob <mjacob@FreeBSD.org>

Part of major rewrite for core version 2.0- clarification of
mdvec structure, removal of printf/CFGPRINTF in place of isp_prt
calls. Parameterization of RQUEST_QUEUE_LEN/RESULT_QUEUE_LEN.


# 05fbcbb0 18-Jul-2000 Matt Jacob <mjacob@FreeBSD.org>

Keep interrupts blocked for all of isp_pci_attach. Redo DMA routines
for target mode for cleanliness and accuracy.


# 469b6b9e 03-Jul-2000 Matt Jacob <mjacob@FreeBSD.org>

Change startup locking. Use new isp_handle_index function
for indexing off of handles to get dma maps.


# 56aef503 17-Jun-2000 Matt Jacob <mjacob@FreeBSD.org>

Clean up firmware load issues and remove darn near all config options.
Force alphas to prefer mem mapping as the default.

Basically, we have a pointer to a function which we can call which will
return us a pointer to firmware for the card we have. We call this function
(if it's non-NULL) with the address of our mdvec f/w pointer.

The way this works is that if ispfw (as a module or a static) is loaded,
it initializes the pointer in isp_pci, so we can call into to it to fetch
a pointer to a f/w set.

If ispfw is MOD_UNLOADed, it's retained a pointer to our mdvec f/w pointers,
which then get zeroed out so we don't have any references to data that's
now gone from kernel memory. Removing the f/w saves ~360KBytes.

Alas, there is no autounload mechanism that works for is here.


# 2e56bc77 28-Feb-2000 Matt Jacob <mjacob@FreeBSD.org>

Clean up defines for correct 12160/1080 exclusion. Final 4.0.
approved: JKH


# e142669a 14-Feb-2000 Matt Jacob <mjacob@FreeBSD.org>

If the CDB length is greater than 12 for parallel SCSI, ispscsicmd has
made the initial queue entry a EXTENDED CMD queue entry, so we have to
go straight to continuation segments for any data segments.

approved: jkh


# 960f6939 11-Feb-2000 Matt Jacob <mjacob@FreeBSD.org>

Add in 12160 (Ultra3) support. Redo things to use the newbus code.

Approved: jkh@freebsd.org

PR: 16141


# 003a310f 15-Jan-2000 Matt Jacob <mjacob@FreeBSD.org>

Remove compile warning not seen when compiling with target mode enabled.


# 65b024e1 14-Jan-2000 Matt Jacob <mjacob@FreeBSD.org>

Redo FC target mode dma routine to try and generate an extra CTIO
in the not so odd case of Moving Data *AND* Sending Status in last CTIO *AND*
status is a CHECK CONDITION *AND* we have Sense Data to send.


# 42426921 03-Jan-2000 Matt Jacob <mjacob@FreeBSD.org>

Add in an isp_tdebug environment variable. Clean up some debugging
printouts for clarity.


# 9e11e5be 03-Jan-2000 Matt Jacob <mjacob@FreeBSD.org>

Support target mode operations. This involves having some variant
dma mapping callback routines to select from as target mode
entries are handled a fair bit differently from normal initiator
mode entries.


# 22e1dc85 15-Dec-1999 Matt Jacob <mjacob@FreeBSD.org>

Add Dual LVD bus (1280) support


# 9637d68c 20-Nov-1999 Matt Jacob <mjacob@FreeBSD.org>

Fix dmasetup functions to have 16 bit queue indices. Get the chip revision
out of the PCI CLASS reg and store it in the softc. Use the getenv_quad
function to get a WWN override from the environment. Look for a config
value for same. Make slightly less lame the wwn seed construction.


# a3f09ae6 05-Nov-1999 Andrew Gallatin <gallatin@FreeBSD.org>

Remove calls to alpha_register_pci_scsi(). After Mike's recent boot
changes, it no longer exists and is preventing alpha kernels from building.

reviewed by: msmith


# fed92c47 30-Oct-1999 Matt Jacob <mjacob@FreeBSD.org>

Organize things to cope with the (possible) lack of downloadable
firmware a bit better.


# a95ae193 17-Oct-1999 Matt Jacob <mjacob@FreeBSD.org>

Add in inclusion of machine/md_var.h (so alpha_scsi_bus_register or what
have you is prototyped). Removed code versions in md struct- not used
any more. Allocate transfer dma maps and xflist stuff in mbxdmasetup based
upon isp->isp_maxcmds. Allow for multiple calls to mbxdmasetup (for
isp_reset cases).


# d23245c0 11-Oct-1999 Matt Jacob <mjacob@FreeBSD.org>

remove unnecessary includes


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# d009ccfa 23-Aug-1999 Bruce Evans <bde@FreeBSD.org>

Cast pointers to uintptr_t instead of casting them to u_long, and/or vice
versa. Cosmetic.


# 0a5f7e8b 16-Aug-1999 Matt Jacob <mjacob@FreeBSD.org>

Set some correct return values. Prefer I/O map all the time unless configured
otherwise.


# 086646f7 15-Aug-1999 Justin T. Gibbs <gibbs@FreeBSD.org>

Properly set the alignment argument to bus_dma_tag_create(). If we
don't care about the alignment, set it to 1, meaning single byte alignment.


# 9ba86737 05-Jul-1999 Matt Jacob <mjacob@FreeBSD.org>

add in a boot environment isp_disable flag


# 100f099b 05-Jul-1999 Matt Jacob <mjacob@FreeBSD.org>

Wow- too much breakage..wait until you compile it, buckwheat...


# 86cb5d6b 05-Jul-1999 Matt Jacob <mjacob@FreeBSD.org>

Oops- got sense of ifdef wrong


# 5542fe4b 05-Jul-1999 Matt Jacob <mjacob@FreeBSD.org>

add ISP_DISABLE_2200_SUPPORT defines; Add reference to 2200 F/W


# 222bb542 02-Jul-1999 Matt Jacob <mjacob@FreeBSD.org>

Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).


# ec697796 24-Jun-1999 Matt Jacob <mjacob@FreeBSD.org>

(corrections for type change in softc)


# c6608df3 10-May-1999 Matt Jacob <mjacob@FreeBSD.org>

Clean up 2.2.X support (which might have to be cleaned up again
after some of the previous commits). Add in support for the 1240
dual channel ISP card. Try the dance of unmapping a PCI interrupt
if we don't configure (if that ever works it'll be helpful).


# 579f45fa 09-May-1999 Peter Wemm <peter@FreeBSD.org>

Simplify the COMPAT_PCI_DRIVER/DATA_SET hack. We can add:
#define COMPAT_PCI_DRIVER(name,data) DATA_SET(pcidevice_set,data)
.. to 2.2.x and 3.x if people think it's worth it. Driver writers can do
this if it's not defined. (The reason for this is that I'm trying to
progressively eliminate use of linker_sets where it hurts modularity and
runtime load capability, and these DATA_SET's keep getting in the way.)


# 96b3554e 24-Apr-1999 Peter Wemm <peter@FreeBSD.org>

Use COMPAT_PCI_DRIVER() for registration if it exists. This shouldn't
hurt the driver portability to 3.x too much for where drivers are shared.


# 66235db5 10-Apr-1999 Eivind Eklund <eivind@FreeBSD.org>

Staticize.


# ab6d0040 03-Apr-1999 Matt Jacob <mjacob@FreeBSD.org>

Read the board revision and trim cache line size back from 16 to 1
for early revision 2100 boards. Make sure to turn ROM off for these
boards.


# 92c49d78 25-Mar-1999 Matt Jacob <mjacob@FreeBSD.org>

enable 1080 LVD support


# d59bd469 16-Mar-1999 Matt Jacob <mjacob@FreeBSD.org>

Prep for 1080/1240 support. Those fine h/w engineers at Qlogic
gave yet another internal register layout model for what is
*still* the same architecture. I hope they saved billyuns of gates
'coz otherwise this is *really* annoying.


# d951bbca 08-Feb-1999 Matt Jacob <mjacob@FreeBSD.org>

Cleanup. Set all PCI parameters of importance. Set a define that will
allow us via config options prefer mem space to I/O space.


# 1d74fa4c 30-Jan-1999 Matt Jacob <mjacob@FreeBSD.org>

roll internal release tag


# 285e230d 09-Jan-1999 Matt Jacob <mjacob@FreeBSD.org>

Amazingly stupid forgetfullness had me forgetting to turn on FIFO bursts
for the 1XX0 cards. That cost > 50% performance.


# 17e318c6 28-Dec-1998 Matt Jacob <mjacob@FreeBSD.org>

clarify headers;ansify


# 2cbe36f7 13-Dec-1998 Matthew Dillon <dillon@FreeBSD.org>

probe function changed from returning char * to const char *.


# 2fa86a2b 04-Dec-1998 Matt Jacob <mjacob@FreeBSD.org>

trivial header fix


# 2127f260 04-Dec-1998 Archie Cobbs <archie@FreeBSD.org>

Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
for possible buffer overflow problems. Replaced most sprintf()'s
with snprintf(); for others cases, added terminating NUL bytes where
appropriate, replaced constants like "16" with sizeof(), etc.

These changes include several bug fixes, but most changes are for
maintainability's sake. Any instance where it wasn't "immediately
obvious" that a buffer overflow could not occur was made safer.

Reviewed by: Bruce Evans <bde@zeta.org.au>
Reviewed by: Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by: Mike Spengler <mks@networkcs.com>


# e37c0455 26-Sep-1998 Doug Rabson <dfr@FreeBSD.org>

Add hooks so that the alpha can detect which disk has the root partition.


# 3dd37e438 17-Sep-1998 Matt Jacob <mjacob@FreeBSD.org>

(requested by gibbs) Remove the SCSI_CAM option (and rework the isp driver
that had depended on it for compilation within or without CAM to use
__FreeBSD_version instead).


# 4873663c 17-Sep-1998 Matt Jacob <mjacob@FreeBSD.org>

A major amount of cleaning up:
+ Change some messages about CCB memory allocation
+ Turn a failure to DMA map all of a transaction due to lack of
ISP queue entries into a requeue operation (instead of the
case where it had been treated the same as a DMA too big
operation).
+ put back splsoftvm around bus_dmamap_load calls.
+ cleanup (and fix a glaring bug) in the and of the dma setup
routine. Also, the dma setup routines either return CMD_QUEUED
(for success) or CMD_COMPLETE (for failure) or CMD_EAGAIN
(for requeuing for resource shortage reasons).


# a185f9b1 16-Sep-1998 Matt Jacob <mjacob@FreeBSD.org>

Alpha port related fixes from Doug Rabson.
Submitted by: dfr


# d720e6d5 15-Sep-1998 Justin T. Gibbs <gibbs@FreeBSD.org>

Convert ISP pci front end to CAM/bus space/dma.

Convert ncr driver to CAM.


# b97fc948 10-Aug-1998 Bruce Evans <bde@FreeBSD.org>

Use [u]intptr_t instead of [unsigned] long to convert and/or represent
pointers.

This finishes fixing conversions between pointers and integers of
possibly different sizes in GENERIC.


# 9bffbcd4 13-Jul-1998 Bruce Evans <bde@FreeBSD.org>

Fixed printf format errors (only 1 left in GENERIC now).


# 65adb54c 22-Apr-1998 Matt Jacob <mjacob@FreeBSD.org>

Add support for the Qlogic ISP SCSI && FC/AL Adapters