Re: [PATCH 1/4] libata: add deadline support to prereset and reset methods

2007-03-07 Thread Jeff Garzik

Tejun Heo wrote:

Add @deadline to prereset and reset methods and make them honor it.
ata_wait_ready() which directly takes @deadline is implemented to be
used as the wait function.  This patch is in preparation for EH timing
improvements.

* ata_wait_ready() never does busy sleep.  It's only used from EH and
  no wait in EH is that urgent.  This function also prints 'be
  patient' message automatically after 5 secs of waiting if more than
  3 secs is remaining till deadline.

* ata_bus_post_reset() now fails with error code if any of its wait
  fails.  This is important because earlier reset tries will have
  shorter timeout than the spec requires.  If a device fails to
  respond before the short timeout, reset should be retried with
  longer timeout rather than silently ignoring the device.

  There are three behavior differences.

  1. Timeout is applied to both devices at once, not separately.  This
 is more consistent with what the spec says.

  2. When a device passes devchk but fails to become ready before
 deadline.  Previouly, post_reset would just succeed and let
 device classification remove the device.  New code fails the
 reset thus causing reset retry.  After a few times, EH will give
 up disabling the port.

  3. When slave device passes devchk but fails to become accessible
 (TF-wise) after reset.  Original code disables dev1 after 30s
 timeout and continues as if the device doesn't exist, while the
 patched code fails reset.  When this happens, new code fails
 reset on whole port rather than proceeding with only the primary
 device.

  If the failing device is suffering transient problems, new code
  retries reset which is a better behavior.  If the failing device is
  actually broken, the net effect is identical to it, but not to the
  other device sharing the channel.  In the previous code, reset would
  have succeeded after 30s thus detecting the working one.  In the new
  code, reset fails and whole port gets disabled.  IMO, it's a
  pathological case anyway (broken device sharing bus with working
  one) and doesn't really matter.

* ata_bus_softreset() is changed to return error code from
  ata_bus_post_reset().  It used to return 0 unconditionally.

* Spin up waiting is to be removed and not converted to honor
  deadline.

* To be on the safe side, deadline is set to 40s for the time being.

Signed-off-by: Tejun Heo [EMAIL PROTECTED]
---
 drivers/ata/ahci.c  |   18 +++--
 drivers/ata/ata_generic.c   |5 +-
 drivers/ata/ata_piix.c  |   12 ++--
 drivers/ata/libata-core.c   |  161 +++
 drivers/ata/libata-eh.c |   10 +-
 drivers/ata/pata_ali.c  |   10 ++-
 drivers/ata/pata_amd.c  |   16 ++--
 drivers/ata/pata_artop.c|9 +-
 drivers/ata/pata_atiixp.c   |4 +-
 drivers/ata/pata_cmd64x.c   |8 +-
 drivers/ata/pata_cs5520.c   |4 +-
 drivers/ata/pata_cs5530.c   |4 +-
 drivers/ata/pata_cs5535.c   |5 +-
 drivers/ata/pata_cypress.c  |4 +-
 drivers/ata/pata_efar.c |5 +-
 drivers/ata/pata_hpt366.c   |4 +-
 drivers/ata/pata_hpt37x.c   |9 +-
 drivers/ata/pata_hpt3x2n.c  |5 +-
 drivers/ata/pata_hpt3x3.c   |4 +-
 drivers/ata/pata_it8213.c   |5 +-
 drivers/ata/pata_it821x.c   |5 +-
 drivers/ata/pata_jmicron.c  |7 +-
 drivers/ata/pata_marvell.c  |5 +-
 drivers/ata/pata_mpiix.c|4 +-
 drivers/ata/pata_netcell.c  |5 +-
 drivers/ata/pata_ns87410.c  |5 +-
 drivers/ata/pata_oldpiix.c  |5 +-
 drivers/ata/pata_opti.c |5 +-
 drivers/ata/pata_optidma.c  |5 +-
 drivers/ata/pata_pdc2027x.c |5 +-
 drivers/ata/pata_pdc202xx_old.c |9 +-
 drivers/ata/pata_radisys.c  |5 +-
 drivers/ata/pata_rz1000.c   |5 +-
 drivers/ata/pata_serverworks.c  |6 +-
 drivers/ata/pata_sil680.c   |   10 ++-
 drivers/ata/pata_sis.c  |   15 ++--
 drivers/ata/pata_sl82c105.c |5 +-
 drivers/ata/pata_triflex.c  |5 +-
 drivers/ata/pata_via.c  |5 +-
 drivers/ata/sata_inic162x.c |   14 ++--
 drivers/ata/sata_nv.c   |5 +-
 drivers/ata/sata_sil24.c|   10 ++-
 drivers/ata/sata_via.c  |9 +-
 include/linux/libata.h  |   24 --
 44 files changed, 296 insertions(+), 184 deletions(-)


applied 1-4 to #reset-seq


-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: iq81340mc: oops with SATA VIA

2007-03-07 Thread Martin Michlmayr
* Dan Williams [EMAIL PROTECTED] [2007-03-06 20:23]:
 Martin can you give the attached patch a try to see if it resolves the
 oops?  It has only been compile tested.  The patch spins the processor
 on the ATU outbound-queue-busy bit whenever out*() is called.

Nope, that doesn't seem to work:

Linux version 2.6.21-rc3 ([EMAIL PROTECTED]) (gcc version 4.1.2 20061028 
(prerelease) (Debian 4.1.1-19)) #23 Wed Mar 7 12:33:00 UTC 2007
CPU: XScale-V3 based processor [69056818] revision 8 (ARMv5TE), cr=0400397f
Machine: Intel IQ81340MC
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIVT undefined 5 cache
CPU0: I cache: 32768 bytes, associativity 4, 32 byte lines, 256 sets
CPU0: D cache: 32768 bytes, associativity 4, 32 byte lines, 256 sets
Built 1 zonelists.  Total pages: 65024
Kernel command line: console=ttyS1,115200 root=/dev/ram0
PID hash table entries: 1024 (order: 10, 4096 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 256MB = 256MB total
Memory: 255744KB available (3624K code, 273K data, 128K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
PCI: bus0: Fast back to back transfers disabled
PCI: bus1: Fast back to back transfers enabled
ATUX: Initialized (16M @ resource/virtual: 8000/5100)
ATUE: Initialized (0M @ resource/virtual: c000/)
SCSI subsystem initialized
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
Installing knfsd (copyright (C) 1996 [EMAIL PROTECTED]).
JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered (default)
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xffd82340 (irq = 52) is a XScale
serial8250.1: ttyS1 at MMIO 0xffd82300 (irq = 51) is a XScale
RAMDISK driver initialized: 2 RAM disks of 8192K size 1024 blocksize
nbd: registered device at major 43
Intel(R) PRO/1000 Network Driver - version 7.3.20-k2-NAPI
Copyright (c) 1999-2006 Intel Corporation.
e1000: :00:02.0: e1000_probe: (PCI:33MHz:64-bit) 00:0e:0c:b9:ab:72
e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
e1000: :00:02.1: e1000_probe: (PCI:33MHz:64-bit) 00:0e:0c:b9:ab:73
e1000: eth1: e1000_probe: Intel(R) PRO/1000 Network Connection
Loading iSCSI transport class v2.0-724.
sata_via :00:01.0: routed to hard irq line 9
ata1: SATA max UDMA/133 cmd 0xfffb04a0 ctl 0xfffb04aa bmdma 0xfffb0480 irq 25
Unhandled fault: imprecise external abort (0x406) at 0x23212064
Internal error: : 406 [#1]
Modules linked in:
CPU: 0
PC is at ata_bmdma_freeze+0x3c/0x50
LR is at __iop13xx_io+0x14/0x4c
pc : [401e9b30]lr : [4003372c]Not tainted
sp : 40651dbc  ip : 40651d98  fp : 40651dcc
r10: 4fce1cf0  r9 : 4fce1cec  r8 : 0001
r7 : 4fcd440c  r6 : 406702b4  r5 : 0053  r4 : 406702b4
r3 : 0001  r2 : fffe04a7  r1 : fee80074  r0 : fec604a7
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  Segment kernel
Control: 400397F
Table: 4018  DAC: 0035
Process swapper (pid: 1, stack limit = 0x40650250)
Stack: (0x40651dbc to 0x40652000)
1da0:406702b4
1dc0: 40651de0 40651dd0 401ea07c 401e9b00 2013 40651df4 40651de4 401ea0d4
1de0: 401ea040 0001 40651e3c 40651df8 401e4448 401ea0b4 fffb04a0 fffb04aa
1e00: fffb0480 0019 4062e848 0019 40651e5a 4062e8ec  40651e5a
1e20: 4062e800 0003 4fcd440c 4062e848 40651e84 40651e40 401ec984 401e422c
1e40: 40651e60 40651e50 40174c78 40175b50 4062e800 40651e70 40f11e64 403c8fc8
1e60: 4062e800   403eb0a4 40023884 4062e8ec 40651ea4 40651e88
1e80: 40187938 401ec6d4 4062e848 4062e848 4fce3fc0 403c8ffc 40651ecc 40651ea8
1ea0: 401acce8 401878dc 403c8ffc 4062e848 4fce3fc0 401acf90 40023884 400233b0
1ec0: 40651ee8 40651ed0 401ace94 401acc7c 4062e920 4062e848 403c8ffc 40651f00
1ee0: 40651eec 401ad074 401ace08  40651f04 40651f2c 40651f04 401ac13c
1f00: 401acf9c 403c0fc0 403c0fc0 4062e890 403c8ffc 403c9010 403c0ec0 
1f20: 40651f3c 40651f30 401acb88 401ac0f4 40651f60 40651f40 401ac4c8 401acb74
1f40: 403c8ffc  403c8ffc  40023884 40651f74 40651f64 401ad29c
1f60: 401ac464 403c8fc8 40651f90 40651f78 40187b18 401ad248 40023328 
1f80: 4065 40651fa0 40651f94 4001df78 40187aa4 40651ff4 40651fa4 400087a0
1fa0: 4001df68 40651fb0 40028c44 4003b8b8   40008724 40041a44
1fc0:        
1fe0:    40651ff8 40041a44 40008730  

sata_promise SATA300TX4 intermittent problems

2007-03-07 Thread Peter Favrholdt

Hi,

I've seen intermittent problems with Promise SATA300 TX4 controllers
and Linux kernel 2.6.19 (through 2.6.20-rc2 with some additional
patches).

Sometimes the TX4 will loose a port - a reboot brings the drive back up 
again. I'm quite sure the harddrives are not at fault.


I have experienced this using plain vanilla Linux 2.6.19.2 and 
2.6.20.1. Today I have tested using Linux 2.6.21-rc2 with Mikael 
Petterson's patches (more on that further down).


Yesterday (using 2.6.20.1) I could fail two out of four drives by doing:
dd if=/dev/sda of=/dev/null bs=1M 
dd if=/dev/sdb of=/dev/null bs=1M 
dd if=/dev/sdc of=/dev/null bs=1M 
dd if=/dev/sdd of=/dev/null bs=1M 

sdd would fail first then after a while sdc, here is the dmesg output 
when sdd failed:


[14895.092650] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x138 
action 0x2 frozen
[14895.092664] ata4.00: cmd 25/00:00:00:3e:1a/00:02:05:00:00/e0 tag 0 
cdb 0x0 data 262144 in
[14895.092666]  res 40/00:01:09:4f:c2/00:00:00:00:00/00 Emask 
0x4 (timeout)

[14895.404597] ata4: soft resetting port
[14895.560511] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[14925.555206] ata4.00: qc timeout (cmd 0xec)
[14925.555437] ata4.00: failed to IDENTIFY (I/O error, err_mask=0x104)
[14925.555441] ata4.00: revalidation failed (errno=-5)
[14925.555452] ata4: failed to recover some devices, retrying in 5 secs
[14930.556912] ata4: hard resetting port
[14930.876763] ata4: COMRESET failed (device not ready)
[14930.876772] ata4: hardreset failed, retrying in 5 secs
[14935.878525] ata4: hard resetting port
[14936.198407] ata4: COMRESET failed (device not ready)
[14936.198416] ata4: hardreset failed, retrying in 5 secs
[14941.200169] ata4: hard resetting port
[14941.520051] ata4: COMRESET failed (device not ready)
[14941.520060] ata4: reset failed, giving up
[14941.520063] ata4.00: disabled
[14941.520075] ata4: EH complete
[14941.520567] sd 4:0:0:0: SCSI error: return code = 0x0004
[14941.520572] end_request: I/O error, dev sdd, sector 85605888
[14941.520577] Buffer I/O error on device sdd, logical block 10700736
[14941.520582] Buffer I/O error on device sdd, logical block 10700737

After a reboot the drives are operating again. But with an entry in the 
SMART log, e.g.:


Error 6 occurred at disk power-on lifetime: 353 hours (14 days + 17 hours)
  When the command that caused the error occurred, the device was 
active or idle.


  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 51 ef 11 3e 1a e0  Error: ICRC, ABRT 239 sectors at LBA = 
0x001a3e11 = 1719825


  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --    
  25 00 00 00 3e 1a e0 00  04:08:17.774  READ DMA EXT
  25 00 00 00 3c 1a e0 00  04:08:17.764  READ DMA EXT
  25 00 00 00 3a 1a e0 00  04:08:17.753  READ DMA EXT
  25 00 00 00 38 1a e0 00  04:08:17.743  READ DMA EXT
  25 00 00 00 36 1a e0 00  04:08:17.734  READ DMA EXT


Today I have tested using Linux 2.6.21-rc2 with Mikael Petterson's
patches. In order to make it build I had to disable local-apic. So far
it seems to work better, but doing

dd if=/dev/sda of=/dev/null bs=1M 
dd if=/dev/sdb of=/dev/null bs=1M 
dd if=/dev/sdc of=/dev/null bs=1M 
dd if=/dev/sdd of=/dev/null bs=1M 

and then a couple of times:

for each in /dev/sd[abcd]; do smartctl -d ata -a $each | awk 
'/194/{print $10}'; done


will trig the error again:

[52849.930755] pdc_error_intr: port_status 0x1000 serror 0x
[52849.930880] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 
frozen

[52849.930883] ata2.00: (port_status 0x1000)
[52849.930892] ata2.00: cmd 25/00:00:00:f7:1e/00:02:1b:00:00/e0 tag 0 
cdb 0x0 data 262144 in
[52849.930894]  res 50/00:00:ff:f8:1e/00:00:ff:59:c8/e0 Emask 
0x4 (timeout)

[52850.241962] ata2: soft resetting port
[52850.397984] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[52850.424344] pdc_error_intr: port_status 0x1000 serror 0x
[52850.424639] ata2.00: failed to set xfermode (err_mask=0x104)
[52850.424643] ata2: failed to recover some devices, retrying in 5 secs
[52855.423576] ata2: hard resetting port
[52855.899453] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[52855.933438] ata2.00: configured for UDMA/133
[52855.933456] ata2: EH complete
[52855.973979] SCSI device sdb: 976773168 512-byte hdwr sectors (500108 MB)
[52856.022739] sdb: Write Protect is off
[52856.022747] sdb: Mode Sense: 00 3a 00 00
[52856.085241] SCSI device sdb: write cache: enabled, read cache: 
enabled, doesn't support DPO or FUA

[52856.089287] SCSI device sdb: 976773168 512-byte hdwr sectors (500108 MB)
[52856.092552] sdb: Write Protect is off
[52856.092560] sdb: Mode Sense: 00 3a 00 00
[52856.099067] SCSI device sdb: write cache: enabled, read cache: 
enabled, doesn't support DPO or FUA


although this 

[PATCH] pata_artop: Cable detect methods

2007-03-07 Thread Alan Cox
Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_artop.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_artop.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_artop.c   2007-03-06 
23:06:26.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_artop.c   2007-03-06 
17:20:22.0 +
@@ -49,8 +49,6 @@
 
if (!pci_test_config_bits(pdev, artop_enable_bits[ap-port_no]))
return -ENOENT;
-
-   ap-cbl = ATA_CBL_PATA40;
return ata_std_prereset(ap);
 }
 
@@ -85,18 +83,28 @@
};
 
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
-   u8 tmp;
 
/* Odd numbered device ids are the units with enable bits (the -R 
cards) */
if (pdev-device % 1  !pci_test_config_bits(pdev, 
artop_enable_bits[ap-port_no]))
return -ENOENT;
+   return ata_std_prereset(ap);
+}
 
+/**
+ * artop6260_cable_detect  -   identify cable type
+ * @ap: Port
+ *
+ * Identify the cable type for the ARTOp interface in question
+ */
+ 
+static int artop6260_cable_detect(struct ata_port *ap)
+{
+   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
+   u8 tmp;
pci_read_config_byte(pdev, 0x49, tmp);
if (tmp  (1  ap-port_no))
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA80;
-   return ata_std_prereset(ap);
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
 }
 
 /**
@@ -225,7 +233,7 @@
 /**
  * artop6210_set_dmamode - Initialize host controller PATA PIO timings
  * @ap: Port whose timings we are configuring
- * @adev: um
+ * @adev: Device whose timings we are configuring
  *
  * Set DMA mode for device, in host controller PCI config space.
  *
@@ -333,6 +341,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = artop6210_error_handler,
.post_internal_cmd  = ata_bmdma_post_internal_cmd,
+   .cable_detect   = ata_cable_40wire,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
@@ -366,6 +375,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = artop6260_error_handler,
.post_internal_cmd  = ata_bmdma_post_internal_cmd,
+   .cable_detect   = artop6260_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_it821x: Clean up by using cable methods

2007-03-07 Thread Alan Cox
Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_it821x.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_it821x.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_it821x.c  2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_it821x.c  2007-03-06 
23:35:28.0 +
@@ -80,7 +80,7 @@
 
 
 #define DRV_NAME pata_it821x
-#define DRV_VERSION 0.3.4
+#define DRV_VERSION 0.3.6
 
 struct it821x_dev
 {
@@ -113,31 +113,6 @@
 static int it8212_noraid;
 
 /**
- * it821x_pre_reset-   probe
- * @ap: ATA port
- *
- * Set the cable type
- */
-
-static int it821x_pre_reset(struct ata_port *ap)
-{
-   ap-cbl = ATA_CBL_PATA80;
-   return ata_std_prereset(ap);
-}
-
-/**
- * it821x_error_handler-   probe/reset
- * @ap: ATA port
- *
- * Set the cable type and trigger a probe
- */
-
-static void it821x_error_handler(struct ata_port *ap)
-{
-   return ata_bmdma_drive_eh(ap, it821x_pre_reset, ata_std_softreset, 
NULL, ata_std_postreset);
-}
-
-/**
  * it821x_program  -   program the PIO/MWDMA registers
  * @ap: ATA port
  * @adev: Device to program
@@ -666,8 +641,9 @@
 
.freeze = ata_bmdma_freeze,
.thaw   = ata_bmdma_thaw,
-   .error_handler  = it821x_error_handler,
+   .error_handler  = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = ata_cable_unknown,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
@@ -702,8 +678,9 @@
 
.freeze = ata_bmdma_freeze,
.thaw   = ata_bmdma_thaw,
-   .error_handler  = it821x_error_handler,
+   .error_handler  = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = ata_cable_unknown,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= it821x_passthru_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_mpc52xx: Cable detect

2007-03-07 Thread Alan Cox
Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_mpc52xx.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_mpc52xx.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_mpc52xx.c 2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_mpc52xx.c 2007-03-06 
23:35:28.0 +
@@ -24,7 +24,7 @@
 
 
 #define DRV_NAME   mpc52xx_ata
-#define DRV_VERSION0.1.0
+#define DRV_VERSION0.1.0ac2
 
 
 /* Private structures used by the driver */
@@ -297,6 +297,7 @@
.freeze = ata_bmdma_freeze,
.thaw   = ata_bmdma_thaw,
.error_handler  = mpc52xx_ata_error_handler,
+   .cable_detect   = ata_cable_40wire,
.qc_prep= ata_qc_prep,
.qc_issue   = ata_qc_issue_prot,
.data_xfer  = ata_data_xfer,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_mpiix: Cable detect method

2007-03-07 Thread Alan Cox
Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_mpiix.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_mpiix.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_mpiix.c   2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_mpiix.c   2007-03-06 
23:35:28.0 +
@@ -35,7 +35,7 @@
 #include linux/libata.h
 
 #define DRV_NAME pata_mpiix
-#define DRV_VERSION 0.7.5
+#define DRV_VERSION 0.7.6
 
 enum {
IDETIM = 0x6C,  /* IDE control register */
@@ -53,7 +53,6 @@
 
if (!pci_test_config_bits(pdev, mpiix_enable_bits))
return -ENOENT;
-   ap-cbl = ATA_CBL_PATA40;
return ata_std_prereset(ap);
 }
 
@@ -185,6 +184,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = mpiix_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = ata_cable_40wire,
 
.qc_prep= ata_qc_prep,
.qc_issue   = mpiix_qc_issue_prot,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_ns87410: cable detect method

2007-03-07 Thread Alan Cox
Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_ns87410.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_ns87410.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_ns87410.c 2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_ns87410.c 2007-03-06 
23:36:02.0 +
@@ -28,13 +28,13 @@
 #include linux/libata.h
 
 #define DRV_NAME pata_ns87410
-#define DRV_VERSION 0.4.3
+#define DRV_VERSION 0.4.6
 
 /**
  * ns87410_pre_reset   -   probe begin
  * @ap: ATA port
  *
- * Set up cable type and use generic probe init
+ * Check enabled ports
  */
 
 static int ns87410_pre_reset(struct ata_port *ap)
@@ -47,7 +47,6 @@
 
if (!pci_test_config_bits(pdev, ns87410_enable_bits[ap-port_no]))
return -ENOENT;
-   ap-cbl = ATA_CBL_PATA40;
return ata_std_prereset(ap);
 }
 
@@ -177,6 +176,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = ns87410_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = ata_cable_40wire,
 
.qc_prep= ata_qc_prep,
.qc_issue   = ns87410_qc_issue_prot,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_oldpiix: cable detect

2007-03-07 Thread Alan Cox
Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_oldpiix.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_oldpiix.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_oldpiix.c 2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_oldpiix.c 2007-03-06 
23:36:02.0 +
@@ -25,7 +25,7 @@
 #include linux/ata.h
 
 #define DRV_NAME   pata_oldpiix
-#define DRV_VERSION0.5.4
+#define DRV_VERSION0.5.5
 
 /**
  * oldpiix_pre_reset   -   probe begin
@@ -44,7 +44,6 @@
 
if (!pci_test_config_bits(pdev, oldpiix_enable_bits[ap-port_no]))
return -ENOENT;
-   ap-cbl = ATA_CBL_PATA40;
return ata_std_prereset(ap);
 }
 
@@ -65,7 +64,7 @@
 /**
  * oldpiix_set_piomode - Initialize host controller PATA PIO timings
  * @ap: Port whose timings we are configuring
- * @adev: um
+ * @adev: Device whose timings we are configuring
  *
  * Set PIO mode for device, in host controller PCI config space.
  *
@@ -255,6 +254,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = oldpiix_pata_error_handler,
.post_internal_cmd  = ata_bmdma_post_internal_cmd,
+   .cable_detect   = ata_cable_40wire,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] pata_hpt3x2n: Cable detect handling

2007-03-07 Thread Sergei Shtylyov

Hello.

Alan Cox wrote:


+/**
+ * hpt3x2n_pre_reset   -   reset the hpt3x2n bus
+ * @ap: ATA port to reset
+ *
+ * Perform the initial reset handling for the 3x2n series controllers.
+ * Reset the hardware and state machine,
+ */
 
+static int hpt3xn_pre_reset(struct ata_port *ap)

+{
+   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
/* Reset the state machine */
pci_write_config_byte(pdev, 0x50, 0x37);
pci_write_config_byte(pdev, 0x54, 0x37);
udelay(100);
-
return ata_std_prereset(ap);
 }
 


   Hmmm... is it really safe to reset both channels here, when only one port 
gets reset?


MBR, Sergei
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_opti: cable detect

2007-03-07 Thread Alan Cox
Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_opti.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_opti.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_opti.c2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_opti.c2007-03-06 
23:36:02.0 +
@@ -34,7 +34,7 @@
 #include linux/libata.h
 
 #define DRV_NAME pata_opti
-#define DRV_VERSION 0.2.8
+#define DRV_VERSION 0.2.9
 
 enum {
READ_REG= 0,/* index of Read cycle timing register */
@@ -61,8 +61,6 @@
 
if (!pci_test_config_bits(pdev, opti_enable_bits[ap-port_no]))
return -ENOENT;
-
-   ap-cbl = ATA_CBL_PATA40;
return ata_std_prereset(ap);
 }
 
@@ -198,6 +196,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = opti_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = ata_cable_40wire,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_pcmcia: Cable detect

2007-03-07 Thread Alan Cox
This one is a bit odd. Most PCMCIA adapters don't really have a cable
but have the controller embedded in the CF adapter or similar. Some real
IDE adapters do exist although they are rare.

As PCMCIA is ISA timing it can only support PIO0 so reporting 40 wire
seems closest to the truth and I don't see the need for a
'ATA_CBL_HARDWIRED' type although we could add one if Jeff wanted.

(As a PS Jeff - if you don't want to merge the code for spotting missing
slave detect for 2.6.21 it would be best to remove the SLAVE flag from
that driver for 2.6.21 and just probe master only - safer and will break
only ultra-obscure setups)

Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_pcmcia.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_pcmcia.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_pcmcia.c  2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_pcmcia.c  2007-03-06 
17:56:21.0 +
@@ -42,7 +42,7 @@
 
 
 #define DRV_NAME pata_pcmcia
-#define DRV_VERSION 0.3.0
+#define DRV_VERSION 0.3.1
 
 /*
  * Private data structure to glue stuff together
@@ -118,6 +118,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = ata_cable_40wire,
 
.qc_prep= ata_qc_prep,
.qc_issue   = ata_qc_issue_prot,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_pdc202xx_old: Cable detect clean up

2007-03-07 Thread Alan Cox
Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_pdc202xx_old.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_pdc202xx_old.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_pdc202xx_old.c
2007-03-06 23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_pdc202xx_old.c2007-03-06 
23:40:02.0 +
@@ -22,45 +22,17 @@
 #include linux/libata.h
 
 #define DRV_NAME pata_pdc202xx_old
-#define DRV_VERSION 0.4.0
+#define DRV_VERSION 0.4.2
 
-/**
- * pdc2024x_pre_reset  -   probe begin
- * @ap: ATA port
- *
- * Set up cable type and use generic probe init
- */
-
-static int pdc2024x_pre_reset(struct ata_port *ap)
-{
-   ap-cbl = ATA_CBL_PATA40;
-   return ata_std_prereset(ap);
-}
-
-
-static void pdc2024x_error_handler(struct ata_port *ap)
-{
-   ata_bmdma_drive_eh(ap, pdc2024x_pre_reset, ata_std_softreset, NULL, 
ata_std_postreset);
-}
-
-
-static int pdc2026x_pre_reset(struct ata_port *ap)
+static int pdc2026x_cable_detect(struct ata_port *ap)
 {
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
u16 cis;
 
pci_read_config_word(pdev, 0x50, cis);
if (cis  (1  (10 + ap-port_no)))
-   ap-cbl = ATA_CBL_PATA80;
-   else
-   ap-cbl = ATA_CBL_PATA40;
-
-   return ata_std_prereset(ap);
-}
-
-static void pdc2026x_error_handler(struct ata_port *ap)
-{
-   ata_bmdma_drive_eh(ap, pdc2026x_pre_reset, ata_std_softreset, NULL, 
ata_std_postreset);
+   return ATA_CBL_PATA80;
+   return ATA_CBL_PATA40;
 }
 
 /**
@@ -291,8 +263,9 @@
 
.freeze = ata_bmdma_freeze,
.thaw   = ata_bmdma_thaw,
-   .error_handler  = pdc2024x_error_handler,
+   .error_handler  = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = ata_cable_40wire,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
@@ -325,8 +298,9 @@
 
.freeze = ata_bmdma_freeze,
.thaw   = ata_bmdma_thaw,
-   .error_handler  = pdc2026x_error_handler,
+   .error_handler  = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = pdc2026x_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= pdc2026x_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_sil680: cable detect

2007-03-07 Thread Alan Cox
Much the same as the others except we have to keep our own error_handler
methods as the chip has bus reset registers that we need to poke.

Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_sil680.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_sil680.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_sil680.c  2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_sil680.c  2007-03-06 
23:36:26.0 +
@@ -33,7 +33,7 @@
 #include linux/libata.h
 
 #define DRV_NAME pata_sil680
-#define DRV_VERSION 0.4.5
+#define DRV_VERSION 0.4.6
 
 /**
  * sil680_selreg   -   return register base
@@ -91,12 +91,6 @@
return ATA_CBL_PATA40;
 }
 
-static int sil680_pre_reset(struct ata_port *ap)
-{
-   ap-cbl = sil680_cable_detect(ap);
-   return ata_std_prereset(ap);
-}
-
 /**
  * sil680_bus_reset-   reset the SIL680 bus
  * @ap: ATA port to reset
@@ -119,7 +113,7 @@
 
 static void sil680_error_handler(struct ata_port *ap)
 {
-   ata_bmdma_drive_eh(ap, sil680_pre_reset, sil680_bus_reset, NULL, 
ata_std_postreset);
+   ata_bmdma_drive_eh(ap, ata_std_prereset, sil680_bus_reset, NULL, 
ata_std_postreset);
 }
 
 /**
@@ -257,6 +251,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = sil680_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = sil680_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_efar: Switch to cable_detect method

2007-03-07 Thread Alan Cox
Unfortunately the device differs also in the higher speeds mode setup so
we can't merge it into ata_piix even though its a sort of clone.

Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_efar.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_efar.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_efar.c2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_efar.c2007-03-06 
23:35:15.0 +
@@ -22,10 +22,10 @@
 #include linux/ata.h
 
 #define DRV_NAME   pata_efar
-#define DRV_VERSION0.4.3
+#define DRV_VERSION0.4.4
 
 /**
- * efar_pre_reset  -   check for 40/80 pin
+ * efar_pre_reset  -   Enable bits
  * @ap: Port
  *
  * Perform cable detection for the EFAR ATA interface. This is
@@ -40,16 +40,8 @@
};
 
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
-   u8 tmp;
-
if (!pci_test_config_bits(pdev, efar_enable_bits[ap-port_no]))
return -ENOENT;
-
-   pci_read_config_byte(pdev, 0x47, tmp);
-   if (tmp  (2  ap-port_no))
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA80;
return ata_std_prereset(ap);
 }
 
@@ -67,6 +59,25 @@
 }
 
 /**
+ * efar_cable_detect   -   check for 40/80 pin
+ * @ap: Port
+ *
+ * Perform cable detection for the EFAR ATA interface. This is
+ * different to the PIIX arrangement
+ */
+
+static int efar_cable_detect(struct ata_port *ap)
+{
+   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
+   u8 tmp;
+
+   pci_read_config_byte(pdev, 0x47, tmp);
+   if (tmp  (2  ap-port_no))
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
+}
+
+/**
  * efar_set_piomode - Initialize host controller PATA PIO timings
  * @ap: Port whose timings we are configuring
  * @adev: um
@@ -256,6 +267,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = efar_error_handler,
.post_internal_cmd  = ata_bmdma_post_internal_cmd,
+   .cable_detect   = efar_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_it8213: Cable detect

2007-03-07 Thread Alan Cox
Another not-quite PIIX, another cable type conversion

Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_it8213.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_it8213.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_it8213.c  2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_it8213.c  2007-03-06 
23:35:15.0 +
@@ -25,8 +25,8 @@
  * it8213_pre_reset-   check for 40/80 pin
  * @ap: Port
  *
- * Perform cable detection for the 8213 ATA interface. This is
- * different to the PIIX arrangement
+ * Filter out ports by the enable bits before doing the normal reset
+ * and probe.
  */
 
 static int it8213_pre_reset(struct ata_port *ap)
@@ -34,23 +34,14 @@
static const struct pci_bits it8213_enable_bits[] = {
{ 0x41U, 1U, 0x80UL, 0x80UL },  /* port 0 */
};
-
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
-   u8 tmp;
-
if (!pci_test_config_bits(pdev, it8213_enable_bits[ap-port_no]))
return -ENOENT;
-
-   pci_read_config_byte(pdev, 0x42, tmp);
-   if (tmp  2)/* The initial docs are incorrect */
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA80;
return ata_std_prereset(ap);
 }
 
 /**
- * it8213_probe_reset - Probe specified port on PATA host controller
+ * it8213_error_handler - Probe specified port on PATA host controller
  * @ap: Port to probe
  *
  * LOCKING:
@@ -63,9 +54,27 @@
 }
 
 /**
+ * it8213_cable_detect -   check for 40/80 pin
+ * @ap: Port
+ *
+ * Perform cable detection for the 8213 ATA interface. This is
+ * different to the PIIX arrangement
+ */
+
+static int it8213_cable_detect(struct ata_port *ap)
+{
+   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
+   u8 tmp;
+   pci_read_config_byte(pdev, 0x42, tmp);
+   if (tmp  2)/* The initial docs are incorrect */
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
+}
+
+/**
  * it8213_set_piomode - Initialize host controller PATA PIO timings
  * @ap: Port whose timings we are configuring
- * @adev: um
+ * @adev: Device whose timings we are configuring
  *
  * Set PIO mode for device, in host controller PCI config space.
  *
@@ -268,6 +277,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = it8213_error_handler,
.post_internal_cmd  = ata_bmdma_post_internal_cmd,
+   .cable_detect   = it8213_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_marvell: Cable and reset fixes

2007-03-07 Thread Alan Cox
There are two changes here. Firstly we switch to a cable detect method,
secondly the old code forgot to call ata_std_prereset() but somehow
managed to work anyway. Fix the missing call.

Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_marvell.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_marvell.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_marvell.c 2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_marvell.c 2007-03-06 
23:35:28.0 +
@@ -20,7 +20,7 @@
 #include linux/ata.h
 
 #define DRV_NAME   pata_marvell
-#define DRV_VERSION0.1.1
+#define DRV_VERSION0.1.4
 
 /**
  * marvell_pre_reset   -   check for 40/80 pin
@@ -52,22 +52,23 @@
if ((pdev-device == 0x6145)  (ap-port_no == 0) 
(!(devices  0x10)))/* PATA enable ? */
return -ENOENT;
+   return ata_std_prereset(ap);
+}
 
+static int marvell_cable_detect(struct ata_port *ap)
+{
/* Cable type */
switch(ap-port_no)
{
case 0:
if (ioread8(ap-ioaddr.bmdma_addr + 1)  1)
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA80;
-   break;
-
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
case 1: /* Legacy SATA port */
-   ap-cbl = ATA_CBL_SATA;
-   break;
+   return ATA_CBL_SATA;
}
-   return ata_std_prereset(ap);
+   BUG();
+   return 0;   /* Our BUG macro needs the right markup */
 }
 
 /**
@@ -123,6 +124,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = marvell_error_handler,
.post_internal_cmd  = ata_bmdma_post_internal_cmd,
+   .cable_detect   = marvell_cable_detect,
 
/* BMDMA handling is PCI ATA format, use helpers */
.bmdma_setup= ata_bmdma_setup,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_serverworks: Cable detect and comment fix

2007-03-07 Thread Alan Cox
- Switch to cable_detect method
- Correct name of driver in initial comments

Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_serverworks.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_serverworks.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_serverworks.c 2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_serverworks.c 2007-03-06 
23:36:26.0 +
@@ -1,5 +1,5 @@
 /*
- * ata-serverworks.c   - Serverworks PATA for new ATA layer
+ * pata_serverworks.c  - Serverworks PATA for new ATA layer
  *   (C) 2005 Red Hat Inc
  *   Alan Cox [EMAIL PROTECTED]
  *
@@ -137,14 +137,14 @@
 };
 
 /**
- * serverworks_pre_reset   -   cable detection
+ * serverworks_cable_detect-   cable detection
  * @ap: ATA port
  *
  * Perform cable detection according to the device and subvendor
  * identifications
  */
 
-static int serverworks_pre_reset(struct ata_port *ap) {
+static int serverworks_cable_detect(struct ata_port *ap) {
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
struct sv_cable_table *cb = cable_detect;
 
@@ -152,8 +152,7 @@
if (cb-device == pdev-device 
(cb-subvendor == pdev-subsystem_vendor ||
  cb-subvendor == PCI_ANY_ID)) {
-   ap-cbl = cb-cable_detect(ap);
-   return ata_std_prereset(ap);
+   return cb-cable_detect(ap);
}
cb++;
}
@@ -162,11 +161,6 @@
return -1;  /* kill compiler warning */
 }
 
-static void serverworks_error_handler(struct ata_port *ap)
-{
-   return ata_bmdma_drive_eh(ap, serverworks_pre_reset, ata_std_softreset, 
NULL, ata_std_postreset);
-}
-
 /**
  * serverworks_is_csb  -   Check for CSB or OSB
  * @pdev: PCI device to check
@@ -339,8 +333,9 @@
 
.freeze = ata_bmdma_freeze,
.thaw   = ata_bmdma_thaw,
-   .error_handler  = serverworks_error_handler,
+   .error_handler  = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = serverworks_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
@@ -374,8 +369,9 @@
 
.freeze = ata_bmdma_freeze,
.thaw   = ata_bmdma_thaw,
-   .error_handler  = serverworks_error_handler,
+   .error_handler  = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = serverworks_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_sis: Clean up using cable_detect methods

2007-03-07 Thread Alan Cox
This changeset revolves around the fact that all the SiS controllers have
the same enable bits, but differing cable detection methods. Previously
that meant each type had its own error_handler methods. Instead we can
now implement different -cable_detect methods and share a single
error_handler which does the filtering by enable bits.

In addition we had some auto const arrays that should be static const. I'm
not sure if gcc already treats them intelligently but adding the static
will make sure.

Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_sis.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_sis.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_sis.c 2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_sis.c 2007-03-06 23:36:26.0 
+
@@ -35,7 +35,7 @@
 #include sis.h
 
 #define DRV_NAME   pata_sis
-#define DRV_VERSION0.5.0
+#define DRV_VERSION0.5.1
 
 struct sis_chipset {
u16 device; /* PCI host ID */
@@ -86,106 +86,55 @@
 }
 
 /**
- * sis_133_pre_reset   -   check for 40/80 pin
+ * sis_133_cable_detect-   check for 40/80 pin
  * @ap: Port
  *
  * Perform cable detection for the later UDMA133 capable
  * SiS chipset.
  */
 
-static int sis_133_pre_reset(struct ata_port *ap)
+static int sis_133_cable_detect(struct ata_port *ap)
 {
-   static const struct pci_bits sis_enable_bits[] = {
-   { 0x4aU, 1U, 0x02UL, 0x02UL },  /* port 0 */
-   { 0x4aU, 1U, 0x04UL, 0x04UL },  /* port 1 */
-   };
-
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
u16 tmp;
 
-   if (!pci_test_config_bits(pdev, sis_enable_bits[ap-port_no]))
-   return -ENOENT;
-
/* The top bit of this register is the cable detect bit */
pci_read_config_word(pdev, 0x50 + 2 * ap-port_no, tmp);
if ((tmp  0x8000)  !sis_short_ata40(pdev))
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA80;
-
-   return ata_std_prereset(ap);
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
 }
 
 /**
- * sis_error_handler - Probe specified port on PATA host controller
- * @ap: Port to probe
- *
- * LOCKING:
- * None (inherited from caller).
- */
-
-static void sis_133_error_handler(struct ata_port *ap)
-{
-   ata_bmdma_drive_eh(ap, sis_133_pre_reset, ata_std_softreset, NULL, 
ata_std_postreset);
-}
-
-
-/**
- * sis_66_pre_reset-   check for 40/80 pin
+ * sis_66_cable_detect -   check for 40/80 pin
  * @ap: Port
  *
  * Perform cable detection on the UDMA66, UDMA100 and early UDMA133
  * SiS IDE controllers.
  */
 
-static int sis_66_pre_reset(struct ata_port *ap)
+static int sis_66_cable_detect(struct ata_port *ap)
 {
-   static const struct pci_bits sis_enable_bits[] = {
-   { 0x4aU, 1U, 0x02UL, 0x02UL },  /* port 0 */
-   { 0x4aU, 1U, 0x04UL, 0x04UL },  /* port 1 */
-   };
-
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
u8 tmp;
 
-   if (!pci_test_config_bits(pdev, sis_enable_bits[ap-port_no])) {
-   ata_port_disable(ap);
-   ata_port_printk(ap, KERN_INFO, port disabled. ignoring.\n);
-   return 0;
-   }
/* Older chips keep cable detect in bits 4/5 of reg 0x48 */
pci_read_config_byte(pdev, 0x48, tmp);
tmp = ap-port_no;
if ((tmp  0x10)  !sis_short_ata40(pdev))
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA80;
-
-   return ata_std_prereset(ap);
+   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA80;
 }
 
-/**
- * sis_66_error_handler - Probe specified port on PATA host controller
- * @ap: Port to probe
- * @classes:
- *
- * LOCKING:
- * None (inherited from caller).
- */
-
-static void sis_66_error_handler(struct ata_port *ap)
-{
-   ata_bmdma_drive_eh(ap, sis_66_pre_reset, ata_std_softreset, NULL, 
ata_std_postreset);
-}
 
 /**
- * sis_old_pre_reset   -   probe begin
+ * sis_pre_reset   -   probe begin
  * @ap: ATA port
  *
  * Set up cable type and use generic probe init
  */
 
-static int sis_old_pre_reset(struct ata_port *ap)
+static int sis_pre_reset(struct ata_port *ap)
 {
static const struct pci_bits sis_enable_bits[] = {
{ 0x4aU, 1U, 0x02UL, 0x02UL },  /* port 0 */
@@ -194,27 +143,23 @@
 
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
 
-   if (!pci_test_config_bits(pdev, sis_enable_bits[ap-port_no])) {
-   ata_port_disable(ap);
-   ata_port_printk(ap, KERN_INFO, port disabled. ignoring.\n);
-   return 0;
-   }
-   ap-cbl = ATA_CBL_PATA40;
+   if (!pci_test_config_bits(pdev, sis_enable_bits[ap-port_no]))
+   

[PATCH] pata_via: Use cable_detect method

2007-03-07 Thread Alan Cox
We end up shifting a few bits of logic around in this driver but the
basic change is the same.

Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_via.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_via.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_via.c 2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_via.c 2007-03-06 23:36:26.0 
+
@@ -62,7 +62,7 @@
 #include linux/libata.h
 
 #define DRV_NAME pata_via
-#define DRV_VERSION 0.2.1
+#define DRV_VERSION 0.3.1
 
 /*
  * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx
@@ -135,16 +135,23 @@
  */
 
 static int via_cable_detect(struct ata_port *ap) {
+   const struct via_isa_bridge *config = ap-host-private_data;
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
u32 ata66;
 
+   /* Early chips are 40 wire */
+   if ((config-flags  VIA_UDMA)  VIA_UDMA_66)
+   return ATA_CBL_PATA40;
+   /* UDMA 66 chips have only drive side logic */
+   else if((config-flags  VIA_UDMA)  VIA_UDMA_100)
+   return ATA_CBL_PATA_UNK;
+   /* UDMA 100 or later */
pci_read_config_dword(pdev, 0x50, ata66);
/* Check both the drive cable reporting bits, we might not have
   two drives */
if (ata66  (0x1010  (16 * ap-port_no)))
return ATA_CBL_PATA80;
-   else
-   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA40;
 }
 
 static int via_pre_reset(struct ata_port *ap)
@@ -156,22 +163,10 @@
{ 0x40, 1, 0x02, 0x02 },
{ 0x40, 1, 0x01, 0x01 }
};
-
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
-
if (!pci_test_config_bits(pdev, via_enable_bits[ap-port_no]))
return -ENOENT;
}
-
-   if ((config-flags  VIA_UDMA) = VIA_UDMA_100)
-   ap-cbl = via_cable_detect(ap);
-   /* The UDMA66 series has no cable detect so do drive side detect */
-   else if ((config-flags  VIA_UDMA)  VIA_UDMA_66)
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA_UNK;
-
-
return ata_std_prereset(ap);
 }
 
@@ -327,6 +322,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = via_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = via_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
@@ -362,6 +358,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = via_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = via_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] pata_hpt3x2n: Cable detect handling

2007-03-07 Thread Alan Cox
xn_pre_reset(struct ata_port *ap)
  +{
  +   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
  /* Reset the state machine */
  pci_write_config_byte(pdev, 0x50, 0x37);
  pci_write_config_byte(pdev, 0x54, 0x37);
  udelay(100);
  -
  return ata_std_prereset(ap);
   }
   
 
 Hmmm... is it really safe to reset both channels here, when only one port 
 gets reset?

It works but you have a good point, that ought to be changed.

Alan
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_atiixp: Switch to cable_detect method

2007-03-07 Thread Alan Cox
Not clear we should keep this ugly BIOS mode hack, but for now it can
stay. Possibly an ACPI based solution will work, or just doing drive side
detection now that is hopefully fixed.

Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_via.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_via.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_via.c 2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_via.c 2007-03-06 23:36:26.0 
+
@@ -62,7 +62,7 @@
 #include linux/libata.h
 
 #define DRV_NAME pata_via
-#define DRV_VERSION 0.2.1
+#define DRV_VERSION 0.3.1
 
 /*
  * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx
@@ -135,16 +135,23 @@
  */
 
 static int via_cable_detect(struct ata_port *ap) {
+   const struct via_isa_bridge *config = ap-host-private_data;
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
u32 ata66;
 
+   /* Early chips are 40 wire */
+   if ((config-flags  VIA_UDMA)  VIA_UDMA_66)
+   return ATA_CBL_PATA40;
+   /* UDMA 66 chips have only drive side logic */
+   else if((config-flags  VIA_UDMA)  VIA_UDMA_100)
+   return ATA_CBL_PATA_UNK;
+   /* UDMA 100 or later */
pci_read_config_dword(pdev, 0x50, ata66);
/* Check both the drive cable reporting bits, we might not have
   two drives */
if (ata66  (0x1010  (16 * ap-port_no)))
return ATA_CBL_PATA80;
-   else
-   return ATA_CBL_PATA40;
+   return ATA_CBL_PATA40;
 }
 
 static int via_pre_reset(struct ata_port *ap)
@@ -156,22 +163,10 @@
{ 0x40, 1, 0x02, 0x02 },
{ 0x40, 1, 0x01, 0x01 }
};
-
struct pci_dev *pdev = to_pci_dev(ap-host-dev);
-
if (!pci_test_config_bits(pdev, via_enable_bits[ap-port_no]))
return -ENOENT;
}
-
-   if ((config-flags  VIA_UDMA) = VIA_UDMA_100)
-   ap-cbl = via_cable_detect(ap);
-   /* The UDMA66 series has no cable detect so do drive side detect */
-   else if ((config-flags  VIA_UDMA)  VIA_UDMA_66)
-   ap-cbl = ATA_CBL_PATA40;
-   else
-   ap-cbl = ATA_CBL_PATA_UNK;
-
-
return ata_std_prereset(ap);
 }
 
@@ -327,6 +322,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = via_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = via_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
@@ -362,6 +358,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = via_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = via_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= ata_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: 30 second timeout on bootup with Intel ICH7 and AHCI(2.6.21-rc2)

2007-03-07 Thread Paul Rolland
Hello,

 Could it be the additional RAID controller (not used). I turned it
 off in BIOS as well. Maybe if I turned the other ports on, but then
 it would have to probe them.

Yes, that's it !

I tried to use : ata2=noprobe in the boot parameters, but that seems
to be a no-op... Too bad, 'cos' I know for sure I don't want to connect
something on this raid controller, and that would help me gain at least
30s at boot time...

Or maybe the syntax is wrong ?

Regards,
Paul

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_atiixp: Switch to cable_detect method (with correct patch)

2007-03-07 Thread Alan Cox
Lets try attaching the right patch file this time

Not clear we should keep this ugly BIOS mode hack, but for now it can
stay. Possibly an ACPI based solution will work, or just doing drive side
detection now that is hopefully fixed.

Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_atiixp.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_atiixp.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_atiixp.c  2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_atiixp.c  2007-03-06 
23:34:56.0 +
@@ -22,7 +22,7 @@
 #include linux/libata.h
 
 #define DRV_NAME pata_atiixp
-#define DRV_VERSION 0.4.4
+#define DRV_VERSION 0.4.5
 
 enum {
ATIIXP_IDE_PIO_TIMING   = 0x40,
@@ -35,23 +35,13 @@
 
 static int atiixp_pre_reset(struct ata_port *ap)
 {
-   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
static const struct pci_bits atiixp_enable_bits[] = {
{ 0x48, 1, 0x01, 0x00 },
{ 0x48, 1, 0x08, 0x00 }
};
-   u8 udma;
-
+   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
if (!pci_test_config_bits(pdev, atiixp_enable_bits[ap-port_no]))
return -ENOENT;
-
-   /* Hack from drivers/ide/pci. Really we want to know how to do the
-  raw detection not play follow the bios mode guess */
-   pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ap-port_no, udma);
-   if ((udma  0x07) = 0x04 || (udma  0x70) = 0x40)
-   ap-cbl = ATA_CBL_PATA80;
-   else
-   ap-cbl = ATA_CBL_PATA40;
return ata_std_prereset(ap);
 }
 
@@ -60,6 +50,19 @@
ata_bmdma_drive_eh(ap, atiixp_pre_reset, ata_std_softreset, NULL,   
ata_std_postreset);
 }
 
+static int atiixp_cable_detect(struct ata_port *ap)
+{
+   struct pci_dev *pdev = to_pci_dev(ap-host-dev);
+   u8 udma;
+
+   /* Hack from drivers/ide/pci. Really we want to know how to do the
+  raw detection not play follow the bios mode guess */
+   pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ap-port_no, udma);
+   if ((udma  0x07) = 0x04 || (udma  0x70) = 0x40)
+   return  ATA_CBL_PATA80;
+   return ATA_CBL_PATA40;
+}
+
 /**
  * atiixp_set_pio_timing   -   set initial PIO mode data
  * @ap: ATA interface
@@ -245,6 +248,7 @@
.thaw   = ata_bmdma_thaw,
.error_handler  = atiixp_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
+   .cable_detect   = atiixp_cable_detect,
 
.bmdma_setup= ata_bmdma_setup,
.bmdma_start= atiixp_bmdma_start,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [3/6] 2.6.21-rc2: known regressions

2007-03-07 Thread Jeff Garzik

Adrian Bunk wrote:

Subject: NCQ problem with ahci and Hitachi drive
References : http://lkml.org/lkml/2007/3/4/178
Submitter  : Mathieu Bérard [EMAIL PROTECTED]
Status : unknown


according to the last message in that thread, it sounds like ACPI and 
interrupt problems




Subject: SATA_ACPI errors during kernel boot
References : http://bugzilla.kernel.org/show_bug.cgi?id=8080
 http://bugzilla.kernel.org/show_bug.cgi?id=8046
 http://bugzilla.kernel.org/show_bug.cgi?id=8095
 http://lkml.org/lkml/2007/2/22/159
Submitter  : Janosch Machowinski [EMAIL PROTECTED]
 Lukas Hejtmanek [EMAIL PROTECTED]
 Meelis Roos [EMAIL PROTECTED]
 Olivier Mondoloni [EMAIL PROTECTED]
Handled-By : Thomas Renninger [EMAIL PROTECTED]
 Tejun Heo [EMAIL PROTECTED]
 Robert Moore [EMAIL PROTECTED]
Status : problem is being debugged


Note that there WILL be an increase in ACPI diagnostic output.  The key 
difference is whether the users are seeing scary printks, or whether the 
boot is actually breaking.


Jeff


-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_cmd640: Multiple updates

2007-03-07 Thread Alan Cox
Add suspend/resume support
Write 0x5B to 0 not 0x5C

The former is important as we must kill the FIFO on a resume

Signed-off-by: Alan Cox [EMAIL PROTECTED]

diff -u --new-file --recursive --exclude-from /usr/src/exclude 
linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_cmd640.c 
linux-2.6.21-rc2-mm2/drivers/ata/pata_cmd640.c
--- linux.vanilla-2.6.21-rc2-mm2/drivers/ata/pata_cmd640.c  2007-03-06 
23:09:46.0 +
+++ linux-2.6.21-rc2-mm2/drivers/ata/pata_cmd640.c  2007-03-06 
23:52:21.0 +
@@ -23,7 +23,7 @@
 #include linux/libata.h
 
 #define DRV_NAME pata_cmd640
-#define DRV_VERSION 0.0.3
+#define DRV_VERSION 0.0.5
 
 struct cmd640_reg {
int last;
@@ -43,6 +43,7 @@
 
 /**
  * cmd640_set_piomode  -   set initial PIO mode data
+ * @ap: ATA port
  * @adev: ATA device
  *
  * Called to do the PIO mode setup.
@@ -106,7 +107,7 @@
pci_write_config_byte(pdev, arttim + 1, (t.active  4) | 
t.recover);
} else {
/* Save the shared timings for channel, they will be loaded
-  by qc_issue_prot. Reloading the setup time is expensive
+  by qc_issue_prot. Reloading the setup time is expensive 
   so we keep a merged one loaded */
pci_read_config_byte(pdev, ARTIM23, reg);
reg = 0x3F;
@@ -219,30 +220,21 @@
.port_start = cmd640_port_start,
 };
 
-static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id 
*id)
+static void cmd640_hardware_init(struct pci_dev *pdev)
 {
u8 r;
u8 ctrl;
 
-   static struct ata_port_info info = {
-   .sht = cmd640_sht,
-   .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
-   .pio_mask = 0x1f,
-   .port_ops = cmd640_port_ops
-   };
-
-   static struct ata_port_info *port_info[2] = { info, info };
-
/* CMD640 detected, commiserations */
-   pci_write_config_byte(pdev, 0x5C, 0x00);
+   pci_write_config_byte(pdev, 0x5B, 0x00);
/* Get version info */
pci_read_config_byte(pdev, CFR, r);
/* PIO0 command cycles */
pci_write_config_byte(pdev, CMDTIM, 0);
/* 512 byte bursts (sector) */
pci_write_config_byte(pdev, BRST, 0x40);
-   /*
-* A reporter a long time ago
+   /* 
+* A reporter a long time ago
 * Had problems with the data fifo
 * So don't run the risk
 * Of putting crap on the disk
@@ -255,12 +247,26 @@
pci_read_config_byte(pdev, ARTIM23, ctrl);
ctrl |= 0x0C;
pci_write_config_byte(pdev, ARTIM23, ctrl);
+}
+
+static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id 
*id)
+{
+   static struct ata_port_info info = {
+   .sht = cmd640_sht,
+   .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+   .pio_mask = 0x1f,
+   .port_ops = cmd640_port_ops
+   };
+
+   static struct ata_port_info *port_info[2] = { info, info };
 
+   cmd640_hardware_init(pdev);
return ata_pci_init_one(pdev, port_info, 2);
 }
 
 static int cmd640_reinit_one(struct pci_dev *pdev)
 {
+   cmd640_hardware_init(pdev);
return ata_pci_device_resume(pdev);
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 008/101] ide: fix drive side 80c cable check

2007-03-07 Thread Greg KH

eighty_ninty_three() had word 93 validitity check but not the 80c bit
test itself (bit 12).  This increases the chance of incorrect wire
detection especially because host side cable detection is often
unreliable and we sometimes soley depend on drive side cable
detection.  Fix it.

Signed-off-by: Tejun Heo [EMAIL PROTECTED]
Acked-by: Alan [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]

---
 drivers/ide/ide-iops.c |2 ++
 1 file changed, 2 insertions(+)

--- linux-2.6.20.1.orig/drivers/ide/ide-iops.c
+++ linux-2.6.20.1/drivers/ide/ide-iops.c
@@ -607,6 +607,8 @@ u8 eighty_ninty_three (ide_drive_t *driv
if(!(drive-id-hw_config  0x4000))
return 0;
 #endif /* CONFIG_IDEDMA_IVB */
+   if (!(drive-id-hw_config  0x2000))
+   return 0;
return 1;
 }
 

--
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 055/101] sata_sil: ignore and clear spurious IRQs while executing commands by polling

2007-03-07 Thread Greg KH

sata_sil used to trigger HSM error if IRQ occurs during polling
command.  This didn't matter because polling wasn't used in sata_sil.
However, as of 2.6.20, all IDENTIFYs are performed by polling and
device detection sometimes fails due to spurious IRQ.  This patch
makes sata_sil ignore and clear spurious IRQ while executing commands
by polling.

This fixes bug#7996 and IMHO should also be included in -stable.

Signed-off-by: Tejun Heo [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]

---
 drivers/ata/sata_sil.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- linux-2.6.20.1.orig/drivers/ata/sata_sil.c
+++ linux-2.6.20.1/drivers/ata/sata_sil.c
@@ -383,9 +383,15 @@ static void sil_host_intr(struct ata_por
goto freeze;
}
 
-   if (unlikely(!qc || qc-tf.ctl  ATA_NIEN))
+   if (unlikely(!qc))
goto freeze;
 
+   if (unlikely(qc-tf.flags  ATA_TFLAG_POLLING)) {
+   /* this sometimes happens, just clear IRQ */
+   ata_chk_status(ap);
+   return;
+   }
+
/* Check whether we are expecting interrupt in this state */
switch (ap-hsm_task_state) {
case HSM_ST_FIRST:

--
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: iq81340mc: oops with SATA VIA

2007-03-07 Thread Dan Williams

On 3/7/07, Martin Michlmayr [EMAIL PROTECTED] wrote:

* Dan Williams [EMAIL PROTECTED] [2007-03-06 20:23]:
 Martin can you give the attached patch a try to see if it resolves the
 oops?  It has only been compile tested.  The patch spins the processor
 on the ATU outbound-queue-busy bit whenever out*() is called.

Nope, that doesn't seem to work:


Ok, this actually makes sense because the hardware will not allow
delayed writes to pass each other.  The patch would only help in the
case where ordering between posted and delayed writes needed to be
maintained, and it looks like sata_via only exposes a delayed write
interface.  I'll put together a patch to dump more diagnostics on an
external abort.
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT] sata_promise: decode and report error reasons

2007-03-07 Thread Mikael Pettersson
Tejun,

Tejun Heo writes:
  Hello, Mikael.
  
  Mikael Pettersson wrote:
   +static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd 
   *qc, u32 port_status)
   +{
   +  struct pdc_host_priv *hp = ap-host-private_data;
   +  struct ata_eh_info *ehi = ap-eh_info;
   +  unsigned int err_mask = 0, action = 0;
   +  u32 serror;
   +
   +  ata_ehi_clear_desc(ehi);
   +
   +  serror = 0;
   +  if (sata_scr_valid(ap)) {
   +  serror = pdc_sata_scr_read(ap, SCR_ERROR);
   +  if (!(hp-flags  PDC_FLAG_GEN_II))
   +  serror = ~PDC2_SERR_MASK;
   +  }
   +
   +  printk(%s: port_status 0x%08x serror 0x%08x\n, __FUNCTION__, 
   port_status, serror);
   +
   +  ata_ehi_push_desc(ehi, port_status 0x%08x, port_status);
   +
   +  if (serror  PDC_SERR_MASK) {
   +  err_mask |= AC_ERR_ATA_BUS;
  
  1. It might be that decoding PDC specific bits is unnecessary if it sets
  the standard bits correctly.  Also, SError bits above bit16 are
  diagnostic bits and don't necessarily indicate error condition.

Which SErrror bits are standard?
It is true that some of the SError bits are diagnostic rather than
actual error indicators, as Promise's driver only checks a subset
of them. I'll fix that.

  2. PDC_SERR_FIS_TYPE is more close to AC_ERR_HSM.

FIS_TYPE is described as reception of a FIS with a good CRC but
unrecognised type field. I can make it AC_ERR_HSM if that's more
appropriate.

   +  ata_ehi_push_desc(ehi, , serror 0x%08x, serror);
   +  }
   +  if (port_status  PDC_DRIVE_ERR)
   +  err_mask |= AC_ERR_DEV;
   +  if (port_status  PDC2_HTO_ERR)
   +  err_mask |= AC_ERR_TIMEOUT;
  
  What does HTO mean?  Host time out?  Until now, AC_ERR_TIMEOUT has been
  used to indicate that driver side timeout has expired and I'd like to
  keep it that way.

Yes, HTO is host bus timeout which is described as the host bus being
busy more than 256 clock (I guess PCI) cycles for an ATA I/O transfer.

If not AC_ERR_TIMEOUT, then what? AC_ERR_HOST_BUS?

   +  if (port_status  (PDC_UNDERRUN_ERR | PDC_OVERRUN_ERR | 
   PDC2_ATA_DMA_CNT_ERR
   + | PDC2_ATA_HBA_ERR))
   +  err_mask |= AC_ERR_ATA_BUS;
  
  AC_ERR_ATA_BUS indicates transmission errors on the ATA bus.  AC_ERR_HSM
  (host state machine/protocol violation), AC_ERR_HOST_BUS (host/PCI BUS
  error) or AC_ERR_SYSTEM (other system errors) seems more appropriate for
  the above error conditions.

UNDERRUN and OVERRUN occur when DMA S/G byte count differs from what the
device accepts or delivers as checked when the device asserts INTRQ.
I can make them AC_ERR_HSM instead. (HOST_BUS or SYSTEM seem inappropriate.)

ATA_HBA_ERR is any FIS transmission error on SATA interface. AC_ERR_ATA_BUS
seems appropriate for that one.

ATA_DMA_CNT_ERR is when a DMA FIS data size differs from total DMA S/G size.
I think AC_ERR_ATA_BUS is the correct choice for this one too.

I will add more explanatory text to the error bit definitions, and
perhaps also a table-driven error logger (a bit like sata_sil24).

Thanks for the review.

/Mikael
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: sata_promise SATA300TX4 intermittent problems

2007-03-07 Thread Mikael Pettersson
Peter Favrholdt writes:
  Hi,
  
  I've seen intermittent problems with Promise SATA300 TX4 controllers
  and Linux kernel 2.6.19 (through 2.6.20-rc2 with some additional
  patches).
  
  Sometimes the TX4 will loose a port - a reboot brings the drive back up 
  again. I'm quite sure the harddrives are not at fault.
  
  I have experienced this using plain vanilla Linux 2.6.19.2 and 
  2.6.20.1. Today I have tested using Linux 2.6.21-rc2 with Mikael 
  Petterson's patches (more on that further down).
  
  Yesterday (using 2.6.20.1) I could fail two out of four drives by doing:
  dd if=/dev/sda of=/dev/null bs=1M 
  dd if=/dev/sdb of=/dev/null bs=1M 
  dd if=/dev/sdc of=/dev/null bs=1M 
  dd if=/dev/sdd of=/dev/null bs=1M 
  
  sdd would fail first then after a while sdc, here is the dmesg output 
  when sdd failed:
  
  [14895.092650] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x138 
  action 0x2 frozen

SErr 0x0138 would indicate:
transport state transmission error (bit 24)
CRC error (bit 21)
disparity error (bit 20) [whatever that is]
10b_to_8b decoding error (bit 19)

I.e., serious transmission issues.

  [52849.930755] pdc_error_intr: port_status 0x1000 serror 0x
  [52849.930880] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 
  frozen
  [52849.930883] ata2.00: (port_status 0x1000)

host bus timeout error (bit 12).
I wonder why SError was clear now.

  I would be very happy to help debug this issue. Any suggestions on what 
  I should try next?

Well, at the moment I have only one possible cure: to forcibly
limit 3Gbps drives to 1.5Gbps operation, as the patch below does.

On one of my test machines (an old UltraSPARC), a SATA300 TX2plus
with a Seagate 3Gbps drive (don't have the model number handy),
will quickly experience DMA S/G overrun errors during an fsck
of a large but clean ext3 partition. With the patch below things
work solidly on that particular machine. OTOH, on another test
machine (a 440BX chipset Intel PIII), the same card/cable/disk
combination works flawlessly at 3Gbps. Mysterious.

/Mikael

--- linux-2.6.21-rc2/drivers/ata/sata_promise.c.~1~ 2007-03-06 
22:17:21.0 +0100
+++ linux-2.6.21-rc2/drivers/ata/sata_promise.c 2007-03-06 23:21:36.0 
+0100
@@ -378,6 +378,18 @@ static int pdc_port_start(struct ata_por
writel(tmp, mmio + 0x014);
}
 
+   /* hack SControl to limit speed to 1.5Gbps */
+   if ((hp-flags  PDC_FLAG_GEN_II)  sata_scr_valid(ap)) {
+   void __iomem *mmio = (void __iomem *) ap-ioaddr.scr_addr;
+   unsigned int tmp1, tmp2;
+
+   tmp1 = readl(mmio + 0x008);
+   tmp2 = (tmp1  0xff00) | 0x0011;
+   writel(tmp2, mmio + 0x008);
+   readl(mmio + 0x008); /* flush */
+   printk(%s(port %u): adjusted SControl from 0x%08x to 
0x%08x\n, __FUNCTION__, ap-port_no, tmp1, tmp2);
+   }
+
return 0;
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 5/7] xenon: add SATA support

2007-03-07 Thread Sergei Shtylyov

Felix Domke wrote:

This adds support for the HDD and DVD SATA controller on the xenon southbridge.


  Pleas post this to linux-ide@vger.kernel.org in the future.


It also disables ATA_TFLAG_POLLING in libata-core, which prevented the DVD drive
from being detected. It needs to be investigated what exactly is wrong here. 



Signed-off-by: Felix Domke [EMAIL PROTECTED]



---
 drivers/ata/Kconfig   |8 +
 drivers/ata/Makefile  |1 
 drivers/ata/libata-core.c |2 
 drivers/ata/sata_xenon.c  |  272 ++

 4 files changed, 282 insertions(+), 1 deletion(-)

Index: linux-2.6.20/drivers/ata/Kconfig
===
--- linux-2.6.20.orig/drivers/ata/Kconfig   2007-03-07 19:01:12.0 
+0100
+++ linux-2.6.20/drivers/ata/Kconfig2007-03-07 19:01:22.0 +0100
@@ -123,6 +123,14 @@
 
 	  If unsure, say N.
 
+config SATA_XENON

+   tristate Xenon SATA support
+   depends on PCI
+   help
+ This option enables support for Xenon southbridge.
+
+ If unsure, say N.
+
 config SATA_ULI
tristate ULi Electronics SATA support
depends on PCI
Index: linux-2.6.20/drivers/ata/Makefile
===
--- linux-2.6.20.orig/drivers/ata/Makefile  2007-03-07 19:01:12.0 
+0100
+++ linux-2.6.20/drivers/ata/Makefile   2007-03-07 19:01:22.0 +0100
@@ -11,6 +11,7 @@
 obj-$(CONFIG_SATA_VIA) += sata_via.o
 obj-$(CONFIG_SATA_VITESSE) += sata_vsc.o
 obj-$(CONFIG_SATA_SIS) += sata_sis.o
+obj-$(CONFIG_SATA_XENON)   += sata_xenon.o
 obj-$(CONFIG_SATA_SX4) += sata_sx4.o
 obj-$(CONFIG_SATA_NV)  += sata_nv.o
 obj-$(CONFIG_SATA_ULI) += sata_uli.o
Index: linux-2.6.20/drivers/ata/libata-core.c
===
--- linux-2.6.20.orig/drivers/ata/libata-core.c 2007-03-07 19:01:12.0 
+0100
+++ linux-2.6.20/drivers/ata/libata-core.c  2007-03-07 19:01:22.0 
+0100
@@ -1478,7 +1478,7 @@
}
 
 	tf.protocol = ATA_PROT_PIO;

-   tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */
+// tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */


   I doubt that this could *ever* get accepted.


err_mask = ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE,
 id, sizeof(id[0]) * ATA_ID_WORDS);
Index: linux-2.6.20/drivers/ata/sata_xenon.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.20/drivers/ata/sata_xenon.c   2007-03-07 19:01:22.0 
+0100
@@ -0,0 +1,272 @@
+/*
+ *  sata_xenon.c - SATA support for xenon southbridge
+ *
+ *  based on sata_sis.c, modifications by anonymous xbox360 hacker,
+ *
+ * Please ALWAYS copy linux-ide@vger.kernel.org
+ * on emails.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *
+ *  libata documentation is available via 'make {ps|pdf}docs',
+ *  as Documentation/DocBook/libata.*
+ *
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/pci.h
+#include linux/init.h
+#include linux/blkdev.h
+#include linux/delay.h
+#include linux/interrupt.h
+#include linux/device.h
+#include scsi/scsi_host.h
+#include linux/libata.h
+
+#define DRV_NAME   sata_xenon
+#define DRV_VERSION0.1
+
+   /* small note: it's completely unknown whether the xenon southbridge 
sata
+  is really based on SiS technology.
+  Most of SATA is standardized anyway.
+
+
+  So, we have these two pci devices, one for each port.
+
+  They have two BARs, one for the IDE registers (0..7,
+  altstatus/devctl is +0xA), and one for the BMDMA.
+
+  SCR seem to be sis-like in pci config space, but that should
+  be verified!
+
+  Note on the DVD-ROM part:
+
+  The drives usually require some tweaks to be usable under linux.
+
+  You either need to hack the scsi layer, or, in case of the GDR3120L,
+  set 'modeB' in the bootloader.
+   */
+
+enum {
+   /* PCI configuration registers */
+   SIS_SCR_BASE= 0xc0, /* 

Re: [patch 5/7] xenon: add SATA support

2007-03-07 Thread Sergei Shtylyov

Felix Domke wrote:

Felix Domke wrote:



This adds support for the HDD and DVD SATA controller on the xenon
southbridge.



 Pleas post this to linux-ide@vger.kernel.org in the future.



I'll do.



It also disables ATA_TFLAG_POLLING in libata-core, which prevented the
DVD drive
from being detected. It needs to be investigated what exactly is wrong
here. 



tf.protocol = ATA_PROT_PIO;
-tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */
+//tf.flags |= ATA_TFLAG_POLLING; /* for polling presence
detection */



  I doubt that this could *ever* get accepted.



It was not meant to be accepted, but to work around the problem which
was introduced in 2.6.19. I have far too less knowledge of the SATA
layer to understand why this flag exactly causes the detection of the
DVD-Drive fail.



As said, this needs to be investigated, and fixed (in the driver, of
course, not in the subsystem).


   Yeah, I've missed it in the patch description. :-


+static unsigned int get_scr_cfg_addr(unsigned int port_no, unsigned
int sc_reg, int device)
+{
+unsigned int addr = SIS_SCR_BASE + (4 * sc_reg);
+



  Why we need device and port_no arguments here?



As there is only one device/port per PCI device, the arguments should
probably be removed from this function, right.



+if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */
+return 0; /* assume no error */


  Since SCR_ERROR == 1, this check seems broken.



Why?


   Since get_scr_cfg_addr() will never return 1... oh wait, we're checking 
another variable... :-
   Maybe worth merging to get_scr_cfg_addr() then, along with (sc_reg  
SCR_CONTROL) checks, to avoid duplicate code.



Felix


MBR, Sergei
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 5/7] xenon: add SATA support

2007-03-07 Thread Felix Domke
Sergei Shtylyov wrote:
 Felix Domke wrote:
 This adds support for the HDD and DVD SATA controller on the xenon
 southbridge.
   Pleas post this to linux-ide@vger.kernel.org in the future.
I'll do.

 It also disables ATA_TFLAG_POLLING in libata-core, which prevented the
 DVD drive
 from being detected. It needs to be investigated what exactly is wrong
 here. 

  tf.protocol = ATA_PROT_PIO;
 -tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */
 +//tf.flags |= ATA_TFLAG_POLLING; /* for polling presence
 detection */
I doubt that this could *ever* get accepted.
It was not meant to be accepted, but to work around the problem which
was introduced in 2.6.19. I have far too less knowledge of the SATA
layer to understand why this flag exactly causes the detection of the
DVD-Drive fail.

As said, this needs to be investigated, and fixed (in the driver, of
course, not in the subsystem).

 +static unsigned int get_scr_cfg_addr(unsigned int port_no, unsigned
 int sc_reg, int device)
 +{
 +unsigned int addr = SIS_SCR_BASE + (4 * sc_reg);
 +
Why we need device and port_no arguments here?
As there is only one device/port per PCI device, the arguments should
probably be removed from this function, right.

 +if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */
 +return 0; /* assume no error */
Since SCR_ERROR == 1, this check seems broken.
Why?


Felix
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 5/7] [RFC] xenon: add SATA support

2007-03-07 Thread Felix Domke
This adds support for the HDD and DVD SATA controller on the xenon
southbridge.

It also disables ATA_TFLAG_POLLING in libata-core, which prevented the
DVD drive
from being detected. It needs to be investigated what exactly is wrong
here.

Signed-off-by: Felix Domke [EMAIL PROTECTED]

---
 drivers/ata/Kconfig   |8 +
 drivers/ata/Makefile  |1
 drivers/ata/libata-core.c |2
 drivers/ata/sata_xenon.c  |  272
++
 4 files changed, 282 insertions(+), 1 deletion(-)

Index: linux-2.6.20/drivers/ata/Kconfig
===
--- linux-2.6.20.orig/drivers/ata/Kconfig   2007-03-07 19:01:12.0
+0100
+++ linux-2.6.20/drivers/ata/Kconfig2007-03-07 19:01:22.0 +0100
@@ -123,6 +123,14 @@

  If unsure, say N.

+config SATA_XENON
+   tristate Xenon SATA support
+   depends on PCI
+   help
+ This option enables support for Xenon southbridge.
+
+ If unsure, say N.
+
 config SATA_ULI
tristate ULi Electronics SATA support
depends on PCI
Index: linux-2.6.20/drivers/ata/Makefile
===
--- linux-2.6.20.orig/drivers/ata/Makefile  2007-03-07 19:01:12.0
+0100
+++ linux-2.6.20/drivers/ata/Makefile   2007-03-07 19:01:22.0 +0100
@@ -11,6 +11,7 @@
 obj-$(CONFIG_SATA_VIA) += sata_via.o
 obj-$(CONFIG_SATA_VITESSE) += sata_vsc.o
 obj-$(CONFIG_SATA_SIS) += sata_sis.o
+obj-$(CONFIG_SATA_XENON)   += sata_xenon.o
 obj-$(CONFIG_SATA_SX4) += sata_sx4.o
 obj-$(CONFIG_SATA_NV)  += sata_nv.o
 obj-$(CONFIG_SATA_ULI) += sata_uli.o
Index: linux-2.6.20/drivers/ata/libata-core.c
===
--- linux-2.6.20.orig/drivers/ata/libata-core.c 2007-03-07
19:01:12.0 +0100
+++ linux-2.6.20/drivers/ata/libata-core.c  2007-03-07 19:01:22.0
+0100
@@ -1478,7 +1478,7 @@
}

tf.protocol = ATA_PROT_PIO;
-   tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */
+// tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */

err_mask = ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE,
 id, sizeof(id[0]) * ATA_ID_WORDS);
Index: linux-2.6.20/drivers/ata/sata_xenon.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.20/drivers/ata/sata_xenon.c   2007-03-07 19:01:22.0
+0100
@@ -0,0 +1,272 @@
+/*
+ *  sata_xenon.c - SATA support for xenon southbridge
+ *
+ *  based on sata_sis.c, modifications by anonymous xbox360 hacker,
+ *
+ * Please ALWAYS copy linux-ide@vger.kernel.org
+ * on emails.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *
+ *  libata documentation is available via 'make {ps|pdf}docs',
+ *  as Documentation/DocBook/libata.*
+ *
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/pci.h
+#include linux/init.h
+#include linux/blkdev.h
+#include linux/delay.h
+#include linux/interrupt.h
+#include linux/device.h
+#include scsi/scsi_host.h
+#include linux/libata.h
+
+#define DRV_NAME   sata_xenon
+#define DRV_VERSION0.1
+
+   /* small note: it's completely unknown whether the xenon southbridge 
sata
+  is really based on SiS technology.
+  Most of SATA is standardized anyway.
+
+
+  So, we have these two pci devices, one for each port.
+
+  They have two BARs, one for the IDE registers (0..7,
+  altstatus/devctl is +0xA), and one for the BMDMA.
+
+  SCR seem to be sis-like in pci config space, but that should
+  be verified!
+
+  Note on the DVD-ROM part:
+
+  The drives usually require some tweaks to be usable under linux.
+
+  You either need to hack the scsi layer, or, in case of the GDR3120L,
+  set 'modeB' in the bootloader.
+   */
+
+enum {
+   /* PCI configuration registers */
+   SIS_SCR_BASE= 0xc0, /* sata0 phy SCR registers */
+};
+
+extern struct ata_probe_ent *ata_probe_ent_alloc(struct device *dev,
+  

NVIDIA MCP55 NCQ

2007-03-07 Thread Richard Scobie
Am running a Redhat FC6 machine with kernel 2.6.19-1.2911.6.5 and 
wondering if there is not yet support for the NCQ feature of sata_nv on 
boards using the NVIDIA MCP55 chipset.


ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata4.00: ATA-7, max UDMA/133, 976773168 sectors: LBA48 NCQ (depth 0/32)
ata4.00: ata4: dev 0 multi count 1
ata4.00: configured for UDMA/133
scsi 2:0:0:0: Direct-Access ATA  WDC WD5000YS-01M 09.0 PQ: 0 ANSI: 5
SCSI device sdc: 976773168 512-byte hdwr sectors (500108 MB)
sdc: Write Protect is off
sdc: Mode Sense: 00 3a 00 00
SCSI device sdc: drive cache: write back
SCSI device sdc: 976773168 512-byte hdwr sectors (500108 MB)
sdc: Write Protect is off
sdc: Mode Sense: 00 3a 00 00

The drive is NCQ capable and when I attempt to:

echo 31  /sys/block/sdc/device/queue_depth

I get a permission denied, (as root) and am reluctant to force the 
issue, as I understand it should all just work, (depth 31/3), if 
everything is OK.


Regards,

Richard
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Libata Pass Through PIO Multi Support

2007-03-07 Thread Jeff Garzik

Fajun Chen wrote:

Hi Folks,

In ata_scsi_pass_thru() function in libata-scsi.c, the following code
is in place:
   if (scsicmd[1]  0xe0)
   /* PIO multi not supported yet */
   goto invalid_fld;
Could someone explain why the PIO multi is not supported in libata pass 
through?


That's just code left over from before we merged Albert Lee's patches 
adding PIO-multi support.  That check should probably just be removed.


Jeff



-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Libata Pass Through PIO Multi Support

2007-03-07 Thread Fajun Chen

On 3/7/07, Jeff Garzik [EMAIL PROTECTED] wrote:

Fajun Chen wrote:
 Hi Folks,

 In ata_scsi_pass_thru() function in libata-scsi.c, the following code
 is in place:
if (scsicmd[1]  0xe0)
/* PIO multi not supported yet */
goto invalid_fld;
 Could someone explain why the PIO multi is not supported in libata pass
 through?

That's just code left over from before we merged Albert Lee's patches
adding PIO-multi support.  That check should probably just be removed.



Could you please provide a pointer to Albert Lee's PIO multi patch?
I'm not sure if 2.6.18-rc2 with libata 2.00 has already got the patch.

Thanks,
Fajun
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: NVIDIA MCP55 NCQ

2007-03-07 Thread Dâniel Fraga
On Thu, 08 Mar 2007 10:56:30 +1300
Richard Scobie [EMAIL PROTECTED] wrote:

 Am running a Redhat FC6 machine with kernel 2.6.19-1.2911.6.5 and 
 wondering if there is not yet support for the NCQ feature of sata_nv
 on boards using the NVIDIA MCP55 chipset.

 I get a permission denied, (as root) and am reluctant to force the 
 issue, as I understand it should all just work, (depth 31/3), if 
 everything is OK.

The only chipsets supported by sata_nv driver are nForce4
(CK804/MCP04) SATA controllers:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fbbb262d9ea9bdbd79d7058271560e9990bc62d3

MCP55 isn't supported. On newer chipsets (MCP65, MCP67...)
nvidia moved to AHCI.

I think that if nobody with the necessary knowledge to support
those chipsets like MCP55 decides to program, we'll be on our
own :( unfortunately.

I searched nvnews.net forum and it seems nvidia will do nothing
about it... :(

-- 
http://u-br.net
Linux 2.6.20: Homicidal Dwarf Hamster
gcc (GCC) 4.1.2

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT] sata_promise: decode and report error reasons

2007-03-07 Thread Tejun Heo
Hello,

Jeff clarified most things.  Just few more things.

Mikael Pettersson wrote:
 Which SErrror bits are standard?
 It is true that some of the SError bits are diagnostic rather than
 actual error indicators, as Promise's driver only checks a subset
 of them. I'll fix that.

Pretty much most of them.  Just take a look at SError section in
serialATA spec.  libata EH decodes most of error and some of diagnostic
bits in ata_eh_analyze_serror().

 ATA_DMA_CNT_ERR is when a DMA FIS data size differs from total DMA S/G size.
 I think AC_ERR_ATA_BUS is the correct choice for this one too.

AC_ERR_ATA_BUS is a bit special in that if it happens repeatedly it will
trigger transfer speed adjustment pretty quickly.  The error should be
set iff the error is a transmission error on the wire which is likely to
be fixed by slowing down the transfer rate.  Maybe it should have been
named AC_ERR_ATA_TRANSMISSION or something.

As Jeff pointed out, AC_ERR_HSM is usually used when we can receive the
FIS correctly but it doesn't make sense.  This is usually caused by
driver error or seriously brain damaged firmware.  :-)

Thanks.

-- 
tejun
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sata-nv hotplug feature

2007-03-07 Thread Russ Weeks
Hi,

First off, please let me know if I should repost this to a support mailing 
list.  Or, if the answer is 'rtfm', please just point me to the manual.  I 
checked the libata FAQ but can't find what I need.

I'd like some more information regarding the device hotplug feature for the 
sata-nv driver.  The FAQ indicates that 'device hotplug' == 'yank the drive': 
this seems more like 'hot-unplug' to me.  Can I then plug the drive back in 
after I've unplugged it?

This thread:
http://www.mail-archive.com/ubuntu-server@lists.ubuntu.com/msg00182.html

Seems to indicate that I can do it, but I may need to refresh the SCSI device 
system somehow.  This suits my needs just fine, as long as a plug doesn't 
necessitate a reboot.  But running rescan-scsi-bus.sh doesn't seem to work.

uname -a:
Linux backfire 2.6.19.2-smp #2 SMP Sat Mar 3 13:06:28 PST 2007 x86_64 x86_64 
x86_64 GNU/Linux

lspci shows this:
00:06.0 IDE interface: nVidia Corporation CK804 IDE (rev f2)
00:07.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev f3)
00:08.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev f3)

lsmod shows that libata and sata-nv are present.

rescan-scsi-bus.sh shows this (after I boot with 1 drive plugged in and then 
try to plug in the other 2):
OLD: Host: scsi2 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA  Model: ST3250824AS  Rev: 3.AA
  Type:   Direct-AccessANSI SCSI revision: 05

(this seems correct, just that 2 other drives are missing)

The hardware is a Tyan Thunder K8W 2895 motherboard with an onboard 
controller.  3 250Gb Seagate Barracudas are attached, 2 are in removable 
drive trays made by some company called 'ByteCC'.

_Any_ advice is appreciated.  I'm really in the dark here.

Thanks,

Russ
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 5/7] [RFC] xenon: add SATA support

2007-03-07 Thread Tejun Heo
Hello,

Generally looks good.  Some questions and suggestions follow.

Felix Domke wrote:
 Index: linux-2.6.20/drivers/ata/libata-core.c
 ===
 --- linux-2.6.20.orig/drivers/ata/libata-core.c   2007-03-07
 19:01:12.0 +0100
 +++ linux-2.6.20/drivers/ata/libata-core.c2007-03-07 19:01:22.0
 +0100
 @@ -1478,7 +1478,7 @@
   }
 
   tf.protocol = ATA_PROT_PIO;
 - tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */
 +//   tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */

Polling IDENTIFY doesn't work for you?  Care to explain how it's broken?

 Index: linux-2.6.20/drivers/ata/sata_xenon.c
 ===
 --- /dev/null 1970-01-01 00:00:00.0 +
 +++ linux-2.6.20/drivers/ata/sata_xenon.c 2007-03-07 19:01:22.0
 +0100
 +Note on the DVD-ROM part:
 +
 +The drives usually require some tweaks to be usable under linux.
 +
 +You either need to hack the scsi layer, or, in case of the GDR3120L,
 +set 'modeB' in the bootloader.

Care to explain it further?  Or is it some cryptic embedded stuff?

 +extern struct ata_probe_ent *ata_probe_ent_alloc(struct device *dev,
 +  const struct ata_port_info 
 *port);

This is an internal function and if you do this, your driver won't build
as a kernel module.  Please do as other drivers do.  probe_ent is in the
process of being removed, so looking ugly is okay for the time being.

 +static u32 xenon_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
 +{
 + struct pci_dev *pdev = to_pci_dev(ap-host-dev);
 + unsigned int cfg_addr = get_scr_cfg_addr(ap-port_no, sc_reg,
 pdev-device);
 + u32 val;
 +
 + if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */
 + return 0; /* assume no error */

Interesting, SError isn't there while other regs are?

 +static u32 xenon_scr_read (struct ata_port *ap, unsigned int sc_reg)
 +{
 + if (sc_reg  SCR_CONTROL)
 + return 0xU;
 +
 + return xenon_scr_cfg_read(ap, sc_reg);
 +}

Just collapse xenon_scr_cfg_read() into xenon_scr_read().

 +static void xenon_scr_write (struct ata_port *ap, unsigned int sc_reg,
 u32 val)
 +{
 + if (sc_reg  SCR_CONTROL)
 + return;
 +
 + xenon_scr_cfg_write(ap, sc_reg, val);
 +}

Ditto for write.

 +static int xenon_init_one (struct pci_dev *pdev, const struct
 pci_device_id *ent)
 +{
 + static int printed_version;
 + struct ata_probe_ent *probe_ent = NULL;
 + int rc;
 + int pci_dev_busy = 0;
 +
 + if (!printed_version++)
 + dev_printk(KERN_INFO, pdev-dev, version  DRV_VERSION \n);
 +
 + rc = pci_enable_device(pdev);
 + if (rc)
 + return rc;

New drivers are generally accepted into libata-dev#upstream branch, and
it looks a bit different in the init path.  If you're a gitter, please
generate patch against libata-dev#upstream, if not the latest -mm should
be good enough.

Thanks.

-- 
tejun
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 005/101] pata_amd: fix an obvious bug in cable detection

2007-03-07 Thread Greg KH

80c test mask is at bits 18 and 19 of EIDE Controller Configuration
not 22 and 23.  Fix it.

Signed-off-by: Tejun Heo [EMAIL PROTECTED]
Acked-by: Alan Cox [EMAIL PROTECTED]

---
 drivers/ata/pata_amd.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-2.6.20.1.orig/drivers/ata/pata_amd.c
+++ linux-2.6.20.1/drivers/ata/pata_amd.c
@@ -128,7 +128,7 @@ static void timing_setup(struct ata_port
 
 static int amd_pre_reset(struct ata_port *ap)
 {
-   static const u32 bitmask[2] = {0x03, 0xC0};
+   static const u32 bitmask[2] = {0x03, 0x0C};
static const struct pci_bits amd_enable_bits[] = {
{ 0x40, 1, 0x02, 0x02 },
{ 0x40, 1, 0x01, 0x01 }
@@ -247,7 +247,7 @@ static void amd133_set_dmamode(struct at
  */
 
 static int nv_pre_reset(struct ata_port *ap) {
-   static const u8 bitmask[2] = {0x03, 0xC0};
+   static const u8 bitmask[2] = {0x03, 0x0C};
static const struct pci_bits nv_enable_bits[] = {
{ 0x50, 1, 0x02, 0x02 },
{ 0x50, 1, 0x01, 0x01 }

--
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


regression: SATA dead after resume from RAM 2.6.21-rc3

2007-03-07 Thread Mark Lord

Mmm.. like others, I've now been bitten by what looks like
a SATA failure on resume from RAM, with 2.6.21-rc3.

I don't have enough info to blame this specific -rc* kernel,
as it has only done it once to me so far.

So, a datapoint, but not much of clue beyond that.
Unless it happens again.

Yes, the GUI did come back from suspend, but the disk
(ICH6M) did not seem want to talk to anything afterwards,
and the system hung on a manual alt-sysrq-Sync.
I waited only about a minute or so before rebooting.

Here's the lspci and the last kernel logs from around
the suspend/resume before I rebooted.

# lspci
:00:00.0 Host bridge: Intel Corporation Mobile 915GM/PM/GMS/910GML Express 
Processor to DRAM Controller (rev 03)
:00:01.0 PCI bridge: Intel Corporation Mobile 915GM/PM Express PCI Express 
Root Port (rev 03)
:00:1d.0 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 
Family) USB UHCI #1 (rev 03)
:00:1d.1 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 
Family) USB UHCI #2 (rev 03)
:00:1d.2 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 
Family) USB UHCI #3 (rev 03)
:00:1d.3 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 
Family) USB UHCI #4 (rev 03)
:00:1d.7 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 
Family) USB2 EHCI Controller (rev 03)
:00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev d3)
:00:1e.2 Multimedia audio controller: Intel Corporation 
82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controller (rev 03)
:00:1f.0 ISA bridge: Intel Corporation 82801FBM (ICH6M) LPC Interface 
Bridge (rev 03)
:00:1f.2 IDE interface: Intel Corporation 82801FBM (ICH6M) SATA Controller 
(rev 03)
:00:1f.3 SMBus: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) SMBus 
Controller (rev 03)
:01:00.0 VGA compatible controller: ATI Technologies Inc M22 [Radeon 
Mobility M300]
:03:00.0 Ethernet controller: Broadcom Corporation BCM4401-B0 100Base-TX 
(rev 02)
:03:01.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev b3)
:03:01.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C552 IEEE 1394 Controller 
(rev 08)
:03:01.2 0805: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 
17)
:03:03.0 Network controller: Intel Corporation PRO/Wireless 2915ABG MiniPCI 
Adapter (rev 05)

14:28:37 gconfd (root-10138): starting (version 2.14.0), pid 10138 user 'root'
14:28:37 gconfd (root-10138): Resolved address 
xml:readonly:/etc/gconf/gconf.xml.mandatory to a read-only configuration 
source at position 0
14:28:37 gconfd (root-10138): Resolved address xml:readwrite:/root/.gconf to 
a writable configuration source at position 1
14:28:37 gconfd (root-10138): Resolved address 
xml:readonly:/etc/gconf/gconf.xml.defaults to a read-only configuration 
source at position 2
14:28:37 gconfd (root-10138): Resolved address 
xml:readonly:/var/lib/gconf/debian.defaults to a read-only configuration 
source at position 3
14:28:37 gconfd (root-10138): Resolved address 
xml:readonly:/var/lib/gconf/defaults to a read-only configuration source at 
position 4
14:32:43 gconfd (root-10138): GConf server is not in use, shutting down.
14:32:43 gconfd (root-10138): Exiting
14:32:43 kernel: Stopping tasks ... done.
14:32:43 kernel: Suspending console(s)
14:32:43 kernel: pl2303 5-1.3:1.0: no suspend for driver pl2303?
14:32:43 kernel: ACPI: PCI interrupt for device :03:01.2 disabled
14:32:43 kernel: ACPI: PCI interrupt for device :03:00.0 disabled
14:32:43 kernel: ACPI: PCI interrupt for device :00:1f.2 disabled
14:32:43 kernel: ACPI: PCI interrupt for device :00:1e.2 disabled
14:32:43 kernel: ACPI: PCI interrupt for device :00:1d.7 disabled
14:32:43 kernel: ACPI: PCI interrupt for device :00:1d.3 disabled
14:32:43 kernel: ACPI: PCI interrupt for device :00:1d.2 disabled
14:32:43 kernel: ACPI: PCI interrupt for device :00:1d.1 disabled
14:32:43 kernel: ACPI: PCI interrupt for device :00:1d.0 disabled
14:32:43 kernel: Intel machine check architecture supported.
14:32:43 kernel: Intel machine check reporting enabled on CPU#0.
14:32:43 kernel: Back to C!
14:32:43 kernel: PM: Writing back config space on device :00:01.0 at offset 
3 (was 1, writing 10010)
14:32:43 kernel: PCI: Setting latency timer of device :00:01.0 to 64
14:32:43 kernel: ACPI: PCI Interrupt :00:1d.0[A] - GSI 16 (level, low) - 
IRQ 16
14:32:43 kernel: PCI: Setting latency timer of device :00:1d.0 to 64
14:32:43 kernel: usb usb1: root hub lost power or was reset
14:32:43 kernel: PCI: Enabling device :00:1d.1 ( - 0001)
14:32:43 kernel: ACPI: PCI Interrupt :00:1d.1[B] - GSI 17 (level, low) - 
IRQ 18
14:32:43 kernel: PCI: Setting latency timer of device :00:1d.1 to 64
14:32:43 kernel: PM: Writing back config space on device :00:1d.1 at offset 
f (was 200, writing 20a)
14:32:43 kernel: PM: Writing back config space on device :00:1d.1 at offset 
8 (was 1, writing bf61)

Re: [PATCH 3/3] Use correct IDE error recovery

2007-03-07 Thread Bartlomiej Zolnierkiewicz

Hi,

(sorry for the long delay)

On Wednesday 21 February 2007, Suleiman Souhlal wrote:
 IDE error recovery is using WIN_IDLEIMMEDIATE which was only valid for
 IDE V1 and IDE V2.  Modern drives will not be able to recover using
 this error handling.  The correct thing to do is issue a SRST followed
 by a SET_FEATURES.

This change looks fine, indeed we are better of using SRST + SET_FEATURES
than IDLE_IMMEDIATE.

 Signed-off-by:Suleiman Souhlal [EMAIL PROTECTED]
 
 ---
  drivers/ide/ide-io.c   |   35 +++-
  drivers/ide/ide-iops.c |  105 
 
  include/linux/ide.h|2 +
  3 files changed, 88 insertions(+), 54 deletions(-)
 
 diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
 index c193553..2f05b4d 100644
 --- a/drivers/ide/ide-io.c
 +++ b/drivers/ide/ide-io.c
 @@ -519,21 +519,21 @@ static ide_startstop_t ide_ata_error(ide
   if ((stat  DRQ_STAT)  rq_data_dir(rq) == READ  
 hwif-err_stops_fifo == 0)
   try_to_flush_leftover_data(drive);
  
 + if (rq-errors = ERROR_MAX || blk_noretry_request(rq)) {
 + ide_kill_rq(drive, rq);
 + return ide_stopped;
 + }
 +
   if (hwif-INB(IDE_STATUS_REG)  (BUSY_STAT|DRQ_STAT))
 - /* force an abort */
 - hwif-OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
 + rq-errors |= ERROR_RESET;
  
 - if (rq-errors = ERROR_MAX || blk_noretry_request(rq))
 - ide_kill_rq(drive, rq);
 - else {
 - if ((rq-errors  ERROR_RESET) == ERROR_RESET) {
 - ++rq-errors;
 - return ide_do_reset(drive);
 - }
 - if ((rq-errors  ERROR_RECAL) == ERROR_RECAL)
 - drive-special.b.recalibrate = 1;

Is the removal of ERROR_RECAL handling intentional?
There is nothing about it in the patch description...

 + if ((rq-errors  ERROR_RESET) == ERROR_RESET) {
   ++rq-errors;
 + return ide_do_reset(drive);
   }
 +
 + ++rq-errors;
 +
   return ide_stopped;
  }
  
 @@ -586,6 +586,13 @@ EXPORT_SYMBOL_GPL(__ide_error);
   *   both new-style (taskfile) and old style command handling here.
   *   In the case of taskfile command handling there is work left to
   *   do
 + *   This used to send a idle immediate to the drive if the drive was
 + *   busy or had drq set.  This violates the ATA spec (can only send IDLE
 + *   immediate when drive is not busy) and really hoses up some drives.

Could this part of the comment be merged into the patch description?
We don't want to clutter the code with the history of the changes.

 + *   We've changed it to just do a SRST followed by a set features (set
 + *   udma mode) it those cases.  This is what Western Digital recommends

hmm, it doesn't have to be UDMA mode,
-current_speed can also be PIO/SWDMA/MWDMA

 + *   for error recovery and what Western Digital says Windows does.  It
 + *   also does not violate the ATA spec as far as I can tell.
   */

The patch fixes code in ide_ata_error() and updates the comment
for ide_error() but ide_atapi_error() is not left untouched
(it still uses IDLE IMMEDIATE).

I suppose that ide_atapi_error() (for ATAPI devices) needs similar fix?

  ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, u8 stat)
 @@ -1004,6 +1011,12 @@ #endif
   goto kill_rq;
   }
  
 + /* We reset the drive so we need to issue a SETFEATURES. */
 + if ((drive-current_speed == 0xff) 
 + ((rq-cmd_type == REQ_TYPE_ATA_CMD) ||
 + (rq-cmd_type == REQ_TYPE_ATA_TASK)))
 + ide_config_drive_speed_irq(drive, drive-desired_speed);

Please update the patch to not depend on ide_config_drive_speed() fixes
[PATCH 2/3] which need more work (shouldn't be a problem as the code here
uses _irq variant anyway).

Please respin the patch so I could merge it.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] Use correct IDE error recovery

2007-03-07 Thread Alan Cox
 On Wednesday 21 February 2007, Suleiman Souhlal wrote:
  IDE error recovery is using WIN_IDLEIMMEDIATE which was only valid for
  IDE V1 and IDE V2.  Modern drives will not be able to recover using
  this error handling.  The correct thing to do is issue a SRST followed
  by a SET_FEATURES.
 
 This change looks fine, indeed we are better of using SRST + SET_FEATURES
 than IDLE_IMMEDIATE.
 
  Signed-off-by:  Suleiman Souhlal [EMAIL PROTECTED]

Acked-by: Alan Cox [EMAIL PROTECTED]

And this is well worth doing - IDLEIMMEDIATE blows the mind of some later
drive firmware that doesn't expect to be treated in an IDE v1 manner.


Alan
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html