[PATCH] trm290: do hook dma_host_{on,off} methods (take 2)

2007-12-27 Thread Sergei Shtylyov
Using default methods caused the chip's DMA PRD count registers, inadvertently
starting DMA!  While fixing it, also do:

- get rid of the 'ide_' prefixes in several functions for which the prefix in
  the method's name has been 'ide_' ectomized already;

- align the code hooking the IDE DMA methods in init_hwif_trm290()...

---
Fixed the header, added 'static' to the new method definitions.
The patch is against Linus' kernel tree...

Signed-off-by: Sergei Shtylyov [EMAIL PROTECTED]

 drivers/ide/pci/trm290.c |   29 -
 1 files changed, 20 insertions(+), 9 deletions(-)

Index: linux-2.6/drivers/ide/pci/trm290.c
===
--- linux-2.6.orig/drivers/ide/pci/trm290.c
+++ linux-2.6/drivers/ide/pci/trm290.c
@@ -1,7 +1,8 @@
 /*
- *  linux/drivers/ide/pci/trm290.c Version 1.02Mar. 18, 2000
+ *  linux/drivers/ide/pci/trm290.c Version 1.05Dec. 26, 2007
  *
  *  Copyright (c) 1997-1998  Mark Lord
+ *  Copyright (c) 2007   MontaVista Software, Inc. [EMAIL PROTECTED]
  *  May be copied or modified under the terms of the GNU General Public License
  *
  *  June 22, 2004 - get rid of check_region
@@ -177,7 +178,7 @@ static void trm290_selectproc (ide_drive
trm290_prepare_drive(drive, drive-using_dma);
 }
 
-static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
+static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
BUG_ON(HWGROUP(drive)-handler != NULL);/* paranoia check */
ide_set_handler(drive, ide_dma_intr, WAIT_CMD, NULL);
@@ -185,7 +186,7 @@ static void trm290_ide_dma_exec_cmd(ide_
outb(command, IDE_COMMAND_REG);
 }
 
-static int trm290_ide_dma_setup(ide_drive_t *drive)
+static int trm290_dma_setup(ide_drive_t *drive)
 {
ide_hwif_t *hwif = drive-hwif;
struct request *rq = hwif-hwgroup-rq;
@@ -215,7 +216,7 @@ static int trm290_ide_dma_setup(ide_driv
return 0;
 }
 
-static void trm290_ide_dma_start(ide_drive_t *drive)
+static void trm290_dma_start(ide_drive_t *drive)
 {
 }
 
@@ -240,6 +241,14 @@ static int trm290_ide_dma_test_irq (ide_
return (status == 0x00ff);
 }
 
+static void trm290_dma_host_on(ide_drive_t *drive)
+{
+}
+
+static void trm290_dma_host_off(ide_drive_t *drive)
+{
+}
+
 static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
 {
unsigned int cfgbase = 0;
@@ -280,11 +289,13 @@ static void __devinit init_hwif_trm290(i
 
ide_setup_dma(hwif, (hwif-config_data + 4) ^ (hwif-channel ? 0x0080 : 
0x), 3);
 
-   hwif-dma_setup = trm290_ide_dma_setup;
-   hwif-dma_exec_cmd = trm290_ide_dma_exec_cmd;
-   hwif-dma_start = trm290_ide_dma_start;
-   hwif-ide_dma_end = trm290_ide_dma_end;
-   hwif-ide_dma_test_irq = trm290_ide_dma_test_irq;
+   hwif-dma_host_off  = trm290_dma_host_off;
+   hwif-dma_host_on   = trm290_dma_host_on;
+   hwif-dma_setup = trm290_dma_setup;
+   hwif-dma_exec_cmd  = trm290_dma_exec_cmd;
+   hwif-dma_start = trm290_dma_start;
+   hwif-ide_dma_end   = trm290_ide_dma_end;
+   hwif-ide_dma_test_irq  = trm290_ide_dma_test_irq;
 
hwif-selectproc = trm290_selectproc;
 #if 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


Re: HSM violation erros on sata_promise

2007-12-27 Thread Mikael Pettersson
Theo Baumgartner writes:
  Hello List
  
  I'm getting these HSM violation's too on all the SATA 300 TX4 ports with 
  Seagate ST3250824NS disks.
  In the files attached are informations about the system with logs included 
  and the kernel .config.
  
  
  Theo
  This is on Promise SATA300 TX4 and sata_promise

(snip)

  uname -rpm
  2.6.23-gentoo-r3 i686 AMD Athlon(tm) XP 2200+

First, we don't support random hacked vendor kernels,
so please try a vanilla kernel, preferably 2.6.24-rc2 or newer.
If you must use 2.6.23, apply this patch first:
http://user.it.uu.se/~mikpe/linux/patches/sata_promise/patch-sata_promise-1-asic-sg-bug-fix-v3-2.6.23

(snip)

  lspci
  00:00.0 Host bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333]
  00:01.0 PCI bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333 
  AGP]
  00:06.0 Mass storage controller: Promise Technology, Inc. PDC40718 (SATA 300 
  TX4) (rev 02)
  00:07.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 
  74)
  00:08.0 RAID bus controller: Silicon Image, Inc. SiI 3124 PCI-X Serial ATA 
  Controller (rev 01)
  00:10.0 USB Controller: VIA Technologies, Inc. VT82x UHCI USB 1.1 
  Controller (rev 80)
  00:10.1 USB Controller: VIA Technologies, Inc. VT82x UHCI USB 1.1 
  Controller (rev 80)
  00:10.2 USB Controller: VIA Technologies, Inc. VT82x UHCI USB 1.1 
  Controller (rev 80)
  00:10.3 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 82)
  00:11.0 ISA bridge: VIA Technologies, Inc. VT8235 ISA Bridge
  00:11.1 IDE interface: VIA Technologies, Inc. 
  VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
  01:00.0 VGA compatible controller: nVidia Corporation NV17 [GeForce4 MX 440] 
  (rev a3)

You have three hard drive controllers. How many disks does this old
mainboard have? It's not uncommon for disks to fail under load due to
overloaded power supplies.

(snip)

  sd 1:0:0:0: [sdb] 488397168 512-byte hardware sectors (250059 MB)
  sd 1:0:0:0: [sdb] Write Protect is off
  sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
  sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support 
  DPO or FUA
  ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2
  ata4.00: port_status 0x2008
  ata4.00: cmd c8/00:08:3f:00:00/00:00:00:00:00/e0 tag 0 cdb 0x0 data 4096 in
   res 50/00:00:46:00:00/00:00:00:00:00/e0 Emask 0x2 (HSM violation)

This is a familiar issue, one that may be fixed or at least
made less frequent in recent kernels -- see above.

But your kernel log is incomplete. You have an nVidia graphics chip:
if you've loaded the nvidia proprietary kernel module then all bets are off.

/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: [PATCH] ide-cd: move the remaining cdrom.c ioctl handling code to ide-cd_ioctl.c

2007-12-27 Thread Bartlomiej Zolnierkiewicz
On Wednesday 26 December 2007, Borislav Petkov wrote:
 On Wed, Dec 26, 2007 at 09:50:14PM +0100, Borislav Petkov wrote:
 
 Actually you should drop the previous one for it wasn't incomplete. Here's,
 hopefully, a better one :).
 --
 From: Borislav Petkov [EMAIL PROTECTED]
 
 There should be no functional changes from this.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied, thanks
-
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] trm290: do hook dma_host_{on,off} methods (take 2)

2007-12-27 Thread Bartlomiej Zolnierkiewicz
On Thursday 27 December 2007, Sergei Shtylyov wrote:
 Using default methods caused the chip's DMA PRD count registers, inadvertently
 starting DMA!  While fixing it, also do:

nasty, this could possibly explain the following trm290.c hack:

...
#if 0 /* play it safe for now */
  IDE_HFLAG_TRUST_BIOS_FOR_DMA |
#endif
...

 - get rid of the 'ide_' prefixes in several functions for which the prefix in
   the method's name has been 'ide_' ectomized already;
 
 - align the code hooking the IDE DMA methods in init_hwif_trm290()...
 
 ---
 Fixed the header, added 'static' to the new method definitions.
 The patch is against Linus' kernel tree...
 
 Signed-off-by: Sergei Shtylyov [EMAIL PROTECTED]

applied
-
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 1/3] amd74xx: remove amd_ide_chips table

2007-12-27 Thread Bartlomiej Zolnierkiewicz

* Remove no longer needed assertion from amd74xx_probe().

* Factor out cable detection for AMD7409 to amd7409_cable_detect() and for
  chipsets = AMD7411 to amd7411_cable_detect().

* Use dev-vendor and dev-device instead of amd_config-udma_mask when
  selecting cable detection method and checking for broken FIFO support in
  init_chipset_amd74xx().

* Remove no longer needed AMD_BAD_FIFO define.

* Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro.

* Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro.

* Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe()
  in order to fix -swdma_mask on early AMD7409 revisions and -udma_mask
  on Serenade mainboards.

* Remove no longer needed fixups from init_chipset_amd74xx()
  and AMD_CHECK_{SWDMA,SERENADE} defines.

* Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(),
  also remove incorrect comment while at it.

* Use hwif-ultra_mask instead of amd_config-udma_mask in amd_set_drive().

* Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from
  amd_set_drive() instead of using amd_config-udma_mask.

* Move amd_config-base from AMD_* defines to users of these defines and add
  0x40 the defined values.  Then add amd_offset() inline helper for selecting
  offset from 0x40 base (needed for nVidia controllers) and finally use it in
  amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead
  of amd_config-base.

* Remove no longer needed AMD_BAD_SWDMA define, -{swdma,ultra}_mask setup
  from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips
  table.

* Fix init_chipset_amd74xx() comment.

* Bump driver version.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
-305 bytes
 drivers/ide/pci/amd74xx.c |  275 --
 1 file changed, 124 insertions(+), 151 deletions(-)

Index: b/drivers/ide/pci/amd74xx.c
===
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -1,5 +1,5 @@
 /*
- * Version 2.24
+ * Version 2.25
  *
  * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
  * IDE driver for Linux.
@@ -28,81 +28,46 @@
 
 #include ide-timing.h
 
-#define AMD_IDE_CONFIG (0x01 + amd_config-base)
-#define AMD_CABLE_DETECT   (0x02 + amd_config-base)
-#define AMD_DRIVE_TIMING   (0x08 + amd_config-base)
-#define AMD_8BIT_TIMING(0x0e + amd_config-base)
-#define AMD_ADDRESS_SETUP  (0x0c + amd_config-base)
-#define AMD_UDMA_TIMING(0x10 + amd_config-base)
-
-#define AMD_CHECK_SWDMA0x08
-#define AMD_BAD_SWDMA  0x10
-#define AMD_BAD_FIFO   0x20
-#define AMD_CHECK_SERENADE 0x40
-
-/*
- * AMD SouthBridge chips.
- */
-
-static struct amd_ide_chip {
-   unsigned short id;
-   u8 base;
-   u8 udma_mask;
-   u8 flags;
-} amd_ide_chips[] = {
-   { PCI_DEVICE_ID_AMD_COBRA_7401,  0x40, ATA_UDMA2, AMD_BAD_SWDMA 
},
-   { PCI_DEVICE_ID_AMD_VIPER_7409,  0x40, ATA_UDMA4, 
AMD_CHECK_SWDMA },
-   { PCI_DEVICE_ID_AMD_VIPER_7411,  0x40, ATA_UDMA5, AMD_BAD_FIFO 
},
-   { PCI_DEVICE_ID_AMD_OPUS_7441,   0x40, ATA_UDMA5, },
-   { PCI_DEVICE_ID_AMD_8111_IDE,0x40, ATA_UDMA6, 
AMD_CHECK_SERENADE },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE_IDE,   0x50, ATA_UDMA5, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE,  0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE, 0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA,0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE,  0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE, 0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA,0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2,   0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, 0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, 0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, 0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE, 0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE, 0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE, 0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE, 0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE, 0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE, 0x50, ATA_UDMA6, },
-   { PCI_DEVICE_ID_AMD_CS5536_IDE,  0x40, ATA_UDMA5, },
-   { 0 }
+enum {
+   AMD_IDE_CONFIG  = 0x41,
+   AMD_CABLE_DETECT= 0x42,
+   AMD_DRIVE_TIMING= 0x48,
+   AMD_8BIT_TIMING = 0x4e,
+   AMD_ADDRESS_SETUP   = 0x4c,
+   AMD_UDMA_TIMING = 0x50,
 };
 
-static struct amd_ide_chip 

[PATCH 2/3] ide: add IDE_HFLAG_CLEAR_SIMPLEX host flag

2007-12-27 Thread Bartlomiej Zolnierkiewicz

* Rename 'simplex_stat' variable to 'dma_stat' in ide_get_or_set_dma_base().

* Factor out code for forcing host out of simplex mode from
  ide_get_or_set_dma_base() to ide_pci_clear_simplex() helper.

* Add IDE_HFLAG_CLEAR_SIMPLEX host flag and set it in alim15x3 (for M5229),
  amd74xx (for AMD 7409), cmd64x (for CMD643), generic (for Netcell) and
  serverworks (for CSB5) host drivers.

* Make ide_get_or_set_dma_base() test for IDE_HFLAG_CLEAR_SIMPLEX host flag
  instead of checking dev-device (BTW the code was buggy because it didn't
  check for dev-vendor, luckily none of these PCI Device IDs was used by
  some other vendor for PCI IDE controller).

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/alim15x3.c|7 ++-
 drivers/ide/pci/amd74xx.c |1 
 drivers/ide/pci/cmd64x.c  |4 +-
 drivers/ide/pci/generic.c |3 +
 drivers/ide/pci/serverworks.c |4 +-
 drivers/ide/setup-pci.c   |   77 ++
 include/linux/ide.h   |2 +
 7 files changed, 49 insertions(+), 49 deletions(-)

Index: b/drivers/ide/pci/alim15x3.c
===
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -775,7 +775,7 @@ static int __devinit alim15x3_init_one(s
};
 
struct ide_port_info d = ali15x3_chipset;
-   u8 rev = dev-revision;
+   u8 rev = dev-revision, idx = id-driver_data;
 
if (pci_dev_present(ati_rs100))
printk(KERN_WARNING alim15x3: ATI Radeon IGP Northbridge is 
not yet fully tested.\n);
@@ -798,6 +798,9 @@ static int __devinit alim15x3_init_one(s
d.udma_mask = ATA_UDMA6;
}
 
+   if (idx == 0)
+   d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX;
+
 #if defined(CONFIG_SPARC64)
d.init_hwif = init_hwif_common_ali15x3;
 #endif /* CONFIG_SPARC64 */
@@ -807,7 +810,7 @@ static int __devinit alim15x3_init_one(s
 
 static const struct pci_device_id alim15x3_pci_tbl[] = {
{ PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5229), 0 },
-   { PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5228), 0 },
+   { PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5228), 1 },
{ 0, },
 };
 MODULE_DEVICE_TABLE(pci, alim15x3_pci_tbl);
Index: b/drivers/ide/pci/amd74xx.c
===
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -295,6 +295,7 @@ static int __devinit amd74xx_probe(struc
if (idx == 1) {
if (dev-revision = 7)
d.swdma_mask = 0;
+   d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX;
} else if (idx == 4) {
if (dev-subsystem_vendor == PCI_VENDOR_ID_AMD 
dev-subsystem_device == PCI_DEVICE_ID_AMD_SERENADE)
Index: b/drivers/ide/pci/cmd64x.c
===
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -443,7 +443,9 @@ static const struct ide_port_info cmd64x
.init_chipset   = init_chipset_cmd64x,
.init_hwif  = init_hwif_cmd64x,
.enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}},
-   .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
+   .host_flags = IDE_HFLAG_CLEAR_SIMPLEX |
+ IDE_HFLAG_ABUSE_PREFETCH |
+ IDE_HFLAG_BOOTABLE,
.pio_mask   = ATA_PIO5,
.mwdma_mask = ATA_MWDMA2,
.udma_mask  = 0x00, /* no udma */
Index: b/drivers/ide/pci/generic.c
===
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -104,7 +104,8 @@ static const struct ide_port_info generi
 
{   /* 14 */
.name   = Revolution,
-   .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
+   .host_flags = IDE_HFLAG_CLEAR_SIMPLEX |
+ IDE_HFLAG_TRUST_BIOS_FOR_DMA |
  IDE_HFLAG_OFF_BOARD,
.swdma_mask = ATA_SWDMA2,
.mwdma_mask = ATA_MWDMA2,
Index: b/drivers/ide/pci/serverworks.c
===
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -418,7 +418,9 @@ static int __devinit svwks_init_one(stru
 
d = serverworks_chipsets[idx];
 
-   if (idx == 2 || idx == 3) {
+   if (idx == 1)
+   d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX;
+   else if (idx == 2 || idx == 3) {
if ((PCI_FUNC(dev-devfn)  1) == 0) {
if (pci_resource_start(dev, 0) != 0x01f1)
d.host_flags = ~IDE_HFLAG_BOOTABLE;
Index: b/drivers/ide/setup-pci.c

[PATCH 3/3] ide: add IDE_HFLAG_NO_DSC host flag

2007-12-27 Thread Bartlomiej Zolnierkiewicz

* Add IDE_HFLAG_NO_DSC host flag for hosts that doesn't support DSC overlap.

* Set it in aec62xx (for ATP850UF only) and hpt34x host drivers.

* Convert ide-tape device driver to check for IDE_HFLAG_NO_DSC flag.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-tape.c|   16 
 drivers/ide/pci/aec62xx.c |1 +
 drivers/ide/pci/hpt34x.c  |1 +
 include/linux/ide.h   |2 ++
 4 files changed, 8 insertions(+), 12 deletions(-)

Index: b/drivers/ide/ide-tape.c
===
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -4532,19 +4532,11 @@ static void idetape_setup (ide_drive_t *
 
spin_lock_init(tape-spinlock);
drive-dsc_overlap = 1;
-#ifdef CONFIG_BLK_DEV_IDEPCI
-   if (HWIF(drive)-pci_dev != NULL) {
-   /*
-* These two ide-pci host adapters appear to need DSC overlap 
disabled.
-* This probably needs further analysis.
-*/
-   if ((HWIF(drive)-pci_dev-device == 
PCI_DEVICE_ID_ARTOP_ATP850UF) ||
-   (HWIF(drive)-pci_dev-device == PCI_DEVICE_ID_TTI_HPT343)) 
{
-   printk(KERN_INFO ide-tape: %s: disabling DSC 
overlap\n, tape-name);
-   drive-dsc_overlap = 0;
-   }
+   if (drive-hwif-host_flags  IDE_HFLAG_NO_DSC) {
+   printk(KERN_INFO ide-tape: %s: disabling DSC overlap\n,
+tape-name);
+   drive-dsc_overlap = 0;
}
-#endif /* CONFIG_BLK_DEV_IDEPCI */
/* Seagate Travan drives do not support DSC overlap. */
if (strstr(drive-id-model, Seagate STT3401))
drive-dsc_overlap = 0;
Index: b/drivers/ide/pci/aec62xx.c
===
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -202,6 +202,7 @@ static const struct ide_port_info aec62x
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
.host_flags = IDE_HFLAG_SERIALIZE |
  IDE_HFLAG_NO_ATAPI_DMA |
+ IDE_HFLAG_NO_DSC |
  IDE_HFLAG_ABUSE_SET_DMA_MODE |
  IDE_HFLAG_OFF_BOARD,
.pio_mask   = ATA_PIO4,
Index: b/drivers/ide/pci/hpt34x.c
===
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -131,6 +131,7 @@ static void __devinit init_hwif_hpt34x(i
 
 #define IDE_HFLAGS_HPT34X \
(IDE_HFLAG_NO_ATAPI_DMA | \
+IDE_HFLAG_NO_DSC | \
 IDE_HFLAG_ABUSE_SET_DMA_MODE | \
 IDE_HFLAG_NO_AUTODMA)
 
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1098,6 +1098,8 @@ enum {
IDE_HFLAG_CY82C693  = (1  27),
/* force host out of simplex mode */
IDE_HFLAG_CLEAR_SIMPLEX = (1  28),
+   /* DSC overlap is unsupported */
+   IDE_HFLAG_NO_DSC= (1  29),
 };
 
 #ifdef CONFIG_BLK_DEV_OFFBOARD
-
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 9/9] ide: use ide_build_sglist() and ide_destroy_dmatable() in non-PCI host drivers

2007-12-27 Thread Bartlomiej Zolnierkiewicz
* Make ide_build_sglist() and ide_destroy_dmatable() available also when
  CONFIG_BLK_DEV_IDEDMA_PCI=n.

* Use ide_build_sglist() and ide_destroy_dmatable() in {ics,au1xxx-}ide.c
  and remove no longer needed {ics,au}ide_build_sglist().

There should be no functionality changes caused by this patch.

Cc: Russell King [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/arm/icside.c  |   21 ++---
 drivers/ide/ide-dma.c |4 +++-
 drivers/ide/mips/au1xxx-ide.c |   28 +++-
 include/linux/ide.h   |5 +++--
 4 files changed, 11 insertions(+), 47 deletions(-)

Index: b/drivers/ide/arm/icside.c
===
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -204,22 +204,6 @@ static void icside_maskproc(ide_drive_t 
  * interfaces use the same IRQ, which should guarantee this.
  */
 
-static void icside_build_sglist(ide_drive_t *drive, struct request *rq)
-{
-   ide_hwif_t *hwif = drive-hwif;
-   struct scatterlist *sg = hwif-sg_table;
-
-   ide_map_sg(drive, rq);
-
-   if (rq_data_dir(rq) == READ)
-   hwif-sg_dma_direction = DMA_FROM_DEVICE;
-   else
-   hwif-sg_dma_direction = DMA_TO_DEVICE;
-
-   hwif-sg_nents = dma_map_sg(hwif-dev, sg, hwif-sg_nents,
-   hwif-sg_dma_direction);
-}
-
 /*
  * Configure the IOMD to give the appropriate timings for the transfer
  * mode being requested.  We take the advice of the ATA standards, and
@@ -298,8 +282,7 @@ static int icside_dma_end(ide_drive_t *d
disable_dma(ec-dma);
 
/* Teardown mappings after DMA has completed. */
-   dma_unmap_sg(hwif-dev, hwif-sg_table, hwif-sg_nents,
-hwif-sg_dma_direction);
+   ide_destroy_dmatable(drive);
 
return get_dma_residue(ec-dma) != 0;
 }
@@ -331,7 +314,7 @@ static int icside_dma_setup(ide_drive_t 
 */
BUG_ON(dma_channel_active(ec-dma));
 
-   icside_build_sglist(drive, rq);
+   hwif-sg_nents = ide_build_sglist(drive, rq);
 
/*
 * Ensure that we have the right interrupt routed.
Index: b/drivers/ide/ide-dma.c
===
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -170,7 +170,6 @@ static int ide_dma_good_drive(ide_drive_
return ide_in_drive_list(drive-id, drive_whitelist);
 }
 
-#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
 /**
  * ide_build_sglist-   map IDE scatter gather for DMA I/O
  * @drive: the drive to build the DMA table for
@@ -200,6 +199,7 @@ int ide_build_sglist(ide_drive_t *drive,
 
 EXPORT_SYMBOL_GPL(ide_build_sglist);
 
+#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
 /**
  * ide_build_dmatable  -   build IDE DMA table
  *
@@ -294,6 +294,7 @@ use_pio_instead:
 }
 
 EXPORT_SYMBOL_GPL(ide_build_dmatable);
+#endif
 
 /**
  * ide_destroy_dmatable-   clean up DMA mapping
@@ -316,6 +317,7 @@ void ide_destroy_dmatable (ide_drive_t *
 
 EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
 
+#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
 /**
  * config_drive_for_dma-   attempt to activate IDE DMA
  * @drive: the drive to place in DMA mode
Index: b/drivers/ide/mips/au1xxx-ide.c
===
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -209,23 +209,6 @@ static void auide_set_dma_mode(ide_drive
  */
 
 #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
-
-static int auide_build_sglist(ide_drive_t *drive,  struct request *rq)
-{
-   ide_hwif_t *hwif = drive-hwif;
-   struct scatterlist *sg = hwif-sg_table;
-
-   ide_map_sg(drive, rq);
-
-   if (rq_data_dir(rq) == READ)
-   hwif-sg_dma_direction = DMA_FROM_DEVICE;
-   else
-   hwif-sg_dma_direction = DMA_TO_DEVICE;
-
-   return dma_map_sg(hwif-dev, sg, hwif-sg_nents,
- hwif-sg_dma_direction);
-}
-
 static int auide_build_dmatable(ide_drive_t *drive)
 {
int i, iswrite, count = 0;
@@ -240,8 +223,7 @@ static int auide_build_dmatable(ide_driv
/* Save for interrupt context */
ahwif-drive = drive;
 
-   /* Build sglist */
-   hwif-sg_nents = i = auide_build_sglist(drive, rq);
+   hwif-sg_nents = i = ide_build_sglist(drive, rq);
 
if (!i)
return 0;
@@ -299,10 +281,7 @@ static int auide_build_dmatable(ide_driv
return 1;
 
  use_pio_instead:
-   dma_unmap_sg(hwif-dev,
-hwif-sg_table,
-hwif-sg_nents,
-hwif-sg_dma_direction);
+   ide_destroy_dmatable(drive);
 
return 0; /* revert to PIO for this request */
 }
@@ -312,8 +291,7 @@ static int auide_dma_end(ide_drive_t *dr
ide_hwif_t *hwif = HWIF(drive);
 
if (hwif-sg_nents) {
-   

[PATCH 8/9] ide: switch to DMA-mapping API

2007-12-27 Thread Bartlomiej Zolnierkiewicz
* pci_map_sg() - dma_map_sg() in ide_build_sglist().

* pci_unmap_sg() - dma_unmap_sg() in ide_destroy_dmatable().

There should be no functionality changes caused by this patch except
for blackfin arch whose dma_[un]map_sg() implementation differs from
pci_[un]map_sg() one (on s390 arch there is no PCI, on avr32 and h8300
archs PCI is currently unsupported, on m32r arch PCI support depends
on BROKEN, on m68k arch PCI support depends on HADES which in turn
depends on BROKEN, on all other archs dma_[un]map_sg() functionality
matches with pci_[un]map_sg() one).

Cc: Bryan Wu [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
It seems like blackfin arch should be using asm-generic/pci-dma-compat.h
in asm-blackfin/pci.h or drivers still using PCI DMA-mapping API instead
of the generic one won't work but I'll leave this to blackfin gurus...

[ Bryan, could you please take a look?  Thanks. ]

 drivers/ide/ide-dma.c |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

Index: b/drivers/ide/ide-dma.c
===
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -85,6 +85,7 @@
 #include linux/ide.h
 #include linux/delay.h
 #include linux/scatterlist.h
+#include linux/dma-mapping.h
 
 #include asm/io.h
 #include asm/irq.h
@@ -175,26 +176,26 @@ static int ide_dma_good_drive(ide_drive_
  * @drive: the drive to build the DMA table for
  * @rq: the request holding the sg list
  *
- * Perform the PCI mapping magic necessary to access the source or
- * target buffers of a request via PCI DMA. The lower layers of the
+ * Perform the DMA mapping magic necessary to access the source or
+ * target buffers of a request via DMA.  The lower layers of the
  * kernel provide the necessary cache management so that we can
- * operate in a portable fashion
+ * operate in a portable fashion.
  */
 
 int ide_build_sglist(ide_drive_t *drive, struct request *rq)
 {
ide_hwif_t *hwif = HWIF(drive);
-   struct pci_dev *pdev = to_pci_dev(hwif-dev);
struct scatterlist *sg = hwif-sg_table;
 
ide_map_sg(drive, rq);
 
if (rq_data_dir(rq) == READ)
-   hwif-sg_dma_direction = PCI_DMA_FROMDEVICE;
+   hwif-sg_dma_direction = DMA_FROM_DEVICE;
else
-   hwif-sg_dma_direction = PCI_DMA_TODEVICE;
+   hwif-sg_dma_direction = DMA_TO_DEVICE;
 
-   return pci_map_sg(pdev, sg, hwif-sg_nents, hwif-sg_dma_direction);
+   return dma_map_sg(hwif-dev, sg, hwif-sg_nents,
+ hwif-sg_dma_direction);
 }
 
 EXPORT_SYMBOL_GPL(ide_build_sglist);
@@ -308,9 +309,8 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable);
 void ide_destroy_dmatable (ide_drive_t *drive)
 {
ide_hwif_t *hwif = drive-hwif;
-   struct pci_dev *pdev = to_pci_dev(hwif-dev);
 
-   pci_unmap_sg(pdev, hwif-sg_table, hwif-sg_nents,
+   dma_unmap_sg(hwif-dev, hwif-sg_table, hwif-sg_nents,
 hwif-sg_dma_direction);
 }
 
-
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 2/9] ide: fix ide_intr() for non-PCI devices and CONFIG_BLK_DEV_IDEPCI=y

2007-12-27 Thread Bartlomiej Zolnierkiewicz
'hwif-pci_dev  !hwif-pci_dev-vendor' condition is never true,
check for 'hwif-chipset != ide_pci' instead.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-io.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/drivers/ide/ide-io.c
===
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -1487,7 +1487,7 @@ irqreturn_t ide_intr (int irq, void *dev
 * remove all the ifdef PCI crap
 */
 #ifdef CONFIG_BLK_DEV_IDEPCI
-   if (hwif-pci_dev  !hwif-pci_dev-vendor)
+   if (hwif-chipset != ide_pci)
 #endif /* CONFIG_BLK_DEV_IDEPCI */
{
/*
-
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 0/9] ide: switch to generic DMA-mapping API

2007-12-27 Thread Bartlomiej Zolnierkiewicz

Make IDE core PCI independent by replacing hwif-pci_dev (struct pci_dev *)
with hwif-dev (struct device *) and switch to using generic DMA-mapping API.

This is on top of IDE quilt tree + 3 patches posted today.

diffstat:

 drivers/ide/arm/icside.c  |   52 
 drivers/ide/ide-dma.c |   55 +++---
 drivers/ide/ide-io.c  |2 -
 drivers/ide/ide-lib.c |6 ++-
 drivers/ide/ide-probe.c   |4 +-
 drivers/ide/ide.c |3 +
 drivers/ide/mips/au1xxx-ide.c |   43 ---
 drivers/ide/pci/aec62xx.c |8 ++--
 drivers/ide/pci/alim15x3.c|9 ++--
 drivers/ide/pci/amd74xx.c |7 ++-
 drivers/ide/pci/atiixp.c  |9 ++--
 drivers/ide/pci/cmd64x.c  |   14 +++
 drivers/ide/pci/cs5520.c  |2 -
 drivers/ide/pci/cs5535.c  |4 +-
 drivers/ide/pci/cy82c693.c|5 +-
 drivers/ide/pci/delkin_cb.c   |2 -
 drivers/ide/pci/hpt34x.c  |2 -
 drivers/ide/pci/hpt366.c  |   29 +--
 drivers/ide/pci/it8213.c  |7 ++-
 drivers/ide/pci/it821x.c  |   47 +++--
 drivers/ide/pci/jmicron.c |2 -
 drivers/ide/pci/ns87415.c |   14 +++
 drivers/ide/pci/pdc202xx_new.c|6 ++-
 drivers/ide/pci/pdc202xx_old.c|   11 +++---
 drivers/ide/pci/piix.c|   53 ++--
 drivers/ide/pci/rz1000.c  |2 -
 drivers/ide/pci/sc1200.c  |   12 +++---
 drivers/ide/pci/scc_pata.c|   13 +++
 drivers/ide/pci/serverworks.c |   18 ++---
 drivers/ide/pci/sgiioc4.c |   19 --
 drivers/ide/pci/siimage.c |   51 ---
 drivers/ide/pci/sis5513.c |   22 ++--
 drivers/ide/pci/sl82c105.c|   17 +
 drivers/ide/pci/slc90e66.c|7 ++-
 drivers/ide/pci/tc86c001.c|3 +
 drivers/ide/pci/triflex.c |2 -
 drivers/ide/pci/trm290.c  |2 -
 drivers/ide/pci/via82cxxx.c   |   12 +++---
 drivers/ide/ppc/pmac.c|   24 ++---
 drivers/ide/setup-pci.c   |6 +--
 include/asm-mips/mach-au1x00/au1xxx_ide.h |1
 include/linux/ide.h   |   10 +++--
 42 files changed, 288 insertions(+), 329 deletions(-)

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


[PATCH 1/9] piix: remove stale comments

2007-12-27 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/piix.c |   47 +--
 1 file changed, 1 insertion(+), 46 deletions(-)

Index: b/drivers/ide/pci/piix.c
===
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -8,53 +8,8 @@
  *
  *  May be copied or modified under the terms of the GNU General Public License
  *
- *  PIO mode setting function for Intel chipsets.
- *  For use instead of BIOS settings.
+ * Documentation:
  *
- * 40-41
- * 42-43
- * 
- * 41
- * 43
- *
- * | PIO 0   | c0 | 80 | 0 |
- * | PIO 2 | SW2 | d0 | 90 | 4 |
- * | PIO 3 | MW1 | e1 | a1 | 9 |
- * | PIO 4 | MW2 | e3 | a3 | b |
- *
- * sitre = word40  0x4000; primary
- * sitre = word42  0x4000; secondary
- *
- * 44 8421|8421hdd|hdb
- *
- * 48 8421 hdd|hdc|hdb|hda udma enabled
- *
- *0001 hda
- *0010 hdb
- *0100 hdc
- *1000 hdd
- *
- * 4a 84|21hdb|hda
- * 4b 84|21hdd|hdc
- *
- *ata-33/82371AB
- *ata-33/82371EB
- *ata-33/82801ABata-66/82801AA
- *00|00 udma 0  00|00 reserved
- *01|01 udma 1  01|01 udma 3
- *10|10 udma 2  10|10 udma 4
- *11|11 reserved11|11 reserved
- *
- * 54 8421|8421ata66 drive|ata66 enable
- *
- * pci_read_config_word(HWIF(drive)-pci_dev, 0x40, reg40);
- * pci_read_config_word(HWIF(drive)-pci_dev, 0x42, reg42);
- * pci_read_config_word(HWIF(drive)-pci_dev, 0x44, reg44);
- * pci_read_config_byte(HWIF(drive)-pci_dev, 0x48, reg48);
- * pci_read_config_word(HWIF(drive)-pci_dev, 0x4a, reg4a);
- * pci_read_config_byte(HWIF(drive)-pci_dev, 0x54, reg54);
- *
- * Documentation
  * Publically available from Intel web site. Errata documentation
  * is also publically available. As an aide to anyone hacking on this
  * driver the list of errata that are relevant is below.going back to
-
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 3/9] ide: remove BUG_ON() from ide_build_sglist()

2007-12-27 Thread Bartlomiej Zolnierkiewicz
do_rw_taskfile() has been fixed to check the return value
of -dma_setup method so this BUG_ON() is no longer needed.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-dma.c |2 --
 1 file changed, 2 deletions(-)

Index: b/drivers/ide/ide-dma.c
===
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -186,8 +186,6 @@ int ide_build_sglist(ide_drive_t *drive,
ide_hwif_t *hwif = HWIF(drive);
struct scatterlist *sg = hwif-sg_table;
 
-   BUG_ON((rq-cmd_type == REQ_TYPE_ATA_TASKFILE)  rq-nr_sectors  256);
-
ide_map_sg(drive, rq);
 
if (rq_data_dir(rq) == READ)
-
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 4/9] ide: use ide_destroy_dmatable() instead of pci_unmap_sg()

2007-12-27 Thread Bartlomiej Zolnierkiewicz
Use ide_destroy_dmatable() in:
* ide-dma.c::ide_build_dmatable()
* sgiioc4.c::sgiioc4_build_dma_table()
* pmac.c::pmac_ide_{build,destroy}_dmatable()

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-dma.c |8 
 drivers/ide/pci/sgiioc4.c |3 +--
 drivers/ide/ppc/pmac.c|   14 +-
 3 files changed, 10 insertions(+), 15 deletions(-)

Index: b/drivers/ide/ide-dma.c
===
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -282,12 +282,12 @@ int ide_build_dmatable (ide_drive_t *dri
*--table |= cpu_to_le32(0x8000);
return count;
}
+
printk(KERN_ERR %s: empty DMA table?\n, drive-name);
+
 use_pio_instead:
-   pci_unmap_sg(hwif-pci_dev,
-hwif-sg_table,
-hwif-sg_nents,
-hwif-sg_dma_direction);
+   ide_destroy_dmatable(drive);
+
return 0; /* revert to PIO for this request */
 }
 
Index: b/drivers/ide/pci/sgiioc4.c
===
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -517,8 +517,7 @@ sgiioc4_build_dma_table(ide_drive_t * dr
}
 
 use_pio_instead:
-   pci_unmap_sg(hwif-pci_dev, hwif-sg_table, hwif-sg_nents,
-hwif-sg_dma_direction);
+   ide_destroy_dmatable(drive);
 
return 0;   /* revert to PIO for this request */
 }
Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1535,11 +1535,10 @@ pmac_ide_build_dmatable(ide_drive_t *dri
}
 
printk(KERN_DEBUG %s: empty DMA table?\n, drive-name);
- use_pio_instead:
-   pci_unmap_sg(hwif-pci_dev,
-hwif-sg_table,
-hwif-sg_nents,
-hwif-sg_dma_direction);
+
+use_pio_instead:
+   ide_destroy_dmatable(drive);
+
return 0; /* revert to PIO for this request */
 }
 
@@ -1548,12 +1547,9 @@ static void
 pmac_ide_destroy_dmatable (ide_drive_t *drive)
 {
ide_hwif_t *hwif = drive-hwif;
-   struct pci_dev *dev = HWIF(drive)-pci_dev;
-   struct scatterlist *sg = hwif-sg_table;
-   int nents = hwif-sg_nents;
 
if (nents) {
-   pci_unmap_sg(dev, sg, nents, hwif-sg_dma_direction);
+   ide_destroy_dmatable(drive);
hwif-sg_nents = 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


[PATCH 6/9] au1xxx-ide: use hwif-dev

2007-12-27 Thread Bartlomiej Zolnierkiewicz
* Setup hwif-dev in au_ide_probe().

* Use hwif-dev instead of ahwif-dev in auide_build_sglist(),
  auide_build_dmatable(), auide_dma_end() and auide_ddma_init().

* Remove no longer needed 'dev' field from _auide_hwif type.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/mips/au1xxx-ide.c |   15 ++-
 include/asm-mips/mach-au1x00/au1xxx_ide.h |1 -
 2 files changed, 6 insertions(+), 10 deletions(-)

Index: b/drivers/ide/mips/au1xxx-ide.c
===
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -213,7 +213,6 @@ static void auide_set_dma_mode(ide_drive
 static int auide_build_sglist(ide_drive_t *drive,  struct request *rq)
 {
ide_hwif_t *hwif = drive-hwif;
-   _auide_hwif *ahwif = (_auide_hwif*)hwif-hwif_data;
struct scatterlist *sg = hwif-sg_table;
 
ide_map_sg(drive, rq);
@@ -223,7 +222,7 @@ static int auide_build_sglist(ide_drive_
else
hwif-sg_dma_direction = DMA_TO_DEVICE;
 
-   return dma_map_sg(ahwif-dev, sg, hwif-sg_nents,
+   return dma_map_sg(hwif-dev, sg, hwif-sg_nents,
  hwif-sg_dma_direction);
 }
 
@@ -300,7 +299,7 @@ static int auide_build_dmatable(ide_driv
return 1;
 
  use_pio_instead:
-   dma_unmap_sg(ahwif-dev,
+   dma_unmap_sg(hwif-dev,
 hwif-sg_table,
 hwif-sg_nents,
 hwif-sg_dma_direction);
@@ -311,10 +310,9 @@ static int auide_build_dmatable(ide_driv
 static int auide_dma_end(ide_drive_t *drive)
 {
ide_hwif_t *hwif = HWIF(drive);
-   _auide_hwif *ahwif = (_auide_hwif*)hwif-hwif_data;
 
if (hwif-sg_nents) {
-   dma_unmap_sg(ahwif-dev, hwif-sg_table, hwif-sg_nents,
+   dma_unmap_sg(hwif-dev, hwif-sg_table, hwif-sg_nents,
 hwif-sg_dma_direction);
hwif-sg_nents = 0;
}
@@ -504,7 +502,7 @@ static int auide_ddma_init(_auide_hwif *
auide-rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide-rx_chan,
 NUM_DESCRIPTORS);
  
-   hwif-dmatable_cpu = dma_alloc_coherent(auide-dev,
+   hwif-dmatable_cpu = dma_alloc_coherent(hwif-dev,
PRD_ENTRIES * PRD_BYTES,
/* 1 Page */
hwif-dmatable_dma, 
GFP_KERNEL);

@@ -592,9 +590,6 @@ static int au_ide_probe(struct device *d
 #endif
 
memset(auide_hwif, 0, sizeof(_auide_hwif));
-   auide_hwif.dev  = 0;
-
-   ahwif-dev = dev;
ahwif-irq = platform_get_irq(pdev, 0);
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -633,6 +628,8 @@ static int au_ide_probe(struct device *d
 
ide_init_port_hw(hwif, hw);
 
+   hwif-dev = dev;
+
hwif-ultra_mask= 0x0;  /* Disable Ultra DMA */
 #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
hwif-mwdma_mask= 0x07; /* Multimode-2 DMA  */
Index: b/include/asm-mips/mach-au1x00/au1xxx_ide.h
===
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -74,7 +74,6 @@ typedef struct
 struct dbdma_cmd*dma_table_cpu;
 dma_addr_t  dma_table_dma;
 #endif
-struct device   *dev;
int irq;
u32 regbase;
 #ifdef CONFIG_PM
-
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 7/9] icside: use hwif-dev

2007-12-27 Thread Bartlomiej Zolnierkiewicz
* Setup hwif-dev in icside_setup().

* Use hwif-dev instead of state-dev in icside_build_sglist(),
  icside_dma_end(), icside_dma_start() and icside_dma_setup().

* Remove no longer needed 'dev' field from struct icside_state.

Cc: Russell King [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/arm/icside.c |   31 ++-
 1 file changed, 14 insertions(+), 17 deletions(-)

Index: b/drivers/ide/arm/icside.c
===
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -71,8 +71,6 @@ struct icside_state {
void __iomem *irq_port;
void __iomem *ioc_base;
unsigned int type;
-   /* parent device... until the IDE core gets one of its own */
-   struct device *dev;
ide_hwif_t *hwif[2];
 };
 
@@ -209,7 +207,6 @@ static void icside_maskproc(ide_drive_t 
 static void icside_build_sglist(ide_drive_t *drive, struct request *rq)
 {
ide_hwif_t *hwif = drive-hwif;
-   struct icside_state *state = hwif-hwif_data;
struct scatterlist *sg = hwif-sg_table;
 
ide_map_sg(drive, rq);
@@ -219,7 +216,7 @@ static void icside_build_sglist(ide_driv
else
hwif-sg_dma_direction = DMA_TO_DEVICE;
 
-   hwif-sg_nents = dma_map_sg(state-dev, sg, hwif-sg_nents,
+   hwif-sg_nents = dma_map_sg(hwif-dev, sg, hwif-sg_nents,
hwif-sg_dma_direction);
 }
 
@@ -294,33 +291,33 @@ static void icside_dma_host_set(ide_driv
 static int icside_dma_end(ide_drive_t *drive)
 {
ide_hwif_t *hwif = HWIF(drive);
-   struct icside_state *state = hwif-hwif_data;
+   struct expansion_card *ec = ECARD_DEV(hwif-dev);
 
drive-waiting_for_dma = 0;
 
-   disable_dma(ECARD_DEV(state-dev)-dma);
+   disable_dma(ec-dma);
 
/* Teardown mappings after DMA has completed. */
-   dma_unmap_sg(state-dev, hwif-sg_table, hwif-sg_nents,
+   dma_unmap_sg(hwif-dev, hwif-sg_table, hwif-sg_nents,
 hwif-sg_dma_direction);
 
-   return get_dma_residue(ECARD_DEV(state-dev)-dma) != 0;
+   return get_dma_residue(ec-dma) != 0;
 }
 
 static void icside_dma_start(ide_drive_t *drive)
 {
ide_hwif_t *hwif = HWIF(drive);
-   struct icside_state *state = hwif-hwif_data;
+   struct expansion_card *ec = ECARD_DEV(hwif-dev);
 
/* We can not enable DMA on both channels simultaneously. */
-   BUG_ON(dma_channel_active(ECARD_DEV(state-dev)-dma));
-   enable_dma(ECARD_DEV(state-dev)-dma);
+   BUG_ON(dma_channel_active(ec-dma));
+   enable_dma(ec-dma);
 }
 
 static int icside_dma_setup(ide_drive_t *drive)
 {
ide_hwif_t *hwif = HWIF(drive);
-   struct icside_state *state = hwif-hwif_data;
+   struct expansion_card *ec = ECARD_DEV(hwif-dev);
struct request *rq = hwif-hwgroup-rq;
unsigned int dma_mode;
 
@@ -332,7 +329,7 @@ static int icside_dma_setup(ide_drive_t 
/*
 * We can not enable DMA on both channels.
 */
-   BUG_ON(dma_channel_active(ECARD_DEV(state-dev)-dma));
+   BUG_ON(dma_channel_active(ec-dma));
 
icside_build_sglist(drive, rq);
 
@@ -349,14 +346,14 @@ static int icside_dma_setup(ide_drive_t 
/*
 * Select the correct timing for this drive.
 */
-   set_dma_speed(ECARD_DEV(state-dev)-dma, drive-drive_data);
+   set_dma_speed(ec-dma, drive-drive_data);
 
/*
 * Tell the DMA engine about the SG table and
 * data direction.
 */
-   set_dma_sg(ECARD_DEV(state-dev)-dma, hwif-sg_table, hwif-sg_nents);
-   set_dma_mode(ECARD_DEV(state-dev)-dma, dma_mode);
+   set_dma_sg(ec-dma, hwif-sg_table, hwif-sg_nents);
+   set_dma_mode(ec-dma, dma_mode);
 
drive-waiting_for_dma = 1;
 
@@ -444,6 +441,7 @@ icside_setup(void __iomem *base, struct 
hwif-noprobe = 0;
hwif-chipset = ide_acorn;
hwif-gendev.parent = ec-dev;
+   hwif-dev = ec-dev;
}
 
return hwif;
@@ -591,7 +589,6 @@ icside_probe(struct expansion_card *ec, 
}
 
state-type = ICS_TYPE_NOTYPE;
-   state-dev  = ec-dev;
 
idmem = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
if (idmem) {
-
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: PROBLEM: NCQ spurious completion

2007-12-27 Thread Alan Cox
On Thu, 27 Dec 2007 17:39:16 +0100
Hugo Grostabussiat [EMAIL PROTECTED] wrote:

 Hello.
 I am not a native English speaker, so sorry for my poor English.

Your English is fine and easy to understand.

 disabled).
 
 That's why I suggest drive Hitachi HTS541616J9SA00 revision SB4OC7DP to
 be added to the blacklist.

It turns out the bug is caused by a Linux bug not a drive bug and it has
been fixed in 2.6.24-rc properly. The blacklist entries for it have also
been removed.

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