Commit b7ded0e8 authored by Finn Thain's avatar Finn Thain Committed by Martin K. Petersen
Browse files

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: 3109e5ae ("scsi: zorro_esp: New driver for Amiga Zorro NCR53C9x boards")
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Cc: Michael Schmitz <schmitzmic@gmail.com>
Tested-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
Reviewed-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent dfda5e21
Loading
Loading
Loading
Loading
+1 −7
Original line number Original line Diff line number Diff line
@@ -221,7 +221,7 @@ static int fastlane_esp_irq_pending(struct esp *esp)
static u32 zorro_esp_dma_length_limit(struct esp *esp, u32 dma_addr,
static u32 zorro_esp_dma_length_limit(struct esp *esp, u32 dma_addr,
					u32 dma_len)
					u32 dma_len)
{
{
	return dma_len > 0xFFFFFF ? 0xFFFFFF : dma_len;
	return dma_len > 0xFFFF ? 0xFFFF : dma_len;
}
}


static void zorro_esp_reset_dma(struct esp *esp)
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,
	scsi_esp_cmd(esp, ESP_CMD_DMA);
	scsi_esp_cmd(esp, ESP_CMD_DMA);
	zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
	zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
	zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
	zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
	zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI);


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


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


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


	zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
	zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
	zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
	zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
	zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI);


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


	zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
	zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
	zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
	zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
	zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI);


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


	zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
	zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
	zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
	zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
	zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI);


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