[Fwd: IDE DMA compact flash patch linux 2.4.20]

From: Stephen Baker (sbaker@stonecold.net)
Date: Mon Apr 21 2003 - 15:20:01 EST


attached mail follows:


All,

I have been testing several vendors Compact Flash Cards with Linux
2.4.20. I have noticed many DMA problems when the Compact Flash is used
with a hard drive (salve or master) on the same control ide0. The
second problem was the detection of the hard drive.

I read most of the posting and most people doing this kind of
configuration work was seeing some kind of DMA error with this
configuration but know one had any fixes.

The first change I made was to modify my grub to use "hda=flash". I did
this because I would have to add each vendors ID string to the list of
compact flash device in the kernel which would mean frequent patches.

Now with the flash flag set correctly; I change the ide-dma.c to black
list Compact Flash cards. This keeps us from having to list all compact
flash cards in the black list as well. Now I'm able to use the Compact
Flash with out random DMA errors.

To fix the hard drive detection in this case I just commented out the
code that disables the other device if one of the devices is Compact
Flash in ide-probe.c. I researched this change and it was put in to fix
having two compact flash and if one was missing so the boot would not
hang for a long time. This breaks any configuration that uses a Compact
Flash with a hard drive. I had seen some posts that had this same
change but I guess they never submitted as a patch. I think the correct
solution for the original two Compact Flash cards would be using the
"noprobe" option in the grub.conf not as a kernel mod.

Thanks,
SB


--- ref/linux-2.4.20/drivers/ide/ide-probe.c 2002-11-28 17:53:13.000000000 -0600
+++ linux-2.4.20/drivers/ide/ide-probe.c 2003-03-30 00:22:43.000000000 -0600
@@ -166,6 +166,7 @@
          * Prevent long system lockup probing later for non-existant
          * slave drive if the hwif is actually a flash memory card of some variety:
          */
+#if 0
         if (drive_is_flashcard(drive)) {
                 ide_drive_t *mate = &HWIF(drive)->drives[1^drive->select.b.unit];
                 if (!mate->ata_flash) {
@@ -173,6 +174,7 @@
                         mate->noprobe = 1;
                 }
         }
+#endif
         drive->media = ide_disk;
         printk("ATA DISK drive\n");
         QUIRK_LIST(HWIF(drive),drive);
--- ref/linux-2.4.20/drivers/ide/ide-dma.c 2002-11-28 17:53:13.000000000 -0600
+++ linux-2.4.20/drivers/ide/ide-dma.c 2003-03-30 00:20:19.000000000 -0600
@@ -439,6 +439,8 @@
  * For both Blacklisted and Whitelisted drives.
  * This is setup to be called as an extern for future support
  * to other special driver code.
+ *
+ * All flash cards in ATA mode should also be black listed
  */
 int check_drive_lists (ide_drive_t *drive, int good_bad)
 {
@@ -448,7 +450,7 @@
         if (good_bad) {
                 return in_drive_list(id, drive_whitelist);
         } else {
- int blacklist = in_drive_list(id, drive_blacklist);
+ int blacklist = drive_is_flashcard(drive) || in_drive_list(id, drive_blacklist);
                 if (blacklist)
                         printk("%s: Disabling (U)DMA for %s\n", drive->name, id->model);
                 return(blacklist);
@@ -465,6 +467,12 @@
                 }
         } else {
                 /* Consult the list of known "bad" drives */
+ if( drive_is_flashcard(drive) ) {
+ printk("%s: Disabling (U)DMA for Flash %s\n",
+ drive->name, id->model);
+ return 1;
+ }
+
                 list = bad_dma_drives;
                 while (*list) {
                         if (!strcmp(*list++,id->model)) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Apr 23 2003 - 22:00:30 EST