xref: /OK3568_Linux_fs/kernel/drivers/scsi/aic7xxx/aic79xx_osm.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Adaptec AIC79xx device driver for Linux.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (c) 2000-2001 Adaptec Inc.
5*4882a593Smuzhiyun  * All rights reserved.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Redistribution and use in source and binary forms, with or without
8*4882a593Smuzhiyun  * modification, are permitted provided that the following conditions
9*4882a593Smuzhiyun  * are met:
10*4882a593Smuzhiyun  * 1. Redistributions of source code must retain the above copyright
11*4882a593Smuzhiyun  *    notice, this list of conditions, and the following disclaimer,
12*4882a593Smuzhiyun  *    without modification.
13*4882a593Smuzhiyun  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14*4882a593Smuzhiyun  *    substantially similar to the "NO WARRANTY" disclaimer below
15*4882a593Smuzhiyun  *    ("Disclaimer") and any redistribution must be conditioned upon
16*4882a593Smuzhiyun  *    including a substantially similar Disclaimer requirement for further
17*4882a593Smuzhiyun  *    binary redistribution.
18*4882a593Smuzhiyun  * 3. Neither the names of the above-listed copyright holders nor the names
19*4882a593Smuzhiyun  *    of any contributors may be used to endorse or promote products derived
20*4882a593Smuzhiyun  *    from this software without specific prior written permission.
21*4882a593Smuzhiyun  *
22*4882a593Smuzhiyun  * Alternatively, this software may be distributed under the terms of the
23*4882a593Smuzhiyun  * GNU General Public License ("GPL") version 2 as published by the Free
24*4882a593Smuzhiyun  * Software Foundation.
25*4882a593Smuzhiyun  *
26*4882a593Smuzhiyun  * NO WARRANTY
27*4882a593Smuzhiyun  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28*4882a593Smuzhiyun  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29*4882a593Smuzhiyun  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
30*4882a593Smuzhiyun  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31*4882a593Smuzhiyun  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32*4882a593Smuzhiyun  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33*4882a593Smuzhiyun  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34*4882a593Smuzhiyun  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35*4882a593Smuzhiyun  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
36*4882a593Smuzhiyun  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37*4882a593Smuzhiyun  * POSSIBILITY OF SUCH DAMAGES.
38*4882a593Smuzhiyun  *
39*4882a593Smuzhiyun  * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#166 $
40*4882a593Smuzhiyun  *
41*4882a593Smuzhiyun  */
42*4882a593Smuzhiyun #ifndef _AIC79XX_LINUX_H_
43*4882a593Smuzhiyun #define _AIC79XX_LINUX_H_
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #include <linux/types.h>
46*4882a593Smuzhiyun #include <linux/blkdev.h>
47*4882a593Smuzhiyun #include <linux/delay.h>
48*4882a593Smuzhiyun #include <linux/ioport.h>
49*4882a593Smuzhiyun #include <linux/pci.h>
50*4882a593Smuzhiyun #include <linux/interrupt.h>
51*4882a593Smuzhiyun #include <linux/module.h>
52*4882a593Smuzhiyun #include <linux/slab.h>
53*4882a593Smuzhiyun #include <asm/byteorder.h>
54*4882a593Smuzhiyun #include <asm/io.h>
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun #include <scsi/scsi.h>
57*4882a593Smuzhiyun #include <scsi/scsi_cmnd.h>
58*4882a593Smuzhiyun #include <scsi/scsi_eh.h>
59*4882a593Smuzhiyun #include <scsi/scsi_device.h>
60*4882a593Smuzhiyun #include <scsi/scsi_host.h>
61*4882a593Smuzhiyun #include <scsi/scsi_tcq.h>
62*4882a593Smuzhiyun #include <scsi/scsi_transport.h>
63*4882a593Smuzhiyun #include <scsi/scsi_transport_spi.h>
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun /* Core SCSI definitions */
66*4882a593Smuzhiyun #define AIC_LIB_PREFIX ahd
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun #include "cam.h"
69*4882a593Smuzhiyun #include "queue.h"
70*4882a593Smuzhiyun #include "scsi_message.h"
71*4882a593Smuzhiyun #include "scsi_iu.h"
72*4882a593Smuzhiyun #include "aiclib.h"
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun /*********************************** Debugging ********************************/
75*4882a593Smuzhiyun #ifdef CONFIG_AIC79XX_DEBUG_ENABLE
76*4882a593Smuzhiyun #ifdef CONFIG_AIC79XX_DEBUG_MASK
77*4882a593Smuzhiyun #define AHD_DEBUG 1
78*4882a593Smuzhiyun #define AHD_DEBUG_OPTS CONFIG_AIC79XX_DEBUG_MASK
79*4882a593Smuzhiyun #else
80*4882a593Smuzhiyun /*
81*4882a593Smuzhiyun  * Compile in debugging code, but do not enable any printfs.
82*4882a593Smuzhiyun  */
83*4882a593Smuzhiyun #define AHD_DEBUG 1
84*4882a593Smuzhiyun #define AHD_DEBUG_OPTS 0
85*4882a593Smuzhiyun #endif
86*4882a593Smuzhiyun /* No debugging code. */
87*4882a593Smuzhiyun #endif
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun /********************************** Misc Macros *******************************/
90*4882a593Smuzhiyun #define	powerof2(x)	((((x)-1)&(x))==0)
91*4882a593Smuzhiyun 
92*4882a593Smuzhiyun /************************* Forward Declarations *******************************/
93*4882a593Smuzhiyun struct ahd_softc;
94*4882a593Smuzhiyun typedef struct pci_dev *ahd_dev_softc_t;
95*4882a593Smuzhiyun typedef struct scsi_cmnd      *ahd_io_ctx_t;
96*4882a593Smuzhiyun 
97*4882a593Smuzhiyun /******************************* Byte Order ***********************************/
98*4882a593Smuzhiyun #define ahd_htobe16(x)	cpu_to_be16(x)
99*4882a593Smuzhiyun #define ahd_htobe32(x)	cpu_to_be32(x)
100*4882a593Smuzhiyun #define ahd_htobe64(x)	cpu_to_be64(x)
101*4882a593Smuzhiyun #define ahd_htole16(x)	cpu_to_le16(x)
102*4882a593Smuzhiyun #define ahd_htole32(x)	cpu_to_le32(x)
103*4882a593Smuzhiyun #define ahd_htole64(x)	cpu_to_le64(x)
104*4882a593Smuzhiyun 
105*4882a593Smuzhiyun #define ahd_be16toh(x)	be16_to_cpu(x)
106*4882a593Smuzhiyun #define ahd_be32toh(x)	be32_to_cpu(x)
107*4882a593Smuzhiyun #define ahd_be64toh(x)	be64_to_cpu(x)
108*4882a593Smuzhiyun #define ahd_le16toh(x)	le16_to_cpu(x)
109*4882a593Smuzhiyun #define ahd_le32toh(x)	le32_to_cpu(x)
110*4882a593Smuzhiyun #define ahd_le64toh(x)	le64_to_cpu(x)
111*4882a593Smuzhiyun 
112*4882a593Smuzhiyun /************************* Configuration Data *********************************/
113*4882a593Smuzhiyun extern uint32_t aic79xx_allow_memio;
114*4882a593Smuzhiyun extern struct scsi_host_template aic79xx_driver_template;
115*4882a593Smuzhiyun 
116*4882a593Smuzhiyun /***************************** Bus Space/DMA **********************************/
117*4882a593Smuzhiyun 
118*4882a593Smuzhiyun typedef uint32_t bus_size_t;
119*4882a593Smuzhiyun 
120*4882a593Smuzhiyun typedef enum {
121*4882a593Smuzhiyun 	BUS_SPACE_MEMIO,
122*4882a593Smuzhiyun 	BUS_SPACE_PIO
123*4882a593Smuzhiyun } bus_space_tag_t;
124*4882a593Smuzhiyun 
125*4882a593Smuzhiyun typedef union {
126*4882a593Smuzhiyun 	u_long		  ioport;
127*4882a593Smuzhiyun 	volatile uint8_t __iomem *maddr;
128*4882a593Smuzhiyun } bus_space_handle_t;
129*4882a593Smuzhiyun 
130*4882a593Smuzhiyun typedef struct bus_dma_segment
131*4882a593Smuzhiyun {
132*4882a593Smuzhiyun 	dma_addr_t	ds_addr;
133*4882a593Smuzhiyun 	bus_size_t	ds_len;
134*4882a593Smuzhiyun } bus_dma_segment_t;
135*4882a593Smuzhiyun 
136*4882a593Smuzhiyun struct ahd_linux_dma_tag
137*4882a593Smuzhiyun {
138*4882a593Smuzhiyun 	bus_size_t	alignment;
139*4882a593Smuzhiyun 	bus_size_t	boundary;
140*4882a593Smuzhiyun 	bus_size_t	maxsize;
141*4882a593Smuzhiyun };
142*4882a593Smuzhiyun typedef struct ahd_linux_dma_tag* bus_dma_tag_t;
143*4882a593Smuzhiyun 
144*4882a593Smuzhiyun typedef dma_addr_t bus_dmamap_t;
145*4882a593Smuzhiyun 
146*4882a593Smuzhiyun typedef int bus_dma_filter_t(void*, dma_addr_t);
147*4882a593Smuzhiyun typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int);
148*4882a593Smuzhiyun 
149*4882a593Smuzhiyun #define BUS_DMA_WAITOK		0x0
150*4882a593Smuzhiyun #define BUS_DMA_NOWAIT		0x1
151*4882a593Smuzhiyun #define BUS_DMA_ALLOCNOW	0x2
152*4882a593Smuzhiyun #define BUS_DMA_LOAD_SEGS	0x4	/*
153*4882a593Smuzhiyun 					 * Argument is an S/G list not
154*4882a593Smuzhiyun 					 * a single buffer.
155*4882a593Smuzhiyun 					 */
156*4882a593Smuzhiyun 
157*4882a593Smuzhiyun #define BUS_SPACE_MAXADDR	0xFFFFFFFF
158*4882a593Smuzhiyun #define BUS_SPACE_MAXADDR_32BIT	0xFFFFFFFF
159*4882a593Smuzhiyun #define BUS_SPACE_MAXSIZE_32BIT	0xFFFFFFFF
160*4882a593Smuzhiyun 
161*4882a593Smuzhiyun int	ahd_dma_tag_create(struct ahd_softc *, bus_dma_tag_t /*parent*/,
162*4882a593Smuzhiyun 			   bus_size_t /*alignment*/, bus_size_t /*boundary*/,
163*4882a593Smuzhiyun 			   dma_addr_t /*lowaddr*/, dma_addr_t /*highaddr*/,
164*4882a593Smuzhiyun 			   bus_dma_filter_t*/*filter*/, void */*filterarg*/,
165*4882a593Smuzhiyun 			   bus_size_t /*maxsize*/, int /*nsegments*/,
166*4882a593Smuzhiyun 			   bus_size_t /*maxsegsz*/, int /*flags*/,
167*4882a593Smuzhiyun 			   bus_dma_tag_t */*dma_tagp*/);
168*4882a593Smuzhiyun 
169*4882a593Smuzhiyun void	ahd_dma_tag_destroy(struct ahd_softc *, bus_dma_tag_t /*tag*/);
170*4882a593Smuzhiyun 
171*4882a593Smuzhiyun int	ahd_dmamem_alloc(struct ahd_softc *, bus_dma_tag_t /*dmat*/,
172*4882a593Smuzhiyun 			 void** /*vaddr*/, int /*flags*/,
173*4882a593Smuzhiyun 			 bus_dmamap_t* /*mapp*/);
174*4882a593Smuzhiyun 
175*4882a593Smuzhiyun void	ahd_dmamem_free(struct ahd_softc *, bus_dma_tag_t /*dmat*/,
176*4882a593Smuzhiyun 			void* /*vaddr*/, bus_dmamap_t /*map*/);
177*4882a593Smuzhiyun 
178*4882a593Smuzhiyun void	ahd_dmamap_destroy(struct ahd_softc *, bus_dma_tag_t /*tag*/,
179*4882a593Smuzhiyun 			   bus_dmamap_t /*map*/);
180*4882a593Smuzhiyun 
181*4882a593Smuzhiyun int	ahd_dmamap_load(struct ahd_softc *ahd, bus_dma_tag_t /*dmat*/,
182*4882a593Smuzhiyun 			bus_dmamap_t /*map*/, void * /*buf*/,
183*4882a593Smuzhiyun 			bus_size_t /*buflen*/, bus_dmamap_callback_t *,
184*4882a593Smuzhiyun 			void */*callback_arg*/, int /*flags*/);
185*4882a593Smuzhiyun 
186*4882a593Smuzhiyun int	ahd_dmamap_unload(struct ahd_softc *, bus_dma_tag_t, bus_dmamap_t);
187*4882a593Smuzhiyun 
188*4882a593Smuzhiyun /*
189*4882a593Smuzhiyun  * Operations performed by ahd_dmamap_sync().
190*4882a593Smuzhiyun  */
191*4882a593Smuzhiyun #define BUS_DMASYNC_PREREAD	0x01	/* pre-read synchronization */
192*4882a593Smuzhiyun #define BUS_DMASYNC_POSTREAD	0x02	/* post-read synchronization */
193*4882a593Smuzhiyun #define BUS_DMASYNC_PREWRITE	0x04	/* pre-write synchronization */
194*4882a593Smuzhiyun #define BUS_DMASYNC_POSTWRITE	0x08	/* post-write synchronization */
195*4882a593Smuzhiyun 
196*4882a593Smuzhiyun /*
197*4882a593Smuzhiyun  * XXX
198*4882a593Smuzhiyun  * ahd_dmamap_sync is only used on buffers allocated with
199*4882a593Smuzhiyun  * the pci_alloc_consistent() API.  Although I'm not sure how
200*4882a593Smuzhiyun  * this works on architectures with a write buffer, Linux does
201*4882a593Smuzhiyun  * not have an API to sync "coherent" memory.  Perhaps we need
202*4882a593Smuzhiyun  * to do an mb()?
203*4882a593Smuzhiyun  */
204*4882a593Smuzhiyun #define ahd_dmamap_sync(ahd, dma_tag, dmamap, offset, len, op)
205*4882a593Smuzhiyun 
206*4882a593Smuzhiyun /********************************** Includes **********************************/
207*4882a593Smuzhiyun #ifdef CONFIG_AIC79XX_REG_PRETTY_PRINT
208*4882a593Smuzhiyun #define AIC_DEBUG_REGISTERS 1
209*4882a593Smuzhiyun #else
210*4882a593Smuzhiyun #define AIC_DEBUG_REGISTERS 0
211*4882a593Smuzhiyun #endif
212*4882a593Smuzhiyun #include "aic79xx.h"
213*4882a593Smuzhiyun 
214*4882a593Smuzhiyun /***************************** SMP support ************************************/
215*4882a593Smuzhiyun #include <linux/spinlock.h>
216*4882a593Smuzhiyun 
217*4882a593Smuzhiyun #define AIC79XX_DRIVER_VERSION "3.0"
218*4882a593Smuzhiyun 
219*4882a593Smuzhiyun /*************************** Device Data Structures ***************************/
220*4882a593Smuzhiyun /*
221*4882a593Smuzhiyun  * A per probed device structure used to deal with some error recovery
222*4882a593Smuzhiyun  * scenarios that the Linux mid-layer code just doesn't know how to
223*4882a593Smuzhiyun  * handle.  The structure allocated for a device only becomes persistent
224*4882a593Smuzhiyun  * after a successfully completed inquiry command to the target when
225*4882a593Smuzhiyun  * that inquiry data indicates a lun is present.
226*4882a593Smuzhiyun  */
227*4882a593Smuzhiyun 
228*4882a593Smuzhiyun typedef enum {
229*4882a593Smuzhiyun 	AHD_DEV_FREEZE_TIL_EMPTY = 0x02, /* Freeze queue until active == 0 */
230*4882a593Smuzhiyun 	AHD_DEV_Q_BASIC		 = 0x10, /* Allow basic device queuing */
231*4882a593Smuzhiyun 	AHD_DEV_Q_TAGGED	 = 0x20, /* Allow full SCSI2 command queueing */
232*4882a593Smuzhiyun 	AHD_DEV_PERIODIC_OTAG	 = 0x40, /* Send OTAG to prevent starvation */
233*4882a593Smuzhiyun } ahd_linux_dev_flags;
234*4882a593Smuzhiyun 
235*4882a593Smuzhiyun struct ahd_linux_device {
236*4882a593Smuzhiyun 	TAILQ_ENTRY(ahd_linux_device) links;
237*4882a593Smuzhiyun 
238*4882a593Smuzhiyun 	/*
239*4882a593Smuzhiyun 	 * The number of transactions currently
240*4882a593Smuzhiyun 	 * queued to the device.
241*4882a593Smuzhiyun 	 */
242*4882a593Smuzhiyun 	int			active;
243*4882a593Smuzhiyun 
244*4882a593Smuzhiyun 	/*
245*4882a593Smuzhiyun 	 * The currently allowed number of
246*4882a593Smuzhiyun 	 * transactions that can be queued to
247*4882a593Smuzhiyun 	 * the device.  Must be signed for
248*4882a593Smuzhiyun 	 * conversion from tagged to untagged
249*4882a593Smuzhiyun 	 * mode where the device may have more
250*4882a593Smuzhiyun 	 * than one outstanding active transaction.
251*4882a593Smuzhiyun 	 */
252*4882a593Smuzhiyun 	int			openings;
253*4882a593Smuzhiyun 
254*4882a593Smuzhiyun 	/*
255*4882a593Smuzhiyun 	 * A positive count indicates that this
256*4882a593Smuzhiyun 	 * device's queue is halted.
257*4882a593Smuzhiyun 	 */
258*4882a593Smuzhiyun 	u_int			qfrozen;
259*4882a593Smuzhiyun 
260*4882a593Smuzhiyun 	/*
261*4882a593Smuzhiyun 	 * Cumulative command counter.
262*4882a593Smuzhiyun 	 */
263*4882a593Smuzhiyun 	u_long			commands_issued;
264*4882a593Smuzhiyun 
265*4882a593Smuzhiyun 	/*
266*4882a593Smuzhiyun 	 * The number of tagged transactions when
267*4882a593Smuzhiyun 	 * running at our current opening level
268*4882a593Smuzhiyun 	 * that have been successfully received by
269*4882a593Smuzhiyun 	 * this device since the last QUEUE FULL.
270*4882a593Smuzhiyun 	 */
271*4882a593Smuzhiyun 	u_int			tag_success_count;
272*4882a593Smuzhiyun #define AHD_TAG_SUCCESS_INTERVAL 50
273*4882a593Smuzhiyun 
274*4882a593Smuzhiyun 	ahd_linux_dev_flags	flags;
275*4882a593Smuzhiyun 
276*4882a593Smuzhiyun 	/*
277*4882a593Smuzhiyun 	 * Per device timer.
278*4882a593Smuzhiyun 	 */
279*4882a593Smuzhiyun 	struct timer_list	timer;
280*4882a593Smuzhiyun 
281*4882a593Smuzhiyun 	/*
282*4882a593Smuzhiyun 	 * The high limit for the tags variable.
283*4882a593Smuzhiyun 	 */
284*4882a593Smuzhiyun 	u_int			maxtags;
285*4882a593Smuzhiyun 
286*4882a593Smuzhiyun 	/*
287*4882a593Smuzhiyun 	 * The computed number of tags outstanding
288*4882a593Smuzhiyun 	 * at the time of the last QUEUE FULL event.
289*4882a593Smuzhiyun 	 */
290*4882a593Smuzhiyun 	u_int			tags_on_last_queuefull;
291*4882a593Smuzhiyun 
292*4882a593Smuzhiyun 	/*
293*4882a593Smuzhiyun 	 * How many times we have seen a queue full
294*4882a593Smuzhiyun 	 * with the same number of tags.  This is used
295*4882a593Smuzhiyun 	 * to stop our adaptive queue depth algorithm
296*4882a593Smuzhiyun 	 * on devices with a fixed number of tags.
297*4882a593Smuzhiyun 	 */
298*4882a593Smuzhiyun 	u_int			last_queuefull_same_count;
299*4882a593Smuzhiyun #define AHD_LOCK_TAGS_COUNT 50
300*4882a593Smuzhiyun 
301*4882a593Smuzhiyun 	/*
302*4882a593Smuzhiyun 	 * How many transactions have been queued
303*4882a593Smuzhiyun 	 * without the device going idle.  We use
304*4882a593Smuzhiyun 	 * this statistic to determine when to issue
305*4882a593Smuzhiyun 	 * an ordered tag to prevent transaction
306*4882a593Smuzhiyun 	 * starvation.  This statistic is only updated
307*4882a593Smuzhiyun 	 * if the AHD_DEV_PERIODIC_OTAG flag is set
308*4882a593Smuzhiyun 	 * on this device.
309*4882a593Smuzhiyun 	 */
310*4882a593Smuzhiyun 	u_int			commands_since_idle_or_otag;
311*4882a593Smuzhiyun #define AHD_OTAG_THRESH	500
312*4882a593Smuzhiyun };
313*4882a593Smuzhiyun 
314*4882a593Smuzhiyun /********************* Definitions Required by the Core ***********************/
315*4882a593Smuzhiyun /*
316*4882a593Smuzhiyun  * Number of SG segments we require.  So long as the S/G segments for
317*4882a593Smuzhiyun  * a particular transaction are allocated in a physically contiguous
318*4882a593Smuzhiyun  * manner and are allocated below 4GB, the number of S/G segments is
319*4882a593Smuzhiyun  * unrestricted.
320*4882a593Smuzhiyun  */
321*4882a593Smuzhiyun #define	AHD_NSEG 128
322*4882a593Smuzhiyun 
323*4882a593Smuzhiyun /*
324*4882a593Smuzhiyun  * Per-SCB OSM storage.
325*4882a593Smuzhiyun  */
326*4882a593Smuzhiyun struct scb_platform_data {
327*4882a593Smuzhiyun 	struct ahd_linux_device	*dev;
328*4882a593Smuzhiyun 	dma_addr_t		 buf_busaddr;
329*4882a593Smuzhiyun 	uint32_t		 xfer_len;
330*4882a593Smuzhiyun 	uint32_t		 sense_resid;	/* Auto-Sense residual */
331*4882a593Smuzhiyun };
332*4882a593Smuzhiyun 
333*4882a593Smuzhiyun /*
334*4882a593Smuzhiyun  * Define a structure used for each host adapter.  All members are
335*4882a593Smuzhiyun  * aligned on a boundary >= the size of the member to honor the
336*4882a593Smuzhiyun  * alignment restrictions of the various platforms supported by
337*4882a593Smuzhiyun  * this driver.
338*4882a593Smuzhiyun  */
339*4882a593Smuzhiyun struct ahd_platform_data {
340*4882a593Smuzhiyun 	/*
341*4882a593Smuzhiyun 	 * Fields accessed from interrupt context.
342*4882a593Smuzhiyun 	 */
343*4882a593Smuzhiyun 	struct scsi_target *starget[AHD_NUM_TARGETS];
344*4882a593Smuzhiyun 
345*4882a593Smuzhiyun 	spinlock_t		 spin_lock;
346*4882a593Smuzhiyun 	struct completion	*eh_done;
347*4882a593Smuzhiyun 	struct Scsi_Host        *host;		/* pointer to scsi host */
348*4882a593Smuzhiyun #define AHD_LINUX_NOIRQ	((uint32_t)~0)
349*4882a593Smuzhiyun 	uint32_t		 irq;		/* IRQ for this adapter */
350*4882a593Smuzhiyun 	uint32_t		 bios_address;
351*4882a593Smuzhiyun 	resource_size_t		 mem_busaddr;	/* Mem Base Addr */
352*4882a593Smuzhiyun };
353*4882a593Smuzhiyun 
354*4882a593Smuzhiyun void ahd_delay(long);
355*4882a593Smuzhiyun 
356*4882a593Smuzhiyun /***************************** Low Level I/O **********************************/
357*4882a593Smuzhiyun uint8_t ahd_inb(struct ahd_softc * ahd, long port);
358*4882a593Smuzhiyun void ahd_outb(struct ahd_softc * ahd, long port, uint8_t val);
359*4882a593Smuzhiyun void ahd_outw_atomic(struct ahd_softc * ahd,
360*4882a593Smuzhiyun 				     long port, uint16_t val);
361*4882a593Smuzhiyun void ahd_outsb(struct ahd_softc * ahd, long port,
362*4882a593Smuzhiyun 			       uint8_t *, int count);
363*4882a593Smuzhiyun void ahd_insb(struct ahd_softc * ahd, long port,
364*4882a593Smuzhiyun 			       uint8_t *, int count);
365*4882a593Smuzhiyun 
366*4882a593Smuzhiyun /**************************** Initialization **********************************/
367*4882a593Smuzhiyun int		ahd_linux_register_host(struct ahd_softc *,
368*4882a593Smuzhiyun 					struct scsi_host_template *);
369*4882a593Smuzhiyun 
370*4882a593Smuzhiyun /******************************** Locking *************************************/
371*4882a593Smuzhiyun static inline void
ahd_lockinit(struct ahd_softc * ahd)372*4882a593Smuzhiyun ahd_lockinit(struct ahd_softc *ahd)
373*4882a593Smuzhiyun {
374*4882a593Smuzhiyun 	spin_lock_init(&ahd->platform_data->spin_lock);
375*4882a593Smuzhiyun }
376*4882a593Smuzhiyun 
377*4882a593Smuzhiyun static inline void
ahd_lock(struct ahd_softc * ahd,unsigned long * flags)378*4882a593Smuzhiyun ahd_lock(struct ahd_softc *ahd, unsigned long *flags)
379*4882a593Smuzhiyun {
380*4882a593Smuzhiyun 	spin_lock_irqsave(&ahd->platform_data->spin_lock, *flags);
381*4882a593Smuzhiyun }
382*4882a593Smuzhiyun 
383*4882a593Smuzhiyun static inline void
ahd_unlock(struct ahd_softc * ahd,unsigned long * flags)384*4882a593Smuzhiyun ahd_unlock(struct ahd_softc *ahd, unsigned long *flags)
385*4882a593Smuzhiyun {
386*4882a593Smuzhiyun 	spin_unlock_irqrestore(&ahd->platform_data->spin_lock, *flags);
387*4882a593Smuzhiyun }
388*4882a593Smuzhiyun 
389*4882a593Smuzhiyun /******************************* PCI Definitions ******************************/
390*4882a593Smuzhiyun /*
391*4882a593Smuzhiyun  * PCIM_xxx: mask to locate subfield in register
392*4882a593Smuzhiyun  * PCIR_xxx: config register offset
393*4882a593Smuzhiyun  * PCIC_xxx: device class
394*4882a593Smuzhiyun  * PCIS_xxx: device subclass
395*4882a593Smuzhiyun  * PCIP_xxx: device programming interface
396*4882a593Smuzhiyun  * PCIV_xxx: PCI vendor ID (only required to fixup ancient devices)
397*4882a593Smuzhiyun  * PCID_xxx: device ID
398*4882a593Smuzhiyun  */
399*4882a593Smuzhiyun #define PCIR_DEVVENDOR		0x00
400*4882a593Smuzhiyun #define PCIR_VENDOR		0x00
401*4882a593Smuzhiyun #define PCIR_DEVICE		0x02
402*4882a593Smuzhiyun #define PCIR_COMMAND		0x04
403*4882a593Smuzhiyun #define PCIM_CMD_PORTEN		0x0001
404*4882a593Smuzhiyun #define PCIM_CMD_MEMEN		0x0002
405*4882a593Smuzhiyun #define PCIM_CMD_BUSMASTEREN	0x0004
406*4882a593Smuzhiyun #define PCIM_CMD_MWRICEN	0x0010
407*4882a593Smuzhiyun #define PCIM_CMD_PERRESPEN	0x0040
408*4882a593Smuzhiyun #define	PCIM_CMD_SERRESPEN	0x0100
409*4882a593Smuzhiyun #define PCIR_STATUS		0x06
410*4882a593Smuzhiyun #define PCIR_REVID		0x08
411*4882a593Smuzhiyun #define PCIR_PROGIF		0x09
412*4882a593Smuzhiyun #define PCIR_SUBCLASS		0x0a
413*4882a593Smuzhiyun #define PCIR_CLASS		0x0b
414*4882a593Smuzhiyun #define PCIR_CACHELNSZ		0x0c
415*4882a593Smuzhiyun #define PCIR_LATTIMER		0x0d
416*4882a593Smuzhiyun #define PCIR_HEADERTYPE		0x0e
417*4882a593Smuzhiyun #define PCIM_MFDEV		0x80
418*4882a593Smuzhiyun #define PCIR_BIST		0x0f
419*4882a593Smuzhiyun #define PCIR_CAP_PTR		0x34
420*4882a593Smuzhiyun 
421*4882a593Smuzhiyun /* config registers for header type 0 devices */
422*4882a593Smuzhiyun #define PCIR_MAPS	0x10
423*4882a593Smuzhiyun #define PCIR_SUBVEND_0	0x2c
424*4882a593Smuzhiyun #define PCIR_SUBDEV_0	0x2e
425*4882a593Smuzhiyun 
426*4882a593Smuzhiyun /****************************** PCI-X definitions *****************************/
427*4882a593Smuzhiyun #define PCIXR_COMMAND	0x96
428*4882a593Smuzhiyun #define PCIXR_DEVADDR	0x98
429*4882a593Smuzhiyun #define PCIXM_DEVADDR_FNUM	0x0003	/* Function Number */
430*4882a593Smuzhiyun #define PCIXM_DEVADDR_DNUM	0x00F8	/* Device Number */
431*4882a593Smuzhiyun #define PCIXM_DEVADDR_BNUM	0xFF00	/* Bus Number */
432*4882a593Smuzhiyun #define PCIXR_STATUS	0x9A
433*4882a593Smuzhiyun #define PCIXM_STATUS_64BIT	0x0001	/* Active 64bit connection to device. */
434*4882a593Smuzhiyun #define PCIXM_STATUS_133CAP	0x0002	/* Device is 133MHz capable */
435*4882a593Smuzhiyun #define PCIXM_STATUS_SCDISC	0x0004	/* Split Completion Discarded */
436*4882a593Smuzhiyun #define PCIXM_STATUS_UNEXPSC	0x0008	/* Unexpected Split Completion */
437*4882a593Smuzhiyun #define PCIXM_STATUS_CMPLEXDEV	0x0010	/* Device Complexity (set == bridge) */
438*4882a593Smuzhiyun #define PCIXM_STATUS_MAXMRDBC	0x0060	/* Maximum Burst Read Count */
439*4882a593Smuzhiyun #define PCIXM_STATUS_MAXSPLITS	0x0380	/* Maximum Split Transactions */
440*4882a593Smuzhiyun #define PCIXM_STATUS_MAXCRDS	0x1C00	/* Maximum Cumulative Read Size */
441*4882a593Smuzhiyun #define PCIXM_STATUS_RCVDSCEM	0x2000	/* Received a Split Comp w/Error msg */
442*4882a593Smuzhiyun 
443*4882a593Smuzhiyun typedef enum
444*4882a593Smuzhiyun {
445*4882a593Smuzhiyun 	AHD_POWER_STATE_D0,
446*4882a593Smuzhiyun 	AHD_POWER_STATE_D1,
447*4882a593Smuzhiyun 	AHD_POWER_STATE_D2,
448*4882a593Smuzhiyun 	AHD_POWER_STATE_D3
449*4882a593Smuzhiyun } ahd_power_state;
450*4882a593Smuzhiyun 
451*4882a593Smuzhiyun void ahd_power_state_change(struct ahd_softc *ahd,
452*4882a593Smuzhiyun 			    ahd_power_state new_state);
453*4882a593Smuzhiyun 
454*4882a593Smuzhiyun /******************************* PCI Routines *********************************/
455*4882a593Smuzhiyun int			 ahd_linux_pci_init(void);
456*4882a593Smuzhiyun void			 ahd_linux_pci_exit(void);
457*4882a593Smuzhiyun int			 ahd_pci_map_registers(struct ahd_softc *ahd);
458*4882a593Smuzhiyun int			 ahd_pci_map_int(struct ahd_softc *ahd);
459*4882a593Smuzhiyun 
460*4882a593Smuzhiyun uint32_t		 ahd_pci_read_config(ahd_dev_softc_t pci,
461*4882a593Smuzhiyun 					     int reg, int width);
462*4882a593Smuzhiyun void			 ahd_pci_write_config(ahd_dev_softc_t pci,
463*4882a593Smuzhiyun 					  int reg, uint32_t value,
464*4882a593Smuzhiyun 					  int width);
465*4882a593Smuzhiyun 
466*4882a593Smuzhiyun static inline int ahd_get_pci_function(ahd_dev_softc_t);
467*4882a593Smuzhiyun static inline int
ahd_get_pci_function(ahd_dev_softc_t pci)468*4882a593Smuzhiyun ahd_get_pci_function(ahd_dev_softc_t pci)
469*4882a593Smuzhiyun {
470*4882a593Smuzhiyun 	return (PCI_FUNC(pci->devfn));
471*4882a593Smuzhiyun }
472*4882a593Smuzhiyun 
473*4882a593Smuzhiyun static inline int ahd_get_pci_slot(ahd_dev_softc_t);
474*4882a593Smuzhiyun static inline int
ahd_get_pci_slot(ahd_dev_softc_t pci)475*4882a593Smuzhiyun ahd_get_pci_slot(ahd_dev_softc_t pci)
476*4882a593Smuzhiyun {
477*4882a593Smuzhiyun 	return (PCI_SLOT(pci->devfn));
478*4882a593Smuzhiyun }
479*4882a593Smuzhiyun 
480*4882a593Smuzhiyun static inline int ahd_get_pci_bus(ahd_dev_softc_t);
481*4882a593Smuzhiyun static inline int
ahd_get_pci_bus(ahd_dev_softc_t pci)482*4882a593Smuzhiyun ahd_get_pci_bus(ahd_dev_softc_t pci)
483*4882a593Smuzhiyun {
484*4882a593Smuzhiyun 	return (pci->bus->number);
485*4882a593Smuzhiyun }
486*4882a593Smuzhiyun 
487*4882a593Smuzhiyun static inline void ahd_flush_device_writes(struct ahd_softc *);
488*4882a593Smuzhiyun static inline void
ahd_flush_device_writes(struct ahd_softc * ahd)489*4882a593Smuzhiyun ahd_flush_device_writes(struct ahd_softc *ahd)
490*4882a593Smuzhiyun {
491*4882a593Smuzhiyun 	/* XXX Is this sufficient for all architectures??? */
492*4882a593Smuzhiyun 	ahd_inb(ahd, INTSTAT);
493*4882a593Smuzhiyun }
494*4882a593Smuzhiyun 
495*4882a593Smuzhiyun /**************************** Proc FS Support *********************************/
496*4882a593Smuzhiyun int	ahd_proc_write_seeprom(struct Scsi_Host *, char *, int);
497*4882a593Smuzhiyun int	ahd_linux_show_info(struct seq_file *,struct Scsi_Host *);
498*4882a593Smuzhiyun 
499*4882a593Smuzhiyun /*********************** Transaction Access Wrappers **************************/
500*4882a593Smuzhiyun static inline void ahd_cmd_set_transaction_status(struct scsi_cmnd *, uint32_t);
501*4882a593Smuzhiyun static inline void ahd_set_transaction_status(struct scb *, uint32_t);
502*4882a593Smuzhiyun static inline void ahd_cmd_set_scsi_status(struct scsi_cmnd *, uint32_t);
503*4882a593Smuzhiyun static inline void ahd_set_scsi_status(struct scb *, uint32_t);
504*4882a593Smuzhiyun static inline uint32_t ahd_cmd_get_transaction_status(struct scsi_cmnd *cmd);
505*4882a593Smuzhiyun static inline uint32_t ahd_get_transaction_status(struct scb *);
506*4882a593Smuzhiyun static inline uint32_t ahd_cmd_get_scsi_status(struct scsi_cmnd *cmd);
507*4882a593Smuzhiyun static inline uint32_t ahd_get_scsi_status(struct scb *);
508*4882a593Smuzhiyun static inline void ahd_set_transaction_tag(struct scb *, int, u_int);
509*4882a593Smuzhiyun static inline u_long ahd_get_transfer_length(struct scb *);
510*4882a593Smuzhiyun static inline int ahd_get_transfer_dir(struct scb *);
511*4882a593Smuzhiyun static inline void ahd_set_residual(struct scb *, u_long);
512*4882a593Smuzhiyun static inline void ahd_set_sense_residual(struct scb *scb, u_long resid);
513*4882a593Smuzhiyun static inline u_long ahd_get_residual(struct scb *);
514*4882a593Smuzhiyun static inline u_long ahd_get_sense_residual(struct scb *);
515*4882a593Smuzhiyun static inline int ahd_perform_autosense(struct scb *);
516*4882a593Smuzhiyun static inline uint32_t ahd_get_sense_bufsize(struct ahd_softc *,
517*4882a593Smuzhiyun 					       struct scb *);
518*4882a593Smuzhiyun static inline void ahd_notify_xfer_settings_change(struct ahd_softc *,
519*4882a593Smuzhiyun 						     struct ahd_devinfo *);
520*4882a593Smuzhiyun static inline void ahd_platform_scb_free(struct ahd_softc *ahd,
521*4882a593Smuzhiyun 					   struct scb *scb);
522*4882a593Smuzhiyun static inline void ahd_freeze_scb(struct scb *scb);
523*4882a593Smuzhiyun 
524*4882a593Smuzhiyun static inline
ahd_cmd_set_transaction_status(struct scsi_cmnd * cmd,uint32_t status)525*4882a593Smuzhiyun void ahd_cmd_set_transaction_status(struct scsi_cmnd *cmd, uint32_t status)
526*4882a593Smuzhiyun {
527*4882a593Smuzhiyun 	cmd->result &= ~(CAM_STATUS_MASK << 16);
528*4882a593Smuzhiyun 	cmd->result |= status << 16;
529*4882a593Smuzhiyun }
530*4882a593Smuzhiyun 
531*4882a593Smuzhiyun static inline
ahd_set_transaction_status(struct scb * scb,uint32_t status)532*4882a593Smuzhiyun void ahd_set_transaction_status(struct scb *scb, uint32_t status)
533*4882a593Smuzhiyun {
534*4882a593Smuzhiyun 	ahd_cmd_set_transaction_status(scb->io_ctx,status);
535*4882a593Smuzhiyun }
536*4882a593Smuzhiyun 
537*4882a593Smuzhiyun static inline
ahd_cmd_set_scsi_status(struct scsi_cmnd * cmd,uint32_t status)538*4882a593Smuzhiyun void ahd_cmd_set_scsi_status(struct scsi_cmnd *cmd, uint32_t status)
539*4882a593Smuzhiyun {
540*4882a593Smuzhiyun 	cmd->result &= ~0xFFFF;
541*4882a593Smuzhiyun 	cmd->result |= status;
542*4882a593Smuzhiyun }
543*4882a593Smuzhiyun 
544*4882a593Smuzhiyun static inline
ahd_set_scsi_status(struct scb * scb,uint32_t status)545*4882a593Smuzhiyun void ahd_set_scsi_status(struct scb *scb, uint32_t status)
546*4882a593Smuzhiyun {
547*4882a593Smuzhiyun 	ahd_cmd_set_scsi_status(scb->io_ctx, status);
548*4882a593Smuzhiyun }
549*4882a593Smuzhiyun 
550*4882a593Smuzhiyun static inline
ahd_cmd_get_transaction_status(struct scsi_cmnd * cmd)551*4882a593Smuzhiyun uint32_t ahd_cmd_get_transaction_status(struct scsi_cmnd *cmd)
552*4882a593Smuzhiyun {
553*4882a593Smuzhiyun 	return ((cmd->result >> 16) & CAM_STATUS_MASK);
554*4882a593Smuzhiyun }
555*4882a593Smuzhiyun 
556*4882a593Smuzhiyun static inline
ahd_get_transaction_status(struct scb * scb)557*4882a593Smuzhiyun uint32_t ahd_get_transaction_status(struct scb *scb)
558*4882a593Smuzhiyun {
559*4882a593Smuzhiyun 	return (ahd_cmd_get_transaction_status(scb->io_ctx));
560*4882a593Smuzhiyun }
561*4882a593Smuzhiyun 
562*4882a593Smuzhiyun static inline
ahd_cmd_get_scsi_status(struct scsi_cmnd * cmd)563*4882a593Smuzhiyun uint32_t ahd_cmd_get_scsi_status(struct scsi_cmnd *cmd)
564*4882a593Smuzhiyun {
565*4882a593Smuzhiyun 	return (cmd->result & 0xFFFF);
566*4882a593Smuzhiyun }
567*4882a593Smuzhiyun 
568*4882a593Smuzhiyun static inline
ahd_get_scsi_status(struct scb * scb)569*4882a593Smuzhiyun uint32_t ahd_get_scsi_status(struct scb *scb)
570*4882a593Smuzhiyun {
571*4882a593Smuzhiyun 	return (ahd_cmd_get_scsi_status(scb->io_ctx));
572*4882a593Smuzhiyun }
573*4882a593Smuzhiyun 
574*4882a593Smuzhiyun static inline
ahd_set_transaction_tag(struct scb * scb,int enabled,u_int type)575*4882a593Smuzhiyun void ahd_set_transaction_tag(struct scb *scb, int enabled, u_int type)
576*4882a593Smuzhiyun {
577*4882a593Smuzhiyun 	/*
578*4882a593Smuzhiyun 	 * Nothing to do for linux as the incoming transaction
579*4882a593Smuzhiyun 	 * has no concept of tag/non tagged, etc.
580*4882a593Smuzhiyun 	 */
581*4882a593Smuzhiyun }
582*4882a593Smuzhiyun 
583*4882a593Smuzhiyun static inline
ahd_get_transfer_length(struct scb * scb)584*4882a593Smuzhiyun u_long ahd_get_transfer_length(struct scb *scb)
585*4882a593Smuzhiyun {
586*4882a593Smuzhiyun 	return (scb->platform_data->xfer_len);
587*4882a593Smuzhiyun }
588*4882a593Smuzhiyun 
589*4882a593Smuzhiyun static inline
ahd_get_transfer_dir(struct scb * scb)590*4882a593Smuzhiyun int ahd_get_transfer_dir(struct scb *scb)
591*4882a593Smuzhiyun {
592*4882a593Smuzhiyun 	return (scb->io_ctx->sc_data_direction);
593*4882a593Smuzhiyun }
594*4882a593Smuzhiyun 
595*4882a593Smuzhiyun static inline
ahd_set_residual(struct scb * scb,u_long resid)596*4882a593Smuzhiyun void ahd_set_residual(struct scb *scb, u_long resid)
597*4882a593Smuzhiyun {
598*4882a593Smuzhiyun 	scsi_set_resid(scb->io_ctx, resid);
599*4882a593Smuzhiyun }
600*4882a593Smuzhiyun 
601*4882a593Smuzhiyun static inline
ahd_set_sense_residual(struct scb * scb,u_long resid)602*4882a593Smuzhiyun void ahd_set_sense_residual(struct scb *scb, u_long resid)
603*4882a593Smuzhiyun {
604*4882a593Smuzhiyun 	scb->platform_data->sense_resid = resid;
605*4882a593Smuzhiyun }
606*4882a593Smuzhiyun 
607*4882a593Smuzhiyun static inline
ahd_get_residual(struct scb * scb)608*4882a593Smuzhiyun u_long ahd_get_residual(struct scb *scb)
609*4882a593Smuzhiyun {
610*4882a593Smuzhiyun 	return scsi_get_resid(scb->io_ctx);
611*4882a593Smuzhiyun }
612*4882a593Smuzhiyun 
613*4882a593Smuzhiyun static inline
ahd_get_sense_residual(struct scb * scb)614*4882a593Smuzhiyun u_long ahd_get_sense_residual(struct scb *scb)
615*4882a593Smuzhiyun {
616*4882a593Smuzhiyun 	return (scb->platform_data->sense_resid);
617*4882a593Smuzhiyun }
618*4882a593Smuzhiyun 
619*4882a593Smuzhiyun static inline
ahd_perform_autosense(struct scb * scb)620*4882a593Smuzhiyun int ahd_perform_autosense(struct scb *scb)
621*4882a593Smuzhiyun {
622*4882a593Smuzhiyun 	/*
623*4882a593Smuzhiyun 	 * We always perform autosense in Linux.
624*4882a593Smuzhiyun 	 * On other platforms this is set on a
625*4882a593Smuzhiyun 	 * per-transaction basis.
626*4882a593Smuzhiyun 	 */
627*4882a593Smuzhiyun 	return (1);
628*4882a593Smuzhiyun }
629*4882a593Smuzhiyun 
630*4882a593Smuzhiyun static inline uint32_t
ahd_get_sense_bufsize(struct ahd_softc * ahd,struct scb * scb)631*4882a593Smuzhiyun ahd_get_sense_bufsize(struct ahd_softc *ahd, struct scb *scb)
632*4882a593Smuzhiyun {
633*4882a593Smuzhiyun 	return (sizeof(struct scsi_sense_data));
634*4882a593Smuzhiyun }
635*4882a593Smuzhiyun 
636*4882a593Smuzhiyun static inline void
ahd_notify_xfer_settings_change(struct ahd_softc * ahd,struct ahd_devinfo * devinfo)637*4882a593Smuzhiyun ahd_notify_xfer_settings_change(struct ahd_softc *ahd,
638*4882a593Smuzhiyun 				struct ahd_devinfo *devinfo)
639*4882a593Smuzhiyun {
640*4882a593Smuzhiyun 	/* Nothing to do here for linux */
641*4882a593Smuzhiyun }
642*4882a593Smuzhiyun 
643*4882a593Smuzhiyun static inline void
ahd_platform_scb_free(struct ahd_softc * ahd,struct scb * scb)644*4882a593Smuzhiyun ahd_platform_scb_free(struct ahd_softc *ahd, struct scb *scb)
645*4882a593Smuzhiyun {
646*4882a593Smuzhiyun 	ahd->flags &= ~AHD_RESOURCE_SHORTAGE;
647*4882a593Smuzhiyun }
648*4882a593Smuzhiyun 
649*4882a593Smuzhiyun int	ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg);
650*4882a593Smuzhiyun void	ahd_platform_free(struct ahd_softc *ahd);
651*4882a593Smuzhiyun void	ahd_platform_init(struct ahd_softc *ahd);
652*4882a593Smuzhiyun void	ahd_platform_freeze_devq(struct ahd_softc *ahd, struct scb *scb);
653*4882a593Smuzhiyun 
654*4882a593Smuzhiyun static inline void
ahd_freeze_scb(struct scb * scb)655*4882a593Smuzhiyun ahd_freeze_scb(struct scb *scb)
656*4882a593Smuzhiyun {
657*4882a593Smuzhiyun 	if ((scb->io_ctx->result & (CAM_DEV_QFRZN << 16)) == 0) {
658*4882a593Smuzhiyun                 scb->io_ctx->result |= CAM_DEV_QFRZN << 16;
659*4882a593Smuzhiyun                 scb->platform_data->dev->qfrozen++;
660*4882a593Smuzhiyun         }
661*4882a593Smuzhiyun }
662*4882a593Smuzhiyun 
663*4882a593Smuzhiyun void	ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
664*4882a593Smuzhiyun 			      struct ahd_devinfo *devinfo, ahd_queue_alg);
665*4882a593Smuzhiyun int	ahd_platform_abort_scbs(struct ahd_softc *ahd, int target,
666*4882a593Smuzhiyun 				char channel, int lun, u_int tag,
667*4882a593Smuzhiyun 				role_t role, uint32_t status);
668*4882a593Smuzhiyun irqreturn_t
669*4882a593Smuzhiyun 	ahd_linux_isr(int irq, void *dev_id);
670*4882a593Smuzhiyun void	ahd_done(struct ahd_softc*, struct scb*);
671*4882a593Smuzhiyun void	ahd_send_async(struct ahd_softc *, char channel,
672*4882a593Smuzhiyun 		       u_int target, u_int lun, ac_code);
673*4882a593Smuzhiyun void	ahd_print_path(struct ahd_softc *, struct scb *);
674*4882a593Smuzhiyun 
675*4882a593Smuzhiyun #ifdef CONFIG_PCI
676*4882a593Smuzhiyun #define AHD_PCI_CONFIG 1
677*4882a593Smuzhiyun #else
678*4882a593Smuzhiyun #define AHD_PCI_CONFIG 0
679*4882a593Smuzhiyun #endif
680*4882a593Smuzhiyun #define bootverbose aic79xx_verbose
681*4882a593Smuzhiyun extern uint32_t aic79xx_verbose;
682*4882a593Smuzhiyun 
683*4882a593Smuzhiyun #endif /* _AIC79XX_LINUX_H_ */
684