> Date: Sat, 14 Nov 2015 16:59:56 +0000
> From: Miod Vallat <m...@online.fr>
> 
> I have a machine here were SATA disks fail to attach on boot:
> 
> pciide0 at pci8 dev 12 function 0 "ServerWorks K2 SATA" rev 0x00: DMA
> pciide0: using irq 0 for native-PCI interrupt
> pciide0: port 0: unknown SStatus: 0x00000005
> pciide0: port 0: PHY offline
> pciide0: port 1: PHY offline
> pciide0: port 2: PHY offline
> pciide0: port 3: PHY offline
> 
> ...and, of course, the machine fails to boot as it can't find its root
> device (despite having been loading its kernel from it).
> 
> I have experimented with a diff which would loop until the phy's SStatus
> register comes up with a reasonable value, and it has never needed more
> than one loop. Therefore, I am suggesting the diff below, which simply
> doubles the time between the phy reset and the status check.
> 
> With this diff, my disk is reliably found on every boot:
> 
> pciide0 at pci8 dev 12 function 0 "ServerWorks K2 SATA" rev 0x00: DMA
> pciide0: using irq 0 for native-PCI interrupt
> pciide0: port 0: 1.5Gb/s
> wd0 at pciide0 channel 0 drive 0: <WDC WD2500JS-75NCB3>
> wd0: 16-sector PIO, LBA48, 238418MB, 488281250 sectors
> wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 6
> pciide0: port 1: PHY offline
> pciide0: port 2: PHY offline
> pciide0: port 3: PHY offline

Don't tell me this fixes SATA on the xserve G5...

Wonder if a "posting read" is necessary here.  If that removes the
need to increase the delay, it probably is a better solution.

But if that doesn't help, this diff is fine.

> Index: pciide.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/dev/pci/pciide.c,v
> retrieving revision 1.355
> diff -u -p -r1.355 pciide.c
> --- pciide.c  18 Oct 2015 20:24:10 -0000      1.355
> +++ pciide.c  14 Nov 2015 16:54:51 -0000
> @@ -7928,7 +7928,7 @@ svwsata_drv_probe(struct channel_softc *
>       scontrol &= ~SControl_DET_INIT;
>       bus_space_write_4(ss->ba5_st, ss->ba5_sh,
>           (channel << 8) + SVWSATA_SCONTROL, scontrol);
> -     delay(50 * 1000);
> +     delay(100 * 1000);
>  
>       sstatus = bus_space_read_4(ss->ba5_st, ss->ba5_sh,
>           (channel << 8) + SVWSATA_SSTATUS);
> 
> 

Reply via email to