Deleted Added
full compact
sbp.c (119556) sbp.c (120660)
1/*
2 * Copyright (c) 2003 Hidetosh Shimokawa
3 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetosh Shimokawa
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 17 unchanged lines hidden (view full) ---

26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
1/*
2 * Copyright (c) 2003 Hidetosh Shimokawa
3 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetosh Shimokawa
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 17 unchanged lines hidden (view full) ---

26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 * $FreeBSD: head/sys/dev/firewire/sbp.c 119556 2003-08-29 13:36:17Z simokawa $
34 * $FreeBSD: head/sys/dev/firewire/sbp.c 120660 2003-10-02 04:06:56Z simokawa $
35 *
36 */
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/module.h>
41#include <sys/bus.h>
42#include <sys/sysctl.h>

--- 18 unchanged lines hidden (view full) ---

61#include <cam/scsi/scsi_all.h>
62
63#include <sys/kernel.h>
64
65#include <dev/firewire/firewire.h>
66#include <dev/firewire/firewirereg.h>
67#include <dev/firewire/fwdma.h>
68#include <dev/firewire/iec13213.h>
35 *
36 */
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/module.h>
41#include <sys/bus.h>
42#include <sys/sysctl.h>

--- 18 unchanged lines hidden (view full) ---

61#include <cam/scsi/scsi_all.h>
62
63#include <sys/kernel.h>
64
65#include <dev/firewire/firewire.h>
66#include <dev/firewire/firewirereg.h>
67#include <dev/firewire/fwdma.h>
68#include <dev/firewire/iec13213.h>
69#include <dev/firewire/sbp.h>
69
70#define ccb_sdev_ptr spriv_ptr0
71#define ccb_sbp_ptr spriv_ptr1
72
73#define SBP_NUM_TARGETS 8 /* MAX 64 */
74#define SBP_NUM_LUNS 8 /* limited by CAM_SCSI2_MAXLUN in cam_xpt.c */
75#define SBP_DMA_SIZE PAGE_SIZE
76#define SBP_LOGIN_SIZE sizeof(struct sbp_login_res)
77#define SBP_QUEUE_LEN ((SBP_DMA_SIZE - SBP_LOGIN_SIZE) / sizeof(struct sbp_ocb))
78#define SBP_NUM_OCB (SBP_QUEUE_LEN * SBP_NUM_TARGETS)
79
70
71#define ccb_sdev_ptr spriv_ptr0
72#define ccb_sbp_ptr spriv_ptr1
73
74#define SBP_NUM_TARGETS 8 /* MAX 64 */
75#define SBP_NUM_LUNS 8 /* limited by CAM_SCSI2_MAXLUN in cam_xpt.c */
76#define SBP_DMA_SIZE PAGE_SIZE
77#define SBP_LOGIN_SIZE sizeof(struct sbp_login_res)
78#define SBP_QUEUE_LEN ((SBP_DMA_SIZE - SBP_LOGIN_SIZE) / sizeof(struct sbp_ocb))
79#define SBP_NUM_OCB (SBP_QUEUE_LEN * SBP_NUM_TARGETS)
80
80#define SBP_INITIATOR 7
81
82#define LOGIN_DELAY 2
83
84/*
85 * STATUS FIFO addressing
86 * bit
87 * -----------------------
88 * 0- 1( 2): 0 (alingment)
89 * 2- 7( 6): target
90 * 8-15( 8): lun
81/*
82 * STATUS FIFO addressing
83 * bit
84 * -----------------------
85 * 0- 1( 2): 0 (alingment)
86 * 2- 7( 6): target
87 * 8-15( 8): lun
91 * 16-23( 8): unit
92 * 24-31( 8): reserved
88 * 16-31( 8): reserved
93 * 32-47(16): SBP_BIND_HI
94 * 48-64(16): bus_id, node_id
95 */
96#define SBP_BIND_HI 0x1
89 * 32-47(16): SBP_BIND_HI
90 * 48-64(16): bus_id, node_id
91 */
92#define SBP_BIND_HI 0x1
97#define SBP_DEV2ADDR(u, t, l) \
98 ((((u) & 0xff) << 16) | (((l) & 0xff) << 8) | (((t) & 0x3f) << 2))
93#define SBP_DEV2ADDR(t, l) \
94 (((u_int64_t)SBP_BIND_HI << 32) \
95 | (((l) & 0xff) << 8) \
96 | (((t) & 0x3f) << 2))
99#define SBP_ADDR2TRG(a) (((a) >> 2) & 0x3f)
100#define SBP_ADDR2LUN(a) (((a) >> 8) & 0xff)
97#define SBP_ADDR2TRG(a) (((a) >> 2) & 0x3f)
98#define SBP_ADDR2LUN(a) (((a) >> 8) & 0xff)
99#define SBP_INITIATOR 7
101
100
102#define ORB_NOTIFY (1 << 31)
103#define ORB_FMT_STD (0 << 29)
104#define ORB_FMT_VED (2 << 29)
105#define ORB_FMT_NOP (3 << 29)
106#define ORB_FMT_MSK (3 << 29)
107#define ORB_EXV (1 << 28)
108/* */
109#define ORB_CMD_IN (1 << 27)
110/* */
111#define ORB_CMD_SPD(x) ((x) << 24)
112#define ORB_CMD_MAXP(x) ((x) << 20)
113#define ORB_RCN_TMO(x) ((x) << 20)
114#define ORB_CMD_PTBL (1 << 19)
115#define ORB_CMD_PSZ(x) ((x) << 16)
101#define LOGIN_DELAY 1
116
102
117#define ORB_FUN_LGI (0 << 16)
118#define ORB_FUN_QLG (1 << 16)
119#define ORB_FUN_RCN (3 << 16)
120#define ORB_FUN_LGO (7 << 16)
121#define ORB_FUN_ATA (0xb << 16)
122#define ORB_FUN_ATS (0xc << 16)
123#define ORB_FUN_LUR (0xe << 16)
124#define ORB_FUN_RST (0xf << 16)
125#define ORB_FUN_MSK (0xf << 16)
126#define ORB_FUN_RUNQUEUE 0xffff
127
128static char *orb_fun_name[] = {
103static char *orb_fun_name[] = {
129 /* 0 */ "LOGIN",
130 /* 1 */ "QUERY LOGINS",
131 /* 2 */ "Reserved",
132 /* 3 */ "RECONNECT",
133 /* 4 */ "SET PASSWORD",
134 /* 5 */ "Reserved",
135 /* 6 */ "Reserved",
136 /* 7 */ "LOGOUT",
137 /* 8 */ "Reserved",
138 /* 9 */ "Reserved",
139 /* A */ "Reserved",
140 /* B */ "ABORT TASK",
141 /* C */ "ABORT TASK SET",
142 /* D */ "Reserved",
143 /* E */ "LOGICAL UNIT RESET",
144 /* F */ "TARGET RESET"
104 ORB_FUN_NAMES
145};
146
105};
106
147#define ORB_RES_CMPL 0
148#define ORB_RES_FAIL 1
149#define ORB_RES_ILLE 2
150#define ORB_RES_VEND 3
151
152static int debug = 0;
153static int auto_login = 1;
154static int max_speed = 2;
155static int sbp_cold = 1;
156
157SYSCTL_DECL(_hw_firewire);
158SYSCTL_NODE(_hw_firewire, OID_AUTO, sbp, CTLFLAG_RD, 0, "SBP-II Subsystem");
159SYSCTL_INT(_debug, OID_AUTO, sbp_debug, CTLFLAG_RW, &debug, 0,
160 "SBP debug flag");
161SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, auto_login, CTLFLAG_RW, &auto_login, 0,
162 "SBP perform login automatically");
163SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, max_speed, CTLFLAG_RW, &max_speed, 0,
164 "SBP transfer max speed");
165
107static int debug = 0;
108static int auto_login = 1;
109static int max_speed = 2;
110static int sbp_cold = 1;
111
112SYSCTL_DECL(_hw_firewire);
113SYSCTL_NODE(_hw_firewire, OID_AUTO, sbp, CTLFLAG_RD, 0, "SBP-II Subsystem");
114SYSCTL_INT(_debug, OID_AUTO, sbp_debug, CTLFLAG_RW, &debug, 0,
115 "SBP debug flag");
116SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, auto_login, CTLFLAG_RW, &auto_login, 0,
117 "SBP perform login automatically");
118SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, max_speed, CTLFLAG_RW, &max_speed, 0,
119 "SBP transfer max speed");
120
166#define SBP_DEBUG(x) if (debug > x) {
167#define END_DEBUG }
168
169#define NEED_RESPONSE 0
170
121#define NEED_RESPONSE 0
122
171struct ind_ptr {
172 u_int32_t hi,lo;
173};
174#define SBP_SEG_MAX rounddown(0xffff, PAGE_SIZE)
175#ifdef __sparc64__ /* iommu */
176#define SBP_IND_MAX howmany(MAXPHYS, SBP_SEG_MAX)
177#else
178#define SBP_IND_MAX howmany(MAXPHYS, PAGE_SIZE)
179#endif
180struct sbp_ocb {
181 STAILQ_ENTRY(sbp_ocb) ocb;
182 union ccb *ccb;
183 bus_addr_t bus_addr;
123#define SBP_SEG_MAX rounddown(0xffff, PAGE_SIZE)
124#ifdef __sparc64__ /* iommu */
125#define SBP_IND_MAX howmany(MAXPHYS, SBP_SEG_MAX)
126#else
127#define SBP_IND_MAX howmany(MAXPHYS, PAGE_SIZE)
128#endif
129struct sbp_ocb {
130 STAILQ_ENTRY(sbp_ocb) ocb;
131 union ccb *ccb;
132 bus_addr_t bus_addr;
184 volatile u_int32_t orb[8];
133 u_int32_t orb[8];
185#define IND_PTR_OFFSET (8*sizeof(u_int32_t))
134#define IND_PTR_OFFSET (8*sizeof(u_int32_t))
186 volatile struct ind_ptr ind_ptr[SBP_IND_MAX];
135 struct ind_ptr ind_ptr[SBP_IND_MAX];
187 struct sbp_dev *sdev;
188 int flags; /* XXX should be removed */
189 bus_dmamap_t dmamap;
190};
191
192#define OCB_ACT_MGM 0
193#define OCB_ACT_CMD 1
194#define OCB_MATCH(o,s) ((o)->bus_addr == ntohl((s)->orb_lo))
195
136 struct sbp_dev *sdev;
137 int flags; /* XXX should be removed */
138 bus_dmamap_t dmamap;
139};
140
141#define OCB_ACT_MGM 0
142#define OCB_ACT_CMD 1
143#define OCB_MATCH(o,s) ((o)->bus_addr == ntohl((s)->orb_lo))
144
196#define SBP_RECV_LEN (16 + 32) /* header + payload */
197
198struct sbp_login_res{
199 u_int16_t len;
200 u_int16_t id;
201 u_int16_t res0;
202 u_int16_t cmd_hi;
203 u_int32_t cmd_lo;
204 u_int16_t res1;
205 u_int16_t recon_hold;
206};
207struct sbp_status{
208#if BYTE_ORDER == BIG_ENDIAN
209 u_int8_t src:2,
210 resp:2,
211 dead:1,
212 len:3;
213#else
214 u_int8_t len:3,
215 dead:1,
216 resp:2,
217 src:2;
218#endif
219 u_int8_t status;
220 u_int16_t orb_hi;
221 u_int32_t orb_lo;
222 u_int32_t data[6];
223};
224struct sbp_cmd_status{
225#define SBP_SFMT_CURR 0
226#define SBP_SFMT_DEFER 1
227#if BYTE_ORDER == BIG_ENDIAN
228 u_int8_t sfmt:2,
229 status:6;
230 u_int8_t valid:1,
231 mark:1,
232 eom:1,
233 ill_len:1,
234 s_key:4;
235#else
236 u_int8_t status:6,
237 sfmt:2;
238 u_int8_t s_key:4,
239 ill_len:1,
240 eom:1,
241 mark:1,
242 valid:1;
243#endif
244 u_int8_t s_code;
245 u_int8_t s_qlfr;
246 u_int32_t info;
247 u_int32_t cdb;
248 u_int8_t fru;
249 u_int8_t s_keydep[3];
250 u_int32_t vend[2];
251};
252
253struct sbp_dev{
254#define SBP_DEV_RESET 0 /* accept login */
255#define SBP_DEV_LOGIN 1 /* to login */
256#if 0
257#define SBP_DEV_RECONN 2 /* to reconnect */
258#endif
259#define SBP_DEV_TOATTACH 3 /* to attach */
260#define SBP_DEV_PROBE 4 /* scan lun */

--- 23 unchanged lines hidden (view full) ---

284 int num_lun;
285 struct sbp_dev *luns;
286 struct sbp_softc *sbp;
287 struct fw_device *fwdev;
288 u_int32_t mgm_hi, mgm_lo;
289 struct sbp_ocb *mgm_ocb_cur;
290 STAILQ_HEAD(, sbp_ocb) mgm_ocb_queue;
291 struct callout mgm_ocb_timeout;
145struct sbp_dev{
146#define SBP_DEV_RESET 0 /* accept login */
147#define SBP_DEV_LOGIN 1 /* to login */
148#if 0
149#define SBP_DEV_RECONN 2 /* to reconnect */
150#endif
151#define SBP_DEV_TOATTACH 3 /* to attach */
152#define SBP_DEV_PROBE 4 /* scan lun */

--- 23 unchanged lines hidden (view full) ---

176 int num_lun;
177 struct sbp_dev *luns;
178 struct sbp_softc *sbp;
179 struct fw_device *fwdev;
180 u_int32_t mgm_hi, mgm_lo;
181 struct sbp_ocb *mgm_ocb_cur;
182 STAILQ_HEAD(, sbp_ocb) mgm_ocb_queue;
183 struct callout mgm_ocb_timeout;
292#define SCAN_DELAY 2
184#define SCAN_DELAY 1
293 struct callout scan_callout;
294 STAILQ_HEAD(, fw_xfer) xferlist;
295 int n_xfer;
296};
297
298struct sbp_softc {
299 struct firewire_dev_comm fd;
300 struct cam_sim *sim;

--- 100 unchanged lines hidden (view full) ---

401 printf("sbp_probe\n");
402END_DEBUG
403
404 pa = device_get_parent(dev);
405 if(device_get_unit(dev) != device_get_unit(pa)){
406 return(ENXIO);
407 }
408
185 struct callout scan_callout;
186 STAILQ_HEAD(, fw_xfer) xferlist;
187 int n_xfer;
188};
189
190struct sbp_softc {
191 struct firewire_dev_comm fd;
192 struct cam_sim *sim;

--- 100 unchanged lines hidden (view full) ---

293 printf("sbp_probe\n");
294END_DEBUG
295
296 pa = device_get_parent(dev);
297 if(device_get_unit(dev) != device_get_unit(pa)){
298 return(ENXIO);
299 }
300
409 device_set_desc(dev, "SBP2/SCSI over firewire");
301 device_set_desc(dev, "SBP-2/SCSI over FireWire");
410
411 if (bootverbose)
412 debug = bootverbose;
413 return (0);
414}
415
416static void
417sbp_show_sdev_info(struct sbp_dev *sdev, int new)

--- 456 unchanged lines hidden (view full) ---

874
875SBP_DEBUG(0)
876 sbp_show_sdev_info(sdev, 2);
877 printf("sbp_reset_start\n");
878END_DEBUG
879
880 xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0);
881 xfer->act.hand = sbp_reset_start_callback;
302
303 if (bootverbose)
304 debug = bootverbose;
305 return (0);
306}
307
308static void
309sbp_show_sdev_info(struct sbp_dev *sdev, int new)

--- 456 unchanged lines hidden (view full) ---

766
767SBP_DEBUG(0)
768 sbp_show_sdev_info(sdev, 2);
769 printf("sbp_reset_start\n");
770END_DEBUG
771
772 xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0);
773 xfer->act.hand = sbp_reset_start_callback;
882 fp = (struct fw_pkt *)xfer->send.buf;
774 fp = &xfer->send.hdr;
883 fp->mode.wreqq.dest_hi = 0xffff;
884 fp->mode.wreqq.dest_lo = 0xf0000000 | RESET_START;
885 fp->mode.wreqq.data = htonl(0xf);
886 fw_asyreq(xfer->fc, -1, xfer);
887}
888
889static void
890sbp_mgm_callback(struct fw_xfer *xfer)

--- 161 unchanged lines hidden (view full) ---

1052static void
1053sbp_agent_reset_callback(struct fw_xfer *xfer)
1054{
1055 struct sbp_dev *sdev;
1056
1057 sdev = (struct sbp_dev *)xfer->sc;
1058SBP_DEBUG(1)
1059 sbp_show_sdev_info(sdev, 2);
775 fp->mode.wreqq.dest_hi = 0xffff;
776 fp->mode.wreqq.dest_lo = 0xf0000000 | RESET_START;
777 fp->mode.wreqq.data = htonl(0xf);
778 fw_asyreq(xfer->fc, -1, xfer);
779}
780
781static void
782sbp_mgm_callback(struct fw_xfer *xfer)

--- 161 unchanged lines hidden (view full) ---

944static void
945sbp_agent_reset_callback(struct fw_xfer *xfer)
946{
947 struct sbp_dev *sdev;
948
949 sdev = (struct sbp_dev *)xfer->sc;
950SBP_DEBUG(1)
951 sbp_show_sdev_info(sdev, 2);
1060 printf("sbp_cmd_callback\n");
952 printf("%s\n", __FUNCTION__);
1061END_DEBUG
1062 if (xfer->resp != 0) {
1063 sbp_show_sdev_info(sdev, 2);
1064 printf("sbp_cmd_callback resp=%d\n", xfer->resp);
1065 }
1066
1067 sbp_xfer_free(xfer);
1068 if (sdev->path) {

--- 14 unchanged lines hidden (view full) ---

1083END_DEBUG
1084 xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0x04);
1085 if (xfer == NULL)
1086 return;
1087 if (sdev->status == SBP_DEV_ATTACHED || sdev->status == SBP_DEV_PROBE)
1088 xfer->act.hand = sbp_agent_reset_callback;
1089 else
1090 xfer->act.hand = sbp_do_attach;
953END_DEBUG
954 if (xfer->resp != 0) {
955 sbp_show_sdev_info(sdev, 2);
956 printf("sbp_cmd_callback resp=%d\n", xfer->resp);
957 }
958
959 sbp_xfer_free(xfer);
960 if (sdev->path) {

--- 14 unchanged lines hidden (view full) ---

975END_DEBUG
976 xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0x04);
977 if (xfer == NULL)
978 return;
979 if (sdev->status == SBP_DEV_ATTACHED || sdev->status == SBP_DEV_PROBE)
980 xfer->act.hand = sbp_agent_reset_callback;
981 else
982 xfer->act.hand = sbp_do_attach;
1091 fp = (struct fw_pkt *)xfer->send.buf;
983 fp = &xfer->send.hdr;
1092 fp->mode.wreqq.data = htonl(0xf);
1093 fw_asyreq(xfer->fc, -1, xfer);
1094 sbp_abort_all_ocbs(sdev, CAM_BDR_SENT);
1095}
1096
1097static void
1098sbp_busy_timeout_callback(struct fw_xfer *xfer)
1099{

--- 15 unchanged lines hidden (view full) ---

1115 struct fw_xfer *xfer;
1116SBP_DEBUG(0)
1117 sbp_show_sdev_info(sdev, 2);
1118 printf("sbp_busy_timeout\n");
1119END_DEBUG
1120 xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0);
1121
1122 xfer->act.hand = sbp_busy_timeout_callback;
984 fp->mode.wreqq.data = htonl(0xf);
985 fw_asyreq(xfer->fc, -1, xfer);
986 sbp_abort_all_ocbs(sdev, CAM_BDR_SENT);
987}
988
989static void
990sbp_busy_timeout_callback(struct fw_xfer *xfer)
991{

--- 15 unchanged lines hidden (view full) ---

1007 struct fw_xfer *xfer;
1008SBP_DEBUG(0)
1009 sbp_show_sdev_info(sdev, 2);
1010 printf("sbp_busy_timeout\n");
1011END_DEBUG
1012 xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0);
1013
1014 xfer->act.hand = sbp_busy_timeout_callback;
1123 fp = (struct fw_pkt *)xfer->send.buf;
1015 fp = &xfer->send.hdr;
1124 fp->mode.wreqq.dest_hi = 0xffff;
1125 fp->mode.wreqq.dest_lo = 0xf0000000 | BUSY_TIMEOUT;
1126 fp->mode.wreqq.data = htonl((1 << (13+12)) | 0xf);
1127 fw_asyreq(xfer->fc, -1, xfer);
1128}
1129
1130static void
1131sbp_orb_pointer(struct sbp_dev *sdev, struct sbp_ocb *ocb)

--- 5 unchanged lines hidden (view full) ---

1137 printf("sbp_orb_pointer\n");
1138END_DEBUG
1139
1140 xfer = sbp_write_cmd(sdev, FWTCODE_WREQB, 0x08);
1141 if (xfer == NULL)
1142 return;
1143 xfer->act.hand = sbp_cmd_callback;
1144
1016 fp->mode.wreqq.dest_hi = 0xffff;
1017 fp->mode.wreqq.dest_lo = 0xf0000000 | BUSY_TIMEOUT;
1018 fp->mode.wreqq.data = htonl((1 << (13+12)) | 0xf);
1019 fw_asyreq(xfer->fc, -1, xfer);
1020}
1021
1022static void
1023sbp_orb_pointer(struct sbp_dev *sdev, struct sbp_ocb *ocb)

--- 5 unchanged lines hidden (view full) ---

1029 printf("sbp_orb_pointer\n");
1030END_DEBUG
1031
1032 xfer = sbp_write_cmd(sdev, FWTCODE_WREQB, 0x08);
1033 if (xfer == NULL)
1034 return;
1035 xfer->act.hand = sbp_cmd_callback;
1036
1145 fp = (struct fw_pkt *)xfer->send.buf;
1037 fp = &xfer->send.hdr;
1146 fp->mode.wreqb.len = 8;
1147 fp->mode.wreqb.extcode = 0;
1038 fp->mode.wreqb.len = 8;
1039 fp->mode.wreqb.extcode = 0;
1148 fp->mode.wreqb.payload[0] =
1040 xfer->send.payload[0] =
1149 htonl(((sdev->target->sbp->fd.fc->nodeid | FWLOCALBUS )<< 16));
1041 htonl(((sdev->target->sbp->fd.fc->nodeid | FWLOCALBUS )<< 16));
1150 fp->mode.wreqb.payload[1] = htonl(ocb->bus_addr);
1042 xfer->send.payload[1] = htonl(ocb->bus_addr);
1151
1152 if(fw_asyreq(xfer->fc, -1, xfer) != 0){
1153 sbp_xfer_free(xfer);
1154 ocb->ccb->ccb_h.status = CAM_REQ_INVALID;
1155 xpt_done(ocb->ccb);
1156 }
1157}
1158

--- 30 unchanged lines hidden (view full) ---

1189 s = splfw();
1190 xfer = STAILQ_FIRST(&target->xferlist);
1191 if (xfer == NULL) {
1192 if (target->n_xfer > 5 /* XXX */) {
1193 printf("sbp: no more xfer for this target\n");
1194 splx(s);
1195 return(NULL);
1196 }
1043
1044 if(fw_asyreq(xfer->fc, -1, xfer) != 0){
1045 sbp_xfer_free(xfer);
1046 ocb->ccb->ccb_h.status = CAM_REQ_INVALID;
1047 xpt_done(ocb->ccb);
1048 }
1049}
1050

--- 30 unchanged lines hidden (view full) ---

1081 s = splfw();
1082 xfer = STAILQ_FIRST(&target->xferlist);
1083 if (xfer == NULL) {
1084 if (target->n_xfer > 5 /* XXX */) {
1085 printf("sbp: no more xfer for this target\n");
1086 splx(s);
1087 return(NULL);
1088 }
1197 xfer = fw_xfer_alloc_buf(M_SBP, 24, 12);
1089 xfer = fw_xfer_alloc_buf(M_SBP, 8, 0);
1198 if(xfer == NULL){
1199 printf("sbp: fw_xfer_alloc_buf failed\n");
1200 splx(s);
1201 return NULL;
1202 }
1203 target->n_xfer ++;
1204 if (debug)
1205 printf("sbp: alloc %d xfer\n", target->n_xfer);
1206 new = 1;
1207 } else {
1208 STAILQ_REMOVE_HEAD(&target->xferlist, link);
1209 }
1210 splx(s);
1211
1212 microtime(&xfer->tv);
1213
1090 if(xfer == NULL){
1091 printf("sbp: fw_xfer_alloc_buf failed\n");
1092 splx(s);
1093 return NULL;
1094 }
1095 target->n_xfer ++;
1096 if (debug)
1097 printf("sbp: alloc %d xfer\n", target->n_xfer);
1098 new = 1;
1099 } else {
1100 STAILQ_REMOVE_HEAD(&target->xferlist, link);
1101 }
1102 splx(s);
1103
1104 microtime(&xfer->tv);
1105
1214 if (tcode == FWTCODE_WREQQ)
1215 xfer->send.len = 16;
1216 else
1217 xfer->send.len = 24;
1218 xfer->recv.len = 12;
1219
1220 if (new) {
1106 if (new) {
1221 xfer->spd = min(sdev->target->fwdev->speed, max_speed);
1107 xfer->recv.pay_len = 0;
1108 xfer->send.spd = min(sdev->target->fwdev->speed, max_speed);
1222 xfer->fc = sdev->target->sbp->fd.fc;
1223 xfer->retry_req = fw_asybusy;
1224 }
1109 xfer->fc = sdev->target->sbp->fd.fc;
1110 xfer->retry_req = fw_asybusy;
1111 }
1112
1113 if (tcode == FWTCODE_WREQB)
1114 xfer->send.pay_len = 8;
1115 else
1116 xfer->send.pay_len = 0;
1117
1225 xfer->sc = (caddr_t)sdev;
1118 xfer->sc = (caddr_t)sdev;
1226 fp = (struct fw_pkt *)xfer->send.buf;
1119 fp = &xfer->send.hdr;
1227 fp->mode.wreqq.dest_hi = sdev->login->cmd_hi;
1228 fp->mode.wreqq.dest_lo = sdev->login->cmd_lo + offset;
1229 fp->mode.wreqq.tlrt = 0;
1230 fp->mode.wreqq.tcode = tcode;
1231 fp->mode.wreqq.pri = 0;
1120 fp->mode.wreqq.dest_hi = sdev->login->cmd_hi;
1121 fp->mode.wreqq.dest_lo = sdev->login->cmd_lo + offset;
1122 fp->mode.wreqq.tlrt = 0;
1123 fp->mode.wreqq.tcode = tcode;
1124 fp->mode.wreqq.pri = 0;
1232 xfer->dst = FWLOCALBUS | sdev->target->fwdev->dst;
1233 fp->mode.wreqq.dst = xfer->dst;
1125 fp->mode.wreqq.dst = FWLOCALBUS | sdev->target->fwdev->dst;
1234
1235 return xfer;
1236
1237}
1238
1239static void
1240sbp_mgm_orb(struct sbp_dev *sdev, int func, struct sbp_ocb *aocb)
1241{

--- 18 unchanged lines hidden (view full) ---

1260 }
1261 if ((ocb = sbp_get_ocb(sdev)) == NULL) {
1262 splx(s);
1263 return;
1264 }
1265 ocb->flags = OCB_ACT_MGM;
1266 ocb->sdev = sdev;
1267
1126
1127 return xfer;
1128
1129}
1130
1131static void
1132sbp_mgm_orb(struct sbp_dev *sdev, int func, struct sbp_ocb *aocb)
1133{

--- 18 unchanged lines hidden (view full) ---

1152 }
1153 if ((ocb = sbp_get_ocb(sdev)) == NULL) {
1154 splx(s);
1155 return;
1156 }
1157 ocb->flags = OCB_ACT_MGM;
1158 ocb->sdev = sdev;
1159
1268 bzero((void *)(uintptr_t)(volatile void *)ocb->orb, sizeof(ocb->orb));
1160 bzero((void *)ocb->orb, sizeof(ocb->orb));
1269 ocb->orb[6] = htonl((nid << 16) | SBP_BIND_HI);
1161 ocb->orb[6] = htonl((nid << 16) | SBP_BIND_HI);
1270 ocb->orb[7] = htonl(SBP_DEV2ADDR(
1271 device_get_unit(target->sbp->fd.dev),
1272 target->target_id,
1273 sdev->lun_id));
1162 ocb->orb[7] = htonl(SBP_DEV2ADDR(target->target_id, sdev->lun_id));
1274
1275SBP_DEBUG(0)
1276 sbp_show_sdev_info(sdev, 2);
1277 printf("%s\n", orb_fun_name[(func>>16)&0xf]);
1278END_DEBUG
1279 switch (func) {
1280 case ORB_FUN_LGI:
1163
1164SBP_DEBUG(0)
1165 sbp_show_sdev_info(sdev, 2);
1166 printf("%s\n", orb_fun_name[(func>>16)&0xf]);
1167END_DEBUG
1168 switch (func) {
1169 case ORB_FUN_LGI:
1170 ocb->orb[0] = ocb->orb[1] = 0; /* password */
1281 ocb->orb[2] = htonl(nid << 16);
1282 ocb->orb[3] = htonl(sdev->dma.bus_addr);
1283 ocb->orb[4] = htonl(ORB_NOTIFY | ORB_EXV | sdev->lun_id);
1284 ocb->orb[5] = htonl(SBP_LOGIN_SIZE);
1285 fwdma_sync(&sdev->dma, BUS_DMASYNC_PREREAD);
1286 break;
1287 case ORB_FUN_ATA:
1288 ocb->orb[0] = htonl((0 << 16) | 0);

--- 21 unchanged lines hidden (view full) ---

1310 callout_reset(&target->mgm_ocb_timeout, 5*hz,
1311 sbp_mgm_timeout, (caddr_t)ocb);
1312 xfer = sbp_write_cmd(sdev, FWTCODE_WREQB, 0);
1313 if(xfer == NULL){
1314 return;
1315 }
1316 xfer->act.hand = sbp_mgm_callback;
1317
1171 ocb->orb[2] = htonl(nid << 16);
1172 ocb->orb[3] = htonl(sdev->dma.bus_addr);
1173 ocb->orb[4] = htonl(ORB_NOTIFY | ORB_EXV | sdev->lun_id);
1174 ocb->orb[5] = htonl(SBP_LOGIN_SIZE);
1175 fwdma_sync(&sdev->dma, BUS_DMASYNC_PREREAD);
1176 break;
1177 case ORB_FUN_ATA:
1178 ocb->orb[0] = htonl((0 << 16) | 0);

--- 21 unchanged lines hidden (view full) ---

1200 callout_reset(&target->mgm_ocb_timeout, 5*hz,
1201 sbp_mgm_timeout, (caddr_t)ocb);
1202 xfer = sbp_write_cmd(sdev, FWTCODE_WREQB, 0);
1203 if(xfer == NULL){
1204 return;
1205 }
1206 xfer->act.hand = sbp_mgm_callback;
1207
1318 fp = (struct fw_pkt *)xfer->send.buf;
1208 fp = &xfer->send.hdr;
1319 fp->mode.wreqb.dest_hi = sdev->target->mgm_hi;
1320 fp->mode.wreqb.dest_lo = sdev->target->mgm_lo;
1321 fp->mode.wreqb.len = 8;
1322 fp->mode.wreqb.extcode = 0;
1209 fp->mode.wreqb.dest_hi = sdev->target->mgm_hi;
1210 fp->mode.wreqb.dest_lo = sdev->target->mgm_lo;
1211 fp->mode.wreqb.len = 8;
1212 fp->mode.wreqb.extcode = 0;
1323 fp->mode.wreqb.payload[0] = htonl(nid << 16);
1324 fp->mode.wreqb.payload[1] = htonl(ocb->bus_addr);
1213 xfer->send.payload[0] = htonl(nid << 16);
1214 xfer->send.payload[1] = htonl(ocb->bus_addr & 0xffffffff);
1215SBP_DEBUG(0)
1216 sbp_show_sdev_info(sdev, 2);
1217 printf("mgm orb: %08x\n", (u_int32_t)ocb->bus_addr);
1218END_DEBUG
1325
1326 fw_asyreq(xfer->fc, -1, xfer);
1327}
1328
1329static void
1330sbp_print_scsi_cmd(struct sbp_ocb *ocb)
1331{
1332 struct ccb_scsiio *csio;

--- 171 unchanged lines hidden (view full) ---

1504/*
1505 u_int32_t *ld;
1506 ld = xfer->recv.buf;
1507printf("sbp %x %d %d %08x %08x %08x %08x\n",
1508 xfer->resp, xfer->recv.len, xfer->recv.off, ntohl(ld[0]), ntohl(ld[1]), ntohl(ld[2]), ntohl(ld[3]));
1509printf("sbp %08x %08x %08x %08x\n", ntohl(ld[4]), ntohl(ld[5]), ntohl(ld[6]), ntohl(ld[7]));
1510printf("sbp %08x %08x %08x %08x\n", ntohl(ld[8]), ntohl(ld[9]), ntohl(ld[10]), ntohl(ld[11]));
1511*/
1219
1220 fw_asyreq(xfer->fc, -1, xfer);
1221}
1222
1223static void
1224sbp_print_scsi_cmd(struct sbp_ocb *ocb)
1225{
1226 struct ccb_scsiio *csio;

--- 171 unchanged lines hidden (view full) ---

1398/*
1399 u_int32_t *ld;
1400 ld = xfer->recv.buf;
1401printf("sbp %x %d %d %08x %08x %08x %08x\n",
1402 xfer->resp, xfer->recv.len, xfer->recv.off, ntohl(ld[0]), ntohl(ld[1]), ntohl(ld[2]), ntohl(ld[3]));
1403printf("sbp %08x %08x %08x %08x\n", ntohl(ld[4]), ntohl(ld[5]), ntohl(ld[6]), ntohl(ld[7]));
1404printf("sbp %08x %08x %08x %08x\n", ntohl(ld[8]), ntohl(ld[9]), ntohl(ld[10]), ntohl(ld[11]));
1405*/
1512
1513 sbp = (struct sbp_softc *)xfer->sc;
1406 sbp = (struct sbp_softc *)xfer->sc;
1514 if(xfer->resp != 0){
1407 if (xfer->resp != 0){
1515 printf("sbp_recv: xfer->resp != 0\n");
1516 goto done0;
1517 }
1408 printf("sbp_recv: xfer->resp != 0\n");
1409 goto done0;
1410 }
1518 if(xfer->recv.buf == NULL){
1519 printf("sbp_recv: xfer->recv.buf == NULL\n");
1411 if (xfer->recv.payload == NULL){
1412 printf("sbp_recv: xfer->recv.payload == NULL\n");
1520 goto done0;
1521 }
1413 goto done0;
1414 }
1522 sbp = (struct sbp_softc *)xfer->sc;
1523 rfp = (struct fw_pkt *)xfer->recv.buf;
1415 rfp = &xfer->recv.hdr;
1524 if(rfp->mode.wreqb.tcode != FWTCODE_WREQB){
1525 printf("sbp_recv: tcode = %d\n", rfp->mode.wreqb.tcode);
1526 goto done0;
1527 }
1416 if(rfp->mode.wreqb.tcode != FWTCODE_WREQB){
1417 printf("sbp_recv: tcode = %d\n", rfp->mode.wreqb.tcode);
1418 goto done0;
1419 }
1528 sbp_status = (struct sbp_status *)rfp->mode.wreqb.payload;
1420 sbp_status = (struct sbp_status *)xfer->recv.payload;
1529 addr = rfp->mode.wreqb.dest_lo;
1530SBP_DEBUG(2)
1531 printf("received address 0x%x\n", addr);
1532END_DEBUG
1533 t = SBP_ADDR2TRG(addr);
1534 if (t >= SBP_NUM_TARGETS) {
1535 device_printf(sbp->fd.dev,
1536 "sbp_recv1: invalid target %d\n", t);

--- 206 unchanged lines hidden (view full) ---

1743 }
1744
1745 sbp_free_ocb(sdev, ocb);
1746done:
1747 if (reset_agent)
1748 sbp_agent_reset(sdev);
1749
1750done0:
1421 addr = rfp->mode.wreqb.dest_lo;
1422SBP_DEBUG(2)
1423 printf("received address 0x%x\n", addr);
1424END_DEBUG
1425 t = SBP_ADDR2TRG(addr);
1426 if (t >= SBP_NUM_TARGETS) {
1427 device_printf(sbp->fd.dev,
1428 "sbp_recv1: invalid target %d\n", t);

--- 206 unchanged lines hidden (view full) ---

1635 }
1636
1637 sbp_free_ocb(sdev, ocb);
1638done:
1639 if (reset_agent)
1640 sbp_agent_reset(sdev);
1641
1642done0:
1643 xfer->recv.pay_len = SBP_RECV_LEN;
1751/* The received packet is usually small enough to be stored within
1752 * the buffer. In that case, the controller return ack_complete and
1753 * no respose is necessary.
1754 *
1755 * XXX fwohci.c and firewire.c should inform event_code such as
1756 * ack_complete or ack_pending to upper driver.
1757 */
1758#if NEED_RESPONSE

--- 8 unchanged lines hidden (view full) ---

1767 sfp->mode.wres.tlrt = rfp->mode.wreqb.tlrt;
1768 sfp->mode.wres.tcode = FWTCODE_WRES;
1769 sfp->mode.wres.rtcode = 0;
1770 sfp->mode.wres.pri = 0;
1771
1772 fw_asyreq(xfer->fc, -1, xfer);
1773#else
1774 /* recycle */
1644/* The received packet is usually small enough to be stored within
1645 * the buffer. In that case, the controller return ack_complete and
1646 * no respose is necessary.
1647 *
1648 * XXX fwohci.c and firewire.c should inform event_code such as
1649 * ack_complete or ack_pending to upper driver.
1650 */
1651#if NEED_RESPONSE

--- 8 unchanged lines hidden (view full) ---

1660 sfp->mode.wres.tlrt = rfp->mode.wreqb.tlrt;
1661 sfp->mode.wres.tcode = FWTCODE_WRES;
1662 sfp->mode.wres.rtcode = 0;
1663 sfp->mode.wres.pri = 0;
1664
1665 fw_asyreq(xfer->fc, -1, xfer);
1666#else
1667 /* recycle */
1775 xfer->recv.len = SBP_RECV_LEN;
1776 STAILQ_INSERT_TAIL(&sbp->fwb.xferlist, xfer, link);
1777#endif
1778
1779 return;
1780
1781}
1782
1783static void

--- 67 unchanged lines hidden (view full) ---

1851 return (ENXIO);
1852 }
1853
1854
1855 if (xpt_bus_register(sbp->sim, /*bus*/0) != CAM_SUCCESS)
1856 goto fail;
1857
1858 if (xpt_create_path(&sbp->path, xpt_periph, cam_sim_path(sbp->sim),
1668 STAILQ_INSERT_TAIL(&sbp->fwb.xferlist, xfer, link);
1669#endif
1670
1671 return;
1672
1673}
1674
1675static void

--- 67 unchanged lines hidden (view full) ---

1743 return (ENXIO);
1744 }
1745
1746
1747 if (xpt_bus_register(sbp->sim, /*bus*/0) != CAM_SUCCESS)
1748 goto fail;
1749
1750 if (xpt_create_path(&sbp->path, xpt_periph, cam_sim_path(sbp->sim),
1859 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP)
1751 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
1752 xpt_bus_deregister(cam_sim_path(sbp->sim));
1860 goto fail;
1753 goto fail;
1754 }
1861
1755
1862 sbp->fwb.start_hi = SBP_BIND_HI;
1863 sbp->fwb.start_lo = SBP_DEV2ADDR(device_get_unit(sbp->fd.dev), 0, 0);
1864 /* We reserve 16 bit space (4 bytes X 64 targets X 256 luns) */
1756 /* We reserve 16 bit space (4 bytes X 64 targets X 256 luns) */
1865 sbp->fwb.addrlen = 0xffff;
1757 sbp->fwb.start = ((u_int64_t)SBP_BIND_HI << 32) | SBP_DEV2ADDR(0, 0);
1758 sbp->fwb.end = sbp->fwb.start + 0xffff;
1866 sbp->fwb.act_type = FWACT_XFER;
1867 /* pre-allocate xfer */
1868 STAILQ_INIT(&sbp->fwb.xferlist);
1869 for (i = 0; i < SBP_NUM_OCB/2; i ++) {
1870 xfer = fw_xfer_alloc_buf(M_SBP,
1759 sbp->fwb.act_type = FWACT_XFER;
1760 /* pre-allocate xfer */
1761 STAILQ_INIT(&sbp->fwb.xferlist);
1762 for (i = 0; i < SBP_NUM_OCB/2; i ++) {
1763 xfer = fw_xfer_alloc_buf(M_SBP,
1871#if NEED_RESPONSE
1872 /* send */12,
1873#else
1874 /* send */0,
1764 /* send */0,
1875#endif
1876 /* recv */SBP_RECV_LEN);
1877 xfer->act.hand = sbp_recv;
1878#if NEED_RESPONSE
1879 xfer->fc = sbp->fd.fc;
1880#endif
1881 xfer->sc = (caddr_t)sbp;
1882 STAILQ_INSERT_TAIL(&sbp->fwb.xferlist, xfer, link);
1883 }

--- 60 unchanged lines hidden (view full) ---

1944 int i, j;
1945
1946SBP_DEBUG(0)
1947 printf("sbp_detach\n");
1948END_DEBUG
1949
1950 for (i = 0; i < SBP_NUM_TARGETS; i ++)
1951 sbp_cam_detach_target(&sbp->targets[i]);
1765 /* recv */SBP_RECV_LEN);
1766 xfer->act.hand = sbp_recv;
1767#if NEED_RESPONSE
1768 xfer->fc = sbp->fd.fc;
1769#endif
1770 xfer->sc = (caddr_t)sbp;
1771 STAILQ_INSERT_TAIL(&sbp->fwb.xferlist, xfer, link);
1772 }

--- 60 unchanged lines hidden (view full) ---

1833 int i, j;
1834
1835SBP_DEBUG(0)
1836 printf("sbp_detach\n");
1837END_DEBUG
1838
1839 for (i = 0; i < SBP_NUM_TARGETS; i ++)
1840 sbp_cam_detach_target(&sbp->targets[i]);
1841 xpt_async(AC_LOST_DEVICE, sbp->path, NULL);
1952 xpt_free_path(sbp->path);
1953 xpt_bus_deregister(cam_sim_path(sbp->sim));
1842 xpt_free_path(sbp->path);
1843 xpt_bus_deregister(cam_sim_path(sbp->sim));
1844 cam_sim_free(sbp->sim, /*free_devq*/ TRUE),
1954
1955 sbp_logout_all(sbp);
1956
1957 /* XXX wait for logout completion */
1958 tsleep(&i, FWPRI, "sbpdtc", hz/2);
1959
1960 for (i = 0 ; i < SBP_NUM_TARGETS ; i ++) {
1961 target = &sbp->targets[i];

--- 7 unchanged lines hidden (view full) ---

1969 bus_dmamap_destroy(sbp->dmat,
1970 sdev->ocb[i].dmamap);
1971 fwdma_free(sbp->fd.fc, &sdev->dma);
1972 }
1973 }
1974 for (xfer = STAILQ_FIRST(&target->xferlist);
1975 xfer != NULL; xfer = next) {
1976 next = STAILQ_NEXT(xfer, link);
1845
1846 sbp_logout_all(sbp);
1847
1848 /* XXX wait for logout completion */
1849 tsleep(&i, FWPRI, "sbpdtc", hz/2);
1850
1851 for (i = 0 ; i < SBP_NUM_TARGETS ; i ++) {
1852 target = &sbp->targets[i];

--- 7 unchanged lines hidden (view full) ---

1860 bus_dmamap_destroy(sbp->dmat,
1861 sdev->ocb[i].dmamap);
1862 fwdma_free(sbp->fd.fc, &sdev->dma);
1863 }
1864 }
1865 for (xfer = STAILQ_FIRST(&target->xferlist);
1866 xfer != NULL; xfer = next) {
1867 next = STAILQ_NEXT(xfer, link);
1977 fw_xfer_free(xfer);
1868 fw_xfer_free_buf(xfer);
1978 }
1979 free(target->luns, M_SBP);
1980 }
1981
1982 for (xfer = STAILQ_FIRST(&sbp->fwb.xferlist);
1983 xfer != NULL; xfer = next) {
1984 next = STAILQ_NEXT(xfer, link);
1869 }
1870 free(target->luns, M_SBP);
1871 }
1872
1873 for (xfer = STAILQ_FIRST(&sbp->fwb.xferlist);
1874 xfer != NULL; xfer = next) {
1875 next = STAILQ_NEXT(xfer, link);
1985 fw_xfer_free(xfer);
1876 fw_xfer_free_buf(xfer);
1986 }
1987 STAILQ_INIT(&sbp->fwb.xferlist);
1988 fw_bindremove(fc, &sbp->fwb);
1989
1990 bus_dma_tag_destroy(sbp->dmat);
1991
1992 return (0);
1993}

--- 260 unchanged lines hidden (view full) ---

2254 printf("sbp: CAM_SCATTER_VALID\n");
2255 if (csio->ccb_h.flags & CAM_DATA_PHYS)
2256 printf("sbp: CAM_DATA_PHYS\n");
2257
2258 if (csio->ccb_h.flags & CAM_CDB_POINTER)
2259 cdb = (void *)csio->cdb_io.cdb_ptr;
2260 else
2261 cdb = (void *)&csio->cdb_io.cdb_bytes;
1877 }
1878 STAILQ_INIT(&sbp->fwb.xferlist);
1879 fw_bindremove(fc, &sbp->fwb);
1880
1881 bus_dma_tag_destroy(sbp->dmat);
1882
1883 return (0);
1884}

--- 260 unchanged lines hidden (view full) ---

2145 printf("sbp: CAM_SCATTER_VALID\n");
2146 if (csio->ccb_h.flags & CAM_DATA_PHYS)
2147 printf("sbp: CAM_DATA_PHYS\n");
2148
2149 if (csio->ccb_h.flags & CAM_CDB_POINTER)
2150 cdb = (void *)csio->cdb_io.cdb_ptr;
2151 else
2152 cdb = (void *)&csio->cdb_io.cdb_bytes;
2262 bcopy(cdb,
2263 (void *)(uintptr_t)(volatile void *)&ocb->orb[5],
2264 csio->cdb_len);
2153 bcopy(cdb, (void *)&ocb->orb[5], csio->cdb_len);
2265/*
2266printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[0]), ntohl(ocb->orb[1]), ntohl(ocb->orb[2]), ntohl(ocb->orb[3]));
2267printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[4]), ntohl(ocb->orb[5]), ntohl(ocb->orb[6]), ntohl(ocb->orb[7]));
2268*/
2269 if (ccb->csio.dxfer_len > 0) {
2270 int s, error;
2271
2272 s = splsoftvm();

--- 407 unchanged lines hidden ---
2154/*
2155printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[0]), ntohl(ocb->orb[1]), ntohl(ocb->orb[2]), ntohl(ocb->orb[3]));
2156printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[4]), ntohl(ocb->orb[5]), ntohl(ocb->orb[6]), ntohl(ocb->orb[7]));
2157*/
2158 if (ccb->csio.dxfer_len > 0) {
2159 int s, error;
2160
2161 s = splsoftvm();

--- 407 unchanged lines hidden ---