Skip to content

Commit 5ec4f82

Browse files
fthainmartinkpetersen
authored andcommitted
scsi: mac_scsi: Revise printk(KERN_DEBUG ...) messages
After a bus fault, capture and log the chip registers immediately, if the NDEBUG_PSEUDO_DMA macro is defined. Remove some printk(KERN_DEBUG ...) messages that aren't needed any more. Don't skip the debug message when bytes == 0. Show all of the byte counters in the debug messages. Cc: [email protected] # 5.15+ Tested-by: Stan Johnson <[email protected]> Signed-off-by: Finn Thain <[email protected]> Link: https://lore.kernel.org/r/7573c79f4e488fc00af2b8a191e257ca945e0409.1723001788.git.fthain@linux-m68k.org Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8400291 commit 5ec4f82

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

drivers/scsi/mac_scsi.c

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,14 @@ static inline int macscsi_pread(struct NCR5380_hostdata *hostdata,
286286
while (!NCR5380_poll_politely(hostdata, BUS_AND_STATUS_REG,
287287
BASR_DRQ | BASR_PHASE_MATCH,
288288
BASR_DRQ | BASR_PHASE_MATCH, 0)) {
289-
int bytes;
289+
int bytes, chunk_bytes;
290290

291291
if (macintosh_config->ident == MAC_MODEL_IIFX)
292292
write_ctrl_reg(hostdata, CTRL_HANDSHAKE_MODE |
293293
CTRL_INTERRUPTS_ENABLE);
294294

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);
296297

297298
if (bytes > 0) {
298299
d += bytes;
@@ -302,23 +303,23 @@ static inline int macscsi_pread(struct NCR5380_hostdata *hostdata,
302303
if (hostdata->pdma_residual == 0)
303304
goto out;
304305

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__);
310306
if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH))
311307
goto out;
312308

313309
if (bytes == 0)
314310
udelay(MAC_PDMA_DELAY);
315311

316-
if (bytes >= 0)
312+
if (bytes > 0)
317313
continue;
318314

319-
dsprintk(NDEBUG_PSEUDO_DMA, hostdata->host,
320-
"%s: bus error (%d/%d)\n", __func__, d - dst, len);
321315
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+
322323
result = -1;
323324
goto out;
324325
}
@@ -345,13 +346,14 @@ static inline int macscsi_pwrite(struct NCR5380_hostdata *hostdata,
345346
while (!NCR5380_poll_politely(hostdata, BUS_AND_STATUS_REG,
346347
BASR_DRQ | BASR_PHASE_MATCH,
347348
BASR_DRQ | BASR_PHASE_MATCH, 0)) {
348-
int bytes;
349+
int bytes, chunk_bytes;
349350

350351
if (macintosh_config->ident == MAC_MODEL_IIFX)
351352
write_ctrl_reg(hostdata, CTRL_HANDSHAKE_MODE |
352353
CTRL_INTERRUPTS_ENABLE);
353354

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);
355357

356358
if (bytes > 0) {
357359
s += bytes;
@@ -370,23 +372,23 @@ static inline int macscsi_pwrite(struct NCR5380_hostdata *hostdata,
370372
goto out;
371373
}
372374

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__);
378375
if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH))
379376
goto out;
380377

381378
if (bytes == 0)
382379
udelay(MAC_PDMA_DELAY);
383380

384-
if (bytes >= 0)
381+
if (bytes > 0)
385382
continue;
386383

387-
dsprintk(NDEBUG_PSEUDO_DMA, hostdata->host,
388-
"%s: bus error (%d/%d)\n", __func__, s - src, len);
389384
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+
390392
result = -1;
391393
goto out;
392394
}

0 commit comments

Comments
 (0)