From 986973a448b6264157604c011ee3ff85c5421da3 Mon Sep 17 00:00:00 2001 From: Matt Jacob Date: Tue, 27 Jun 2000 19:14:14 +0000 Subject: Add an isp_handle_index function- this is prepatory to loading more into the handle (i.e., generation number), so we will now need a function that will take a handle and return a flat index [ 0 .. maxhandles-1 ] for auxillary routines that need an index to get at buddy store values (like dma maps or xflist pointers). --- sys/dev/isp/isp_inline.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'sys/dev/isp') diff --git a/sys/dev/isp/isp_inline.h b/sys/dev/isp/isp_inline.h index 861424218f0bc..e59d2776ceae9 100644 --- a/sys/dev/isp/isp_inline.h +++ b/sys/dev/isp/isp_inline.h @@ -171,6 +171,9 @@ isp_find_xs __P((struct ispsoftc *, u_int32_t)); static INLINE u_int32_t isp_find_handle __P((struct ispsoftc *, ISP_SCSI_XFER_T *)); +static INLINE int +isp_handle_index __P((u_int32_t)); + static INLINE void isp_destroy_handle __P((struct ispsoftc *, u_int32_t)); @@ -232,13 +235,20 @@ isp_find_handle(isp, xs) return (0); } +static INLINE int +isp_handle_index(handle) + u_int32_t handle; +{ + return (handle-1); +} + static INLINE void isp_destroy_handle(isp, handle) struct ispsoftc *isp; u_int32_t handle; { if (handle > 0 && handle <= (u_int32_t) isp->isp_maxcmds) { - isp->isp_xflist[handle - 1] = NULL; + isp->isp_xflist[isp_handle_index(handle)] = NULL; } } @@ -269,8 +279,10 @@ isp_getrqentry(isp, iptrp, optrp, resultp) if (iptr == optr) { return (1); } - *optrp = optr; - *iptrp = iptr; + if (optrp) + *optrp = optr; + if (iptrp) + *iptrp = iptr; return (0); } -- cgit v1.3