From: Michael Schmitz <schmitzmic@gmail.com>
To: Finn Thain <fthain@telegraphics.com.au>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Kars de Jong <jongk@linux-m68k.org>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] esp_scsi: Clear Transfer Count registers before PIO transfers
Date: Sat, 16 Nov 2019 17:30:32 +1300 [thread overview]
Message-ID: <36712461-b94c-4aff-8664-3896c2cf2524@gmail.com> (raw)
In-Reply-To: <2bbb6359d542f5882be67c415ecc25ad2d9eeb5e.1573875417.git.fthain@telegraphics.com.au>
Hi Finn,
Am 16.11.2019 um 16:36 schrieb Finn Thain:
> The zorro_esp driver uses both PIO and DMA transfers. If a failed DMA
> transfer happened to be followed by a PIO transfer, the TCLOW and TCMED
> registers would not get cleared. It is theoretically possible that the
> stale value from the transfer counter or the TCLOW/TCMED registers
> could then be used by the controller and the driver. Avoid that by
> clearing these registers before each PIO transfer.
I believe you also need to send a DMA NOP command to the ESP:
"Values
written to these two registers will be stored inter-
nally and loaded into the transfer counter by any
DMA command. These values remain unchanged
while the transfer counter decrements. Thus,
successive blocks of equal size may be transferred
without reprogramming the count. They may be
reprogrammed any time after the previous DMA
operation has started, whether it has finished or
not."
"Any DMA command will load the transfer count into
the counter. A DMA NOP (80h) will load the
counter while the non-DMA NOP (OOh) will not."
(53CF64_96-2 data book)
Without the DMA NOP, the transfer counts will remain as they were left
by the prematurely terminated DMA command.
Cheers,
Michael
>
> Cc: Michael Schmitz <schmitzmic@gmail.com>
> Cc: Kars de Jong <jongk@linux-m68k.org>
> Tested-by: Stan Johnson <userm57@yahoo.com>
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
> ---
> drivers/scsi/esp_scsi.c | 3 +++
> drivers/scsi/mac_esp.c | 2 --
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
> index bb88995a12c7..afbef83f5dd9 100644
> --- a/drivers/scsi/esp_scsi.c
> +++ b/drivers/scsi/esp_scsi.c
> @@ -2835,6 +2835,9 @@ void esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
> cmd &= ~ESP_CMD_DMA;
> esp->send_cmd_error = 0;
>
> + esp_write8(0, ESP_TCLOW);
> + esp_write8(0, ESP_TCMED);
> +
> if (write) {
> u8 *dst = (u8 *)addr;
> u8 mask = ~(phase == ESP_MIP ? ESP_INTR_FDONE : ESP_INTR_BSERV);
> diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c
> index 1c78bc10c790..797579247e47 100644
> --- a/drivers/scsi/mac_esp.c
> +++ b/drivers/scsi/mac_esp.c
> @@ -361,8 +361,6 @@ static int esp_mac_probe(struct platform_device *dev)
> esp->flags = ESP_FLAG_NO_DMA_MAP;
> if (mep->pdma_io == NULL) {
> printk(KERN_INFO PFX "using PIO for controller %d\n", dev->id);
> - esp_write8(0, ESP_TCLOW);
> - esp_write8(0, ESP_TCMED);
> esp->flags |= ESP_FLAG_DISABLE_SYNC;
> mac_esp_ops.send_dma_cmd = esp_send_pio_cmd;
> } else {
>
next prev parent reply other threads:[~2019-11-16 4:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-16 3:36 [PATCH] esp_scsi: Clear Transfer Count registers before PIO transfers Finn Thain
2019-11-16 4:30 ` Michael Schmitz [this message]
2019-11-16 23:02 ` Finn Thain
2019-11-17 6:26 ` Kars de Jong
2019-11-17 6:29 ` Kars de Jong
2019-11-17 23:13 ` Finn Thain
2019-11-17 23:26 ` Finn Thain
2019-11-18 8:13 ` Kars de Jong
2019-11-18 23:04 ` Finn Thain
2019-11-19 23:12 ` Finn Thain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36712461-b94c-4aff-8664-3896c2cf2524@gmail.com \
--to=schmitzmic@gmail.com \
--cc=fthain@telegraphics.com.au \
--cc=jejb@linux.ibm.com \
--cc=jongk@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox