Re: [PATCH] ahci: retry enabling AHCI a few times before spitting out WARN_ON()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Freitag, 25. April 2008, Tejun Heo wrote:
> Volker Armin Hemmann wrote:
> > git fetch
> > git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
> > upstream:upstream
> > From git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
> >  * [new branch]      upstream   -> upstream
> > energy libata-dev # git checkout -f upstream
> > Checking out files: 100% (1243/1243), done.
> > Switched to branch "upstream"
> > energy libata-dev # patch -p1 < ../ahci.patch
> > patching file drivers/ata/ahci.c
> > Hunk #1 FAILED at 556.
> > 1 out of 1 hunk FAILED -- saving rejects to file drivers/ata/ahci.c.rej
>
> That's really weird.
>
> $ git fetch -f -u
> git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git 
> upstream:upstream remote: Counting objects: 7151, done.
> remote: Compressing objects: 100% (1439/1439), done.
> Indexing 5254 objects...
> remote: Total 5254 (delta 4424), reused 4645 (delta 3815)
>  100% (5254/5254) done
> Resolving 4424 deltas...
>  100% (4424/4424) done
> 1186 objects were added to complete this thin pack.
> * refs/heads/upstream: forcing update to non-fast forward branch 'upstream'
> of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
> old...new: ed75ba5...48feb3c
> $ git checkout -f upstream
> Checking 1203 files out...
>  100% (1203/1203) done
> Switched to branch "upstream"


git clone git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
Initialized empty Git repository in /usr/src/libata-dev/.git/
remote: Counting objects: 743097, done.
remote: Compressing objects: 100% (127420/127420), done.
remote: Total 743097 (delta 617111), reused 740658 (delta 614672)
Receiving objects: 100% (743097/743097), 173.30 MiB | 7980 KiB/s, done.
Resolving deltas: 100% (617111/617111), done.
Checking out files: 100% (23824/23824), done.

energy src # cd libata-dev

energy libata-dev # git fetch -f -u 
git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git  
upstream:upstream
>From git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
 * [new branch]      upstream   -> upstream

git checkout -f upstream
Switched to branch "upstream"

cat ../ahci.patch
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 739ba3f..711b5d7 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -556,16 +556,27 @@ static inline void __iomem *ahci_port_base(struct 
ata_port *ap)

 static void ahci_enable_ahci(void __iomem *mmio)
 {
+       int i;
        u32 tmp;

        /* turn on AHCI_EN */
        tmp = readl(mmio + HOST_CTL);
-       if (!(tmp & HOST_AHCI_EN)) {
+       if (tmp & HOST_AHCI_EN)
+               return;
+
+       /* Some controllers need AHCI_EN to be written multiple times.
+        * Try a few times before giving up.
+        */
+       for (i = 0; i < 5; i++) {
                tmp |= HOST_AHCI_EN;
                writel(tmp, mmio + HOST_CTL);
                tmp = readl(mmio + HOST_CTL);   /* flush && sanity check */
-               WARN_ON(!(tmp & HOST_AHCI_EN));
+               if (tmp & HOST_AHCI_EN)
+                       return;
+               msleep(10);
        }
+
+       WARN_ON(1);
 }

 /**
energy libata-dev # patch -p1 < ../ahci.patch
patching file drivers/ata/ahci.c
Hunk #1 FAILED at 556.
1 out of 1 hunk FAILED -- saving rejects to file drivers/ata/ahci.c.rej

somewhere I am doing something wrong. But what?

btw:
git --version
git version 1.5.4.5

Glück Auf,
Volkert
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux