0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 #ifndef _AIC79XX_INLINE_H_
0046 #define _AIC79XX_INLINE_H_
0047
0048
0049 static inline char *ahd_name(struct ahd_softc *ahd);
0050
0051 static inline char *ahd_name(struct ahd_softc *ahd)
0052 {
0053 return (ahd->name);
0054 }
0055
0056
0057 static inline void ahd_known_modes(struct ahd_softc *ahd,
0058 ahd_mode src, ahd_mode dst);
0059 static inline ahd_mode_state ahd_build_mode_state(struct ahd_softc *ahd,
0060 ahd_mode src,
0061 ahd_mode dst);
0062 static inline void ahd_extract_mode_state(struct ahd_softc *ahd,
0063 ahd_mode_state state,
0064 ahd_mode *src, ahd_mode *dst);
0065
0066 void ahd_set_modes(struct ahd_softc *ahd, ahd_mode src,
0067 ahd_mode dst);
0068 ahd_mode_state ahd_save_modes(struct ahd_softc *ahd);
0069 void ahd_restore_modes(struct ahd_softc *ahd,
0070 ahd_mode_state state);
0071 int ahd_is_paused(struct ahd_softc *ahd);
0072 void ahd_pause(struct ahd_softc *ahd);
0073 void ahd_unpause(struct ahd_softc *ahd);
0074
0075 static inline void
0076 ahd_known_modes(struct ahd_softc *ahd, ahd_mode src, ahd_mode dst)
0077 {
0078 ahd->src_mode = src;
0079 ahd->dst_mode = dst;
0080 ahd->saved_src_mode = src;
0081 ahd->saved_dst_mode = dst;
0082 }
0083
0084 static inline ahd_mode_state
0085 ahd_build_mode_state(struct ahd_softc *ahd, ahd_mode src, ahd_mode dst)
0086 {
0087 return ((src << SRC_MODE_SHIFT) | (dst << DST_MODE_SHIFT));
0088 }
0089
0090 static inline void
0091 ahd_extract_mode_state(struct ahd_softc *ahd, ahd_mode_state state,
0092 ahd_mode *src, ahd_mode *dst)
0093 {
0094 *src = (state & SRC_MODE) >> SRC_MODE_SHIFT;
0095 *dst = (state & DST_MODE) >> DST_MODE_SHIFT;
0096 }
0097
0098
0099 void *ahd_sg_setup(struct ahd_softc *ahd, struct scb *scb,
0100 void *sgptr, dma_addr_t addr,
0101 bus_size_t len, int last);
0102
0103
0104 static inline size_t ahd_sg_size(struct ahd_softc *ahd);
0105
0106 void ahd_sync_sglist(struct ahd_softc *ahd,
0107 struct scb *scb, int op);
0108
0109 static inline size_t ahd_sg_size(struct ahd_softc *ahd)
0110 {
0111 if ((ahd->flags & AHD_64BIT_ADDRESSING) != 0)
0112 return (sizeof(struct ahd_dma64_seg));
0113 return (sizeof(struct ahd_dma_seg));
0114 }
0115
0116
0117 struct ahd_initiator_tinfo *
0118 ahd_fetch_transinfo(struct ahd_softc *ahd,
0119 char channel, u_int our_id,
0120 u_int remote_id,
0121 struct ahd_tmode_tstate **tstate);
0122 uint16_t
0123 ahd_inw(struct ahd_softc *ahd, u_int port);
0124 void ahd_outw(struct ahd_softc *ahd, u_int port,
0125 u_int value);
0126 uint32_t
0127 ahd_inl(struct ahd_softc *ahd, u_int port);
0128 void ahd_outl(struct ahd_softc *ahd, u_int port,
0129 uint32_t value);
0130 uint64_t
0131 ahd_inq(struct ahd_softc *ahd, u_int port);
0132 void ahd_outq(struct ahd_softc *ahd, u_int port,
0133 uint64_t value);
0134 u_int ahd_get_scbptr(struct ahd_softc *ahd);
0135 void ahd_set_scbptr(struct ahd_softc *ahd, u_int scbptr);
0136 u_int ahd_inb_scbram(struct ahd_softc *ahd, u_int offset);
0137 u_int ahd_inw_scbram(struct ahd_softc *ahd, u_int offset);
0138 struct scb *
0139 ahd_lookup_scb(struct ahd_softc *ahd, u_int tag);
0140 void ahd_queue_scb(struct ahd_softc *ahd, struct scb *scb);
0141
0142 static inline uint8_t *ahd_get_sense_buf(struct ahd_softc *ahd,
0143 struct scb *scb);
0144 static inline uint32_t ahd_get_sense_bufaddr(struct ahd_softc *ahd,
0145 struct scb *scb);
0146
0147 #if 0
0148
0149 #define AHD_COPY_COL_IDX(dst, src) \
0150 do { \
0151 dst->hscb->scsiid = src->hscb->scsiid; \
0152 dst->hscb->lun = src->hscb->lun; \
0153 } while (0)
0154
0155 #endif
0156
0157 static inline uint8_t *
0158 ahd_get_sense_buf(struct ahd_softc *ahd, struct scb *scb)
0159 {
0160 return (scb->sense_data);
0161 }
0162
0163 static inline uint32_t
0164 ahd_get_sense_bufaddr(struct ahd_softc *ahd, struct scb *scb)
0165 {
0166 return (scb->sense_busaddr);
0167 }
0168
0169
0170 int ahd_intr(struct ahd_softc *ahd);
0171
0172 #endif