xref: /openbmc/linux/drivers/scsi/aic7xxx/aic7xxx_inline.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * Inline routines shareable across OS platforms.
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * Copyright (c) 1994-2001 Justin T. Gibbs.
51da177e4SLinus Torvalds  * Copyright (c) 2000-2001 Adaptec Inc.
61da177e4SLinus Torvalds  * All rights reserved.
71da177e4SLinus Torvalds  *
81da177e4SLinus Torvalds  * Redistribution and use in source and binary forms, with or without
91da177e4SLinus Torvalds  * modification, are permitted provided that the following conditions
101da177e4SLinus Torvalds  * are met:
111da177e4SLinus Torvalds  * 1. Redistributions of source code must retain the above copyright
121da177e4SLinus Torvalds  *    notice, this list of conditions, and the following disclaimer,
131da177e4SLinus Torvalds  *    without modification.
141da177e4SLinus Torvalds  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
151da177e4SLinus Torvalds  *    substantially similar to the "NO WARRANTY" disclaimer below
161da177e4SLinus Torvalds  *    ("Disclaimer") and any redistribution must be conditioned upon
171da177e4SLinus Torvalds  *    including a substantially similar Disclaimer requirement for further
181da177e4SLinus Torvalds  *    binary redistribution.
191da177e4SLinus Torvalds  * 3. Neither the names of the above-listed copyright holders nor the names
201da177e4SLinus Torvalds  *    of any contributors may be used to endorse or promote products derived
211da177e4SLinus Torvalds  *    from this software without specific prior written permission.
221da177e4SLinus Torvalds  *
231da177e4SLinus Torvalds  * Alternatively, this software may be distributed under the terms of the
241da177e4SLinus Torvalds  * GNU General Public License ("GPL") version 2 as published by the Free
251da177e4SLinus Torvalds  * Software Foundation.
261da177e4SLinus Torvalds  *
271da177e4SLinus Torvalds  * NO WARRANTY
281da177e4SLinus Torvalds  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
291da177e4SLinus Torvalds  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
301da177e4SLinus Torvalds  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
311da177e4SLinus Torvalds  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
321da177e4SLinus Torvalds  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
331da177e4SLinus Torvalds  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
341da177e4SLinus Torvalds  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
351da177e4SLinus Torvalds  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
361da177e4SLinus Torvalds  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
371da177e4SLinus Torvalds  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
381da177e4SLinus Torvalds  * POSSIBILITY OF SUCH DAMAGES.
391da177e4SLinus Torvalds  *
401da177e4SLinus Torvalds  * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_inline.h#43 $
411da177e4SLinus Torvalds  *
421da177e4SLinus Torvalds  * $FreeBSD$
431da177e4SLinus Torvalds  */
441da177e4SLinus Torvalds 
451da177e4SLinus Torvalds #ifndef _AIC7XXX_INLINE_H_
461da177e4SLinus Torvalds #define _AIC7XXX_INLINE_H_
471da177e4SLinus Torvalds 
481da177e4SLinus Torvalds /************************* Sequencer Execution Control ************************/
49be0d6768SDenys Vlasenko int  ahc_is_paused(struct ahc_softc *ahc);
50be0d6768SDenys Vlasenko void ahc_pause(struct ahc_softc *ahc);
51be0d6768SDenys Vlasenko void ahc_unpause(struct ahc_softc *ahc);
521da177e4SLinus Torvalds 
531da177e4SLinus Torvalds /************************** Memory mapping routines ***************************/
54be0d6768SDenys Vlasenko void	ahc_sync_sglist(struct ahc_softc *ahc,
551da177e4SLinus Torvalds 			struct scb *scb, int op);
561da177e4SLinus Torvalds 
571da177e4SLinus Torvalds /******************************** Debugging ***********************************/
58*1beb6fa8SHarvey Harrison static inline char *ahc_name(struct ahc_softc *ahc);
591da177e4SLinus Torvalds 
ahc_name(struct ahc_softc * ahc)60*1beb6fa8SHarvey Harrison static inline char *ahc_name(struct ahc_softc *ahc)
611da177e4SLinus Torvalds {
621da177e4SLinus Torvalds 	return (ahc->name);
631da177e4SLinus Torvalds }
641da177e4SLinus Torvalds 
65b1c11812SJoe Perches /*********************** Miscellaneous Support Functions ***********************/
661da177e4SLinus Torvalds 
67be0d6768SDenys Vlasenko struct ahc_initiator_tinfo *
681da177e4SLinus Torvalds 	ahc_fetch_transinfo(struct ahc_softc *ahc,
691da177e4SLinus Torvalds 			    char channel, u_int our_id,
701da177e4SLinus Torvalds 			    u_int remote_id,
711da177e4SLinus Torvalds 			    struct ahc_tmode_tstate **tstate);
72be0d6768SDenys Vlasenko uint16_t
731da177e4SLinus Torvalds 	ahc_inw(struct ahc_softc *ahc, u_int port);
74be0d6768SDenys Vlasenko void	ahc_outw(struct ahc_softc *ahc, u_int port,
751da177e4SLinus Torvalds 		 u_int value);
76be0d6768SDenys Vlasenko uint32_t
771da177e4SLinus Torvalds 	ahc_inl(struct ahc_softc *ahc, u_int port);
78be0d6768SDenys Vlasenko void	ahc_outl(struct ahc_softc *ahc, u_int port,
791da177e4SLinus Torvalds 		 uint32_t value);
80be0d6768SDenys Vlasenko uint64_t
811da177e4SLinus Torvalds 	ahc_inq(struct ahc_softc *ahc, u_int port);
82be0d6768SDenys Vlasenko void	ahc_outq(struct ahc_softc *ahc, u_int port,
831da177e4SLinus Torvalds 		 uint64_t value);
84be0d6768SDenys Vlasenko struct scb*
851da177e4SLinus Torvalds 	ahc_get_scb(struct ahc_softc *ahc);
86be0d6768SDenys Vlasenko void	ahc_free_scb(struct ahc_softc *ahc, struct scb *scb);
87be0d6768SDenys Vlasenko struct scb *
88be0d6768SDenys Vlasenko 	ahc_lookup_scb(struct ahc_softc *ahc, u_int tag);
89be0d6768SDenys Vlasenko void	ahc_queue_scb(struct ahc_softc *ahc, struct scb *scb);
90be0d6768SDenys Vlasenko struct scsi_sense_data *
911da177e4SLinus Torvalds 	ahc_get_sense_buf(struct ahc_softc *ahc,
921da177e4SLinus Torvalds 			  struct scb *scb);
931da177e4SLinus Torvalds 
941da177e4SLinus Torvalds /************************** Interrupt Processing ******************************/
95be0d6768SDenys Vlasenko int	ahc_intr(struct ahc_softc *ahc);
961da177e4SLinus Torvalds 
971da177e4SLinus Torvalds #endif  /* _AIC7XXX_INLINE_H_ */
98