NetBSD/sys/dev/ic/isp_netbsd.h

391 lines
12 KiB
C
Raw Normal View History

/* $NetBSD: isp_netbsd.h,v 1.66 2008/05/11 02:08:11 mjacob Exp $ */
/*
* NetBSD Specific definitions for the Qlogic ISP Host Adapter
*/
/*
* Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
* All rights reserved.
*
* Additional Copyright (C) 2000-2007 by Matthew Jacob
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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_NETBSD_H
#define _ISP_NETBSD_H
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
2005-02-27 03:26:58 +03:00
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/device.h>
#include <sys/malloc.h>
2005-02-27 03:26:58 +03:00
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/user.h>
Create a kernel thread for Fibre Channel cards. This is the new way of doing business- modulo some startup spasms and peculiarities of the way kthreads are started (*after* configuration, weird) and some strangeness with the freeze/thaw code, what now happens is that any of Loop Down, LIP, Loop Reset or Port Datbase or Name Server Database Changed ASYNC events cause the queues to freeze for this channel. The arrival of a Loop UP is not relevant. What *is* relevant is that the Port Datbase or Name Server Changed async event indicate that it's okay to go and (re)evaluate the state of the FC link and (re)probe local loop and fabric membership. We have a kthread do this because it's *sooooo* much nicer to be able to sleep while doing the 130-250 mailbox commands it'll take to re-evaluate things. When the state is well known again, we can unfreeze the channel queues. Then, as commands start arriving, we simply can start them or bounce them with XS_SELTIMEOUT (if the device in question has gone away). Previously, we did lazy evaluation, which meant that if a change occurred, we would wait until the very *next* command to go rebuild stuff. The reason this is not sensible is: a) Even with sleeping, you can hang up your system because you might be making some poor stat(2) call pay the price of re-evaluating the whole fabric. b) If we ever really want to get to dynamic attachment/detachment, we should find out sooner, rather than later, where things get to. Split off ispminphys_1020 from ispminphys- a 1020 has a 24 bit limit- not anything newer. Re-enable LIPs and Loop Resets as async events- this allows the outer layer to set policy about them. Roll platform major && minor. Remove bogus waitq (no longer used). Remove callout entry in softc (no longer used). Define some shorthands for channels. Clean up a variety of cruft left over from the thorpej_scsipi changeover.
2001-05-26 01:45:55 +04:00
#include <sys/kthread.h>
#include <sys/bus.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <dev/scsipi/scsi_message.h>
#include <dev/scsipi/scsipi_debug.h>
#include <machine/stdarg.h>
#include "opt_isp.h"
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). 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. For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of the explicit ddi_dmamap_sync on the whole response queue that we did for SBus cards at each interrupt. Set things up so that platforms that cannot have an SBus don't get a lot of the SBus code checks (dead coded out). 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). Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response. Otherwise, we won't unswizzle it correctly. Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
/*
* Efficiency- get rid of SBus code && tests unless we need them.
*/
#if defined(__sparcv9__ ) || defined(__sparc__)
#define ISP_SBUS_SUPPORTED 1
#else
#define ISP_SBUS_SUPPORTED 0
#endif
#define ISP_PLATFORM_VERSION_MAJOR 4
#define ISP_PLATFORM_VERSION_MINOR 0
struct isposinfo {
struct device dev;
struct scsipi_adapter adapter;
struct scsipi_channel * chan;
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). 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. For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of the explicit ddi_dmamap_sync on the whole response queue that we did for SBus cards at each interrupt. Set things up so that platforms that cannot have an SBus don't get a lot of the SBus code checks (dead coded out). 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). Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response. Otherwise, we won't unswizzle it correctly. Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
bus_dma_tag_t dmatag;
bus_dmamap_t rqdmap;
bus_dmamap_t rsdmap;
bus_dmamap_t scdmap; /* FC only */
int splsaved;
int mboxwaiting;
uint32_t islocked;
uint32_t onintstack;
uint32_t loop_down_time;
uint32_t loop_down_limit;
uint32_t gone_device_time;
unsigned int : 16,
: 8,
gdt_running : 1,
Create a kernel thread for Fibre Channel cards. This is the new way of doing business- modulo some startup spasms and peculiarities of the way kthreads are started (*after* configuration, weird) and some strangeness with the freeze/thaw code, what now happens is that any of Loop Down, LIP, Loop Reset or Port Datbase or Name Server Database Changed ASYNC events cause the queues to freeze for this channel. The arrival of a Loop UP is not relevant. What *is* relevant is that the Port Datbase or Name Server Changed async event indicate that it's okay to go and (re)evaluate the state of the FC link and (re)probe local loop and fabric membership. We have a kthread do this because it's *sooooo* much nicer to be able to sleep while doing the 130-250 mailbox commands it'll take to re-evaluate things. When the state is well known again, we can unfreeze the channel queues. Then, as commands start arriving, we simply can start them or bounce them with XS_SELTIMEOUT (if the device in question has gone away). Previously, we did lazy evaluation, which meant that if a change occurred, we would wait until the very *next* command to go rebuild stuff. The reason this is not sensible is: a) Even with sleeping, you can hang up your system because you might be making some poor stat(2) call pay the price of re-evaluating the whole fabric. b) If we ever really want to get to dynamic attachment/detachment, we should find out sooner, rather than later, where things get to. Split off ispminphys_1020 from ispminphys- a 1020 has a 24 bit limit- not anything newer. Re-enable LIPs and Loop Resets as async events- this allows the outer layer to set policy about them. Roll platform major && minor. Remove bogus waitq (no longer used). Remove callout entry in softc (no longer used). Define some shorthands for channels. Clean up a variety of cruft left over from the thorpej_scsipi changeover.
2001-05-26 01:45:55 +04:00
loop_checked : 1,
mbox_sleeping : 1,
mbox_sleep_ok : 1,
mboxcmd_done : 1,
mboxbsy : 1,
Create a kernel thread for Fibre Channel cards. This is the new way of doing business- modulo some startup spasms and peculiarities of the way kthreads are started (*after* configuration, weird) and some strangeness with the freeze/thaw code, what now happens is that any of Loop Down, LIP, Loop Reset or Port Datbase or Name Server Database Changed ASYNC events cause the queues to freeze for this channel. The arrival of a Loop UP is not relevant. What *is* relevant is that the Port Datbase or Name Server Changed async event indicate that it's okay to go and (re)evaluate the state of the FC link and (re)probe local loop and fabric membership. We have a kthread do this because it's *sooooo* much nicer to be able to sleep while doing the 130-250 mailbox commands it'll take to re-evaluate things. When the state is well known again, we can unfreeze the channel queues. Then, as commands start arriving, we simply can start them or bounce them with XS_SELTIMEOUT (if the device in question has gone away). Previously, we did lazy evaluation, which meant that if a change occurred, we would wait until the very *next* command to go rebuild stuff. The reason this is not sensible is: a) Even with sleeping, you can hang up your system because you might be making some poor stat(2) call pay the price of re-evaluating the whole fabric. b) If we ever really want to get to dynamic attachment/detachment, we should find out sooner, rather than later, where things get to. Split off ispminphys_1020 from ispminphys- a 1020 has a 24 bit limit- not anything newer. Re-enable LIPs and Loop Resets as async events- this allows the outer layer to set policy about them. Roll platform major && minor. Remove bogus waitq (no longer used). Remove callout entry in softc (no longer used). Define some shorthands for channels. Clean up a variety of cruft left over from the thorpej_scsipi changeover.
2001-05-26 01:45:55 +04:00
paused : 1,
blocked : 1;
struct callout ldt; /* loop down timer */
struct callout gdt; /* gone device timer */
uint64_t wwn;
uint16_t framesize;
uint16_t exec_throttle;
struct lwp * thread;
};
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). 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. For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of the explicit ddi_dmamap_sync on the whole response queue that we did for SBus cards at each interrupt. Set things up so that platforms that cannot have an SBus don't get a lot of the SBus code checks (dead coded out). 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). Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response. Otherwise, we won't unswizzle it correctly. Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
#define isp_dmatag isp_osinfo.dmatag
#define isp_rqdmap isp_osinfo.rqdmap
#define isp_rsdmap isp_osinfo.rsdmap
#define isp_scdmap isp_osinfo.scdmap
#define ISP_MUSTPOLL(isp) \
(isp->isp_osinfo.onintstack || isp->isp_osinfo.mbox_sleep_ok == 0)
Create a kernel thread for Fibre Channel cards. This is the new way of doing business- modulo some startup spasms and peculiarities of the way kthreads are started (*after* configuration, weird) and some strangeness with the freeze/thaw code, what now happens is that any of Loop Down, LIP, Loop Reset or Port Datbase or Name Server Database Changed ASYNC events cause the queues to freeze for this channel. The arrival of a Loop UP is not relevant. What *is* relevant is that the Port Datbase or Name Server Changed async event indicate that it's okay to go and (re)evaluate the state of the FC link and (re)probe local loop and fabric membership. We have a kthread do this because it's *sooooo* much nicer to be able to sleep while doing the 130-250 mailbox commands it'll take to re-evaluate things. When the state is well known again, we can unfreeze the channel queues. Then, as commands start arriving, we simply can start them or bounce them with XS_SELTIMEOUT (if the device in question has gone away). Previously, we did lazy evaluation, which meant that if a change occurred, we would wait until the very *next* command to go rebuild stuff. The reason this is not sensible is: a) Even with sleeping, you can hang up your system because you might be making some poor stat(2) call pay the price of re-evaluating the whole fabric. b) If we ever really want to get to dynamic attachment/detachment, we should find out sooner, rather than later, where things get to. Split off ispminphys_1020 from ispminphys- a 1020 has a 24 bit limit- not anything newer. Re-enable LIPs and Loop Resets as async events- this allows the outer layer to set policy about them. Roll platform major && minor. Remove bogus waitq (no longer used). Remove callout entry in softc (no longer used). Define some shorthands for channels. Clean up a variety of cruft left over from the thorpej_scsipi changeover.
2001-05-26 01:45:55 +04:00
/*
* Required Macros/Defines
*/
#define ISP_FC_SCRLEN 0x1000
2001-07-07 20:13:44 +04:00
#define MEMZERO(dst, amt) memset((dst), 0, (amt))
2001-07-07 19:53:13 +04:00
#define MEMCPY(dst, src, amt) memcpy((dst), (src), (amt))
#define SNPRINTF snprintf
#define USEC_DELAY DELAY
#define USEC_SLEEP(isp, x) \
if (!ISP_MUSTPOLL(isp)) \
ISP_UNLOCK(isp); \
DELAY(x); \
if (!ISP_MUSTPOLL(isp)) \
ISP_LOCK(isp)
#define NANOTIME_T struct timeval
#define GET_NANOTIME microtime
#define GET_NANOSEC(x) (((x)->tv_sec * 1000000 + (x)->tv_usec) * 1000)
#define NANOTIME_SUB isp_microtime_sub
#define MAXISPREQUEST(isp) 256
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). 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. For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of the explicit ddi_dmamap_sync on the whole response queue that we did for SBus cards at each interrupt. Set things up so that platforms that cannot have an SBus don't get a lot of the SBus code checks (dead coded out). 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). Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response. Otherwise, we won't unswizzle it correctly. Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
#define MEMORYBARRIER(isp, type, offset, size) \
switch (type) { \
case SYNC_REQUEST: \
{ \
off_t off = (off_t) offset * QENTRY_LEN; \
bus_dmamap_sync(isp->isp_dmatag, isp->isp_rqdmap, \
off, size, BUS_DMASYNC_PREWRITE); \
break; \
} \
case SYNC_RESULT: \
{ \
off_t off = (off_t) offset * QENTRY_LEN; \
bus_dmamap_sync(isp->isp_dmatag, isp->isp_rsdmap, \
off, size, BUS_DMASYNC_POSTREAD); \
break; \
} \
case SYNC_SFORDEV: \
{ \
off_t off = (off_t) offset; \
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). 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. For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of the explicit ddi_dmamap_sync on the whole response queue that we did for SBus cards at each interrupt. Set things up so that platforms that cannot have an SBus don't get a lot of the SBus code checks (dead coded out). 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). Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response. Otherwise, we won't unswizzle it correctly. Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
bus_dmamap_sync(isp->isp_dmatag, isp->isp_scdmap, \
off, size, BUS_DMASYNC_PREWRITE); \
break; \
} \
case SYNC_SFORCPU: \
{ \
off_t off = (off_t) offset; \
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). 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. For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of the explicit ddi_dmamap_sync on the whole response queue that we did for SBus cards at each interrupt. Set things up so that platforms that cannot have an SBus don't get a lot of the SBus code checks (dead coded out). 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). Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response. Otherwise, we won't unswizzle it correctly. Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
bus_dmamap_sync(isp->isp_dmatag, isp->isp_scdmap, \
off, size, BUS_DMASYNC_POSTREAD); \
break; \
} \
default: \
break; \
}
1999-01-10 08:04:18 +03:00
#define MBOX_ACQUIRE isp_mbox_acquire
#define MBOX_WAIT_COMPLETE isp_mbox_wait_complete
#define MBOX_NOTIFY_COMPLETE isp_mbox_notify_done
#define MBOX_RELEASE isp_mbox_release
#define FC_SCRATCH_ACQUIRE(isp, chan) 0
#define FC_SCRATCH_RELEASE(isp, chan) do { } while (0)
#ifndef SCSI_GOOD
#define SCSI_GOOD 0x0
#endif
#ifndef SCSI_CHECK
#define SCSI_CHECK 0x2
#endif
#ifndef SCSI_BUSY
#define SCSI_BUSY 0x8
#endif
#ifndef SCSI_QFULL
#define SCSI_QFULL 0x28
#endif
#define XS_T struct scsipi_xfer
#define XS_DMA_ADDR_T bus_addr_t
#define XS_CHANNEL(xs) \
((int) (xs)->xs_periph->periph_channel->chan_channel)
#define XS_ISP(xs) \
((void *)(xs)->xs_periph->periph_channel->chan_adapter->adapt_dev)
#define XS_LUN(xs) ((int) (xs)->xs_periph->periph_lun)
#define XS_TGT(xs) ((int) (xs)->xs_periph->periph_target)
#define XS_CDBP(xs) ((uint8_t *) (xs)->cmd)
#define XS_CDBLEN(xs) (xs)->cmdlen
#define XS_XFRLEN(xs) (xs)->datalen
#define XS_TIME(xs) (xs)->timeout
#define XS_RESID(xs) (xs)->resid
#define XS_STSP(xs) (&(xs)->status)
#define XS_SNSP(xs) (&(xs)->sense.scsi_sense)
#define XS_SNSLEN(xs) (sizeof (xs)->sense)
#define XS_SNSKEY(xs) ((xs)->sense.scsi_sense.flags)
/* PORTING NOTES: check to see if there's a better way of checking for tagged */
#define XS_TAG_P(ccb) (((xs)->xs_control & XS_CTL_POLL) != 0)
/* PORTING NOTES: We elimited OTAG option for performance */
#define XS_TAG_TYPE(xs) \
(((xs)->xs_control & XS_CTL_URGENT) ? REQFLAG_HTAG : REQFLAG_STAG)
#define XS_SETERR(xs, v) (xs)->error = v
# define HBA_NOERROR XS_NOERROR
# define HBA_BOTCH XS_DRIVER_STUFFUP
# define HBA_CMDTIMEOUT XS_TIMEOUT
# define HBA_SELTIMEOUT XS_SELTIMEOUT
# define HBA_TGTBSY XS_BUSY
# define HBA_BUSRESET XS_RESET
# define HBA_ABORTED XS_DRIVER_STUFFUP
# define HBA_DATAOVR XS_DRIVER_STUFFUP
# define HBA_ARQFAIL XS_DRIVER_STUFFUP
#define XS_ERR(xs) (xs)->error
#define XS_NOERR(xs) (xs)->error == XS_NOERROR
#define XS_INITERR(xs) (xs)->error = 0, XS_CMD_S_CLEAR(xs)
#define XS_SAVE_SENSE(xs, ptr, len) \
if (xs->error == XS_NOERROR) { \
xs->error = XS_SENSE; \
} \
memcpy(&(xs)->sense, ptr, imin(XS_SNSLEN(xs), len))
#define XS_SET_STATE_STAT(a, b, c)
#define DEFAULT_FRAMESIZE(isp) (isp)->isp_osinfo.framesize
#define DEFAULT_EXEC_THROTTLE(isp) (isp)->isp_osinfo.exec_throttle
#define GET_DEFAULT_ROLE(isp, chan) ISP_ROLE_INITIATOR
#define SET_DEFAULT_ROLE(isp, chan) do { } while (0)
#define DEFAULT_IID(x, chan) 7
#define DEFAULT_LOOPID(x, chan) 108
#define DEFAULT_NODEWWN(isp, chan) (isp)->isp_osinfo.wwn
#define DEFAULT_PORTWWN(isp, chan) (isp)->isp_osinfo.wwn
#define ACTIVE_NODEWWN(isp, chan) \
(isp)->isp_osinfo.wwn? (isp)->isp_osinfo.wwn : \
FCPARAM(isp, chan)->isp_wwnn_nvram
#define ACTIVE_PORTWWN(isp, chan) \
(isp)->isp_osinfo.wwn? (isp)->isp_osinfo.wwn : \
FCPARAM(isp, chan)->isp_wwpn_nvram
#if _BYTE_ORDER == _BIG_ENDIAN
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). 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. For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of the explicit ddi_dmamap_sync on the whole response queue that we did for SBus cards at each interrupt. Set things up so that platforms that cannot have an SBus don't get a lot of the SBus code checks (dead coded out). 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). Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response. Otherwise, we won't unswizzle it correctly. Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
#ifdef ISP_SBUS_SUPPORTED
#define ISP_IOXPUT_8(isp, s, d) *(d) = s
#define ISP_IOXPUT_16(isp, s, d) \
*(d) = (isp->isp_bustype == ISP_BT_SBUS)? s : bswap16(s)
#define ISP_IOXPUT_32(isp, s, d) \
*(d) = (isp->isp_bustype == ISP_BT_SBUS)? s : bswap32(s)
#define ISP_IOXGET_8(isp, s, d) d = (*((uint8_t *)s))
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). 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. For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of the explicit ddi_dmamap_sync on the whole response queue that we did for SBus cards at each interrupt. Set things up so that platforms that cannot have an SBus don't get a lot of the SBus code checks (dead coded out). 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). Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response. Otherwise, we won't unswizzle it correctly. Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
#define ISP_IOXGET_16(isp, s, d) \
d = (isp->isp_bustype == ISP_BT_SBUS)? \
*((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). 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. For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of the explicit ddi_dmamap_sync on the whole response queue that we did for SBus cards at each interrupt. Set things up so that platforms that cannot have an SBus don't get a lot of the SBus code checks (dead coded out). 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). Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response. Otherwise, we won't unswizzle it correctly. Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
#define ISP_IOXGET_32(isp, s, d) \
d = (isp->isp_bustype == ISP_BT_SBUS)? \
*((uint32_t *)s) : bswap32(*((uint32_t *)s))
#else /* ISP_SBUS_SUPPORTED */
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). 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. For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of the explicit ddi_dmamap_sync on the whole response queue that we did for SBus cards at each interrupt. Set things up so that platforms that cannot have an SBus don't get a lot of the SBus code checks (dead coded out). 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). Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response. Otherwise, we won't unswizzle it correctly. Nuke some additional __P macros.
2001-12-14 03:13:44 +03: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)
#define ISP_IOXGET_8(isp, s, d) d = (*((uint8_t *)s))
#define ISP_IOXGET_16(isp, s, d) d = bswap16(*((uint16_t *)s))
#define ISP_IOXGET_32(isp, s, d) d = bswap32(*((uint32_t *)s))
#endif /* ISP_SBUS_SUPPORTED */
#define ISP_SWIZZLE_NVRAM_WORD(isp, rp) *rp = bswap16(*rp)
#define ISP_SWIZZLE_NVRAM_LONG(isp, rp) *rp = bswap32(*rp)
#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
#else
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). 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. For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of the explicit ddi_dmamap_sync on the whole response queue that we did for SBus cards at each interrupt. Set things up so that platforms that cannot have an SBus don't get a lot of the SBus code checks (dead coded out). 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). Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response. Otherwise, we won't unswizzle it correctly. Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
#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)
#define ISP_SWIZZLE_NVRAM_LONG(isp, rp)
#define ISP_IOZPUT_8(isp, s, d) *(d) = s
#define ISP_IOZPUT_16(isp, s, d) *(d) = bswap16(s)
#define ISP_IOZPUT_32(isp, s, d) *(d) = bswap32(s)
#define ISP_IOZGET_8(isp, s, d) d = (*((uint8_t *)(s)))
#define ISP_IOZGET_16(isp, s, d) d = bswap16(*((uint16_t *)(s)))
#define ISP_IOZGET_32(isp, s, d) d = bswap32(*((uint32_t *)(s)))
#endif
#define ISP_SWAP16(isp, x) bswap16(x)
#define ISP_SWAP32(isp, x) bswap32(x)
/*
* Includes of common header files
*/
#include <dev/ic/ispreg.h>
#include <dev/ic/ispvar.h>
#include <dev/ic/ispmbox.h>
/*
* isp_osinfo definitions, extensions and shorthand.
*/
#define isp_unit isp_osinfo.dev.dv_unit
Create a kernel thread for Fibre Channel cards. This is the new way of doing business- modulo some startup spasms and peculiarities of the way kthreads are started (*after* configuration, weird) and some strangeness with the freeze/thaw code, what now happens is that any of Loop Down, LIP, Loop Reset or Port Datbase or Name Server Database Changed ASYNC events cause the queues to freeze for this channel. The arrival of a Loop UP is not relevant. What *is* relevant is that the Port Datbase or Name Server Changed async event indicate that it's okay to go and (re)evaluate the state of the FC link and (re)probe local loop and fabric membership. We have a kthread do this because it's *sooooo* much nicer to be able to sleep while doing the 130-250 mailbox commands it'll take to re-evaluate things. When the state is well known again, we can unfreeze the channel queues. Then, as commands start arriving, we simply can start them or bounce them with XS_SELTIMEOUT (if the device in question has gone away). Previously, we did lazy evaluation, which meant that if a change occurred, we would wait until the very *next* command to go rebuild stuff. The reason this is not sensible is: a) Even with sleeping, you can hang up your system because you might be making some poor stat(2) call pay the price of re-evaluating the whole fabric. b) If we ever really want to get to dynamic attachment/detachment, we should find out sooner, rather than later, where things get to. Split off ispminphys_1020 from ispminphys- a 1020 has a 24 bit limit- not anything newer. Re-enable LIPs and Loop Resets as async events- this allows the outer layer to set policy about them. Roll platform major && minor. Remove bogus waitq (no longer used). Remove callout entry in softc (no longer used). Define some shorthands for channels. Clean up a variety of cruft left over from the thorpej_scsipi changeover.
2001-05-26 01:45:55 +04:00
/*
* Driver prototypes..
*/
void isp_attach(ispsoftc_t *);
void isp_uninit(ispsoftc_t *);
/*
* Driver wide data...
*/
/*
* Locking macros...
*/
#define ISP_LOCK isp_lock
#define ISP_UNLOCK isp_unlock
#define ISP_ILOCK(x) isp_lock(x); isp->isp_osinfo.onintstack++
#define ISP_IUNLOCK(x) isp->isp_osinfo.onintstack--; isp_unlock(x)
2005-02-27 03:26:58 +03:00
/*
* Platform private flags
*/
#define XS_PSTS_INWDOG 0x10000000
#define XS_PSTS_GRACE 0x20000000
#define XS_PSTS_ALL 0x30000000
#define XS_CMD_S_WDOG(xs) (xs)->xs_status |= XS_PSTS_INWDOG
#define XS_CMD_C_WDOG(xs) (xs)->xs_status &= ~XS_PSTS_INWDOG
#define XS_CMD_WDOG_P(xs) (((xs)->xs_status & XS_PSTS_INWDOG) != 0)
#define XS_CMD_S_GRACE(xs) (xs)->xs_status |= XS_PSTS_GRACE
#define XS_CMD_C_GRACE(xs) (xs)->xs_status &= ~XS_PSTS_GRACE
#define XS_CMD_GRACE_P(xs) (((xs)->xs_status & XS_PSTS_GRACE) != 0)
#define XS_CMD_S_DONE(xs) (xs)->xs_status |= XS_STS_DONE
#define XS_CMD_C_DONE(xs) (xs)->xs_status &= ~XS_STS_DONE
#define XS_CMD_DONE_P(xs) (((xs)->xs_status & XS_STS_DONE) != 0)
#define XS_CMD_S_CLEAR(xs) (xs)->xs_status &= ~XS_PSTS_ALL
/*
* Platform Library Functionw
*/
void isp_prt(ispsoftc_t *, int level, const char *, ...);
void isp_lock(ispsoftc_t *);
void isp_unlock(ispsoftc_t *);
uint64_t isp_microtime_sub(struct timeval *, struct timeval *);
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 *);
/*
* Common Library functions
*/
#include <dev/ic/isp_library.h>
#if !defined(ISP_DISABLE_FW) && !defined(ISP_COMPILE_FW)
#define ISP_COMPILE_FW 1
#endif
#endif /* _ISP_NETBSD_H */