@@ -115,6 +115,11 @@ struct fdomain {
115
115
struct work_struct work ;
116
116
};
117
117
118
+ static struct scsi_pointer * fdomain_scsi_pointer (struct scsi_cmnd * cmd )
119
+ {
120
+ return scsi_cmd_priv (cmd );
121
+ }
122
+
118
123
static inline void fdomain_make_bus_idle (struct fdomain * fd )
119
124
{
120
125
outb (0 , fd -> base + REG_BCTL );
@@ -263,20 +268,21 @@ static void fdomain_work(struct work_struct *work)
263
268
struct Scsi_Host * sh = container_of ((void * )fd , struct Scsi_Host ,
264
269
hostdata );
265
270
struct scsi_cmnd * cmd = fd -> cur_cmd ;
271
+ struct scsi_pointer * scsi_pointer = fdomain_scsi_pointer (cmd );
266
272
unsigned long flags ;
267
273
int status ;
268
274
int done = 0 ;
269
275
270
276
spin_lock_irqsave (sh -> host_lock , flags );
271
277
272
- if (cmd -> SCp . phase & in_arbitration ) {
278
+ if (scsi_pointer -> phase & in_arbitration ) {
273
279
status = inb (fd -> base + REG_ASTAT );
274
280
if (!(status & ASTAT_ARB )) {
275
281
set_host_byte (cmd , DID_BUS_BUSY );
276
282
fdomain_finish_cmd (fd );
277
283
goto out ;
278
284
}
279
- cmd -> SCp . phase = in_selection ;
285
+ scsi_pointer -> phase = in_selection ;
280
286
281
287
outb (ICTL_SEL | FIFO_COUNT , fd -> base + REG_ICTL );
282
288
outb (BCTL_BUSEN | BCTL_SEL , fd -> base + REG_BCTL );
@@ -285,7 +291,7 @@ static void fdomain_work(struct work_struct *work)
285
291
/* Stop arbitration and enable parity */
286
292
outb (ACTL_IRQEN | PARITY_MASK , fd -> base + REG_ACTL );
287
293
goto out ;
288
- } else if (cmd -> SCp . phase & in_selection ) {
294
+ } else if (scsi_pointer -> phase & in_selection ) {
289
295
status = inb (fd -> base + REG_BSTAT );
290
296
if (!(status & BSTAT_BSY )) {
291
297
/* Try again, for slow devices */
@@ -297,75 +303,75 @@ static void fdomain_work(struct work_struct *work)
297
303
/* Stop arbitration and enable parity */
298
304
outb (ACTL_IRQEN | PARITY_MASK , fd -> base + REG_ACTL );
299
305
}
300
- cmd -> SCp . phase = in_other ;
306
+ scsi_pointer -> phase = in_other ;
301
307
outb (ICTL_FIFO | ICTL_REQ | FIFO_COUNT , fd -> base + REG_ICTL );
302
308
outb (BCTL_BUSEN , fd -> base + REG_BCTL );
303
309
goto out ;
304
310
}
305
311
306
- /* cur_cmd->SCp. phase == in_other: this is the body of the routine */
312
+ /* fdomain_scsi_pointer( cur_cmd)-> phase == in_other: this is the body of the routine */
307
313
status = inb (fd -> base + REG_BSTAT );
308
314
309
315
if (status & BSTAT_REQ ) {
310
316
switch (status & (BSTAT_MSG | BSTAT_CMD | BSTAT_IO )) {
311
317
case BSTAT_CMD : /* COMMAND OUT */
312
- outb (cmd -> cmnd [cmd -> SCp . sent_command ++ ],
318
+ outb (cmd -> cmnd [scsi_pointer -> sent_command ++ ],
313
319
fd -> base + REG_SCSI_DATA );
314
320
break ;
315
321
case 0 : /* DATA OUT -- tmc18c50/tmc18c30 only */
316
- if (fd -> chip != tmc1800 && !cmd -> SCp . have_data_in ) {
317
- cmd -> SCp . have_data_in = -1 ;
322
+ if (fd -> chip != tmc1800 && !scsi_pointer -> have_data_in ) {
323
+ scsi_pointer -> have_data_in = -1 ;
318
324
outb (ACTL_IRQEN | ACTL_FIFOWR | ACTL_FIFOEN |
319
325
PARITY_MASK , fd -> base + REG_ACTL );
320
326
}
321
327
break ;
322
328
case BSTAT_IO : /* DATA IN -- tmc18c50/tmc18c30 only */
323
- if (fd -> chip != tmc1800 && !cmd -> SCp . have_data_in ) {
324
- cmd -> SCp . have_data_in = 1 ;
329
+ if (fd -> chip != tmc1800 && !scsi_pointer -> have_data_in ) {
330
+ scsi_pointer -> have_data_in = 1 ;
325
331
outb (ACTL_IRQEN | ACTL_FIFOEN | PARITY_MASK ,
326
332
fd -> base + REG_ACTL );
327
333
}
328
334
break ;
329
335
case BSTAT_CMD | BSTAT_IO : /* STATUS IN */
330
- cmd -> SCp . Status = inb (fd -> base + REG_SCSI_DATA );
336
+ scsi_pointer -> Status = inb (fd -> base + REG_SCSI_DATA );
331
337
break ;
332
338
case BSTAT_MSG | BSTAT_CMD : /* MESSAGE OUT */
333
339
outb (MESSAGE_REJECT , fd -> base + REG_SCSI_DATA );
334
340
break ;
335
341
case BSTAT_MSG | BSTAT_CMD | BSTAT_IO : /* MESSAGE IN */
336
- cmd -> SCp . Message = inb (fd -> base + REG_SCSI_DATA );
337
- if (cmd -> SCp . Message == COMMAND_COMPLETE )
342
+ scsi_pointer -> Message = inb (fd -> base + REG_SCSI_DATA );
343
+ if (scsi_pointer -> Message == COMMAND_COMPLETE )
338
344
++ done ;
339
345
break ;
340
346
}
341
347
}
342
348
343
- if (fd -> chip == tmc1800 && !cmd -> SCp . have_data_in &&
344
- cmd -> SCp . sent_command >= cmd -> cmd_len ) {
349
+ if (fd -> chip == tmc1800 && !scsi_pointer -> have_data_in &&
350
+ scsi_pointer -> sent_command >= cmd -> cmd_len ) {
345
351
if (cmd -> sc_data_direction == DMA_TO_DEVICE ) {
346
- cmd -> SCp . have_data_in = -1 ;
352
+ scsi_pointer -> have_data_in = -1 ;
347
353
outb (ACTL_IRQEN | ACTL_FIFOWR | ACTL_FIFOEN |
348
354
PARITY_MASK , fd -> base + REG_ACTL );
349
355
} else {
350
- cmd -> SCp . have_data_in = 1 ;
356
+ scsi_pointer -> have_data_in = 1 ;
351
357
outb (ACTL_IRQEN | ACTL_FIFOEN | PARITY_MASK ,
352
358
fd -> base + REG_ACTL );
353
359
}
354
360
}
355
361
356
- if (cmd -> SCp . have_data_in == -1 ) /* DATA OUT */
362
+ if (scsi_pointer -> have_data_in == -1 ) /* DATA OUT */
357
363
fdomain_write_data (cmd );
358
364
359
- if (cmd -> SCp . have_data_in == 1 ) /* DATA IN */
365
+ if (scsi_pointer -> have_data_in == 1 ) /* DATA IN */
360
366
fdomain_read_data (cmd );
361
367
362
368
if (done ) {
363
- set_status_byte (cmd , cmd -> SCp . Status );
369
+ set_status_byte (cmd , scsi_pointer -> Status );
364
370
set_host_byte (cmd , DID_OK );
365
- scsi_msg_to_host_byte (cmd , cmd -> SCp . Message );
371
+ scsi_msg_to_host_byte (cmd , scsi_pointer -> Message );
366
372
fdomain_finish_cmd (fd );
367
373
} else {
368
- if (cmd -> SCp . phase & disconnect ) {
374
+ if (scsi_pointer -> phase & disconnect ) {
369
375
outb (ICTL_FIFO | ICTL_SEL | ICTL_REQ | FIFO_COUNT ,
370
376
fd -> base + REG_ICTL );
371
377
outb (0 , fd -> base + REG_BCTL );
@@ -398,14 +404,15 @@ static irqreturn_t fdomain_irq(int irq, void *dev_id)
398
404
399
405
static int fdomain_queue (struct Scsi_Host * sh , struct scsi_cmnd * cmd )
400
406
{
407
+ struct scsi_pointer * scsi_pointer = fdomain_scsi_pointer (cmd );
401
408
struct fdomain * fd = shost_priv (cmd -> device -> host );
402
409
unsigned long flags ;
403
410
404
- cmd -> SCp . Status = 0 ;
405
- cmd -> SCp . Message = 0 ;
406
- cmd -> SCp . have_data_in = 0 ;
407
- cmd -> SCp . sent_command = 0 ;
408
- cmd -> SCp . phase = in_arbitration ;
411
+ scsi_pointer -> Status = 0 ;
412
+ scsi_pointer -> Message = 0 ;
413
+ scsi_pointer -> have_data_in = 0 ;
414
+ scsi_pointer -> sent_command = 0 ;
415
+ scsi_pointer -> phase = in_arbitration ;
409
416
scsi_set_resid (cmd , scsi_bufflen (cmd ));
410
417
411
418
spin_lock_irqsave (sh -> host_lock , flags );
@@ -440,7 +447,7 @@ static int fdomain_abort(struct scsi_cmnd *cmd)
440
447
spin_lock_irqsave (sh -> host_lock , flags );
441
448
442
449
fdomain_make_bus_idle (fd );
443
- fd -> cur_cmd -> SCp . phase |= aborted ;
450
+ fdomain_scsi_pointer ( fd -> cur_cmd ) -> phase |= aborted ;
444
451
445
452
/* Aborts are not done well. . . */
446
453
set_host_byte (fd -> cur_cmd , DID_ABORT );
@@ -501,6 +508,7 @@ static struct scsi_host_template fdomain_template = {
501
508
.this_id = 7 ,
502
509
.sg_tablesize = 64 ,
503
510
.dma_boundary = PAGE_SIZE - 1 ,
511
+ .cmd_size = sizeof (struct scsi_pointer ),
504
512
};
505
513
506
514
struct Scsi_Host * fdomain_create (int base , int irq , int this_id ,
0 commit comments