1999-08-28 01:08:13 +00:00
|
|
|
/* $FreeBSD$ */
|
2005-01-06 01:43:34 +00:00
|
|
|
/*-
|
2001-07-25 04:21:53 +00:00
|
|
|
* Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions
|
2006-01-23 06:23:37 +00:00
|
|
|
*
|
|
|
|
* Copyright (c) 1997-2006 by Matthew Jacob
|
|
|
|
* All rights reserved.
|
1998-04-22 17:54:58 +00:00
|
|
|
*
|
|
|
|
* 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.
|
2000-09-21 20:16:04 +00:00
|
|
|
* 2. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
1998-04-22 17:54:58 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
#ifndef _ISP_FREEBSD_H
|
|
|
|
#define _ISP_FREEBSD_H
|
|
|
|
|
1999-07-02 23:10:34 +00:00
|
|
|
#include <sys/param.h>
|
1998-04-22 17:54:58 +00:00
|
|
|
#include <sys/systm.h>
|
2002-04-26 22:48:23 +00:00
|
|
|
#include <sys/endian.h>
|
2006-04-21 18:30:01 +00:00
|
|
|
#if __FreeBSD_version < 500000
|
1999-07-02 23:10:34 +00:00
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/queue.h>
|
2006-04-21 18:30:01 +00:00
|
|
|
#include <sys/malloc.h>
|
|
|
|
#else
|
2001-03-28 09:17:56 +00:00
|
|
|
#include <sys/lock.h>
|
2006-04-21 18:30:01 +00:00
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/queue.h>
|
2000-04-21 02:05:13 +00:00
|
|
|
#include <sys/malloc.h>
|
2000-10-20 07:58:15 +00:00
|
|
|
#include <sys/mutex.h>
|
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
2001-05-28 21:20:43 +00:00
|
|
|
#include <sys/condvar.h>
|
2006-04-21 18:30:01 +00:00
|
|
|
#endif
|
|
|
|
|
2000-07-04 01:04:35 +00:00
|
|
|
#include <sys/proc.h>
|
2001-03-01 02:15:58 +00:00
|
|
|
#include <sys/bus.h>
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1999-07-02 23:10:34 +00:00
|
|
|
#include <machine/bus.h>
|
2006-06-03 07:19:44 +00:00
|
|
|
#if __FreeBSD_version < 500000
|
|
|
|
#include <machine/clock.h>
|
|
|
|
#endif
|
2000-07-04 01:04:35 +00:00
|
|
|
#include <machine/cpu.h>
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1999-07-02 23:10:34 +00:00
|
|
|
#include <cam/cam.h>
|
|
|
|
#include <cam/cam_debug.h>
|
|
|
|
#include <cam/cam_ccb.h>
|
|
|
|
#include <cam/cam_sim.h>
|
|
|
|
#include <cam/cam_xpt.h>
|
|
|
|
#include <cam/cam_xpt_sim.h>
|
|
|
|
#include <cam/cam_debug.h>
|
|
|
|
#include <cam/scsi/scsi_all.h>
|
|
|
|
#include <cam/scsi/scsi_message.h>
|
|
|
|
|
1999-10-17 18:48:16 +00:00
|
|
|
#include "opt_ddb.h"
|
1999-07-02 23:10:34 +00:00
|
|
|
#include "opt_isp.h"
|
2002-08-22 16:14:19 +00:00
|
|
|
|
2006-05-16 16:31:58 +00:00
|
|
|
#if __FreeBSD_version < 500000
|
|
|
|
#define ISP_PLATFORM_VERSION_MAJOR 4
|
|
|
|
#define ISP_PLATFORM_VERSION_MINOR 17
|
|
|
|
#else
|
|
|
|
#define ISP_PLATFORM_VERSION_MAJOR 5
|
|
|
|
#define ISP_PLATFORM_VERSION_MINOR 9
|
|
|
|
#endif
|
|
|
|
|
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
2001-12-11 00:18:45 +00:00
|
|
|
/*
|
|
|
|
* Efficiency- get rid of SBus code && tests unless we need them.
|
|
|
|
*/
|
2005-12-04 02:12:43 +00:00
|
|
|
#ifdef __sparc64__
|
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
2001-12-11 00:18:45 +00:00
|
|
|
#define ISP_SBUS_SUPPORTED 1
|
|
|
|
#else
|
|
|
|
#define ISP_SBUS_SUPPORTED 0
|
|
|
|
#endif
|
1999-04-04 01:34:06 +00:00
|
|
|
|
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
2001-05-28 21:20:43 +00:00
|
|
|
#define HANDLE_LOOPSTATE_IN_OUTER_LAYERS 1
|
2003-10-21 21:52:23 +00:00
|
|
|
/* #define ISP_SMPLOCK 1 */
|
2002-07-25 16:02:09 +00:00
|
|
|
|
2006-04-21 18:30:01 +00:00
|
|
|
#if __FreeBSD_version < 500000
|
|
|
|
#define ISP_IFLAGS INTR_TYPE_CAM
|
|
|
|
#else
|
2002-07-25 16:02:09 +00:00
|
|
|
#ifdef ISP_SMPLOCK
|
|
|
|
#define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE
|
|
|
|
#else
|
|
|
|
#define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY
|
|
|
|
#endif
|
2006-04-21 18:30:01 +00:00
|
|
|
#endif
|
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
2001-05-28 21:20:43 +00:00
|
|
|
|
2006-09-01 05:03:42 +00:00
|
|
|
#if __FreeBSD_version < 700000
|
2007-01-05 23:01:54 +00:00
|
|
|
typedef void ispfwfunc(int, int, int, void **);
|
2006-09-01 05:03:42 +00:00
|
|
|
#endif
|
|
|
|
|
2000-01-03 22:15:16 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
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
2001-12-11 00:18:45 +00:00
|
|
|
#define ISP_TARGET_FUNCTIONS 1
|
2001-10-01 03:48:42 +00:00
|
|
|
#define ATPDPSIZE 256
|
|
|
|
typedef struct {
|
2006-02-15 00:31:48 +00:00
|
|
|
uint32_t orig_datalen;
|
|
|
|
uint32_t bytes_xfered;
|
|
|
|
uint32_t last_xframt;
|
|
|
|
uint32_t tag : 16,
|
2002-06-16 05:02:25 +00:00
|
|
|
lun : 13, /* not enough */
|
|
|
|
state : 3;
|
2001-10-01 03:48:42 +00:00
|
|
|
} atio_private_data_t;
|
2002-06-16 05:02:25 +00:00
|
|
|
#define ATPD_STATE_FREE 0
|
|
|
|
#define ATPD_STATE_ATIO 1
|
|
|
|
#define ATPD_STATE_CAM 2
|
|
|
|
#define ATPD_STATE_CTIO 3
|
|
|
|
#define ATPD_STATE_LAST_CTIO 4
|
|
|
|
#define ATPD_STATE_PDON 5
|
2001-10-01 03:48:42 +00:00
|
|
|
|
2000-01-03 22:15:16 +00:00
|
|
|
typedef struct tstate {
|
|
|
|
struct tstate *next;
|
|
|
|
struct cam_path *owner;
|
|
|
|
struct ccb_hdr_slist atios;
|
|
|
|
struct ccb_hdr_slist inots;
|
|
|
|
lun_id_t lun;
|
2001-04-04 21:56:15 +00:00
|
|
|
int bus;
|
2006-02-15 00:31:48 +00:00
|
|
|
uint32_t hold;
|
2002-06-16 05:02:25 +00:00
|
|
|
int atio_count;
|
2004-02-07 03:44:43 +00:00
|
|
|
int inot_count;
|
2000-01-03 22:15:16 +00:00
|
|
|
} tstate_t;
|
|
|
|
|
2001-04-04 21:56:15 +00:00
|
|
|
#define LUN_HASH_SIZE 32
|
|
|
|
#define LUN_HASH_FUNC(isp, port, lun) \
|
|
|
|
((IS_DUALBUS(isp)) ? \
|
|
|
|
(((lun) & ((LUN_HASH_SIZE >> 1) - 1)) << (port)) : \
|
|
|
|
((lun) & (LUN_HASH_SIZE - 1)))
|
2000-01-03 22:15:16 +00:00
|
|
|
#endif
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
struct isposinfo {
|
2000-01-03 22:15:16 +00:00
|
|
|
struct ispsoftc * next;
|
2007-03-13 06:46:08 +00:00
|
|
|
bus_space_tag_t bus_tag;
|
|
|
|
bus_space_handle_t bus_handle;
|
2006-02-15 00:31:48 +00:00
|
|
|
uint64_t default_port_wwn;
|
|
|
|
uint64_t default_node_wwn;
|
|
|
|
uint32_t default_id;
|
2001-03-01 02:15:58 +00:00
|
|
|
device_t dev;
|
1999-07-02 23:10:34 +00:00
|
|
|
struct cam_sim *sim;
|
|
|
|
struct cam_path *path;
|
|
|
|
struct cam_sim *sim2;
|
|
|
|
struct cam_path *path2;
|
2000-07-04 01:04:35 +00:00
|
|
|
struct intr_config_hook ehook;
|
2006-11-14 08:45:48 +00:00
|
|
|
uint32_t loop_down_time;
|
|
|
|
uint32_t loop_down_limit;
|
|
|
|
uint32_t gone_device_time;
|
2006-11-02 03:21:32 +00:00
|
|
|
uint32_t : 5,
|
|
|
|
simqfrozen : 3,
|
|
|
|
hysteresis : 8,
|
2006-11-14 08:45:48 +00:00
|
|
|
gdt_running : 1,
|
|
|
|
ldt_running : 1,
|
2006-04-21 18:30:01 +00:00
|
|
|
disabled : 1,
|
2002-07-08 17:42:47 +00:00
|
|
|
fcbsy : 1,
|
2006-11-14 08:45:48 +00:00
|
|
|
mbox_sleeping : 1,
|
|
|
|
mbox_sleep_ok : 1,
|
2006-11-02 03:21:32 +00:00
|
|
|
mboxcmd_done : 1,
|
|
|
|
mboxbsy : 1;
|
2006-11-14 08:45:48 +00:00
|
|
|
struct callout_handle ldt; /* loop down timer */
|
|
|
|
struct callout_handle gdt; /* gone device timer */
|
2006-04-21 18:30:01 +00:00
|
|
|
#if __FreeBSD_version >= 500000
|
Cleanup and document the implementation of firmware(9) based on
a version that i posted earlier on the -current mailing list,
and subsequent feedback received.
The core of the change is just in sys/firmware.h and kern/subr_firmware.c,
while other files are just adaptation of the clients to the ABI change
(const-ification of some parameters and hiding of internal info,
so this is fully compatible at the binary level).
In detail:
- reduce the amount of information exported to clients in struct firmware,
and constify the pointer;
- internally, document and simplify the implementation of the various
functions, and make sure error conditions are dealt with properly.
The diffs are large, but the code is really straightforward now (i hope).
Note also that there is a subtle issue with the implementation of
firmware_register(): currently, as in the previous version, we just
store a reference to the 'imagename' argument, but we should rather
copy it because there is no guarantee that this is a static string.
I realised this while testing this code, but i prefer to fix it in
a later commit -- there is no regression with respect to the past.
Note, too, that the version in RELENG_6 has various bugs including
missing locks around the module release calls, mishandling of modules
loaded by /boot/loader, and so on, so an MFC is absolutely necessary
there. I was just postponing it until this cleanup to avoid doing
things twice.
MFC after: 1 week
2007-02-15 17:21:31 +00:00
|
|
|
const struct firmware * fw;
|
2000-10-17 18:18:14 +00:00
|
|
|
struct mtx lock;
|
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
2001-05-28 21:20:43 +00:00
|
|
|
struct cv kthread_cv;
|
2006-09-26 04:59:52 +00:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
char wwnn[17];
|
|
|
|
char wwpn[17];
|
|
|
|
} fc;
|
|
|
|
} sysctl_info;
|
2006-04-21 18:30:01 +00:00
|
|
|
#endif
|
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
2001-05-28 21:20:43 +00:00
|
|
|
struct proc *kproc;
|
2002-04-02 23:36:14 +00:00
|
|
|
bus_dma_tag_t cdmat;
|
|
|
|
bus_dmamap_t cdmap;
|
|
|
|
#define isp_cdmat isp_osinfo.cdmat
|
|
|
|
#define isp_cdmap isp_osinfo.cdmap
|
2000-01-03 22:15:16 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
2001-09-04 21:33:06 +00:00
|
|
|
#define TM_WILDCARD_ENABLED 0x02
|
|
|
|
#define TM_TMODE_ENABLED 0x01
|
2006-02-15 00:31:48 +00:00
|
|
|
uint8_t tmflags[2]; /* two busses */
|
2004-02-08 19:16:01 +00:00
|
|
|
#define NLEACT 4
|
|
|
|
union ccb * leact[NLEACT];
|
2001-04-04 21:56:15 +00:00
|
|
|
tstate_t tsdflt[2]; /* two busses */
|
2000-01-03 22:15:16 +00:00
|
|
|
tstate_t *lun_hash[LUN_HASH_SIZE];
|
2001-10-01 03:48:42 +00:00
|
|
|
atio_private_data_t atpdp[ATPDPSIZE];
|
2000-01-03 22:15:16 +00:00
|
|
|
#endif
|
1998-04-22 17:54:58 +00:00
|
|
|
};
|
1999-07-02 23:10:34 +00:00
|
|
|
|
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
2001-05-28 21:20:43 +00:00
|
|
|
#define isp_lock isp_osinfo.lock
|
2007-03-13 06:46:08 +00:00
|
|
|
#define isp_bus_tag isp_osinfo.bus_tag
|
|
|
|
#define isp_bus_handle isp_osinfo.bus_handle
|
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
2001-05-28 21:20:43 +00:00
|
|
|
|
2000-12-02 18:33:29 +00:00
|
|
|
/*
|
|
|
|
* Locking macros...
|
|
|
|
*/
|
|
|
|
|
2002-09-03 04:31:55 +00:00
|
|
|
#ifdef ISP_SMPLOCK
|
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
2001-05-28 21:20:43 +00:00
|
|
|
#define ISP_LOCK(x) mtx_lock(&(x)->isp_lock)
|
|
|
|
#define ISP_UNLOCK(x) mtx_unlock(&(x)->isp_lock)
|
|
|
|
#define ISPLOCK_2_CAMLOCK(isp) \
|
|
|
|
mtx_unlock(&(isp)->isp_lock); mtx_lock(&Giant)
|
|
|
|
#define CAMLOCK_2_ISPLOCK(isp) \
|
|
|
|
mtx_unlock(&Giant); mtx_lock(&(isp)->isp_lock)
|
2002-09-03 04:31:55 +00:00
|
|
|
#else
|
2006-11-14 08:45:48 +00:00
|
|
|
#if __FreeBSD_version < 500000
|
2002-09-03 04:31:55 +00:00
|
|
|
#define ISP_LOCK(x) do { } while (0)
|
|
|
|
#define ISP_UNLOCK(x) do { } while (0)
|
|
|
|
#define ISPLOCK_2_CAMLOCK(isp) do { } while (0)
|
|
|
|
#define CAMLOCK_2_ISPLOCK(isp) do { } while (0)
|
2006-11-14 08:45:48 +00:00
|
|
|
#else
|
|
|
|
#define ISP_LOCK(x) GIANT_REQUIRED
|
|
|
|
#define ISP_UNLOCK(x) do { } while (0)
|
|
|
|
#define ISPLOCK_2_CAMLOCK(isp) do { } while (0)
|
|
|
|
#define CAMLOCK_2_ISPLOCK(isp) GIANT_REQUIRED
|
|
|
|
#endif
|
2002-09-03 04:31:55 +00:00
|
|
|
#endif
|
2000-12-02 18:33:29 +00:00
|
|
|
|
2000-08-01 06:29:55 +00:00
|
|
|
/*
|
|
|
|
* Required Macros/Defines
|
|
|
|
*/
|
1998-09-15 08:42:56 +00:00
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
#define ISP2100_SCRLEN 0x1000
|
2000-07-04 01:04:35 +00:00
|
|
|
|
2006-05-22 06:48:40 +00:00
|
|
|
#define MEMZERO(a, b) memset(a, 0, b)
|
|
|
|
#define MEMCPY memcpy
|
2000-08-01 06:29:55 +00:00
|
|
|
#define SNPRINTF snprintf
|
|
|
|
#define USEC_DELAY DELAY
|
2006-11-02 03:21:32 +00:00
|
|
|
#define USEC_SLEEP(isp, x) DELAY(x)
|
2000-07-04 01:04:35 +00:00
|
|
|
|
2000-08-01 06:29:55 +00:00
|
|
|
#define NANOTIME_T struct timespec
|
|
|
|
#define GET_NANOTIME nanotime
|
|
|
|
#define GET_NANOSEC(x) ((x)->tv_sec * 1000000000 + (x)->tv_nsec)
|
2006-11-14 08:45:48 +00:00
|
|
|
#define NANOTIME_SUB isp_nanotime_sub
|
2000-07-04 01:04:35 +00:00
|
|
|
|
2002-07-08 17:42:47 +00:00
|
|
|
#define MAXISPREQUEST(isp) ((IS_FC(isp) || IS_ULTRA2(isp))? 1024 : 256)
|
2000-07-04 01:04:35 +00:00
|
|
|
|
2002-04-02 23:36:14 +00:00
|
|
|
#define MEMORYBARRIER(isp, type, offset, size) \
|
|
|
|
switch (type) { \
|
|
|
|
case SYNC_SFORDEV: \
|
|
|
|
case SYNC_REQUEST: \
|
|
|
|
bus_dmamap_sync(isp->isp_cdmat, isp->isp_cdmap, \
|
|
|
|
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); \
|
|
|
|
break; \
|
|
|
|
case SYNC_SFORCPU: \
|
|
|
|
case SYNC_RESULT: \
|
|
|
|
bus_dmamap_sync(isp->isp_cdmat, isp->isp_cdmap, \
|
|
|
|
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \
|
|
|
|
break; \
|
2007-03-13 06:46:08 +00:00
|
|
|
case SYNC_REG: \
|
|
|
|
bus_space_barrier(isp->isp_bus_tag, \
|
|
|
|
isp->isp_bus_handle, offset, size, \
|
|
|
|
BUS_SPACE_BARRIER_READ); \
|
|
|
|
break; \
|
2002-04-02 23:36:14 +00:00
|
|
|
default: \
|
|
|
|
break; \
|
|
|
|
}
|
2000-07-04 01:04:35 +00:00
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
#define MBOX_ACQUIRE isp_mbox_acquire
|
2000-08-01 06:29:55 +00:00
|
|
|
#define MBOX_WAIT_COMPLETE isp_mbox_wait_complete
|
2006-11-14 08:45:48 +00:00
|
|
|
#define MBOX_NOTIFY_COMPLETE isp_mbox_notify_done
|
2006-11-02 03:21:32 +00:00
|
|
|
#define MBOX_RELEASE isp_mbox_release
|
1999-07-02 23:10:34 +00:00
|
|
|
|
2002-07-08 17:42:47 +00:00
|
|
|
#define FC_SCRATCH_ACQUIRE(isp) \
|
|
|
|
if (isp->isp_osinfo.fcbsy) { \
|
|
|
|
isp_prt(isp, ISP_LOGWARN, \
|
|
|
|
"FC scratch area busy (line %d)!", __LINE__); \
|
|
|
|
} else \
|
|
|
|
isp->isp_osinfo.fcbsy = 1
|
|
|
|
#define FC_SCRATCH_RELEASE(isp) isp->isp_osinfo.fcbsy = 0
|
2002-02-04 21:04:25 +00:00
|
|
|
|
2000-08-01 06:29:55 +00:00
|
|
|
#ifndef SCSI_GOOD
|
|
|
|
#define SCSI_GOOD SCSI_STATUS_OK
|
|
|
|
#endif
|
|
|
|
#ifndef SCSI_CHECK
|
|
|
|
#define SCSI_CHECK SCSI_STATUS_CHECK_COND
|
|
|
|
#endif
|
|
|
|
#ifndef SCSI_BUSY
|
|
|
|
#define SCSI_BUSY SCSI_STATUS_BUSY
|
|
|
|
#endif
|
|
|
|
#ifndef SCSI_QFULL
|
|
|
|
#define SCSI_QFULL SCSI_STATUS_QUEUE_FULL
|
|
|
|
#endif
|
1999-07-02 23:10:34 +00:00
|
|
|
|
2000-08-01 06:29:55 +00:00
|
|
|
#define XS_T struct ccb_scsiio
|
2006-02-15 00:31:48 +00:00
|
|
|
#define XS_DMA_ADDR_T bus_addr_t
|
2006-04-21 18:30:01 +00:00
|
|
|
#define XS_ISP(ccb) ((ispsoftc_t *) (ccb)->ccb_h.spriv_ptr1)
|
1999-07-02 23:10:34 +00:00
|
|
|
#define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path))
|
2000-08-01 06:29:55 +00:00
|
|
|
#define XS_TGT(ccb) (ccb)->ccb_h.target_id
|
|
|
|
#define XS_LUN(ccb) (ccb)->ccb_h.target_lun
|
|
|
|
|
|
|
|
#define XS_CDBP(ccb) \
|
|
|
|
(((ccb)->ccb_h.flags & CAM_CDB_POINTER)? \
|
|
|
|
(ccb)->cdb_io.cdb_ptr : (ccb)->cdb_io.cdb_bytes)
|
|
|
|
|
1999-07-02 23:10:34 +00:00
|
|
|
#define XS_CDBLEN(ccb) (ccb)->cdb_len
|
2000-08-01 06:29:55 +00:00
|
|
|
#define XS_XFRLEN(ccb) (ccb)->dxfer_len
|
1999-07-02 23:10:34 +00:00
|
|
|
#define XS_TIME(ccb) (ccb)->ccb_h.timeout
|
2000-08-01 06:29:55 +00:00
|
|
|
#define XS_RESID(ccb) (ccb)->resid
|
|
|
|
#define XS_STSP(ccb) (&(ccb)->scsi_status)
|
1999-07-02 23:10:34 +00:00
|
|
|
#define XS_SNSP(ccb) (&(ccb)->sense_data)
|
2000-08-01 06:29:55 +00:00
|
|
|
|
1999-10-17 18:48:16 +00:00
|
|
|
#define XS_SNSLEN(ccb) \
|
|
|
|
imin((sizeof((ccb)->sense_data)), ccb->sense_len)
|
2000-08-01 06:29:55 +00:00
|
|
|
|
1999-07-02 23:10:34 +00:00
|
|
|
#define XS_SNSKEY(ccb) ((ccb)->sense_data.flags & 0xf)
|
2000-08-01 06:29:55 +00:00
|
|
|
#define XS_TAG_P(ccb) \
|
|
|
|
(((ccb)->ccb_h.flags & CAM_TAG_ACTION_VALID) && \
|
|
|
|
(ccb)->tag_action != CAM_TAG_ACTION_NONE)
|
|
|
|
|
|
|
|
#define XS_TAG_TYPE(ccb) \
|
|
|
|
((ccb->tag_action == MSG_SIMPLE_Q_TAG)? REQFLAG_STAG : \
|
|
|
|
((ccb->tag_action == MSG_HEAD_OF_Q_TAG)? REQFLAG_HTAG : REQFLAG_OTAG))
|
|
|
|
|
|
|
|
|
|
|
|
#define XS_SETERR(ccb, v) (ccb)->ccb_h.status &= ~CAM_STATUS_MASK, \
|
|
|
|
(ccb)->ccb_h.status |= v, \
|
|
|
|
(ccb)->ccb_h.spriv_field0 |= ISP_SPRIV_ERRSET
|
|
|
|
|
|
|
|
# define HBA_NOERROR CAM_REQ_INPROG
|
|
|
|
# define HBA_BOTCH CAM_UNREC_HBA_ERROR
|
|
|
|
# define HBA_CMDTIMEOUT CAM_CMD_TIMEOUT
|
|
|
|
# define HBA_SELTIMEOUT CAM_SEL_TIMEOUT
|
|
|
|
# define HBA_TGTBSY CAM_SCSI_STATUS_ERROR
|
|
|
|
# define HBA_BUSRESET CAM_SCSI_BUS_RESET
|
|
|
|
# define HBA_ABORTED CAM_REQ_ABORTED
|
|
|
|
# define HBA_DATAOVR CAM_DATA_RUN_ERR
|
|
|
|
# define HBA_ARQFAIL CAM_AUTOSENSE_FAIL
|
|
|
|
|
|
|
|
|
|
|
|
#define XS_ERR(ccb) ((ccb)->ccb_h.status & CAM_STATUS_MASK)
|
|
|
|
|
|
|
|
#define XS_NOERR(ccb) \
|
|
|
|
(((ccb)->ccb_h.spriv_field0 & ISP_SPRIV_ERRSET) == 0 || \
|
|
|
|
((ccb)->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG)
|
|
|
|
|
|
|
|
#define XS_INITERR(ccb) \
|
|
|
|
XS_SETERR(ccb, CAM_REQ_INPROG), (ccb)->ccb_h.spriv_field0 = 0
|
|
|
|
|
2006-11-14 08:45:48 +00:00
|
|
|
#define XS_SAVE_SENSE(xs, sense_ptr, sense_len) \
|
|
|
|
(xs)->ccb_h.status |= CAM_AUTOSNS_VALID; \
|
|
|
|
memcpy(&(xs)->sense_data, sense_ptr, imin(XS_SNSLEN(xs), sense_len))
|
2000-08-01 06:29:55 +00:00
|
|
|
|
|
|
|
#define XS_SET_STATE_STAT(a, b, c)
|
|
|
|
|
2002-07-08 17:42:47 +00:00
|
|
|
#define DEFAULT_IID(x) (isp)->isp_osinfo.default_id
|
|
|
|
#define DEFAULT_LOOPID(x) (isp)->isp_osinfo.default_id
|
2001-03-01 02:15:58 +00:00
|
|
|
#define DEFAULT_NODEWWN(isp) (isp)->isp_osinfo.default_node_wwn
|
|
|
|
#define DEFAULT_PORTWWN(isp) (isp)->isp_osinfo.default_port_wwn
|
2007-01-20 04:00:21 +00:00
|
|
|
#define ISP_NODEWWN(isp) FCPARAM(isp)->isp_wwnn_nvram
|
|
|
|
#define ISP_PORTWWN(isp) FCPARAM(isp)->isp_wwpn_nvram
|
2000-08-01 06:29:55 +00:00
|
|
|
|
2007-03-12 04:54:30 +00:00
|
|
|
|
|
|
|
#if __FreeBSD_version < 500000
|
|
|
|
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
|
|
|
#define bswap16 htobe16
|
|
|
|
#define bswap32 htobe32
|
|
|
|
#else
|
|
|
|
#define bswap16 htole16
|
|
|
|
#define bswap32 htole32
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
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
2001-12-11 00:18:45 +00:00
|
|
|
#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)
|
2006-02-15 00:31:48 +00:00
|
|
|
#define ISP_IOXGET_8(isp, s, d) d = (*((uint8_t *)s))
|
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
2001-12-11 00:18:45 +00:00
|
|
|
#define ISP_IOXGET_16(isp, s, d) \
|
|
|
|
d = (isp->isp_bustype == ISP_BT_SBUS)? \
|
2006-02-15 00:31:48 +00:00
|
|
|
*((uint16_t *)s) : bswap16(*((uint16_t *)s))
|
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
2001-12-11 00:18:45 +00:00
|
|
|
#define ISP_IOXGET_32(isp, s, d) \
|
|
|
|
d = (isp->isp_bustype == ISP_BT_SBUS)? \
|
2006-02-15 00:31:48 +00:00
|
|
|
*((uint32_t *)s) : bswap32(*((uint32_t *)s))
|
2006-11-02 03:21:32 +00:00
|
|
|
|
|
|
|
#else /* ISP_SBUS_SUPPORTED */
|
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
2001-12-11 00:18:45 +00:00
|
|
|
#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)
|
2006-02-15 00:31:48 +00:00
|
|
|
#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))
|
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
2001-12-11 00:18:45 +00:00
|
|
|
#endif
|
|
|
|
#define ISP_SWIZZLE_NVRAM_WORD(isp, rp) *rp = bswap16(*rp)
|
2006-11-02 03:21:32 +00:00
|
|
|
|
|
|
|
#define ISP_IOZGET_8(isp, s, d) d = (*((uint8_t *)s))
|
|
|
|
#define ISP_IOZGET_16(isp, s, d) d = (*((uint16_t *)s))
|
|
|
|
#define ISP_IOZGET_32(isp, s, d) d = (*((uint32_t *)s))
|
|
|
|
#define ISP_IOZPUT_8(isp, s, d) *(d) = s
|
|
|
|
#define ISP_IOZPUT_16(isp, s, d) *(d) = s
|
|
|
|
#define ISP_IOZPUT_32(isp, s, d) *(d) = s
|
|
|
|
|
|
|
|
|
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
2001-12-11 00:18:45 +00:00
|
|
|
#else
|
|
|
|
#define ISP_IOXPUT_8(isp, s, d) *(d) = s
|
|
|
|
#define ISP_IOXPUT_16(isp, s, d) *(d) = s
|
|
|
|
#define ISP_IOXPUT_32(isp, s, d) *(d) = s
|
|
|
|
#define ISP_IOXGET_8(isp, s, d) d = *(s)
|
|
|
|
#define ISP_IOXGET_16(isp, s, d) d = *(s)
|
|
|
|
#define ISP_IOXGET_32(isp, s, d) d = *(s)
|
|
|
|
#define ISP_SWIZZLE_NVRAM_WORD(isp, rp)
|
2006-11-02 03:21:32 +00:00
|
|
|
|
|
|
|
#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)))
|
|
|
|
|
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
2001-12-11 00:18:45 +00:00
|
|
|
#endif
|
2000-08-01 06:29:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Includes of common header files
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <dev/isp/ispreg.h>
|
|
|
|
#include <dev/isp/ispvar.h>
|
|
|
|
#include <dev/isp/ispmbox.h>
|
|
|
|
|
2006-02-15 00:31:48 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
#include <dev/isp/isp_tpublic.h>
|
|
|
|
#endif
|
|
|
|
|
2000-08-01 06:29:55 +00:00
|
|
|
/*
|
|
|
|
* isp_osinfo definiitions && shorthand
|
|
|
|
*/
|
|
|
|
#define SIMQFRZ_RESOURCE 0x1
|
|
|
|
#define SIMQFRZ_LOOPDOWN 0x2
|
|
|
|
#define SIMQFRZ_TIMED 0x4
|
|
|
|
|
|
|
|
#define isp_sim isp_osinfo.sim
|
|
|
|
#define isp_path isp_osinfo.path
|
|
|
|
#define isp_sim2 isp_osinfo.sim2
|
|
|
|
#define isp_path2 isp_osinfo.path2
|
2001-03-01 02:15:58 +00:00
|
|
|
#define isp_dev isp_osinfo.dev
|
2000-08-01 06:29:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* prototypes for isp_pci && isp_freebsd to share
|
|
|
|
*/
|
2006-04-21 18:30:01 +00:00
|
|
|
extern void isp_attach(ispsoftc_t *);
|
|
|
|
extern void isp_uninit(ispsoftc_t *);
|
1998-04-22 17:54:58 +00:00
|
|
|
|
2002-07-11 03:25:04 +00:00
|
|
|
/*
|
|
|
|
* driver global data
|
|
|
|
*/
|
|
|
|
extern int isp_announced;
|
2006-11-02 03:21:32 +00:00
|
|
|
extern int isp_fabric_hysteresis;
|
|
|
|
extern int isp_loop_down_limit;
|
2006-11-14 08:45:48 +00:00
|
|
|
extern int isp_gone_device_time;
|
2006-11-02 03:21:32 +00:00
|
|
|
extern int isp_quickboot_time;
|
2002-07-11 03:25:04 +00:00
|
|
|
|
2000-08-01 06:29:55 +00:00
|
|
|
/*
|
|
|
|
* Platform private flags
|
|
|
|
*/
|
2000-06-27 19:22:13 +00:00
|
|
|
#define ISP_SPRIV_ERRSET 0x1
|
|
|
|
#define ISP_SPRIV_INWDOG 0x2
|
|
|
|
#define ISP_SPRIV_GRACE 0x4
|
|
|
|
#define ISP_SPRIV_DONE 0x8
|
|
|
|
|
|
|
|
#define XS_CMD_S_WDOG(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_INWDOG
|
|
|
|
#define XS_CMD_C_WDOG(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_INWDOG
|
|
|
|
#define XS_CMD_WDOG_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_INWDOG)
|
|
|
|
|
|
|
|
#define XS_CMD_S_GRACE(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_GRACE
|
|
|
|
#define XS_CMD_C_GRACE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_GRACE
|
|
|
|
#define XS_CMD_GRACE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_GRACE)
|
|
|
|
|
|
|
|
#define XS_CMD_S_DONE(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_DONE
|
|
|
|
#define XS_CMD_C_DONE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_DONE
|
|
|
|
#define XS_CMD_DONE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_DONE)
|
|
|
|
|
|
|
|
#define XS_CMD_S_CLEAR(sccb) (sccb)->ccb_h.spriv_field0 = 0
|
2006-02-02 21:31:34 +00:00
|
|
|
|
1999-07-02 23:10:34 +00:00
|
|
|
/*
|
2006-11-14 08:45:48 +00:00
|
|
|
* Platform Library Functions
|
1999-07-02 23:10:34 +00:00
|
|
|
*/
|
2006-11-14 08:45:48 +00:00
|
|
|
void isp_prt(ispsoftc_t *, int level, const char *, ...) __printflike(3, 4);
|
|
|
|
uint64_t isp_nanotime_sub(struct timespec *, struct timespec *);
|
|
|
|
int isp_mbox_acquire(ispsoftc_t *);
|
|
|
|
void isp_mbox_wait_complete(ispsoftc_t *, mbreg_t *);
|
|
|
|
void isp_mbox_notify_done(ispsoftc_t *);
|
|
|
|
void isp_mbox_release(ispsoftc_t *);
|
|
|
|
int isp_mstohz(int);
|
2000-08-01 06:29:55 +00:00
|
|
|
|
2007-01-23 00:02:29 +00:00
|
|
|
/*
|
|
|
|
* Platform specific defines
|
|
|
|
*/
|
|
|
|
#if __FreeBSD_version < 500000
|
|
|
|
#define BUS_DMA_ROOTARG(x) NULL
|
|
|
|
#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \
|
|
|
|
bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z)
|
|
|
|
#elif __FreeBSD_version < 700020
|
|
|
|
#define BUS_DMA_ROOTARG(x) NULL
|
|
|
|
#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \
|
|
|
|
bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \
|
|
|
|
busdma_lock_mutex, &Giant, z)
|
|
|
|
#else
|
|
|
|
#define BUS_DMA_ROOTARG(x) bus_get_dma_tag(x)
|
|
|
|
#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \
|
|
|
|
bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \
|
|
|
|
busdma_lock_mutex, &Giant, z)
|
|
|
|
#endif
|
2007-02-23 23:13:46 +00:00
|
|
|
#if __FreeBSD_version < 700031
|
|
|
|
#define isp_setup_intr(d, i, f, U, if, ifa, hp) \
|
|
|
|
bus_setup_intr(d, i, f, if, ifa, hp)
|
|
|
|
#else
|
|
|
|
#define isp_setup_intr bus_setup_intr
|
|
|
|
#endif
|
2007-01-23 00:02:29 +00:00
|
|
|
|
|
|
|
/* Should be BUS_SPACE_MAXSIZE, but MAXPHYS is larger than BUS_SPACE_MAXSIZE */
|
|
|
|
#define ISP_NSEGS ((MAXPHYS / PAGE_SIZE) + 1)
|
|
|
|
|
2006-11-14 08:45:48 +00:00
|
|
|
/*
|
|
|
|
* Platform specific inline functions
|
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
|
2000-08-01 06:29:55 +00:00
|
|
|
/*
|
2006-11-14 08:45:48 +00:00
|
|
|
* ISP General Library functions
|
2000-08-01 06:29:55 +00:00
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
|
2006-02-02 21:31:34 +00:00
|
|
|
#include <dev/isp/isp_library.h>
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
#endif /* _ISP_FREEBSD_H */
|