isp_freebsd.h (62172) | isp_freebsd.h (62496) |
---|---|
1/* $FreeBSD: head/sys/dev/isp/isp_freebsd.h 62172 2000-06-27 19:22:13Z mjacob $ */ | 1/* $FreeBSD: head/sys/dev/isp/isp_freebsd.h 62496 2000-07-04 01:04:35Z mjacob $ */ |
2/* 3 * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions (CAM version) 4 *--------------------------------------- 5 * Copyright (c) 1997, 1998, 1999 by Matthew Jacob 6 * NASA/Ames Research Center 7 * All rights reserved. 8 *--------------------------------------- 9 * --- 29 unchanged lines hidden (view full) --- 39 40 41#include <sys/param.h> 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/kernel.h> 45#include <sys/queue.h> 46#include <sys/malloc.h> | 2/* 3 * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions (CAM version) 4 *--------------------------------------- 5 * Copyright (c) 1997, 1998, 1999 by Matthew Jacob 6 * NASA/Ames Research Center 7 * All rights reserved. 8 *--------------------------------------- 9 * --- 29 unchanged lines hidden (view full) --- 39 40 41#include <sys/param.h> 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/kernel.h> 45#include <sys/queue.h> 46#include <sys/malloc.h> |
47#include <sys/proc.h> |
|
47 48#include <machine/bus_memio.h> 49#include <machine/bus_pio.h> 50#include <machine/bus.h> 51#include <machine/clock.h> | 48 49#include <machine/bus_memio.h> 50#include <machine/bus_pio.h> 51#include <machine/bus.h> 52#include <machine/clock.h> |
53#include <machine/cpu.h> |
|
52 53#include <cam/cam.h> 54#include <cam/cam_debug.h> 55#include <cam/cam_ccb.h> 56#include <cam/cam_sim.h> 57#include <cam/cam_xpt.h> 58#include <cam/cam_xpt_sim.h> 59#include <cam/cam_debug.h> --- 47 unchanged lines hidden (view full) --- 107 struct ispsoftc * next; 108 u_int64_t default_wwn; 109 char name[8]; 110 int unit; 111 struct cam_sim *sim; 112 struct cam_path *path; 113 struct cam_sim *sim2; 114 struct cam_path *path2; | 54 55#include <cam/cam.h> 56#include <cam/cam_debug.h> 57#include <cam/cam_ccb.h> 58#include <cam/cam_sim.h> 59#include <cam/cam_xpt.h> 60#include <cam/cam_xpt_sim.h> 61#include <cam/cam_debug.h> --- 47 unchanged lines hidden (view full) --- 109 struct ispsoftc * next; 110 u_int64_t default_wwn; 111 char name[8]; 112 int unit; 113 struct cam_sim *sim; 114 struct cam_path *path; 115 struct cam_sim *sim2; 116 struct cam_path *path2; |
115 volatile char simqfrozen; | 117 struct intr_config_hook ehook; 118 volatile u_int16_t : 14, 119 islocked : 1, 120 intsok : 1; 121 u_int8_t mboxwaiting; 122 u_int8_t simqfrozen; 123 int splsaved; |
116#ifdef ISP_TARGET_MODE 117#define TM_WANTED 0x01 118#define TM_BUSY 0x02 119#define TM_TMODE_ENABLED 0x80 120 u_int8_t tmflags; 121 u_int8_t rstatus; 122 u_int16_t rollinfo; 123 tstate_t tsdflt; --- 14 unchanged lines hidden (view full) --- 138#define MAXISPREQUEST 256 139 140#include <dev/isp/ispreg.h> 141#include <dev/isp/ispvar.h> 142#include <dev/isp/ispmbox.h> 143 144#define DFLT_DBLEVEL isp_debug 145extern int isp_debug; | 124#ifdef ISP_TARGET_MODE 125#define TM_WANTED 0x01 126#define TM_BUSY 0x02 127#define TM_TMODE_ENABLED 0x80 128 u_int8_t tmflags; 129 u_int8_t rstatus; 130 u_int16_t rollinfo; 131 tstate_t tsdflt; --- 14 unchanged lines hidden (view full) --- 146#define MAXISPREQUEST 256 147 148#include <dev/isp/ispreg.h> 149#include <dev/isp/ispvar.h> 150#include <dev/isp/ispmbox.h> 151 152#define DFLT_DBLEVEL isp_debug 153extern int isp_debug; |
146#define ISP_LOCKVAL_DECL int isp_spl_save 147#define ISP_ILOCKVAL_DECL ISP_LOCKVAL_DECL 148#define ISP_UNLOCK(isp) (void) splx(isp_spl_save) 149#define ISP_LOCK(isp) isp_spl_save = splcam() 150#define ISP_ILOCK(isp) ISP_LOCK(isp) 151#define ISP_IUNLOCK(isp) ISP_UNLOCK(isp) 152#define IMASK cam_imask | |
153 | 154 |
155static __inline void isp_lock(struct ispsoftc *); 156static __inline void isp_unlock(struct ispsoftc *); 157 158static __inline void 159isp_lock(struct ispsoftc *isp) 160{ 161 int s = splcam(); 162 if (isp->isp_osinfo.islocked == 0) { 163 isp->isp_osinfo.islocked = 1; 164 isp->isp_osinfo.splsaved = s; 165 } else { 166 splx(s); 167 } 168} 169 170static __inline void 171isp_unlock(struct ispsoftc *isp) 172{ 173 if (isp->isp_osinfo.islocked) { 174 isp->isp_osinfo.islocked = 0; 175 splx(isp->isp_osinfo.splsaved); 176 } 177} 178 179#define ISP_LOCK isp_lock 180#define ISP_UNLOCK isp_unlock 181#define SERVICING_INTERRUPT(isp) (intr_nesting_level != 0) 182 183#define MBOX_WAIT_COMPLETE(isp) \ 184 if (isp->isp_osinfo.intsok == 0 || SERVICING_INTERRUPT(isp)) { \ 185 int j; \ 186 for (j = 0; j < 60 * 2000; j++) { \ 187 if (isp_intr(isp) == 0) { \ 188 SYS_DELAY(500); \ 189 } \ 190 if (isp->isp_mboxbsy == 0) \ 191 break; \ 192 } \ 193 if (isp->isp_mboxbsy != 0) \ 194 printf("%s: mailbox timeout\n", isp->isp_name); \ 195 } else { \ 196 isp->isp_osinfo.mboxwaiting = 1; \ 197 while (isp->isp_mboxbsy != 0) \ 198 (void) tsleep(&isp->isp_osinfo.mboxwaiting, PRIBIO, \ 199 "isp_mailbox", 0);\ 200 } 201 202#define MBOX_NOTIFY_COMPLETE(isp) \ 203 if (isp->isp_osinfo.mboxwaiting) { \ 204 isp->isp_osinfo.mboxwaiting = 0; \ 205 wakeup(&isp->isp_osinfo.mboxwaiting); \ 206 } \ 207 isp->isp_mboxbsy = 0 208 |
|
154#define XS_NULL(ccb) ccb == NULL 155#define XS_ISP(ccb) ((struct ispsoftc *) (ccb)->ccb_h.spriv_ptr1) 156 157#define XS_LUN(ccb) (ccb)->ccb_h.target_lun 158#define XS_TGT(ccb) (ccb)->ccb_h.target_id 159#define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path)) 160#define XS_RESID(ccb) (ccb)->resid 161#define XS_XFRLEN(ccb) (ccb)->dxfer_len --- 99 unchanged lines hidden (view full) --- 261#define ISP_SWIZZLE_REQUEST(a, b) 262#define ISP_UNSWIZZLE_RESPONSE(a, b) 263#define ISP_SWIZZLE_SNS_REQ(a, b) 264#define ISP_UNSWIZZLE_SNS_RSP(a, b, c) 265 266#define IDPRINTF(lev, x) if (isp->isp_dblev >= (u_int8_t) lev) printf x 267#define PRINTF printf 268#define CFGPRINTF if (bootverbose || DFLT_DBLEVEL > 1) printf | 209#define XS_NULL(ccb) ccb == NULL 210#define XS_ISP(ccb) ((struct ispsoftc *) (ccb)->ccb_h.spriv_ptr1) 211 212#define XS_LUN(ccb) (ccb)->ccb_h.target_lun 213#define XS_TGT(ccb) (ccb)->ccb_h.target_id 214#define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path)) 215#define XS_RESID(ccb) (ccb)->resid 216#define XS_XFRLEN(ccb) (ccb)->dxfer_len --- 99 unchanged lines hidden (view full) --- 316#define ISP_SWIZZLE_REQUEST(a, b) 317#define ISP_UNSWIZZLE_RESPONSE(a, b) 318#define ISP_SWIZZLE_SNS_REQ(a, b) 319#define ISP_UNSWIZZLE_SNS_RSP(a, b, c) 320 321#define IDPRINTF(lev, x) if (isp->isp_dblev >= (u_int8_t) lev) printf x 322#define PRINTF printf 323#define CFGPRINTF if (bootverbose || DFLT_DBLEVEL > 1) printf |
324#define STRNCAT strncat 325static __inline char *strncat(char *, const char *, size_t); 326static __inline char * 327strncat(char *d, const char *s, size_t c) 328{ 329 char *t = d; |
|
269 | 330 |
331 if (c) { 332 while (*d) 333 d++; 334 while ((*d++ = *s++)) { 335 if (--c == 0) { 336 *d = '\0'; 337 break; 338 } 339 } 340 } 341 return (t); 342} 343 |
|
270#define SYS_DELAY(x) DELAY(x) 271 272#define FC_FW_READY_DELAY (5 * 1000000) 273#define DEFAULT_LOOPID(x) 109 274#define DEFAULT_WWN(x) (x)->isp_osinfo.default_wwn 275 276#define INLINE __inline 277#include <dev/isp/isp_inline.h> 278#endif /* _ISP_FREEBSD_H */ | 344#define SYS_DELAY(x) DELAY(x) 345 346#define FC_FW_READY_DELAY (5 * 1000000) 347#define DEFAULT_LOOPID(x) 109 348#define DEFAULT_WWN(x) (x)->isp_osinfo.default_wwn 349 350#define INLINE __inline 351#include <dev/isp/isp_inline.h> 352#endif /* _ISP_FREEBSD_H */ |
279 | |