Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jun 2008 09:40:44 +0200
From:      =?ISO-8859-1?Q?S=F8ren_Schmidt?= <sos@FreeBSD.ORG>
To:        "Andrey V. Elsukov" <bu7cher@yandex.ru>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: [RFC] patch to AHCI device detection code
Message-ID:  <5291278A-81B5-4665-B5FF-1A6B2EC9CD15@FreeBSD.ORG>
In-Reply-To: <484F7EF9.5080602@yandex.ru>
References:  <484F7EF9.5080602@yandex.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi

Well, as you can see I tried this when I added the PM code to AHCI, =20
however one of the reasons I left it out again (for now) is that it =20
doesn't work on more than about 50% of the AHCI chipsets out there..

Modern HW in a nutshell, you win some you loose some ;)

-S=F8ren






On 11Jun, 2008, at 9:30 , Andrey V. Elsukov wrote:

> Hi, Soren.
>
> I'm found solution for AHCI that solve ATAPI device detection for me.
> I just added waiting loop on PxTFD after reset and now my SATA DVD
> detected well. Waiting time (in my case) may vary from 1ms to 900 ms.
>
> Also AHCI spec says:
>
> 10.4.2 Port Reset
> ...
> When PxSCTL.DET is set to 0h, upon receiving a COMINIT from
> the attached device, PxTFD.STS.BSY shall be set to =921=92 by the HBA.
>
> So we can wait until PxTFD.STS.BSY resets to zero and then
> read PxSIG.
>
> Any comments?
>
> --=20
> WBR, Andrey V. Elsukov
> Index: src/sys/dev/ata/ata-chipset.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /ncvs/src/sys/dev/ata/ata-chipset.c,v
> retrieving revision 1.219
> diff -u -b -p -r1.219 ata-chipset.c
> --- src/sys/dev/ata/ata-chipset.c	21 Apr 2008 10:51:38 -0000	=
1.219
> +++ src/sys/dev/ata/ata-chipset.c	11 Jun 2008 07:17:53 -0000
> @@ -1059,10 +1059,10 @@ ata_ahci_softreset(device_t dev, int por
>     struct ata_pci_controller *ctlr =3D =20
> device_get_softc(device_get_parent(dev));
>     struct ata_channel *ch =3D device_get_softc(dev);
>     int offset =3D ch->unit << 7;
> +    int timeout =3D 0;
> #ifdef AHCI_PM
>     struct ata_ahci_cmd_tab *ctp =3D
> 	(struct ata_ahci_cmd_tab *)(ch->dma.work + ATA_AHCI_CT_OFFSET);
> -    int timeout =3D 0;
>
>     /* kick controller into sane state if needed */
>     ata_ahci_restart(dev);
> @@ -1091,6 +1091,7 @@ ata_ahci_softreset(device_t dev, int por
>
>     ata_udelay(150000);
>
> +#endif
>     timeout =3D 0;
>     do {
> 	    DELAY(1000);
> @@ -1101,7 +1102,6 @@ ata_ahci_softreset(device_t dev, int por
>     } while (ATA_INL(ctlr->r_res2, ATA_AHCI_P_TFD + offset) & =20
> ATA_S_BUSY);
>     if (bootverbose)
> 	device_printf(dev, "BUSY wait time=3D%dms\n", timeout);
> -#endif
>     return ATA_INL(ctlr->r_res2, ATA_AHCI_P_SIG + offset);
> }
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5291278A-81B5-4665-B5FF-1A6B2EC9CD15>