Home | History | Annotate | Line # | Download | only in ic
isp_netbsd.h revision 1.53.4.4
      1  1.53.4.4     yamt /* $NetBSD: isp_netbsd.h,v 1.53.4.4 2008/03/17 09:14:42 yamt Exp $ */
      2       1.1   mjacob /*
      3       1.1   mjacob  * NetBSD Specific definitions for the Qlogic ISP Host Adapter
      4      1.15   mjacob  */
      5      1.15   mjacob /*
      6      1.15   mjacob  * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
      7       1.1   mjacob  * All rights reserved.
      8       1.1   mjacob  *
      9  1.53.4.2     yamt  * Additional Copyright (C) 2000-2007 by Matthew Jacob
     10  1.53.4.2     yamt  * All rights reserved.
     11  1.53.4.2     yamt  *
     12       1.1   mjacob  * Redistribution and use in source and binary forms, with or without
     13       1.1   mjacob  * modification, are permitted provided that the following conditions
     14       1.1   mjacob  * are met:
     15       1.1   mjacob  * 1. Redistributions of source code must retain the above copyright
     16      1.15   mjacob  *    notice, this list of conditions and the following disclaimer.
     17       1.1   mjacob  * 2. Redistributions in binary form must reproduce the above copyright
     18       1.1   mjacob  *    notice, this list of conditions and the following disclaimer in the
     19       1.1   mjacob  *    documentation and/or other materials provided with the distribution.
     20       1.1   mjacob  * 3. The name of the author may not be used to endorse or promote products
     21      1.15   mjacob  *    derived from this software without specific prior written permission
     22       1.1   mjacob  *
     23      1.15   mjacob  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     24      1.15   mjacob  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     25      1.15   mjacob  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     26      1.15   mjacob  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     27      1.15   mjacob  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     28      1.15   mjacob  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     29      1.15   mjacob  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     30      1.15   mjacob  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     31      1.15   mjacob  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     32      1.15   mjacob  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     33       1.1   mjacob  */
     34       1.1   mjacob #ifndef	_ISP_NETBSD_H
     35       1.1   mjacob #define	_ISP_NETBSD_H
     36       1.1   mjacob 
     37       1.1   mjacob #include <sys/types.h>
     38       1.1   mjacob #include <sys/param.h>
     39       1.1   mjacob #include <sys/systm.h>
     40       1.1   mjacob #include <sys/kernel.h>
     41      1.53    perry #include <sys/errno.h>
     42       1.1   mjacob #include <sys/ioctl.h>
     43       1.1   mjacob #include <sys/device.h>
     44       1.1   mjacob #include <sys/malloc.h>
     45      1.53    perry #include <sys/buf.h>
     46       1.1   mjacob #include <sys/proc.h>
     47       1.1   mjacob #include <sys/user.h>
     48      1.43   mjacob #include <sys/kthread.h>
     49       1.1   mjacob 
     50  1.53.4.3     yamt #include <sys/bus.h>
     51       1.1   mjacob 
     52       1.1   mjacob #include <dev/scsipi/scsi_all.h>
     53       1.1   mjacob #include <dev/scsipi/scsipi_all.h>
     54       1.1   mjacob #include <dev/scsipi/scsiconf.h>
     55       1.1   mjacob 
     56       1.1   mjacob #include <dev/scsipi/scsi_message.h>
     57       1.1   mjacob #include <dev/scsipi/scsipi_debug.h>
     58       1.1   mjacob 
     59  1.53.4.4     yamt #include <machine/stdarg.h>
     60  1.53.4.4     yamt 
     61      1.15   mjacob #include "opt_isp.h"
     62      1.26   mjacob 
     63      1.47   mjacob /*
     64      1.47   mjacob  * Efficiency- get rid of SBus code && tests unless we need them.
     65      1.47   mjacob  */
     66      1.47   mjacob #if	defined(__sparcv9__ ) || defined(__sparc__)
     67      1.47   mjacob #define	ISP_SBUS_SUPPORTED	1
     68      1.47   mjacob #else
     69      1.47   mjacob #define	ISP_SBUS_SUPPORTED	0
     70      1.47   mjacob #endif
     71      1.15   mjacob 
     72  1.53.4.4     yamt #define	ISP_PLATFORM_VERSION_MAJOR	4
     73  1.53.4.2     yamt #define	ISP_PLATFORM_VERSION_MINOR	0
     74       1.1   mjacob 
     75       1.1   mjacob struct isposinfo {
     76  1.53.4.4     yamt 	struct device		dev;
     77  1.53.4.4     yamt 	struct scsipi_adapter   adapter;
     78  1.53.4.4     yamt 	struct scsipi_channel * chan;
     79      1.47   mjacob 	bus_dma_tag_t		dmatag;
     80      1.47   mjacob 	bus_dmamap_t		rqdmap;
     81      1.47   mjacob 	bus_dmamap_t		rsdmap;
     82      1.47   mjacob 	bus_dmamap_t		scdmap;	/* FC only */
     83      1.47   mjacob 	int			splsaved;
     84      1.47   mjacob 	int			mboxwaiting;
     85  1.53.4.2     yamt 	uint32_t		islocked;
     86  1.53.4.2     yamt 	uint32_t		onintstack;
     87  1.53.4.2     yamt 	uint32_t		loop_down_time;
     88  1.53.4.2     yamt 	uint32_t		loop_down_limit;
     89  1.53.4.2     yamt 	uint32_t		gone_device_time;
     90  1.53.4.2     yamt 	unsigned int		: 16,
     91  1.53.4.2     yamt 				: 8,
     92  1.53.4.2     yamt 		gdt_running	: 1,
     93      1.43   mjacob 		loop_checked	: 1,
     94  1.53.4.2     yamt 		mbox_sleeping	: 1,
     95  1.53.4.2     yamt 		mbox_sleep_ok	: 1,
     96  1.53.4.2     yamt 		mboxcmd_done	: 1,
     97  1.53.4.2     yamt 		mboxbsy		: 1,
     98      1.43   mjacob 		paused		: 1,
     99      1.41   mjacob 		blocked		: 1;
    100  1.53.4.2     yamt 	struct callout		ldt;	/* loop down timer */
    101  1.53.4.2     yamt 	struct callout		gdt;	/* gone device timer */
    102  1.53.4.4     yamt 	uint64_t		wwn;
    103  1.53.4.4     yamt 	uint16_t		framesize;
    104  1.53.4.4     yamt 	uint16_t		exec_throttle;
    105  1.53.4.2     yamt 	struct lwp *		thread;
    106       1.1   mjacob };
    107      1.47   mjacob #define	isp_dmatag		isp_osinfo.dmatag
    108      1.47   mjacob #define	isp_rqdmap		isp_osinfo.rqdmap
    109      1.47   mjacob #define	isp_rsdmap		isp_osinfo.rsdmap
    110      1.47   mjacob #define	isp_scdmap		isp_osinfo.scdmap
    111      1.47   mjacob 
    112      1.32   mjacob #define	ISP_MUSTPOLL(isp)	\
    113  1.53.4.2     yamt  	(isp->isp_osinfo.onintstack || isp->isp_osinfo.mbox_sleep_ok == 0)
    114      1.43   mjacob 
    115      1.27   mjacob /*
    116      1.27   mjacob  * Required Macros/Defines
    117      1.27   mjacob  */
    118      1.27   mjacob 
    119  1.53.4.4     yamt #define	ISP_FC_SCRLEN		0x1000
    120       1.1   mjacob 
    121      1.45  thorpej #define	MEMZERO(dst, amt)	memset((dst), 0, (amt))
    122      1.44  thorpej #define	MEMCPY(dst, src, amt)	memcpy((dst), (src), (amt))
    123      1.27   mjacob #define	SNPRINTF		snprintf
    124      1.27   mjacob #define	USEC_DELAY		DELAY
    125      1.32   mjacob #define	USEC_SLEEP(isp, x)		\
    126      1.32   mjacob 	if (!ISP_MUSTPOLL(isp))		\
    127      1.32   mjacob 		ISP_UNLOCK(isp);	\
    128      1.32   mjacob 	DELAY(x);			\
    129      1.32   mjacob 	if (!ISP_MUSTPOLL(isp))		\
    130      1.32   mjacob 		ISP_LOCK(isp)
    131      1.27   mjacob 
    132      1.27   mjacob #define	NANOTIME_T		struct timeval
    133      1.27   mjacob #define	GET_NANOTIME		microtime
    134      1.27   mjacob #define	GET_NANOSEC(x)		(((x)->tv_sec * 1000000 + (x)->tv_usec) * 1000)
    135      1.27   mjacob #define	NANOTIME_SUB		isp_microtime_sub
    136       1.1   mjacob 
    137      1.27   mjacob #define	MAXISPREQUEST(isp)	256
    138       1.8   mjacob 
    139      1.47   mjacob 
    140      1.47   mjacob #define	MEMORYBARRIER(isp, type, offset, size)			\
    141      1.47   mjacob switch (type) {							\
    142      1.47   mjacob case SYNC_REQUEST:						\
    143      1.47   mjacob {								\
    144      1.47   mjacob 	off_t off = (off_t) offset * QENTRY_LEN;		\
    145      1.47   mjacob 	bus_dmamap_sync(isp->isp_dmatag, isp->isp_rqdmap,	\
    146      1.47   mjacob 	    off, size, BUS_DMASYNC_PREWRITE);			\
    147      1.47   mjacob 	break;							\
    148      1.47   mjacob }								\
    149      1.47   mjacob case SYNC_RESULT:						\
    150      1.47   mjacob {								\
    151      1.47   mjacob 	off_t off = (off_t) offset * QENTRY_LEN;		\
    152      1.47   mjacob 	bus_dmamap_sync(isp->isp_dmatag, isp->isp_rsdmap,	\
    153      1.47   mjacob 	    off, size, BUS_DMASYNC_POSTREAD);			\
    154      1.47   mjacob 	break;							\
    155      1.47   mjacob }								\
    156      1.47   mjacob case SYNC_SFORDEV:						\
    157      1.47   mjacob {								\
    158      1.49   mjacob 	off_t off = (off_t) offset;				\
    159      1.47   mjacob 	bus_dmamap_sync(isp->isp_dmatag, isp->isp_scdmap,	\
    160      1.47   mjacob 	    off, size, BUS_DMASYNC_PREWRITE);			\
    161      1.47   mjacob 	break;							\
    162      1.47   mjacob }								\
    163      1.47   mjacob case SYNC_SFORCPU:						\
    164      1.47   mjacob {								\
    165      1.49   mjacob 	off_t off = (off_t) offset;				\
    166      1.47   mjacob 	bus_dmamap_sync(isp->isp_dmatag, isp->isp_scdmap,	\
    167      1.47   mjacob 	    off, size, BUS_DMASYNC_POSTREAD);			\
    168      1.47   mjacob 	break;							\
    169      1.47   mjacob }								\
    170      1.47   mjacob default:							\
    171      1.47   mjacob 	break;							\
    172      1.47   mjacob }
    173       1.3   mjacob 
    174  1.53.4.2     yamt #define	MBOX_ACQUIRE		isp_mbox_acquire
    175  1.53.4.2     yamt #define	MBOX_WAIT_COMPLETE	isp_mbox_wait_complete
    176  1.53.4.2     yamt #define	MBOX_NOTIFY_COMPLETE	isp_mbox_notify_done
    177  1.53.4.2     yamt #define	MBOX_RELEASE		isp_mbox_release
    178      1.26   mjacob 
    179  1.53.4.4     yamt #define	FC_SCRATCH_ACQUIRE(isp, chan)
    180  1.53.4.4     yamt #define	FC_SCRATCH_RELEASE(isp, chan)
    181      1.48   mjacob 
    182      1.27   mjacob #ifndef	SCSI_GOOD
    183      1.27   mjacob #define	SCSI_GOOD	0x0
    184      1.27   mjacob #endif
    185      1.27   mjacob #ifndef	SCSI_CHECK
    186      1.27   mjacob #define	SCSI_CHECK	0x2
    187      1.27   mjacob #endif
    188      1.27   mjacob #ifndef	SCSI_BUSY
    189      1.27   mjacob #define	SCSI_BUSY	0x8
    190      1.27   mjacob #endif
    191      1.27   mjacob #ifndef	SCSI_QFULL
    192      1.27   mjacob #define	SCSI_QFULL	0x28
    193      1.27   mjacob #endif
    194      1.26   mjacob 
    195      1.27   mjacob #define	XS_T			struct scsipi_xfer
    196  1.53.4.2     yamt #define	XS_DMA_ADDR_T		bus_addr_t
    197  1.53.4.2     yamt #define	XS_CHANNEL(xs)		\
    198  1.53.4.2     yamt 	((int) (xs)->xs_periph->periph_channel->chan_channel)
    199      1.40   bouyer #define	XS_ISP(xs)		\
    200      1.40   bouyer 	((void *)(xs)->xs_periph->periph_channel->chan_adapter->adapt_dev)
    201      1.40   bouyer #define	XS_LUN(xs)		((int) (xs)->xs_periph->periph_lun)
    202      1.40   bouyer #define	XS_TGT(xs)		((int) (xs)->xs_periph->periph_target)
    203  1.53.4.2     yamt #define	XS_CDBP(xs)		((uint8_t *) (xs)->cmd)
    204      1.27   mjacob #define	XS_CDBLEN(xs)		(xs)->cmdlen
    205       1.1   mjacob #define	XS_XFRLEN(xs)		(xs)->datalen
    206       1.1   mjacob #define	XS_TIME(xs)		(xs)->timeout
    207      1.27   mjacob #define	XS_RESID(xs)		(xs)->resid
    208      1.27   mjacob #define	XS_STSP(xs)		(&(xs)->status)
    209       1.1   mjacob #define	XS_SNSP(xs)		(&(xs)->sense.scsi_sense)
    210      1.27   mjacob #define	XS_SNSLEN(xs)		(sizeof (xs)->sense)
    211       1.1   mjacob #define	XS_SNSKEY(xs)		((xs)->sense.scsi_sense.flags)
    212  1.53.4.2     yamt /* PORTING NOTES: check to see if there's a better way of checking for tagged */
    213      1.27   mjacob #define	XS_TAG_P(ccb)		(((xs)->xs_control & XS_CTL_POLL) != 0)
    214  1.53.4.2     yamt /* PORTING NOTES: We elimited OTAG option for performance */
    215      1.27   mjacob #define	XS_TAG_TYPE(xs)	\
    216  1.53.4.2     yamt 	(((xs)->xs_control & XS_CTL_URGENT) ? REQFLAG_HTAG : REQFLAG_STAG)
    217      1.27   mjacob 
    218      1.27   mjacob #define	XS_SETERR(xs, v)	(xs)->error = v
    219      1.27   mjacob 
    220      1.27   mjacob #	define	HBA_NOERROR		XS_NOERROR
    221      1.27   mjacob #	define	HBA_BOTCH		XS_DRIVER_STUFFUP
    222      1.27   mjacob #	define	HBA_CMDTIMEOUT		XS_TIMEOUT
    223      1.27   mjacob #	define	HBA_SELTIMEOUT		XS_SELTIMEOUT
    224      1.27   mjacob #	define	HBA_TGTBSY		XS_BUSY
    225      1.27   mjacob #	define	HBA_BUSRESET		XS_RESET
    226      1.27   mjacob #	define	HBA_ABORTED		XS_DRIVER_STUFFUP
    227      1.27   mjacob #	define	HBA_DATAOVR		XS_DRIVER_STUFFUP
    228      1.27   mjacob #	define	HBA_ARQFAIL		XS_DRIVER_STUFFUP
    229       1.1   mjacob 
    230      1.27   mjacob #define	XS_ERR(xs)		(xs)->error
    231      1.27   mjacob 
    232      1.27   mjacob #define	XS_NOERR(xs)		(xs)->error == XS_NOERROR
    233      1.27   mjacob 
    234      1.27   mjacob #define	XS_INITERR(xs)		(xs)->error = 0, XS_CMD_S_CLEAR(xs)
    235      1.27   mjacob 
    236  1.53.4.2     yamt #define	XS_SAVE_SENSE(xs, ptr, len)				\
    237  1.53.4.2     yamt 	if (xs->error == XS_NOERROR) {				\
    238  1.53.4.2     yamt 		xs->error = XS_SENSE;				\
    239  1.53.4.2     yamt 	}							\
    240  1.53.4.2     yamt 	memcpy(&(xs)->sense, ptr, imin(XS_SNSLEN(xs), len))
    241      1.27   mjacob 
    242      1.27   mjacob #define	XS_SET_STATE_STAT(a, b, c)
    243      1.27   mjacob 
    244  1.53.4.4     yamt #define	DEFAULT_FRAMESIZE(isp)		(isp)->isp_osinfo.framesize
    245  1.53.4.4     yamt #define	DEFAULT_EXEC_THROTTLE(isp)	(isp)->isp_osinfo.exec_throttle
    246  1.53.4.4     yamt #define	GET_DEFAULT_ROLE(isp, chan)	ISP_ROLE_INITIATOR
    247  1.53.4.4     yamt #define	SET_DEFAULT_ROLE(isp, chan)	do { } while (0)
    248  1.53.4.4     yamt #define	DEFAULT_IID(x, chan)		7
    249  1.53.4.4     yamt #define	DEFAULT_LOOPID(x, chan)		108
    250  1.53.4.4     yamt #define	DEFAULT_NODEWWN(isp, chan)	(isp)->isp_osinfo.wwn
    251  1.53.4.4     yamt #define	DEFAULT_PORTWWN(isp, chan)	(isp)->isp_osinfo.wwn
    252  1.53.4.4     yamt #define	ACTIVE_NODEWWN(isp, chan)				\
    253  1.53.4.4     yamt 	(isp)->isp_osinfo.wwn? (isp)->isp_osinfo.wwn :	\
    254  1.53.4.4     yamt 	FCPARAM(isp, chan)->isp_wwnn_nvram
    255  1.53.4.4     yamt #define	ACTIVE_PORTWWN(isp, chan)				\
    256  1.53.4.4     yamt 	(isp)->isp_osinfo.wwn? (isp)->isp_osinfo.wwn :	\
    257  1.53.4.4     yamt 	FCPARAM(isp, chan)->isp_wwpn_nvram
    258      1.27   mjacob 
    259      1.32   mjacob #if	_BYTE_ORDER == _BIG_ENDIAN
    260      1.47   mjacob #ifdef	ISP_SBUS_SUPPORTED
    261      1.47   mjacob #define	ISP_IOXPUT_8(isp, s, d)		*(d) = s
    262      1.47   mjacob #define	ISP_IOXPUT_16(isp, s, d)				\
    263      1.47   mjacob 	*(d) = (isp->isp_bustype == ISP_BT_SBUS)? s : bswap16(s)
    264      1.47   mjacob #define	ISP_IOXPUT_32(isp, s, d)				\
    265      1.47   mjacob 	*(d) = (isp->isp_bustype == ISP_BT_SBUS)? s : bswap32(s)
    266      1.47   mjacob 
    267  1.53.4.2     yamt #define	ISP_IOXGET_8(isp, s, d)		d = (*((uint8_t *)s))
    268      1.47   mjacob #define	ISP_IOXGET_16(isp, s, d)				\
    269      1.47   mjacob 	d = (isp->isp_bustype == ISP_BT_SBUS)?			\
    270  1.53.4.2     yamt 	*((uint16_t *)s) : bswap16(*((uint16_t *)s))
    271      1.47   mjacob #define	ISP_IOXGET_32(isp, s, d)				\
    272      1.47   mjacob 	d = (isp->isp_bustype == ISP_BT_SBUS)?			\
    273  1.53.4.2     yamt 	*((uint32_t *)s) : bswap32(*((uint32_t *)s))
    274  1.53.4.2     yamt 
    275  1.53.4.2     yamt #else	/* ISP_SBUS_SUPPORTED */
    276      1.47   mjacob #define	ISP_IOXPUT_8(isp, s, d)		*(d) = s
    277      1.47   mjacob #define	ISP_IOXPUT_16(isp, s, d)	*(d) = bswap16(s)
    278      1.47   mjacob #define	ISP_IOXPUT_32(isp, s, d)	*(d) = bswap32(s)
    279  1.53.4.2     yamt #define	ISP_IOXGET_8(isp, s, d)		d = (*((uint8_t *)s))
    280  1.53.4.2     yamt #define	ISP_IOXGET_16(isp, s, d)	d = bswap16(*((uint16_t *)s))
    281  1.53.4.2     yamt #define	ISP_IOXGET_32(isp, s, d)	d = bswap32(*((uint32_t *)s))
    282  1.53.4.2     yamt #endif	/* ISP_SBUS_SUPPORTED */
    283      1.32   mjacob #define	ISP_SWIZZLE_NVRAM_WORD(isp, rp)	*rp = bswap16(*rp)
    284  1.53.4.2     yamt #define	ISP_SWIZZLE_NVRAM_LONG(isp, rp)	*rp = bswap32(*rp)
    285  1.53.4.2     yamt 
    286  1.53.4.2     yamt #define	ISP_IOZGET_8(isp, s, d)		d = (*((uint8_t *)s))
    287  1.53.4.2     yamt #define	ISP_IOZGET_16(isp, s, d)	d = (*((uint16_t *)s))
    288  1.53.4.2     yamt #define	ISP_IOZGET_32(isp, s, d)	d = (*((uint32_t *)s))
    289  1.53.4.2     yamt #define	ISP_IOZPUT_8(isp, s, d)		*(d) = s
    290  1.53.4.2     yamt #define	ISP_IOZPUT_16(isp, s, d)	*(d) = s
    291  1.53.4.2     yamt #define	ISP_IOZPUT_32(isp, s, d)	*(d) = s
    292  1.53.4.2     yamt 
    293       1.3   mjacob #else
    294      1.47   mjacob #define	ISP_IOXPUT_8(isp, s, d)		*(d) = s
    295      1.47   mjacob #define	ISP_IOXPUT_16(isp, s, d)	*(d) = s
    296      1.47   mjacob #define	ISP_IOXPUT_32(isp, s, d)	*(d) = s
    297      1.47   mjacob #define	ISP_IOXGET_8(isp, s, d)		d = *(s)
    298      1.47   mjacob #define	ISP_IOXGET_16(isp, s, d)	d = *(s)
    299      1.47   mjacob #define	ISP_IOXGET_32(isp, s, d)	d = *(s)
    300      1.27   mjacob #define	ISP_SWIZZLE_NVRAM_WORD(isp, rp)
    301  1.53.4.2     yamt #define	ISP_SWIZZLE_NVRAM_LONG(isp, rp)
    302  1.53.4.2     yamt 
    303  1.53.4.2     yamt #define	ISP_IOZPUT_8(isp, s, d)		*(d) = s
    304  1.53.4.2     yamt #define	ISP_IOZPUT_16(isp, s, d)	*(d) = bswap16(s)
    305  1.53.4.2     yamt #define	ISP_IOZPUT_32(isp, s, d)	*(d) = bswap32(s)
    306  1.53.4.2     yamt 
    307  1.53.4.2     yamt #define	ISP_IOZGET_8(isp, s, d)		d = (*((uint8_t *)(s)))
    308  1.53.4.2     yamt #define	ISP_IOZGET_16(isp, s, d)	d = bswap16(*((uint16_t *)(s)))
    309  1.53.4.2     yamt #define	ISP_IOZGET_32(isp, s, d)	d = bswap32(*((uint32_t *)(s)))
    310  1.53.4.2     yamt 
    311      1.27   mjacob #endif
    312      1.27   mjacob 
    313  1.53.4.2     yamt #define	ISP_SWAP16(isp, x)		bswap16(x)
    314  1.53.4.2     yamt #define	ISP_SWAP32(isp, x)		bswap32(x)
    315  1.53.4.2     yamt 
    316      1.27   mjacob /*
    317      1.27   mjacob  * Includes of common header files
    318      1.27   mjacob  */
    319       1.1   mjacob 
    320      1.27   mjacob #include <dev/ic/ispreg.h>
    321      1.27   mjacob #include <dev/ic/ispvar.h>
    322      1.27   mjacob #include <dev/ic/ispmbox.h>
    323      1.27   mjacob 
    324      1.27   mjacob /*
    325      1.27   mjacob  * isp_osinfo definitions, extensions and shorthand.
    326      1.27   mjacob  */
    327  1.53.4.4     yamt #define	isp_name	isp_osinfo.dev.dv_xname
    328  1.53.4.4     yamt #define	isp_unit	isp_osinfo.dev.dv_unit
    329      1.43   mjacob 
    330      1.27   mjacob 
    331      1.27   mjacob /*
    332      1.27   mjacob  * Driver prototypes..
    333      1.27   mjacob  */
    334  1.53.4.2     yamt void isp_attach(ispsoftc_t *);
    335  1.53.4.2     yamt void isp_uninit(ispsoftc_t *);
    336      1.27   mjacob 
    337      1.27   mjacob /*
    338      1.27   mjacob  * Driver wide data...
    339      1.27   mjacob  */
    340      1.27   mjacob 
    341      1.27   mjacob /*
    342      1.27   mjacob  * Locking macros...
    343      1.27   mjacob  */
    344      1.27   mjacob #define	ISP_LOCK		isp_lock
    345      1.27   mjacob #define	ISP_UNLOCK		isp_unlock
    346      1.29   mjacob #define	ISP_ILOCK(x)		isp_lock(x); isp->isp_osinfo.onintstack++
    347      1.29   mjacob #define	ISP_IUNLOCK(x)		isp->isp_osinfo.onintstack--; isp_unlock(x)
    348      1.27   mjacob 
    349      1.53    perry /*
    350      1.53    perry  * Platform private flags
    351      1.27   mjacob  */
    352       1.1   mjacob 
    353      1.26   mjacob #define	XS_PSTS_INWDOG		0x10000000
    354      1.26   mjacob #define	XS_PSTS_GRACE		0x20000000
    355      1.26   mjacob #define	XS_PSTS_ALL		0x30000000
    356      1.26   mjacob 
    357      1.26   mjacob #define	XS_CMD_S_WDOG(xs)	(xs)->xs_status |= XS_PSTS_INWDOG
    358      1.26   mjacob #define	XS_CMD_C_WDOG(xs)	(xs)->xs_status &= ~XS_PSTS_INWDOG
    359      1.26   mjacob #define	XS_CMD_WDOG_P(xs)	(((xs)->xs_status & XS_PSTS_INWDOG) != 0)
    360      1.26   mjacob 
    361      1.26   mjacob #define	XS_CMD_S_GRACE(xs)	(xs)->xs_status |= XS_PSTS_GRACE
    362      1.26   mjacob #define	XS_CMD_C_GRACE(xs)	(xs)->xs_status &= ~XS_PSTS_GRACE
    363      1.26   mjacob #define	XS_CMD_GRACE_P(xs)	(((xs)->xs_status & XS_PSTS_GRACE) != 0)
    364      1.26   mjacob 
    365      1.26   mjacob #define	XS_CMD_S_DONE(xs)	(xs)->xs_status |= XS_STS_DONE
    366      1.26   mjacob #define	XS_CMD_C_DONE(xs)	(xs)->xs_status &= ~XS_STS_DONE
    367      1.26   mjacob #define	XS_CMD_DONE_P(xs)	(((xs)->xs_status & XS_STS_DONE) != 0)
    368      1.26   mjacob 
    369      1.26   mjacob #define	XS_CMD_S_CLEAR(xs)	(xs)->xs_status &= ~XS_PSTS_ALL
    370      1.26   mjacob 
    371       1.1   mjacob /*
    372  1.53.4.2     yamt  * Platform Library Functionw
    373       1.1   mjacob  */
    374  1.53.4.2     yamt void isp_prt(ispsoftc_t *, int level, const char *, ...);
    375  1.53.4.2     yamt void isp_lock(ispsoftc_t *);
    376  1.53.4.2     yamt void isp_unlock(ispsoftc_t *);
    377  1.53.4.2     yamt uint64_t isp_microtime_sub(struct timeval *, struct timeval *);
    378  1.53.4.2     yamt int isp_mbox_acquire(ispsoftc_t *);
    379  1.53.4.2     yamt void isp_mbox_wait_complete(ispsoftc_t *, mbreg_t *);
    380  1.53.4.2     yamt void isp_mbox_notify_done(ispsoftc_t *);
    381  1.53.4.2     yamt void isp_mbox_release(ispsoftc_t *);
    382      1.27   mjacob 
    383      1.27   mjacob /*
    384  1.53.4.2     yamt  * Common Library functions
    385      1.27   mjacob  */
    386  1.53.4.2     yamt #include <dev/ic/isp_library.h>
    387      1.18   mjacob 
    388      1.19   mjacob #if	!defined(ISP_DISABLE_FW) && !defined(ISP_COMPILE_FW)
    389      1.19   mjacob #define	ISP_COMPILE_FW	1
    390      1.19   mjacob #endif
    391       1.1   mjacob #endif	/* _ISP_NETBSD_H */
    392