39 /*
40 * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
41 * Need to use the ugly RAID LUN mappings in FCP Annex D
42 * to prevent SCSA from barfing. This *REALLY* needs to
43 * be addressed by the standards committee.
44 */
45 #define RAID_LUNS 1
46
47 #ifdef DEBUG
48 static int sfdebug = 0;
49 #include <sys/debug.h>
50
51 #define SF_DEBUG(level, args) \
52 if (sfdebug >= (level)) sf_log args
53 #else
54 #define SF_DEBUG(level, args)
55 #endif
56
57 static int sf_bus_config_debug = 0;
58
59 /* Why do I have to do this? */
60 #define offsetof(s, m) (size_t)(&(((s *)0)->m))
61
62 #include <sys/scsi/scsi.h>
63 #include <sys/fc4/fcal.h>
64 #include <sys/fc4/fcp.h>
65 #include <sys/fc4/fcal_linkapp.h>
66 #include <sys/socal_cq_defs.h>
67 #include <sys/fc4/fcal_transport.h>
68 #include <sys/fc4/fcio.h>
69 #include <sys/scsi/adapters/sfvar.h>
70 #include <sys/scsi/impl/scsi_reset_notify.h>
71 #include <sys/stat.h>
72 #include <sys/varargs.h>
73 #include <sys/var.h>
74 #include <sys/thread.h>
75 #include <sys/proc.h>
76 #include <sys/kstat.h>
77 #include <sys/devctl.h>
78 #include <sys/scsi/targets/ses.h>
79 #include <sys/callb.h>
80
81 static int sf_info(dev_info_t *, ddi_info_cmd_t, void *, void **);
82 static int sf_attach(dev_info_t *, ddi_attach_cmd_t);
83 static int sf_detach(dev_info_t *, ddi_detach_cmd_t);
84 static void sf_softstate_unlink(struct sf *);
85 static int sf_scsi_bus_config(dev_info_t *parent, uint_t flag,
86 ddi_bus_config_op_t op, void *arg, dev_info_t **childp);
87 static int sf_scsi_bus_unconfig(dev_info_t *parent, uint_t flag,
88 ddi_bus_config_op_t op, void *arg);
89 static int sf_scsi_tgt_init(dev_info_t *, dev_info_t *,
90 scsi_hba_tran_t *, struct scsi_device *);
91 static void sf_scsi_tgt_free(dev_info_t *, dev_info_t *,
92 scsi_hba_tran_t *, struct scsi_device *);
93 static int sf_pkt_alloc_extern(struct sf *, struct sf_pkt *,
94 int, int, int);
95 static void sf_pkt_destroy_extern(struct sf *, struct sf_pkt *);
96 static struct scsi_pkt *sf_scsi_init_pkt(struct scsi_address *,
97 struct scsi_pkt *, struct buf *, int, int, int, int, int (*)(), caddr_t);
98 static void sf_scsi_destroy_pkt(struct scsi_address *, struct scsi_pkt *);
99 static void sf_scsi_dmafree(struct scsi_address *, struct scsi_pkt *);
|
39 /*
40 * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
41 * Need to use the ugly RAID LUN mappings in FCP Annex D
42 * to prevent SCSA from barfing. This *REALLY* needs to
43 * be addressed by the standards committee.
44 */
45 #define RAID_LUNS 1
46
47 #ifdef DEBUG
48 static int sfdebug = 0;
49 #include <sys/debug.h>
50
51 #define SF_DEBUG(level, args) \
52 if (sfdebug >= (level)) sf_log args
53 #else
54 #define SF_DEBUG(level, args)
55 #endif
56
57 static int sf_bus_config_debug = 0;
58
59 #include <sys/scsi/scsi.h>
60 #include <sys/fc4/fcal.h>
61 #include <sys/fc4/fcp.h>
62 #include <sys/fc4/fcal_linkapp.h>
63 #include <sys/socal_cq_defs.h>
64 #include <sys/fc4/fcal_transport.h>
65 #include <sys/fc4/fcio.h>
66 #include <sys/scsi/adapters/sfvar.h>
67 #include <sys/scsi/impl/scsi_reset_notify.h>
68 #include <sys/stat.h>
69 #include <sys/varargs.h>
70 #include <sys/var.h>
71 #include <sys/thread.h>
72 #include <sys/proc.h>
73 #include <sys/kstat.h>
74 #include <sys/devctl.h>
75 #include <sys/scsi/targets/ses.h>
76 #include <sys/callb.h>
77 #include <sys/sysmacros.h>
78
79 static int sf_info(dev_info_t *, ddi_info_cmd_t, void *, void **);
80 static int sf_attach(dev_info_t *, ddi_attach_cmd_t);
81 static int sf_detach(dev_info_t *, ddi_detach_cmd_t);
82 static void sf_softstate_unlink(struct sf *);
83 static int sf_scsi_bus_config(dev_info_t *parent, uint_t flag,
84 ddi_bus_config_op_t op, void *arg, dev_info_t **childp);
85 static int sf_scsi_bus_unconfig(dev_info_t *parent, uint_t flag,
86 ddi_bus_config_op_t op, void *arg);
87 static int sf_scsi_tgt_init(dev_info_t *, dev_info_t *,
88 scsi_hba_tran_t *, struct scsi_device *);
89 static void sf_scsi_tgt_free(dev_info_t *, dev_info_t *,
90 scsi_hba_tran_t *, struct scsi_device *);
91 static int sf_pkt_alloc_extern(struct sf *, struct sf_pkt *,
92 int, int, int);
93 static void sf_pkt_destroy_extern(struct sf *, struct sf_pkt *);
94 static struct scsi_pkt *sf_scsi_init_pkt(struct scsi_address *,
95 struct scsi_pkt *, struct buf *, int, int, int, int, int (*)(), caddr_t);
96 static void sf_scsi_destroy_pkt(struct scsi_address *, struct scsi_pkt *);
97 static void sf_scsi_dmafree(struct scsi_address *, struct scsi_pkt *);
|