Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Mar 2009 15:54:41 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 160060 for review
Message-ID:  <200903311554.n2VFsfwr020791@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=160060

Change 160060 by scottl@scottl-deimos on 2009/03/31 15:54:04

	Move cam_ed, cam_et, cam_eb, and cam_path definitions to cam_xpt.h.
	Also move the CAM_DEBUG logic there, as well as some function
	declarations.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/cam.c#6 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_periph.c#26 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#80 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.h#12 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_periph.h#11 edit
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_all.c#8 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/cam.c#6 (text+ko) ====

@@ -46,6 +46,7 @@
 
 #ifdef _KERNEL
 #include <sys/libkern.h>
+#include <cam/cam_queue.h>
 #include <cam/cam_xpt.h>
 #endif
 

==== //depot/projects/scottl-camlock/src/sys/cam/cam_periph.c#26 (text+ko) ====

@@ -48,6 +48,7 @@
 
 #include <cam/cam.h>
 #include <cam/cam_ccb.h>
+#include <cam/cam_queue.h>
 #include <cam/cam_xpt_periph.h>
 #include <cam/cam_periph.h>
 #include <cam/cam_debug.h>

==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#80 (text+ko) ====

@@ -56,6 +56,7 @@
 #include <cam/cam.h>
 #include <cam/cam_ccb.h>
 #include <cam/cam_periph.h>
+#include <cam/cam_queue.h>
 #include <cam/cam_sim.h>
 #include <cam/cam_xpt.h>
 #include <cam/cam_xpt_sim.h>
@@ -79,21 +80,6 @@
 };
 
 /*
- * Definition of an async handler callback block.  These are used to add
- * SIMs and peripherals to the async callback lists.
- */
-struct async_node {
-	SLIST_ENTRY(async_node)	links;
-	u_int32_t	event_enable;	/* Async Event enables */
-	void		(*callback)(void *arg, u_int32_t code,
-				    struct cam_path *path, void *args);
-	void		*callback_arg;
-};
-
-SLIST_HEAD(async_list, async_node);
-SLIST_HEAD(periph_list, cam_periph);
-
-/*
  * This is the maximum number of high powered commands (e.g. start unit)
  * that can be outstanding at a particular time.
  */
@@ -101,112 +87,6 @@
 #define CAM_MAX_HIGHPOWER  4
 #endif
 
-/*
- * Structure for queueing a device in a run queue.
- * There is one run queue for allocating new ccbs,
- * and another for sending ccbs to the controller.
- */
-struct cam_ed_qinfo {
-	cam_pinfo pinfo;
-	struct	  cam_ed *device;
-};
-
-/*
- * The CAM EDT (Existing Device Table) contains the device information for
- * all devices for all busses in the system.  The table contains a
- * cam_ed structure for each device on the bus.
- */
-struct cam_ed {
-	TAILQ_ENTRY(cam_ed) links;
-	struct	cam_ed_qinfo alloc_ccb_entry;
-	struct	cam_ed_qinfo send_ccb_entry;
-	struct	cam_et	 *target;
-	struct	cam_sim  *sim;
-	lun_id_t	 lun_id;
-	struct	camq drvq;		/*
-					 * Queue of type drivers wanting to do
-					 * work on this device.
-					 */
-	struct	cam_ccbq ccbq;		/* Queue of pending ccbs */
-	struct	async_list asyncs;	/* Async callback info for this B/T/L */
-	struct	periph_list periphs;	/* All attached devices */
-	u_int	generation;		/* Generation number */
-	struct	cam_periph *owner;	/* Peripheral driver's ownership tag */
-	struct	xpt_quirk_entry *quirk;	/* Oddities about this device */
-					/* Storage for the inquiry data */
-	cam_proto	 protocol;
-	u_int		 protocol_version;
-	cam_xport	 transport;
-	u_int		 transport_version;
-	struct		 scsi_inquiry_data inq_data;
-	u_int8_t	 inq_flags;	/*
-					 * Current settings for inquiry flags.
-					 * This allows us to override settings
-					 * like disconnection and tagged
-					 * queuing for a device.
-					 */
-	u_int8_t	 queue_flags;	/* Queue flags from the control page */
-	u_int8_t	 serial_num_len;
-	u_int8_t	*serial_num;
-	u_int32_t	 qfrozen_cnt;
-	u_int32_t	 flags;
-#define CAM_DEV_UNCONFIGURED	 	0x01
-#define CAM_DEV_REL_TIMEOUT_PENDING	0x02
-#define CAM_DEV_REL_ON_COMPLETE		0x04
-#define CAM_DEV_REL_ON_QUEUE_EMPTY	0x08
-#define CAM_DEV_RESIZE_QUEUE_NEEDED	0x10
-#define CAM_DEV_TAG_AFTER_COUNT		0x20
-#define CAM_DEV_INQUIRY_DATA_VALID	0x40
-#define	CAM_DEV_IN_DV			0x80
-#define	CAM_DEV_DV_HIT_BOTTOM		0x100
-	u_int32_t	 tag_delay_count;
-#define	CAM_TAG_DELAY_COUNT		5
-	u_int32_t	 tag_saved_openings;
-	u_int32_t	 refcount;
-	struct callout	 callout;
-};
-
-/*
- * Each target is represented by an ET (Existing Target).  These
- * entries are created when a target is successfully probed with an
- * identify, and removed when a device fails to respond after a number
- * of retries, or a bus rescan finds the device missing.
- */
-struct cam_et {
-	TAILQ_HEAD(, cam_ed) ed_entries;
-	TAILQ_ENTRY(cam_et) links;
-	struct	cam_eb	*bus;
-	target_id_t	target_id;
-	u_int32_t	refcount;
-	u_int		generation;
-	struct		timeval last_reset;
-};
-
-/*
- * Each bus is represented by an EB (Existing Bus).  These entries
- * are created by calls to xpt_bus_register and deleted by calls to
- * xpt_bus_deregister.
- */
-struct cam_eb {
-	TAILQ_HEAD(, cam_et) et_entries;
-	TAILQ_ENTRY(cam_eb)  links;
-	path_id_t	     path_id;
-	struct cam_sim	     *sim;
-	struct timeval	     last_reset;
-	u_int32_t	     flags;
-#define	CAM_EB_RUNQ_SCHEDULED	0x01
-	u_int32_t	     refcount;
-	u_int		     generation;
-	device_t	     parent_dev;
-};
-
-struct cam_path {
-	struct cam_periph *periph;
-	struct cam_eb	  *bus;
-	struct cam_et	  *target;
-	struct cam_ed	  *device;
-};
-
 struct xpt_quirk_entry {
 	struct scsi_inquiry_pattern inq_pat;
 	u_int8_t quirks;
@@ -697,7 +577,6 @@
 	.d_name =	"xpt",
 };
 
-
 /* Storage for debugging datastructures */
 #ifdef	CAMDEBUG
 struct cam_path *cam_dpath;
@@ -705,28 +584,6 @@
 u_int32_t cam_debug_delay;
 #endif
 
-#if defined(CAM_DEBUG_FLAGS) && !defined(CAMDEBUG)
-#error "You must have options CAMDEBUG to use options CAM_DEBUG_FLAGS"
-#endif
-
-/*
- * In order to enable the CAM_DEBUG_* options, the user must have CAMDEBUG
- * enabled.  Also, the user must have either none, or all of CAM_DEBUG_BUS,
- * CAM_DEBUG_TARGET, and CAM_DEBUG_LUN specified.
- */
-#if defined(CAM_DEBUG_BUS) || defined(CAM_DEBUG_TARGET) \
-    || defined(CAM_DEBUG_LUN)
-#ifdef CAMDEBUG
-#if !defined(CAM_DEBUG_BUS) || !defined(CAM_DEBUG_TARGET) \
-    || !defined(CAM_DEBUG_LUN)
-#error "You must define all or none of CAM_DEBUG_BUS, CAM_DEBUG_TARGET \
-        and CAM_DEBUG_LUN"
-#endif /* !CAM_DEBUG_BUS || !CAM_DEBUG_TARGET || !CAM_DEBUG_LUN */
-#else /* !CAMDEBUG */
-#error "You must use options CAMDEBUG if you use the CAM_DEBUG_* options"
-#endif /* CAMDEBUG */
-#endif /* CAM_DEBUG_BUS || CAM_DEBUG_TARGET || CAM_DEBUG_LUN */
-
 /* Our boot-time initialization hook */
 static int cam_module_event_handler(module_t, int /*modeventtype_t*/, void *);
 
@@ -742,14 +599,6 @@
 MODULE_VERSION(cam, 1);
 
 
-static cam_status	xpt_compile_path(struct cam_path *new_path,
-					 struct cam_periph *perph,
-					 path_id_t path_id,
-					 target_id_t target_id,
-					 lun_id_t lun_id);
-
-static void		xpt_release_path(struct cam_path *path);
-
 static void		xpt_async_bcast(struct async_list *async_head,
 					u_int32_t async_code,
 					struct cam_path *path,
@@ -854,7 +703,6 @@
 static void	 probedone(struct cam_periph *periph, union ccb *done_ccb);
 static void	 probecleanup(struct cam_periph *periph);
 static void	 xpt_find_quirk(struct cam_ed *device);
-static void	 xpt_devise_transport(struct cam_path *path);
 static void	 xpt_set_transfer_settings(struct ccb_trans_settings *cts,
 					   struct cam_ed *device,
 					   int async_update);
@@ -3993,7 +3841,7 @@
 	return (status);
 }
 
-static cam_status
+cam_status
 xpt_compile_path(struct cam_path *new_path, struct cam_periph *perph,
 		 path_id_t path_id, target_id_t target_id, lun_id_t lun_id)
 {
@@ -4064,7 +3912,7 @@
 	return (status);
 }
 
-static void
+void
 xpt_release_path(struct cam_path *path)
 {
 	CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_release_path\n"));
@@ -6445,7 +6293,7 @@
 }
 
 
-static void
+void
 xpt_devise_transport(struct cam_path *path)
 {
 	struct ccb_pathinq cpi;

==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.h#12 (text+ko) ====

@@ -48,6 +48,149 @@
 
 #ifdef _KERNEL
 
+/*
+ * Definition of an async handler callback block.  These are used to add
+ * SIMs and peripherals to the async callback lists.
+ */
+struct async_node {
+	SLIST_ENTRY(async_node)	links;
+	u_int32_t	event_enable;	/* Async Event enables */
+	void		(*callback)(void *arg, u_int32_t code,
+				    struct cam_path *path, void *args);
+	void		*callback_arg;
+};
+
+SLIST_HEAD(async_list, async_node);
+SLIST_HEAD(periph_list, cam_periph);
+
+/*
+ * Structure for queueing a device in a run queue.
+ * There is one run queue for allocating new ccbs,
+ * and another for sending ccbs to the controller.
+ */
+struct cam_ed_qinfo {
+	cam_pinfo pinfo;
+	struct	  cam_ed *device;
+};
+
+/*
+ * The CAM EDT (Existing Device Table) contains the device information for
+ * all devices for all busses in the system.  The table contains a
+ * cam_ed structure for each device on the bus.
+ */
+struct cam_ed {
+	TAILQ_ENTRY(cam_ed) links;
+	struct	cam_ed_qinfo alloc_ccb_entry;
+	struct	cam_ed_qinfo send_ccb_entry;
+	struct	cam_et	 *target;
+	struct	cam_sim  *sim;
+	lun_id_t	 lun_id;
+	struct	camq drvq;		/*
+					 * Queue of type drivers wanting to do
+					 * work on this device.
+					 */
+	struct	cam_ccbq ccbq;		/* Queue of pending ccbs */
+	struct	async_list asyncs;	/* Async callback info for this B/T/L */
+	struct	periph_list periphs;	/* All attached devices */
+	u_int	generation;		/* Generation number */
+	struct	cam_periph *owner;	/* Peripheral driver's ownership tag */
+	struct	xpt_quirk_entry *quirk;	/* Oddities about this device */
+					/* Storage for the inquiry data */
+	cam_proto	 protocol;
+	u_int		 protocol_version;
+	cam_xport	 transport;
+	u_int		 transport_version;
+	struct		 scsi_inquiry_data inq_data;
+	u_int8_t	 inq_flags;	/*
+					 * Current settings for inquiry flags.
+					 * This allows us to override settings
+					 * like disconnection and tagged
+					 * queuing for a device.
+					 */
+	u_int8_t	 queue_flags;	/* Queue flags from the control page */
+	u_int8_t	 serial_num_len;
+	u_int8_t	*serial_num;
+	u_int32_t	 qfrozen_cnt;
+	u_int32_t	 flags;
+#define CAM_DEV_UNCONFIGURED	 	0x01
+#define CAM_DEV_REL_TIMEOUT_PENDING	0x02
+#define CAM_DEV_REL_ON_COMPLETE		0x04
+#define CAM_DEV_REL_ON_QUEUE_EMPTY	0x08
+#define CAM_DEV_RESIZE_QUEUE_NEEDED	0x10
+#define CAM_DEV_TAG_AFTER_COUNT		0x20
+#define CAM_DEV_INQUIRY_DATA_VALID	0x40
+#define	CAM_DEV_IN_DV			0x80
+#define	CAM_DEV_DV_HIT_BOTTOM		0x100
+	u_int32_t	 tag_delay_count;
+#define	CAM_TAG_DELAY_COUNT		5
+	u_int32_t	 tag_saved_openings;
+	u_int32_t	 refcount;
+	struct callout	 callout;
+};
+
+/*
+ * Each target is represented by an ET (Existing Target).  These
+ * entries are created when a target is successfully probed with an
+ * identify, and removed when a device fails to respond after a number
+ * of retries, or a bus rescan finds the device missing.
+ */
+struct cam_et {
+	TAILQ_HEAD(, cam_ed) ed_entries;
+	TAILQ_ENTRY(cam_et) links;
+	struct	cam_eb	*bus;
+	target_id_t	target_id;
+	u_int32_t	refcount;
+	u_int		generation;
+	struct		timeval last_reset;
+};
+
+/*
+ * Each bus is represented by an EB (Existing Bus).  These entries
+ * are created by calls to xpt_bus_register and deleted by calls to
+ * xpt_bus_deregister.
+ */
+struct cam_eb {
+	TAILQ_HEAD(, cam_et) et_entries;
+	TAILQ_ENTRY(cam_eb)  links;
+	path_id_t	     path_id;
+	struct cam_sim	     *sim;
+	struct timeval	     last_reset;
+	u_int32_t	     flags;
+#define	CAM_EB_RUNQ_SCHEDULED	0x01
+	u_int32_t	     refcount;
+	u_int		     generation;
+	device_t	     parent_dev;
+};
+
+struct cam_path {
+	struct cam_periph *periph;
+	struct cam_eb	  *bus;
+	struct cam_et	  *target;
+	struct cam_ed	  *device;
+};
+
+#if defined(CAM_DEBUG_FLAGS) && !defined(CAMDEBUG)
+#error "You must have options CAMDEBUG to use options CAM_DEBUG_FLAGS"
+#endif
+
+/*
+ * In order to enable the CAM_DEBUG_* options, the user must have CAMDEBUG
+ * enabled.  Also, the user must have either none, or all of CAM_DEBUG_BUS,
+ * CAM_DEBUG_TARGET, and CAM_DEBUG_LUN specified.
+ */
+#if defined(CAM_DEBUG_BUS) || defined(CAM_DEBUG_TARGET) \
+    || defined(CAM_DEBUG_LUN)
+#ifdef CAMDEBUG
+#if !defined(CAM_DEBUG_BUS) || !defined(CAM_DEBUG_TARGET) \
+    || !defined(CAM_DEBUG_LUN)
+#error "You must define all or none of CAM_DEBUG_BUS, CAM_DEBUG_TARGET \
+        and CAM_DEBUG_LUN"
+#endif /* !CAM_DEBUG_BUS || !CAM_DEBUG_TARGET || !CAM_DEBUG_LUN */
+#else /* !CAMDEBUG */
+#error "You must use options CAMDEBUG if you use the CAM_DEBUG_* options"
+#endif /* CAMDEBUG */
+#endif /* CAM_DEBUG_BUS || CAM_DEBUG_TARGET || CAM_DEBUG_LUN */
+
 void			xpt_action(union ccb *new_ccb);
 void			xpt_devise_transport(struct cam_path *path);
 void			xpt_setup_ccb(struct ccb_hdr *ccb_h,

==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_periph.h#11 (text+ko) ====

@@ -33,6 +33,7 @@
 #ifndef _CAM_CAM_XPT_PERIPH_H
 #define _CAM_CAM_XPT_PERIPH_H 1
 
+#include <cam/cam_queue.h>
 #include <cam/cam_xpt.h>
 
 /* Functions accessed by the peripheral drivers */

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_all.c#8 (text+ko) ====

@@ -48,6 +48,7 @@
 
 #include <cam/cam.h>
 #include <cam/cam_ccb.h>
+#include <cam/cam_queue.h>
 #include <cam/cam_xpt.h>
 #include <cam/scsi/scsi_all.h>
 #include <sys/sbuf.h>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903311554.n2VFsfwr020791>