--- src/sys/bus/cam/cam_periph.h 2008/05/18 03:02:53 1.10 +++ src/sys/bus/cam/cam_periph.h 2008/05/18 20:30:19 1.11 @@ -1,4 +1,4 @@ -/* +/*- * Data structures and definitions for CAM peripheral ("type") drivers. * * Copyright (c) 1997, 1998 Justin T. Gibbs. @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cam/cam_periph.h,v 1.6.2.1 2000/05/07 18:16:49 n_hibma Exp $ + * $FreeBSD: src/sys/cam/cam_periph.h,v 1.18 2007/04/19 22:46:26 scottl Exp $ * $DragonFly$ */ @@ -33,6 +33,7 @@ #define _CAM_CAM_PERIPH_H 1 #include +#include "cam_sim.h" #ifdef _KERNEL @@ -103,6 +104,7 @@ struct cam_periph { char *periph_name; struct cam_path *path; /* Compiled path to device */ void *softc; + struct cam_sim *sim; u_int32_t unit_number; cam_periph_type type; u_int32_t flags; @@ -112,6 +114,7 @@ struct cam_periph { #define CAM_PERIPH_INVALID 0x08 #define CAM_PERIPH_NEW_DEV_FOUND 0x10 #define CAM_PERIPH_RECOVERY_INPROG 0x20 +#define CAM_PERIPH_POLLED 0x40 u_int32_t immediate_priority; u_int32_t refcount; SLIST_HEAD(, ccb_hdr) ccb_list; /* For "immediate" requests */ @@ -138,10 +141,10 @@ cam_status cam_periph_alloc(periph_ctor_ char *name, cam_periph_type type, struct cam_path *, ac_callback_t *, ac_code, void *arg); struct cam_periph *cam_periph_find(struct cam_path *path, char *name); -int cam_periph_lock(struct cam_periph *periph, int flags); -void cam_periph_unlock(struct cam_periph *periph); cam_status cam_periph_acquire(struct cam_periph *periph); void cam_periph_release(struct cam_periph *periph); +int cam_periph_hold(struct cam_periph *periph, int flags); +void cam_periph_unhold(struct cam_periph *periph); void cam_periph_invalidate(struct cam_periph *periph); int cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo); @@ -175,5 +178,17 @@ void cam_periph_freeze_after_event(stru int cam_periph_error(union ccb *ccb, cam_flags camflags, u_int32_t sense_flags, union ccb *save_ccb); +static __inline void +cam_periph_lock(struct cam_periph *periph) +{ + CAM_SIM_LOCK(periph->sim); +} + +static __inline void +cam_periph_unlock(struct cam_periph *periph) +{ + CAM_SIM_UNLOCK(periph->sim); +} + #endif /* _KERNEL */ #endif /* _CAM_CAM_PERIPH_H */