@@ -286,13 +286,14 @@ static inline int macscsi_pread(struct NCR5380_hostdata *hostdata,
286
286
while (!NCR5380_poll_politely (hostdata , BUS_AND_STATUS_REG ,
287
287
BASR_DRQ | BASR_PHASE_MATCH ,
288
288
BASR_DRQ | BASR_PHASE_MATCH , 0 )) {
289
- int bytes ;
289
+ int bytes , chunk_bytes ;
290
290
291
291
if (macintosh_config -> ident == MAC_MODEL_IIFX )
292
292
write_ctrl_reg (hostdata , CTRL_HANDSHAKE_MODE |
293
293
CTRL_INTERRUPTS_ENABLE );
294
294
295
- bytes = mac_pdma_recv (s , d , min (hostdata -> pdma_residual , 512 ));
295
+ chunk_bytes = min (hostdata -> pdma_residual , 512 );
296
+ bytes = mac_pdma_recv (s , d , chunk_bytes );
296
297
297
298
if (bytes > 0 ) {
298
299
d += bytes ;
@@ -302,23 +303,23 @@ static inline int macscsi_pread(struct NCR5380_hostdata *hostdata,
302
303
if (hostdata -> pdma_residual == 0 )
303
304
goto out ;
304
305
305
- if (NCR5380_poll_politely2 (hostdata , STATUS_REG , SR_REQ , SR_REQ ,
306
- BUS_AND_STATUS_REG , BASR_ACK ,
307
- BASR_ACK , 0 ) < 0 )
308
- scmd_printk (KERN_DEBUG , hostdata -> connected ,
309
- "%s: !REQ and !ACK\n" , __func__ );
310
306
if (!(NCR5380_read (BUS_AND_STATUS_REG ) & BASR_PHASE_MATCH ))
311
307
goto out ;
312
308
313
309
if (bytes == 0 )
314
310
udelay (MAC_PDMA_DELAY );
315
311
316
- if (bytes >= 0 )
312
+ if (bytes > 0 )
317
313
continue ;
318
314
319
- dsprintk (NDEBUG_PSEUDO_DMA , hostdata -> host ,
320
- "%s: bus error (%d/%d)\n" , __func__ , d - dst , len );
321
315
NCR5380_dprint (NDEBUG_PSEUDO_DMA , hostdata -> host );
316
+ dsprintk (NDEBUG_PSEUDO_DMA , hostdata -> host ,
317
+ "%s: bus error [%d/%d] (%d/%d)\n" ,
318
+ __func__ , d - dst , len , bytes , chunk_bytes );
319
+
320
+ if (bytes == 0 )
321
+ continue ;
322
+
322
323
result = -1 ;
323
324
goto out ;
324
325
}
@@ -345,13 +346,14 @@ static inline int macscsi_pwrite(struct NCR5380_hostdata *hostdata,
345
346
while (!NCR5380_poll_politely (hostdata , BUS_AND_STATUS_REG ,
346
347
BASR_DRQ | BASR_PHASE_MATCH ,
347
348
BASR_DRQ | BASR_PHASE_MATCH , 0 )) {
348
- int bytes ;
349
+ int bytes , chunk_bytes ;
349
350
350
351
if (macintosh_config -> ident == MAC_MODEL_IIFX )
351
352
write_ctrl_reg (hostdata , CTRL_HANDSHAKE_MODE |
352
353
CTRL_INTERRUPTS_ENABLE );
353
354
354
- bytes = mac_pdma_send (s , d , min (hostdata -> pdma_residual , 512 ));
355
+ chunk_bytes = min (hostdata -> pdma_residual , 512 );
356
+ bytes = mac_pdma_send (s , d , chunk_bytes );
355
357
356
358
if (bytes > 0 ) {
357
359
s += bytes ;
@@ -370,23 +372,23 @@ static inline int macscsi_pwrite(struct NCR5380_hostdata *hostdata,
370
372
goto out ;
371
373
}
372
374
373
- if (NCR5380_poll_politely2 (hostdata , STATUS_REG , SR_REQ , SR_REQ ,
374
- BUS_AND_STATUS_REG , BASR_ACK ,
375
- BASR_ACK , 0 ) < 0 )
376
- scmd_printk (KERN_DEBUG , hostdata -> connected ,
377
- "%s: !REQ and !ACK\n" , __func__ );
378
375
if (!(NCR5380_read (BUS_AND_STATUS_REG ) & BASR_PHASE_MATCH ))
379
376
goto out ;
380
377
381
378
if (bytes == 0 )
382
379
udelay (MAC_PDMA_DELAY );
383
380
384
- if (bytes >= 0 )
381
+ if (bytes > 0 )
385
382
continue ;
386
383
387
- dsprintk (NDEBUG_PSEUDO_DMA , hostdata -> host ,
388
- "%s: bus error (%d/%d)\n" , __func__ , s - src , len );
389
384
NCR5380_dprint (NDEBUG_PSEUDO_DMA , hostdata -> host );
385
+ dsprintk (NDEBUG_PSEUDO_DMA , hostdata -> host ,
386
+ "%s: bus error [%d/%d] (%d/%d)\n" ,
387
+ __func__ , s - src , len , bytes , chunk_bytes );
388
+
389
+ if (bytes == 0 )
390
+ continue ;
391
+
390
392
result = -1 ;
391
393
goto out ;
392
394
}
0 commit comments