isp_freebsd.h (154879) | isp_freebsd.h (155228) |
---|---|
1/* $FreeBSD: head/sys/dev/isp/isp_freebsd.h 154879 2006-01-27 00:46:10Z mjacob $ */ | 1/* $FreeBSD: head/sys/dev/isp/isp_freebsd.h 155228 2006-02-02 21:31:34Z mjacob $ */ |
2/*- 3 * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions 4 * 5 * Copyright (c) 1997-2006 by Matthew Jacob 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 59 unchanged lines hidden (view full) --- 69 * Efficiency- get rid of SBus code && tests unless we need them. 70 */ 71#ifdef __sparc64__ 72#define ISP_SBUS_SUPPORTED 1 73#else 74#define ISP_SBUS_SUPPORTED 0 75#endif 76 | 2/*- 3 * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions 4 * 5 * Copyright (c) 1997-2006 by Matthew Jacob 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 59 unchanged lines hidden (view full) --- 69 * Efficiency- get rid of SBus code && tests unless we need them. 70 */ 71#ifdef __sparc64__ 72#define ISP_SBUS_SUPPORTED 1 73#else 74#define ISP_SBUS_SUPPORTED 0 75#endif 76 |
77/* 78 * Hackery- remove TARGET MODE when compiling as a module on sparc64 79 */ 80#if defined(__sparc64__) && defined(KLD_MODULE) && defined(ISP_TARGET_MODE) 81#undef ISP_TARGET_MODE 82#endif 83 | |
84#define HANDLE_LOOPSTATE_IN_OUTER_LAYERS 1 85/* #define ISP_SMPLOCK 1 */ 86 87#ifdef ISP_SMPLOCK 88#define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE 89#else 90#define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY 91#endif --- 92 unchanged lines hidden (view full) --- 184#define ISPLOCK_2_CAMLOCK(isp) do { } while (0) 185#define CAMLOCK_2_ISPLOCK(isp) do { } while (0) 186#endif 187 188/* 189 * Required Macros/Defines 190 */ 191 | 77#define HANDLE_LOOPSTATE_IN_OUTER_LAYERS 1 78/* #define ISP_SMPLOCK 1 */ 79 80#ifdef ISP_SMPLOCK 81#define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE 82#else 83#define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY 84#endif --- 92 unchanged lines hidden (view full) --- 177#define ISPLOCK_2_CAMLOCK(isp) do { } while (0) 178#define CAMLOCK_2_ISPLOCK(isp) do { } while (0) 179#endif 180 181/* 182 * Required Macros/Defines 183 */ 184 |
192#define INLINE __inline 193 | |
194#define ISP2100_SCRLEN 0x800 195 196#define MEMZERO bzero 197#define MEMCPY(dst, src, amt) bcopy((src), (dst), (amt)) 198#define SNPRINTF snprintf 199#define USEC_DELAY DELAY 200#define USEC_SLEEP(isp, x) \ 201 if (isp->isp_osinfo.intsok) \ --- 207 unchanged lines hidden (view full) --- 409#define XS_CMD_C_GRACE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_GRACE 410#define XS_CMD_GRACE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_GRACE) 411 412#define XS_CMD_S_DONE(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_DONE 413#define XS_CMD_C_DONE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_DONE 414#define XS_CMD_DONE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_DONE) 415 416#define XS_CMD_S_CLEAR(sccb) (sccb)->ccb_h.spriv_field0 = 0 | 185#define ISP2100_SCRLEN 0x800 186 187#define MEMZERO bzero 188#define MEMCPY(dst, src, amt) bcopy((src), (dst), (amt)) 189#define SNPRINTF snprintf 190#define USEC_DELAY DELAY 191#define USEC_SLEEP(isp, x) \ 192 if (isp->isp_osinfo.intsok) \ --- 207 unchanged lines hidden (view full) --- 400#define XS_CMD_C_GRACE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_GRACE 401#define XS_CMD_GRACE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_GRACE) 402 403#define XS_CMD_S_DONE(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_DONE 404#define XS_CMD_C_DONE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_DONE 405#define XS_CMD_DONE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_DONE) 406 407#define XS_CMD_S_CLEAR(sccb) (sccb)->ccb_h.spriv_field0 = 0 |
408 |
|
417/* 418 * Platform specific inline functions 419 */ 420 | 409/* 410 * Platform specific inline functions 411 */ 412 |
421static INLINE void isp_mbox_wait_complete(struct ispsoftc *); 422static INLINE void | 413static __inline void isp_mbox_wait_complete(struct ispsoftc *); 414static __inline void |
423isp_mbox_wait_complete(struct ispsoftc *isp) 424{ 425 if (isp->isp_osinfo.intsok) { 426 int lim = ((isp->isp_mbxwrk0)? 120 : 20) * hz; 427 isp->isp_osinfo.mboxwaiting = 1; 428#ifdef ISP_SMPLOCK 429 (void) msleep(&isp->isp_mbxworkp, 430 &isp->isp_lock, PRIBIO, "isp_mboxwaiting", lim); --- 27 unchanged lines hidden (view full) --- 458 if (isp->isp_mboxbsy != 0) { 459 isp_prt(isp, ISP_LOGWARN, 460 "Polled Mailbox Command (0x%x) Timeout", 461 isp->isp_lastmbxcmd); 462 } 463 } 464} 465 | 415isp_mbox_wait_complete(struct ispsoftc *isp) 416{ 417 if (isp->isp_osinfo.intsok) { 418 int lim = ((isp->isp_mbxwrk0)? 120 : 20) * hz; 419 isp->isp_osinfo.mboxwaiting = 1; 420#ifdef ISP_SMPLOCK 421 (void) msleep(&isp->isp_mbxworkp, 422 &isp->isp_lock, PRIBIO, "isp_mboxwaiting", lim); --- 27 unchanged lines hidden (view full) --- 450 if (isp->isp_mboxbsy != 0) { 451 isp_prt(isp, ISP_LOGWARN, 452 "Polled Mailbox Command (0x%x) Timeout", 453 isp->isp_lastmbxcmd); 454 } 455 } 456} 457 |
466static INLINE u_int64_t nanotime_sub(struct timespec *, struct timespec *); 467static INLINE u_int64_t | 458static __inline u_int64_t nanotime_sub(struct timespec *, struct timespec *); 459static __inline u_int64_t |
468nanotime_sub(struct timespec *b, struct timespec *a) 469{ 470 u_int64_t elapsed; 471 struct timespec x = *b; 472 timespecsub(&x, a); 473 elapsed = GET_NANOSEC(&x); 474 if (elapsed == 0) 475 elapsed++; 476 return (elapsed); 477} 478 | 460nanotime_sub(struct timespec *b, struct timespec *a) 461{ 462 u_int64_t elapsed; 463 struct timespec x = *b; 464 timespecsub(&x, a); 465 elapsed = GET_NANOSEC(&x); 466 if (elapsed == 0) 467 elapsed++; 468 return (elapsed); 469} 470 |
479static INLINE char *strncat(char *, const char *, size_t); 480static INLINE char * | 471static __inline char *strncat(char *, const char *, size_t); 472static __inline char * |
481strncat(char *d, const char *s, size_t c) 482{ 483 char *t = d; 484 485 if (c) { 486 while (*d) 487 d++; 488 while ((*d++ = *s++)) { 489 if (--c == 0) { 490 *d = '\0'; 491 break; 492 } 493 } 494 } 495 return (t); 496} 497 498/* | 473strncat(char *d, const char *s, size_t c) 474{ 475 char *t = d; 476 477 if (c) { 478 while (*d) 479 d++; 480 while ((*d++ = *s++)) { 481 if (--c == 0) { 482 *d = '\0'; 483 break; 484 } 485 } 486 } 487 return (t); 488} 489 490/* |
499 * Common inline functions | 491 * ISP Library functions |
500 */ 501 | 492 */ 493 |
502#include <dev/isp/isp_inline.h> | 494#include <dev/isp/isp_library.h> 495 |
503#endif /* _ISP_FREEBSD_H */ | 496#endif /* _ISP_FREEBSD_H */ |