Commit 75b1f2f8 authored by Albert Lee's avatar Albert Lee Committed by Jeff Garzik

[PATCH] libata: honor the transfer cycle time speficied by the EIDE device

  The following code segment is not functional because the transfer cycle time speficied by
  the EIDE device is later overwritten by ata_timing_quantize():

	/*
	 * If the drive is an EIDE drive, it can tell us it needs extended
	 * PIO/MW_DMA cycle timing.
	 */
	if (adev->id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
		memset(&p, 0, sizeof(p));
		(snip)
		ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B);
               <== uninitialized "t" is used here
	}

	/*
	 * Convert the timing to bus clock counts.
	 */
	ata_timing_quantize(s, t, T, UT);  <== t is overwritten by quantized s

  The patch has been submitted for ide-timing.h before:
  http://marc.theaimsgroup.com/?l=linux-ide&m=110820013425454&w=2
  Resubmitted for libata.

Changes:
  - Minor fix to honor the following transfer cycle time speficied by the device
    - id[65]: Minimum Multiword DMA transfer cycle time per word
    - id[67]: Minimum PIO transfer cycle time without flow control
    - id[68]: Minimum PIO transfer cycle time with IORDY
Signed-off-by: default avatarAlbert Lee <albertcc@tw.ibm.com>

=======
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent d10cb35a
...@@ -1575,6 +1575,8 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, ...@@ -1575,6 +1575,8 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
if (!(s = ata_timing_find_mode(speed))) if (!(s = ata_timing_find_mode(speed)))
return -EINVAL; return -EINVAL;
memcpy(t, s, sizeof(*s));
/* /*
* If the drive is an EIDE drive, it can tell us it needs extended * If the drive is an EIDE drive, it can tell us it needs extended
* PIO/MW_DMA cycle timing. * PIO/MW_DMA cycle timing.
...@@ -1595,7 +1597,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, ...@@ -1595,7 +1597,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
* Convert the timing to bus clock counts. * Convert the timing to bus clock counts.
*/ */
ata_timing_quantize(s, t, T, UT); ata_timing_quantize(t, t, T, UT);
/* /*
* Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment