Skip to content

Commit b7ded0e

Browse files
Finn Thainmartinkpetersen
authored andcommitted
scsi: zorro_esp: Limit DMA transfers to 65535 bytes
The core driver, esp_scsi, does not use the ESP_CONFIG2_FENAB bit, so the chip's Transfer Counter register is only 16 bits wide (not 24). A larger transfer cannot work and will theoretically result in a failed command and a "DMA length is zero" error. Fixes: 3109e5a ("scsi: zorro_esp: New driver for Amiga Zorro NCR53C9x boards") Signed-off-by: Finn Thain <[email protected]> Cc: Michael Schmitz <[email protected]> Tested-by: Michael Schmitz <[email protected]> Reviewed-by: Michael Schmitz <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent dfda5e2 commit b7ded0e

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

drivers/scsi/zorro_esp.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static int fastlane_esp_irq_pending(struct esp *esp)
221221
static u32 zorro_esp_dma_length_limit(struct esp *esp, u32 dma_addr,
222222
u32 dma_len)
223223
{
224-
return dma_len > 0xFFFFFF ? 0xFFFFFF : dma_len;
224+
return dma_len > 0xFFFF ? 0xFFFF : dma_len;
225225
}
226226

227227
static void zorro_esp_reset_dma(struct esp *esp)
@@ -460,7 +460,6 @@ static void zorro_esp_send_blz1230_dma_cmd(struct esp *esp, u32 addr,
460460
scsi_esp_cmd(esp, ESP_CMD_DMA);
461461
zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
462462
zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
463-
zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI);
464463

465464
scsi_esp_cmd(esp, cmd);
466465
}
@@ -505,7 +504,6 @@ static void zorro_esp_send_blz1230II_dma_cmd(struct esp *esp, u32 addr,
505504
scsi_esp_cmd(esp, ESP_CMD_DMA);
506505
zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
507506
zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
508-
zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI);
509507

510508
scsi_esp_cmd(esp, cmd);
511509
}
@@ -550,7 +548,6 @@ static void zorro_esp_send_blz2060_dma_cmd(struct esp *esp, u32 addr,
550548
scsi_esp_cmd(esp, ESP_CMD_DMA);
551549
zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
552550
zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
553-
zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI);
554551

555552
scsi_esp_cmd(esp, cmd);
556553
}
@@ -575,7 +572,6 @@ static void zorro_esp_send_cyber_dma_cmd(struct esp *esp, u32 addr,
575572

576573
zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
577574
zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
578-
zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI);
579575

580576
if (write) {
581577
/* DMA receive */
@@ -625,7 +621,6 @@ static void zorro_esp_send_cyberII_dma_cmd(struct esp *esp, u32 addr,
625621

626622
zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
627623
zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
628-
zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI);
629624

630625
if (write) {
631626
/* DMA receive */
@@ -667,7 +662,6 @@ static void zorro_esp_send_fastlane_dma_cmd(struct esp *esp, u32 addr,
667662

668663
zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
669664
zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
670-
zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI);
671665

672666
if (write) {
673667
/* DMA receive */

0 commit comments

Comments
 (0)