xref: /linux/drivers/scsi/aic7xxx/aic7xxx_osm.h (revision 37a9bd70)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * Adaptec AIC7xxx device driver for Linux.
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * Copyright (c) 1994 John Aycock
51da177e4SLinus Torvalds  *   The University of Calgary Department of Computer Science.
61da177e4SLinus Torvalds  *
71da177e4SLinus Torvalds  * This program is free software; you can redistribute it and/or modify
81da177e4SLinus Torvalds  * it under the terms of the GNU General Public License as published by
91da177e4SLinus Torvalds  * the Free Software Foundation; either version 2, or (at your option)
101da177e4SLinus Torvalds  * any later version.
111da177e4SLinus Torvalds  *
121da177e4SLinus Torvalds  * This program is distributed in the hope that it will be useful,
131da177e4SLinus Torvalds  * but WITHOUT ANY WARRANTY; without even the implied warranty of
141da177e4SLinus Torvalds  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
151da177e4SLinus Torvalds  * GNU General Public License for more details.
161da177e4SLinus Torvalds  *
171da177e4SLinus Torvalds  * You should have received a copy of the GNU General Public License
181da177e4SLinus Torvalds  * along with this program; see the file COPYING.  If not, write to
191da177e4SLinus Torvalds  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
201da177e4SLinus Torvalds  *
211da177e4SLinus Torvalds  * Copyright (c) 2000-2003 Adaptec Inc.
221da177e4SLinus Torvalds  * All rights reserved.
231da177e4SLinus Torvalds  *
241da177e4SLinus Torvalds  * Redistribution and use in source and binary forms, with or without
251da177e4SLinus Torvalds  * modification, are permitted provided that the following conditions
261da177e4SLinus Torvalds  * are met:
271da177e4SLinus Torvalds  * 1. Redistributions of source code must retain the above copyright
281da177e4SLinus Torvalds  *    notice, this list of conditions, and the following disclaimer,
291da177e4SLinus Torvalds  *    without modification.
301da177e4SLinus Torvalds  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
311da177e4SLinus Torvalds  *    substantially similar to the "NO WARRANTY" disclaimer below
321da177e4SLinus Torvalds  *    ("Disclaimer") and any redistribution must be conditioned upon
331da177e4SLinus Torvalds  *    including a substantially similar Disclaimer requirement for further
341da177e4SLinus Torvalds  *    binary redistribution.
351da177e4SLinus Torvalds  * 3. Neither the names of the above-listed copyright holders nor the names
361da177e4SLinus Torvalds  *    of any contributors may be used to endorse or promote products derived
371da177e4SLinus Torvalds  *    from this software without specific prior written permission.
381da177e4SLinus Torvalds  *
391da177e4SLinus Torvalds  * Alternatively, this software may be distributed under the terms of the
401da177e4SLinus Torvalds  * GNU General Public License ("GPL") version 2 as published by the Free
411da177e4SLinus Torvalds  * Software Foundation.
421da177e4SLinus Torvalds  *
431da177e4SLinus Torvalds  * NO WARRANTY
441da177e4SLinus Torvalds  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
451da177e4SLinus Torvalds  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
461da177e4SLinus Torvalds  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
471da177e4SLinus Torvalds  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
481da177e4SLinus Torvalds  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
491da177e4SLinus Torvalds  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
501da177e4SLinus Torvalds  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
511da177e4SLinus Torvalds  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
521da177e4SLinus Torvalds  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
531da177e4SLinus Torvalds  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
541da177e4SLinus Torvalds  * POSSIBILITY OF SUCH DAMAGES.
551da177e4SLinus Torvalds  *
561da177e4SLinus Torvalds  * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#151 $
571da177e4SLinus Torvalds  *
581da177e4SLinus Torvalds  */
591da177e4SLinus Torvalds #ifndef _AIC7XXX_LINUX_H_
601da177e4SLinus Torvalds #define _AIC7XXX_LINUX_H_
611da177e4SLinus Torvalds 
621da177e4SLinus Torvalds #include <linux/types.h>
631da177e4SLinus Torvalds #include <linux/blkdev.h>
641da177e4SLinus Torvalds #include <linux/delay.h>
651da177e4SLinus Torvalds #include <linux/ioport.h>
661da177e4SLinus Torvalds #include <linux/pci.h>
67e4e360c3SJames Bottomley  #include <linux/interrupt.h>
681da177e4SLinus Torvalds #include <linux/module.h>
69013791eeSChristoph Hellwig  #include <linux/slab.h>
701da177e4SLinus Torvalds #include <asm/byteorder.h>
711da177e4SLinus Torvalds #include <asm/io.h>
721da177e4SLinus Torvalds 
73013791eeSChristoph Hellwig  #include <scsi/scsi.h>
74013791eeSChristoph Hellwig  #include <scsi/scsi_cmnd.h>
75013791eeSChristoph Hellwig  #include <scsi/scsi_eh.h>
76013791eeSChristoph Hellwig  #include <scsi/scsi_device.h>
77013791eeSChristoph Hellwig  #include <scsi/scsi_host.h>
78013791eeSChristoph Hellwig  #include <scsi/scsi_tcq.h>
79b1abb4d6SJames Bottomley #include <scsi/scsi_transport.h>
80b1abb4d6SJames Bottomley #include <scsi/scsi_transport_spi.h>
811da177e4SLinus Torvalds 
821da177e4SLinus Torvalds /* Core SCSI definitions */
831da177e4SLinus Torvalds #define AIC_LIB_PREFIX ahc
841da177e4SLinus Torvalds 
851da177e4SLinus Torvalds #include "cam.h"
861da177e4SLinus Torvalds #include "queue.h"
871da177e4SLinus Torvalds #include "scsi_message.h"
881da177e4SLinus Torvalds #include "aiclib.h"
891da177e4SLinus Torvalds 
901da177e4SLinus Torvalds /*********************************** Debugging ********************************/
911da177e4SLinus Torvalds #ifdef CONFIG_AIC7XXX_DEBUG_ENABLE
921da177e4SLinus Torvalds #ifdef CONFIG_AIC7XXX_DEBUG_MASK
931da177e4SLinus Torvalds #define AHC_DEBUG 1
941da177e4SLinus Torvalds #define AHC_DEBUG_OPTS CONFIG_AIC7XXX_DEBUG_MASK
951da177e4SLinus Torvalds #else
961da177e4SLinus Torvalds /*
971da177e4SLinus Torvalds  * Compile in debugging code, but do not enable any printfs.
981da177e4SLinus Torvalds  */
991da177e4SLinus Torvalds #define AHC_DEBUG 1
1001da177e4SLinus Torvalds #endif
1011da177e4SLinus Torvalds /* No debugging code. */
1021da177e4SLinus Torvalds #endif
1031da177e4SLinus Torvalds 
1041da177e4SLinus Torvalds /************************* Forward Declarations *******************************/
1051da177e4SLinus Torvalds struct ahc_softc;
1061da177e4SLinus Torvalds typedef struct pci_dev *ahc_dev_softc_t;
107013791eeSChristoph Hellwig  typedef struct scsi_cmnd      *ahc_io_ctx_t;
1081da177e4SLinus Torvalds 
1091da177e4SLinus Torvalds /******************************* Byte Order ***********************************/
1101da177e4SLinus Torvalds #define ahc_htobe16(x)	cpu_to_be16(x)
1111da177e4SLinus Torvalds #define ahc_htobe32(x)	cpu_to_be32(x)
1121da177e4SLinus Torvalds #define ahc_htobe64(x)	cpu_to_be64(x)
1131da177e4SLinus Torvalds #define ahc_htole16(x)	cpu_to_le16(x)
1141da177e4SLinus Torvalds #define ahc_htole32(x)	cpu_to_le32(x)
1151da177e4SLinus Torvalds #define ahc_htole64(x)	cpu_to_le64(x)
1161da177e4SLinus Torvalds 
1171da177e4SLinus Torvalds #define ahc_be16toh(x)	be16_to_cpu(x)
1181da177e4SLinus Torvalds #define ahc_be32toh(x)	be32_to_cpu(x)
1191da177e4SLinus Torvalds #define ahc_be64toh(x)	be64_to_cpu(x)
1201da177e4SLinus Torvalds #define ahc_le16toh(x)	le16_to_cpu(x)
1211da177e4SLinus Torvalds #define ahc_le32toh(x)	le32_to_cpu(x)
1221da177e4SLinus Torvalds #define ahc_le64toh(x)	le64_to_cpu(x)
1231da177e4SLinus Torvalds 
1241da177e4SLinus Torvalds /************************* Configuration Data *********************************/
1251da177e4SLinus Torvalds extern u_int aic7xxx_no_probe;
1261da177e4SLinus Torvalds extern u_int aic7xxx_allow_memio;
127013791eeSChristoph Hellwig  extern struct scsi_host_template aic7xxx_driver_template;
1281da177e4SLinus Torvalds 
1291da177e4SLinus Torvalds /***************************** Bus Space/DMA **********************************/
1301da177e4SLinus Torvalds 
1311da177e4SLinus Torvalds typedef uint32_t bus_size_t;
1321da177e4SLinus Torvalds 
1331da177e4SLinus Torvalds typedef enum {
1341da177e4SLinus Torvalds 	BUS_SPACE_MEMIO,
1351da177e4SLinus Torvalds 	BUS_SPACE_PIO
1361da177e4SLinus Torvalds } bus_space_tag_t;
1371da177e4SLinus Torvalds 
1381da177e4SLinus Torvalds typedef union {
1391da177e4SLinus Torvalds 	u_long		  ioport;
1401da177e4SLinus Torvalds 	volatile uint8_t __iomem *maddr;
1411da177e4SLinus Torvalds } bus_space_handle_t;
1421da177e4SLinus Torvalds 
1431da177e4SLinus Torvalds typedef struct bus_dma_segment
1441da177e4SLinus Torvalds {
1451da177e4SLinus Torvalds 	dma_addr_t	ds_addr;
1461da177e4SLinus Torvalds 	bus_size_t	ds_len;
1471da177e4SLinus Torvalds } bus_dma_segment_t;
1481da177e4SLinus Torvalds 
1491da177e4SLinus Torvalds struct ahc_linux_dma_tag
1501da177e4SLinus Torvalds {
1511da177e4SLinus Torvalds 	bus_size_t	alignment;
1521da177e4SLinus Torvalds 	bus_size_t	boundary;
1531da177e4SLinus Torvalds 	bus_size_t	maxsize;
1541da177e4SLinus Torvalds };
1551da177e4SLinus Torvalds typedef struct ahc_linux_dma_tag* bus_dma_tag_t;
1561da177e4SLinus Torvalds 
1577dfa0f26SChristoph Hellwig  typedef dma_addr_t bus_dmamap_t;
1581da177e4SLinus Torvalds 
1591da177e4SLinus Torvalds typedef int bus_dma_filter_t(void*, dma_addr_t);
1601da177e4SLinus Torvalds typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int);
1611da177e4SLinus Torvalds 
1621da177e4SLinus Torvalds #define BUS_DMA_WAITOK		0x0
1631da177e4SLinus Torvalds #define BUS_DMA_NOWAIT		0x1
1641da177e4SLinus Torvalds #define BUS_DMA_ALLOCNOW	0x2
1651da177e4SLinus Torvalds #define BUS_DMA_LOAD_SEGS	0x4	/*
1661da177e4SLinus Torvalds 					 * Argument is an S/G list not
1671da177e4SLinus Torvalds 					 * a single buffer.
1681da177e4SLinus Torvalds 					 */
1691da177e4SLinus Torvalds 
1701da177e4SLinus Torvalds #define BUS_SPACE_MAXADDR	0xFFFFFFFF
1711da177e4SLinus Torvalds #define BUS_SPACE_MAXADDR_32BIT	0xFFFFFFFF
1721da177e4SLinus Torvalds #define BUS_SPACE_MAXSIZE_32BIT	0xFFFFFFFF
1731da177e4SLinus Torvalds 
1741da177e4SLinus Torvalds int	ahc_dma_tag_create(struct ahc_softc *, bus_dma_tag_t /*parent*/,
1751da177e4SLinus Torvalds 			   bus_size_t /*alignment*/, bus_size_t /*boundary*/,
1761da177e4SLinus Torvalds 			   dma_addr_t /*lowaddr*/, dma_addr_t /*highaddr*/,
1771da177e4SLinus Torvalds 			   bus_dma_filter_t*/*filter*/, void */*filterarg*/,
1781da177e4SLinus Torvalds 			   bus_size_t /*maxsize*/, int /*nsegments*/,
1791da177e4SLinus Torvalds 			   bus_size_t /*maxsegsz*/, int /*flags*/,
1801da177e4SLinus Torvalds 			   bus_dma_tag_t */*dma_tagp*/);
1811da177e4SLinus Torvalds 
1821da177e4SLinus Torvalds void	ahc_dma_tag_destroy(struct ahc_softc *, bus_dma_tag_t /*tag*/);
1831da177e4SLinus Torvalds 
1841da177e4SLinus Torvalds int	ahc_dmamem_alloc(struct ahc_softc *, bus_dma_tag_t /*dmat*/,
1851da177e4SLinus Torvalds 			 void** /*vaddr*/, int /*flags*/,
1861da177e4SLinus Torvalds 			 bus_dmamap_t* /*mapp*/);
1871da177e4SLinus Torvalds 
1881da177e4SLinus Torvalds void	ahc_dmamem_free(struct ahc_softc *, bus_dma_tag_t /*dmat*/,
1891da177e4SLinus Torvalds 			void* /*vaddr*/, bus_dmamap_t /*map*/);
1901da177e4SLinus Torvalds 
1911da177e4SLinus Torvalds void	ahc_dmamap_destroy(struct ahc_softc *, bus_dma_tag_t /*tag*/,
1921da177e4SLinus Torvalds 			   bus_dmamap_t /*map*/);
1931da177e4SLinus Torvalds 
1941da177e4SLinus Torvalds int	ahc_dmamap_load(struct ahc_softc *ahc, bus_dma_tag_t /*dmat*/,
1951da177e4SLinus Torvalds 			bus_dmamap_t /*map*/, void * /*buf*/,
1961da177e4SLinus Torvalds 			bus_size_t /*buflen*/, bus_dmamap_callback_t *,
1971da177e4SLinus Torvalds 			void */*callback_arg*/, int /*flags*/);
1981da177e4SLinus Torvalds 
1991da177e4SLinus Torvalds int	ahc_dmamap_unload(struct ahc_softc *, bus_dma_tag_t, bus_dmamap_t);
2001da177e4SLinus Torvalds 
2011da177e4SLinus Torvalds /*
2021da177e4SLinus Torvalds  * Operations performed by ahc_dmamap_sync().
2031da177e4SLinus Torvalds  */
2041da177e4SLinus Torvalds #define BUS_DMASYNC_PREREAD	0x01	/* pre-read synchronization */
2051da177e4SLinus Torvalds #define BUS_DMASYNC_POSTREAD	0x02	/* post-read synchronization */
2061da177e4SLinus Torvalds #define BUS_DMASYNC_PREWRITE	0x04	/* pre-write synchronization */
2071da177e4SLinus Torvalds #define BUS_DMASYNC_POSTWRITE	0x08	/* post-write synchronization */
2081da177e4SLinus Torvalds 
2091da177e4SLinus Torvalds /*
2101da177e4SLinus Torvalds  * XXX
2111da177e4SLinus Torvalds  * ahc_dmamap_sync is only used on buffers allocated with
212*9f80eca4SCai Huoqing  * the dma_alloc_coherent() API.  Although I'm not sure how
2131da177e4SLinus Torvalds  * this works on architectures with a write buffer, Linux does
2141da177e4SLinus Torvalds  * not have an API to sync "coherent" memory.  Perhaps we need
2151da177e4SLinus Torvalds  * to do an mb()?
2161da177e4SLinus Torvalds  */
2171da177e4SLinus Torvalds #define ahc_dmamap_sync(ahc, dma_tag, dmamap, offset, len, op)
2181da177e4SLinus Torvalds 
2191da177e4SLinus Torvalds /********************************** Includes **********************************/
2201da177e4SLinus Torvalds #ifdef CONFIG_AIC7XXX_REG_PRETTY_PRINT
2211da177e4SLinus Torvalds #define AIC_DEBUG_REGISTERS 1
2221da177e4SLinus Torvalds #else
2231da177e4SLinus Torvalds #define AIC_DEBUG_REGISTERS 0
2241da177e4SLinus Torvalds #endif
2251da177e4SLinus Torvalds #include "aic7xxx.h"
2261da177e4SLinus Torvalds 
2271da177e4SLinus Torvalds /***************************** Timer Facilities *******************************/
2281beb6fa8SHarvey Harrison static inline void
ahc_scb_timer_reset(struct scb * scb,u_int usec)2291da177e4SLinus Torvalds ahc_scb_timer_reset(struct scb *scb, u_int usec)
2301da177e4SLinus Torvalds {
2311da177e4SLinus Torvalds }
2321da177e4SLinus Torvalds 
2331da177e4SLinus Torvalds /***************************** SMP support ************************************/
2341da177e4SLinus Torvalds #include <linux/spinlock.h>
2351da177e4SLinus Torvalds 
23679778a27SJames Bottomley #define AIC7XXX_DRIVER_VERSION "7.0"
2371da177e4SLinus Torvalds 
2381da177e4SLinus Torvalds /*************************** Device Data Structures ***************************/
2391da177e4SLinus Torvalds /*
2401da177e4SLinus Torvalds  * A per probed device structure used to deal with some error recovery
2411da177e4SLinus Torvalds  * scenarios that the Linux mid-layer code just doesn't know how to
2421da177e4SLinus Torvalds  * handle.  The structure allocated for a device only becomes persistent
2431da177e4SLinus Torvalds  * after a successfully completed inquiry command to the target when
2441da177e4SLinus Torvalds  * that inquiry data indicates a lun is present.
2451da177e4SLinus Torvalds  */
2461da177e4SLinus Torvalds typedef enum {
2471da177e4SLinus Torvalds 	AHC_DEV_FREEZE_TIL_EMPTY = 0x02, /* Freeze queue until active == 0 */
2481da177e4SLinus Torvalds 	AHC_DEV_Q_BASIC		 = 0x10, /* Allow basic device queuing */
2491da177e4SLinus Torvalds 	AHC_DEV_Q_TAGGED	 = 0x20, /* Allow full SCSI2 command queueing */
2501da177e4SLinus Torvalds 	AHC_DEV_PERIODIC_OTAG	 = 0x40, /* Send OTAG to prevent starvation */
2511da177e4SLinus Torvalds } ahc_linux_dev_flags;
2521da177e4SLinus Torvalds 
2531da177e4SLinus Torvalds struct ahc_linux_device {
2541da177e4SLinus Torvalds 	/*
2551da177e4SLinus Torvalds 	 * The number of transactions currently
2561da177e4SLinus Torvalds 	 * queued to the device.
2571da177e4SLinus Torvalds 	 */
2581da177e4SLinus Torvalds 	int			active;
2591da177e4SLinus Torvalds 
2601da177e4SLinus Torvalds 	/*
2611da177e4SLinus Torvalds 	 * The currently allowed number of
2621da177e4SLinus Torvalds 	 * transactions that can be queued to
2631da177e4SLinus Torvalds 	 * the device.  Must be signed for
2641da177e4SLinus Torvalds 	 * conversion from tagged to untagged
2651da177e4SLinus Torvalds 	 * mode where the device may have more
2661da177e4SLinus Torvalds 	 * than one outstanding active transaction.
2671da177e4SLinus Torvalds 	 */
2681da177e4SLinus Torvalds 	int			openings;
2691da177e4SLinus Torvalds 
2701da177e4SLinus Torvalds 	/*
2711da177e4SLinus Torvalds 	 * A positive count indicates that this
2721da177e4SLinus Torvalds 	 * device's queue is halted.
2731da177e4SLinus Torvalds 	 */
2741da177e4SLinus Torvalds 	u_int			qfrozen;
2751da177e4SLinus Torvalds 
2761da177e4SLinus Torvalds 	/*
2771da177e4SLinus Torvalds 	 * Cumulative command counter.
2781da177e4SLinus Torvalds 	 */
2791da177e4SLinus Torvalds 	u_long			commands_issued;
2801da177e4SLinus Torvalds 
2811da177e4SLinus Torvalds 	/*
2821da177e4SLinus Torvalds 	 * The number of tagged transactions when
2831da177e4SLinus Torvalds 	 * running at our current opening level
2841da177e4SLinus Torvalds 	 * that have been successfully received by
2851da177e4SLinus Torvalds 	 * this device since the last QUEUE FULL.
2861da177e4SLinus Torvalds 	 */
2871da177e4SLinus Torvalds 	u_int			tag_success_count;
2881da177e4SLinus Torvalds #define AHC_TAG_SUCCESS_INTERVAL 50
2891da177e4SLinus Torvalds 
2901da177e4SLinus Torvalds 	ahc_linux_dev_flags	flags;
2911da177e4SLinus Torvalds 
2921da177e4SLinus Torvalds 	/*
2931da177e4SLinus Torvalds 	 * The high limit for the tags variable.
2941da177e4SLinus Torvalds 	 */
2951da177e4SLinus Torvalds 	u_int			maxtags;
2961da177e4SLinus Torvalds 
2971da177e4SLinus Torvalds 	/*
2981da177e4SLinus Torvalds 	 * The computed number of tags outstanding
2991da177e4SLinus Torvalds 	 * at the time of the last QUEUE FULL event.
3001da177e4SLinus Torvalds 	 */
3011da177e4SLinus Torvalds 	u_int			tags_on_last_queuefull;
3021da177e4SLinus Torvalds 
3031da177e4SLinus Torvalds 	/*
3041da177e4SLinus Torvalds 	 * How many times we have seen a queue full
3051da177e4SLinus Torvalds 	 * with the same number of tags.  This is used
3061da177e4SLinus Torvalds 	 * to stop our adaptive queue depth algorithm
3071da177e4SLinus Torvalds 	 * on devices with a fixed number of tags.
3081da177e4SLinus Torvalds 	 */
3091da177e4SLinus Torvalds 	u_int			last_queuefull_same_count;
3101da177e4SLinus Torvalds #define AHC_LOCK_TAGS_COUNT 50
3111da177e4SLinus Torvalds 
3121da177e4SLinus Torvalds 	/*
3131da177e4SLinus Torvalds 	 * How many transactions have been queued
3141da177e4SLinus Torvalds 	 * without the device going idle.  We use
3151da177e4SLinus Torvalds 	 * this statistic to determine when to issue
3161da177e4SLinus Torvalds 	 * an ordered tag to prevent transaction
3171da177e4SLinus Torvalds 	 * starvation.  This statistic is only updated
3181da177e4SLinus Torvalds 	 * if the AHC_DEV_PERIODIC_OTAG flag is set
3191da177e4SLinus Torvalds 	 * on this device.
3201da177e4SLinus Torvalds 	 */
3211da177e4SLinus Torvalds 	u_int			commands_since_idle_or_otag;
3221da177e4SLinus Torvalds #define AHC_OTAG_THRESH	500
3231da177e4SLinus Torvalds };
3241da177e4SLinus Torvalds 
3251da177e4SLinus Torvalds /********************* Definitions Required by the Core ***********************/
3261da177e4SLinus Torvalds /*
3271da177e4SLinus Torvalds  * Number of SG segments we require.  So long as the S/G segments for
3281da177e4SLinus Torvalds  * a particular transaction are allocated in a physically contiguous
3291da177e4SLinus Torvalds  * manner and are allocated below 4GB, the number of S/G segments is
3301da177e4SLinus Torvalds  * unrestricted.
3311da177e4SLinus Torvalds  */
3321da177e4SLinus Torvalds #define	AHC_NSEG 128
3331da177e4SLinus Torvalds 
3341da177e4SLinus Torvalds /*
3351da177e4SLinus Torvalds  * Per-SCB OSM storage.
3361da177e4SLinus Torvalds  */
3371da177e4SLinus Torvalds struct scb_platform_data {
3381da177e4SLinus Torvalds 	struct ahc_linux_device	*dev;
3391da177e4SLinus Torvalds 	dma_addr_t		 buf_busaddr;
3401da177e4SLinus Torvalds 	uint32_t		 xfer_len;
3411da177e4SLinus Torvalds 	uint32_t		 sense_resid;	/* Auto-Sense residual */
3421da177e4SLinus Torvalds };
3431da177e4SLinus Torvalds 
3441da177e4SLinus Torvalds /*
3451da177e4SLinus Torvalds  * Define a structure used for each host adapter.  All members are
3461da177e4SLinus Torvalds  * aligned on a boundary >= the size of the member to honor the
3471da177e4SLinus Torvalds  * alignment restrictions of the various platforms supported by
3481da177e4SLinus Torvalds  * this driver.
3491da177e4SLinus Torvalds  */
3501da177e4SLinus Torvalds struct ahc_platform_data {
3511da177e4SLinus Torvalds 	/*
3521da177e4SLinus Torvalds 	 * Fields accessed from interrupt context.
3531da177e4SLinus Torvalds 	 */
354b1abb4d6SJames Bottomley 	struct scsi_target *starget[AHC_NUM_TARGETS];
3551da177e4SLinus Torvalds 
3561da177e4SLinus Torvalds 	spinlock_t		 spin_lock;
3571da177e4SLinus Torvalds 	u_int			 qfrozen;
3588cac8145SChristoph Hellwig 	struct completion	*eh_done;
3591da177e4SLinus Torvalds 	struct Scsi_Host	*host;		/* pointer to scsi host */
3601da177e4SLinus Torvalds #define AHC_LINUX_NOIRQ	((uint32_t)~0)
3611da177e4SLinus Torvalds 	uint32_t		 irq;		/* IRQ for this adapter */
3621da177e4SLinus Torvalds 	uint32_t		 bios_address;
36344850413SSergei Shtylyov 	resource_size_t		 mem_busaddr;	/* Mem Base Addr */
3641da177e4SLinus Torvalds };
3651da177e4SLinus Torvalds 
366be0d6768SDenys Vlasenko void ahc_delay(long);
3671da177e4SLinus Torvalds 
3681da177e4SLinus Torvalds 
3691da177e4SLinus Torvalds /***************************** Low Level I/O **********************************/
370be0d6768SDenys Vlasenko uint8_t ahc_inb(struct ahc_softc * ahc, long port);
371be0d6768SDenys Vlasenko void ahc_outb(struct ahc_softc * ahc, long port, uint8_t val);
372be0d6768SDenys Vlasenko void ahc_outsb(struct ahc_softc * ahc, long port,
3731da177e4SLinus Torvalds 	       uint8_t *, int count);
374be0d6768SDenys Vlasenko void ahc_insb(struct ahc_softc * ahc, long port,
3751da177e4SLinus Torvalds 	       uint8_t *, int count);
3761da177e4SLinus Torvalds 
3771da177e4SLinus Torvalds /**************************** Initialization **********************************/
3781da177e4SLinus Torvalds int		ahc_linux_register_host(struct ahc_softc *,
379013791eeSChristoph Hellwig  					struct scsi_host_template *);
3801da177e4SLinus Torvalds 
3811da177e4SLinus Torvalds /******************************** Locking *************************************/
3821da177e4SLinus Torvalds /* Lock protecting internal data structures */
3831da177e4SLinus Torvalds 
3841beb6fa8SHarvey Harrison static inline void
ahc_lockinit(struct ahc_softc * ahc)3851da177e4SLinus Torvalds ahc_lockinit(struct ahc_softc *ahc)
3861da177e4SLinus Torvalds {
3871da177e4SLinus Torvalds 	spin_lock_init(&ahc->platform_data->spin_lock);
3881da177e4SLinus Torvalds }
3891da177e4SLinus Torvalds 
3901beb6fa8SHarvey Harrison static inline void
ahc_lock(struct ahc_softc * ahc,unsigned long * flags)3911da177e4SLinus Torvalds ahc_lock(struct ahc_softc *ahc, unsigned long *flags)
3921da177e4SLinus Torvalds {
3931da177e4SLinus Torvalds 	spin_lock_irqsave(&ahc->platform_data->spin_lock, *flags);
3941da177e4SLinus Torvalds }
3951da177e4SLinus Torvalds 
3961beb6fa8SHarvey Harrison static inline void
ahc_unlock(struct ahc_softc * ahc,unsigned long * flags)3971da177e4SLinus Torvalds ahc_unlock(struct ahc_softc *ahc, unsigned long *flags)
3981da177e4SLinus Torvalds {
3991da177e4SLinus Torvalds 	spin_unlock_irqrestore(&ahc->platform_data->spin_lock, *flags);
4001da177e4SLinus Torvalds }
4011da177e4SLinus Torvalds 
4021da177e4SLinus Torvalds /******************************* PCI Definitions ******************************/
4031da177e4SLinus Torvalds /*
4041da177e4SLinus Torvalds  * PCIM_xxx: mask to locate subfield in register
4051da177e4SLinus Torvalds  * PCIR_xxx: config register offset
4061da177e4SLinus Torvalds  * PCIC_xxx: device class
4071da177e4SLinus Torvalds  * PCIS_xxx: device subclass
4081da177e4SLinus Torvalds  * PCIP_xxx: device programming interface
4091da177e4SLinus Torvalds  * PCIV_xxx: PCI vendor ID (only required to fixup ancient devices)
4101da177e4SLinus Torvalds  * PCID_xxx: device ID
4111da177e4SLinus Torvalds  */
4121da177e4SLinus Torvalds #define PCIR_DEVVENDOR		0x00
4131da177e4SLinus Torvalds #define PCIR_VENDOR		0x00
4141da177e4SLinus Torvalds #define PCIR_DEVICE		0x02
4151da177e4SLinus Torvalds #define PCIR_COMMAND		0x04
4161da177e4SLinus Torvalds #define PCIM_CMD_PORTEN		0x0001
4171da177e4SLinus Torvalds #define PCIM_CMD_MEMEN		0x0002
4181da177e4SLinus Torvalds #define PCIM_CMD_BUSMASTEREN	0x0004
4191da177e4SLinus Torvalds #define PCIM_CMD_MWRICEN	0x0010
4201da177e4SLinus Torvalds #define PCIM_CMD_PERRESPEN	0x0040
4211da177e4SLinus Torvalds #define	PCIM_CMD_SERRESPEN	0x0100
4221da177e4SLinus Torvalds #define PCIR_STATUS		0x06
4231da177e4SLinus Torvalds #define PCIR_REVID		0x08
4241da177e4SLinus Torvalds #define PCIR_PROGIF		0x09
4251da177e4SLinus Torvalds #define PCIR_SUBCLASS		0x0a
4261da177e4SLinus Torvalds #define PCIR_CLASS		0x0b
4271da177e4SLinus Torvalds #define PCIR_CACHELNSZ		0x0c
4281da177e4SLinus Torvalds #define PCIR_LATTIMER		0x0d
4291da177e4SLinus Torvalds #define PCIR_HEADERTYPE		0x0e
4301da177e4SLinus Torvalds #define PCIM_MFDEV		0x80
4311da177e4SLinus Torvalds #define PCIR_BIST		0x0f
4321da177e4SLinus Torvalds #define PCIR_CAP_PTR		0x34
4331da177e4SLinus Torvalds 
4341da177e4SLinus Torvalds /* config registers for header type 0 devices */
4351da177e4SLinus Torvalds #define PCIR_MAPS	0x10
4361da177e4SLinus Torvalds 
4371da177e4SLinus Torvalds typedef enum
4381da177e4SLinus Torvalds {
4391da177e4SLinus Torvalds 	AHC_POWER_STATE_D0,
4401da177e4SLinus Torvalds 	AHC_POWER_STATE_D1,
4411da177e4SLinus Torvalds 	AHC_POWER_STATE_D2,
4421da177e4SLinus Torvalds 	AHC_POWER_STATE_D3
4431da177e4SLinus Torvalds } ahc_power_state;
4441da177e4SLinus Torvalds 
4451da177e4SLinus Torvalds /**************************** VL/EISA Routines ********************************/
4461da177e4SLinus Torvalds #ifdef CONFIG_EISA
4471da177e4SLinus Torvalds int			 ahc_linux_eisa_init(void);
4481da177e4SLinus Torvalds void			 ahc_linux_eisa_exit(void);
4491da177e4SLinus Torvalds int			 aic7770_map_registers(struct ahc_softc *ahc,
4501da177e4SLinus Torvalds 					       u_int port);
4511da177e4SLinus Torvalds int			 aic7770_map_int(struct ahc_softc *ahc, u_int irq);
4521da177e4SLinus Torvalds #else
ahc_linux_eisa_init(void)4531da177e4SLinus Torvalds static inline int	ahc_linux_eisa_init(void) {
4541da177e4SLinus Torvalds 	return -ENODEV;
4551da177e4SLinus Torvalds }
ahc_linux_eisa_exit(void)4561da177e4SLinus Torvalds static inline void	ahc_linux_eisa_exit(void) {
4571da177e4SLinus Torvalds }
4581da177e4SLinus Torvalds #endif
4591da177e4SLinus Torvalds 
4601da177e4SLinus Torvalds /******************************* PCI Routines *********************************/
4611da177e4SLinus Torvalds #ifdef CONFIG_PCI
4621da177e4SLinus Torvalds int			 ahc_linux_pci_init(void);
4631da177e4SLinus Torvalds void			 ahc_linux_pci_exit(void);
4641da177e4SLinus Torvalds int			 ahc_pci_map_registers(struct ahc_softc *ahc);
4651da177e4SLinus Torvalds int			 ahc_pci_map_int(struct ahc_softc *ahc);
4661da177e4SLinus Torvalds 
467be0d6768SDenys Vlasenko uint32_t		 ahc_pci_read_config(ahc_dev_softc_t pci,
4681da177e4SLinus Torvalds 					     int reg, int width);
4691da177e4SLinus Torvalds 
470be0d6768SDenys Vlasenko void			 ahc_pci_write_config(ahc_dev_softc_t pci,
4711da177e4SLinus Torvalds 					      int reg, uint32_t value,
4721da177e4SLinus Torvalds 					      int width);
4731da177e4SLinus Torvalds 
4741beb6fa8SHarvey Harrison static inline int ahc_get_pci_function(ahc_dev_softc_t);
4751beb6fa8SHarvey Harrison static inline int
ahc_get_pci_function(ahc_dev_softc_t pci)4761da177e4SLinus Torvalds ahc_get_pci_function(ahc_dev_softc_t pci)
4771da177e4SLinus Torvalds {
4781da177e4SLinus Torvalds 	return (PCI_FUNC(pci->devfn));
4791da177e4SLinus Torvalds }
4801da177e4SLinus Torvalds 
4811beb6fa8SHarvey Harrison static inline int ahc_get_pci_slot(ahc_dev_softc_t);
4821beb6fa8SHarvey Harrison static inline int
ahc_get_pci_slot(ahc_dev_softc_t pci)4831da177e4SLinus Torvalds ahc_get_pci_slot(ahc_dev_softc_t pci)
4841da177e4SLinus Torvalds {
4851da177e4SLinus Torvalds 	return (PCI_SLOT(pci->devfn));
4861da177e4SLinus Torvalds }
4871da177e4SLinus Torvalds 
4881beb6fa8SHarvey Harrison static inline int ahc_get_pci_bus(ahc_dev_softc_t);
4891beb6fa8SHarvey Harrison static inline int
ahc_get_pci_bus(ahc_dev_softc_t pci)4901da177e4SLinus Torvalds ahc_get_pci_bus(ahc_dev_softc_t pci)
4911da177e4SLinus Torvalds {
4921da177e4SLinus Torvalds 	return (pci->bus->number);
4931da177e4SLinus Torvalds }
4941da177e4SLinus Torvalds #else
ahc_linux_pci_init(void)4951da177e4SLinus Torvalds static inline int ahc_linux_pci_init(void) {
4961da177e4SLinus Torvalds 	return 0;
4971da177e4SLinus Torvalds }
ahc_linux_pci_exit(void)4981da177e4SLinus Torvalds static inline void ahc_linux_pci_exit(void) {
4991da177e4SLinus Torvalds }
5001da177e4SLinus Torvalds #endif
5011da177e4SLinus Torvalds 
5021beb6fa8SHarvey Harrison static inline void ahc_flush_device_writes(struct ahc_softc *);
5031beb6fa8SHarvey Harrison static inline void
ahc_flush_device_writes(struct ahc_softc * ahc)5041da177e4SLinus Torvalds ahc_flush_device_writes(struct ahc_softc *ahc)
5051da177e4SLinus Torvalds {
5061da177e4SLinus Torvalds 	/* XXX Is this sufficient for all architectures??? */
5071da177e4SLinus Torvalds 	ahc_inb(ahc, INTSTAT);
5081da177e4SLinus Torvalds }
5091da177e4SLinus Torvalds 
5101da177e4SLinus Torvalds /**************************** Proc FS Support *********************************/
5116b3a8bbfSAl Viro int	ahc_proc_write_seeprom(struct Scsi_Host *, char *, int);
5126b3a8bbfSAl Viro int	ahc_linux_show_info(struct seq_file *, struct Scsi_Host *);
5131da177e4SLinus Torvalds 
5141da177e4SLinus Torvalds /*************************** Domain Validation ********************************/
5151da177e4SLinus Torvalds /*********************** Transaction Access Wrappers *************************/
5161da177e4SLinus Torvalds 
5171beb6fa8SHarvey Harrison static inline
ahc_cmd_set_transaction_status(struct scsi_cmnd * cmd,uint32_t status)518013791eeSChristoph Hellwig  void ahc_cmd_set_transaction_status(struct scsi_cmnd *cmd, uint32_t status)
5191da177e4SLinus Torvalds {
5201da177e4SLinus Torvalds 	cmd->result &= ~(CAM_STATUS_MASK << 16);
5211da177e4SLinus Torvalds 	cmd->result |= status << 16;
5221da177e4SLinus Torvalds }
5231da177e4SLinus Torvalds 
5241beb6fa8SHarvey Harrison static inline
ahc_set_transaction_status(struct scb * scb,uint32_t status)5251da177e4SLinus Torvalds void ahc_set_transaction_status(struct scb *scb, uint32_t status)
5261da177e4SLinus Torvalds {
5271da177e4SLinus Torvalds 	ahc_cmd_set_transaction_status(scb->io_ctx,status);
5281da177e4SLinus Torvalds }
5291da177e4SLinus Torvalds 
5301beb6fa8SHarvey Harrison static inline
ahc_cmd_set_scsi_status(struct scsi_cmnd * cmd,uint32_t status)531013791eeSChristoph Hellwig  void ahc_cmd_set_scsi_status(struct scsi_cmnd *cmd, uint32_t status)
5321da177e4SLinus Torvalds {
5331da177e4SLinus Torvalds 	cmd->result &= ~0xFFFF;
5341da177e4SLinus Torvalds 	cmd->result |= status;
5351da177e4SLinus Torvalds }
5361da177e4SLinus Torvalds 
5371beb6fa8SHarvey Harrison static inline
ahc_set_scsi_status(struct scb * scb,uint32_t status)5381da177e4SLinus Torvalds void ahc_set_scsi_status(struct scb *scb, uint32_t status)
5391da177e4SLinus Torvalds {
5401da177e4SLinus Torvalds 	ahc_cmd_set_scsi_status(scb->io_ctx, status);
5411da177e4SLinus Torvalds }
5421da177e4SLinus Torvalds 
5431beb6fa8SHarvey Harrison static inline
ahc_cmd_get_transaction_status(struct scsi_cmnd * cmd)544013791eeSChristoph Hellwig  uint32_t ahc_cmd_get_transaction_status(struct scsi_cmnd *cmd)
5451da177e4SLinus Torvalds {
5461da177e4SLinus Torvalds 	return ((cmd->result >> 16) & CAM_STATUS_MASK);
5471da177e4SLinus Torvalds }
5481da177e4SLinus Torvalds 
5491beb6fa8SHarvey Harrison static inline
ahc_get_transaction_status(struct scb * scb)5501da177e4SLinus Torvalds uint32_t ahc_get_transaction_status(struct scb *scb)
5511da177e4SLinus Torvalds {
5521da177e4SLinus Torvalds 	return (ahc_cmd_get_transaction_status(scb->io_ctx));
5531da177e4SLinus Torvalds }
5541da177e4SLinus Torvalds 
5551beb6fa8SHarvey Harrison static inline
ahc_cmd_get_scsi_status(struct scsi_cmnd * cmd)556013791eeSChristoph Hellwig  uint32_t ahc_cmd_get_scsi_status(struct scsi_cmnd *cmd)
5571da177e4SLinus Torvalds {
5581da177e4SLinus Torvalds 	return (cmd->result & 0xFFFF);
5591da177e4SLinus Torvalds }
5601da177e4SLinus Torvalds 
5611beb6fa8SHarvey Harrison static inline
ahc_get_scsi_status(struct scb * scb)5621da177e4SLinus Torvalds uint32_t ahc_get_scsi_status(struct scb *scb)
5631da177e4SLinus Torvalds {
5641da177e4SLinus Torvalds 	return (ahc_cmd_get_scsi_status(scb->io_ctx));
5651da177e4SLinus Torvalds }
5661da177e4SLinus Torvalds 
5671beb6fa8SHarvey Harrison static inline
ahc_set_transaction_tag(struct scb * scb,int enabled,u_int type)5681da177e4SLinus Torvalds void ahc_set_transaction_tag(struct scb *scb, int enabled, u_int type)
5691da177e4SLinus Torvalds {
5701da177e4SLinus Torvalds 	/*
5711da177e4SLinus Torvalds 	 * Nothing to do for linux as the incoming transaction
5721da177e4SLinus Torvalds 	 * has no concept of tag/non tagged, etc.
5731da177e4SLinus Torvalds 	 */
5741da177e4SLinus Torvalds }
5751da177e4SLinus Torvalds 
5761beb6fa8SHarvey Harrison static inline
ahc_get_transfer_length(struct scb * scb)5771da177e4SLinus Torvalds u_long ahc_get_transfer_length(struct scb *scb)
5781da177e4SLinus Torvalds {
5791da177e4SLinus Torvalds 	return (scb->platform_data->xfer_len);
5801da177e4SLinus Torvalds }
5811da177e4SLinus Torvalds 
5821beb6fa8SHarvey Harrison static inline
ahc_get_transfer_dir(struct scb * scb)5831da177e4SLinus Torvalds int ahc_get_transfer_dir(struct scb *scb)
5841da177e4SLinus Torvalds {
5851da177e4SLinus Torvalds 	return (scb->io_ctx->sc_data_direction);
5861da177e4SLinus Torvalds }
5871da177e4SLinus Torvalds 
5881beb6fa8SHarvey Harrison static inline
ahc_set_residual(struct scb * scb,u_long resid)5891da177e4SLinus Torvalds void ahc_set_residual(struct scb *scb, u_long resid)
5901da177e4SLinus Torvalds {
5913a57c4a5SFUJITA Tomonori 	scsi_set_resid(scb->io_ctx, resid);
5921da177e4SLinus Torvalds }
5931da177e4SLinus Torvalds 
5941beb6fa8SHarvey Harrison static inline
ahc_set_sense_residual(struct scb * scb,u_long resid)5951da177e4SLinus Torvalds void ahc_set_sense_residual(struct scb *scb, u_long resid)
5961da177e4SLinus Torvalds {
5971da177e4SLinus Torvalds 	scb->platform_data->sense_resid = resid;
5981da177e4SLinus Torvalds }
5991da177e4SLinus Torvalds 
6001beb6fa8SHarvey Harrison static inline
ahc_get_residual(struct scb * scb)6011da177e4SLinus Torvalds u_long ahc_get_residual(struct scb *scb)
6021da177e4SLinus Torvalds {
6033a57c4a5SFUJITA Tomonori 	return scsi_get_resid(scb->io_ctx);
6041da177e4SLinus Torvalds }
6051da177e4SLinus Torvalds 
6061beb6fa8SHarvey Harrison static inline
ahc_get_sense_residual(struct scb * scb)6071da177e4SLinus Torvalds u_long ahc_get_sense_residual(struct scb *scb)
6081da177e4SLinus Torvalds {
6091da177e4SLinus Torvalds 	return (scb->platform_data->sense_resid);
6101da177e4SLinus Torvalds }
6111da177e4SLinus Torvalds 
6121beb6fa8SHarvey Harrison static inline
ahc_perform_autosense(struct scb * scb)6131da177e4SLinus Torvalds int ahc_perform_autosense(struct scb *scb)
6141da177e4SLinus Torvalds {
6151da177e4SLinus Torvalds 	/*
6161da177e4SLinus Torvalds 	 * We always perform autosense in Linux.
6171da177e4SLinus Torvalds 	 * On other platforms this is set on a
6181da177e4SLinus Torvalds 	 * per-transaction basis.
6191da177e4SLinus Torvalds 	 */
6201da177e4SLinus Torvalds 	return (1);
6211da177e4SLinus Torvalds }
6221da177e4SLinus Torvalds 
6231beb6fa8SHarvey Harrison static inline uint32_t
ahc_get_sense_bufsize(struct ahc_softc * ahc,struct scb * scb)6241da177e4SLinus Torvalds ahc_get_sense_bufsize(struct ahc_softc *ahc, struct scb *scb)
6251da177e4SLinus Torvalds {
6261da177e4SLinus Torvalds 	return (sizeof(struct scsi_sense_data));
6271da177e4SLinus Torvalds }
6281da177e4SLinus Torvalds 
6291beb6fa8SHarvey Harrison static inline void
ahc_notify_xfer_settings_change(struct ahc_softc * ahc,struct ahc_devinfo * devinfo)6301da177e4SLinus Torvalds ahc_notify_xfer_settings_change(struct ahc_softc *ahc,
6311da177e4SLinus Torvalds 				struct ahc_devinfo *devinfo)
6321da177e4SLinus Torvalds {
6331da177e4SLinus Torvalds 	/* Nothing to do here for linux */
6341da177e4SLinus Torvalds }
6351da177e4SLinus Torvalds 
6361beb6fa8SHarvey Harrison static inline void
ahc_platform_scb_free(struct ahc_softc * ahc,struct scb * scb)6371da177e4SLinus Torvalds ahc_platform_scb_free(struct ahc_softc *ahc, struct scb *scb)
6381da177e4SLinus Torvalds {
6391da177e4SLinus Torvalds }
6401da177e4SLinus Torvalds 
6411da177e4SLinus Torvalds int	ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg);
6421da177e4SLinus Torvalds void	ahc_platform_free(struct ahc_softc *ahc);
6431da177e4SLinus Torvalds void	ahc_platform_freeze_devq(struct ahc_softc *ahc, struct scb *scb);
6441da177e4SLinus Torvalds 
6451beb6fa8SHarvey Harrison static inline void
ahc_freeze_scb(struct scb * scb)6461da177e4SLinus Torvalds ahc_freeze_scb(struct scb *scb)
6471da177e4SLinus Torvalds {
6481da177e4SLinus Torvalds 	if ((scb->io_ctx->result & (CAM_DEV_QFRZN << 16)) == 0) {
6491da177e4SLinus Torvalds 		scb->io_ctx->result |= CAM_DEV_QFRZN << 16;
6501da177e4SLinus Torvalds 		scb->platform_data->dev->qfrozen++;
6511da177e4SLinus Torvalds 	}
6521da177e4SLinus Torvalds }
6531da177e4SLinus Torvalds 
6549080063fSHannes Reinecke void	ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
6551da177e4SLinus Torvalds 			      struct ahc_devinfo *devinfo, ahc_queue_alg);
6561da177e4SLinus Torvalds int	ahc_platform_abort_scbs(struct ahc_softc *ahc, int target,
6571da177e4SLinus Torvalds 				char channel, int lun, u_int tag,
6581da177e4SLinus Torvalds 				role_t role, uint32_t status);
6591da177e4SLinus Torvalds irqreturn_t
6607d12e780SDavid Howells 	ahc_linux_isr(int irq, void *dev_id);
6611da177e4SLinus Torvalds void	ahc_platform_flushwork(struct ahc_softc *ahc);
6621da177e4SLinus Torvalds void	ahc_done(struct ahc_softc*, struct scb*);
6631da177e4SLinus Torvalds void	ahc_send_async(struct ahc_softc *, char channel,
6649080063fSHannes Reinecke 		       u_int target, u_int lun, ac_code);
6651da177e4SLinus Torvalds void	ahc_print_path(struct ahc_softc *, struct scb *);
6661da177e4SLinus Torvalds 
6671da177e4SLinus Torvalds #ifdef CONFIG_PCI
6681da177e4SLinus Torvalds #define AHC_PCI_CONFIG 1
6691da177e4SLinus Torvalds #else
6701da177e4SLinus Torvalds #define AHC_PCI_CONFIG 0
6711da177e4SLinus Torvalds #endif
6721da177e4SLinus Torvalds #define bootverbose aic7xxx_verbose
6731da177e4SLinus Torvalds extern u_int aic7xxx_verbose;
6741da177e4SLinus Torvalds #endif /* _AIC7XXX_LINUX_H_ */
675