• xiangliang yu's avatar
    ahci: disabled FBS prior to issuing software reset · 420df0f5
    xiangliang yu authored
    commit 89dafa20f3daab5b3e0c13d0068a28e8e64e2102 upstream.
    
    Tested with Marvell 88se9125, attached with one port mulitplier(5 ports)
    and one disk, we will get following boot log messages if using current
    code:
    
      ata8: SATA link up 6.0 Gbps (SStatus 133 SControl 330)
      ata8.15: Port Multiplier 1.2, 0x1b4b:0x9715 r160, 5 ports, feat 0x1/0x1f
      ahci 0000:03:00.0: FBS is enabled
      ata8.00: hard resetting link
      ata8.00: SATA link down (SStatus 0 SControl 330)
      ata8.01: hard resetting link
      ata8.01: SATA link down (SStatus 0 SControl 330)
      ata8.02: hard resetting link
      ata8.02: SATA link down (SStatus 0 SControl 330)
      ata8.03: hard resetting link
      ata8.03: SATA link up 6.0 Gbps (SStatus 133 SControl 133)
      ata8.04: hard resetting link
      ata8.04: failed to resume link (SControl 133)
      ata8.04: failed to read SCR 0 (Emask=0x40)
      ata8.04: failed to read SCR 0 (Emask=0x40)
      ata8.04: failed to read SCR 1 (Emask=0x40)
      ata8.04: failed to read SCR 0 (Emask=0x40)
      ata8.03: native sectors (2) is smaller than sectors (976773168)
      ata8.03: ATA-8: ST3500413AS, JC4B, max UDMA/133
      ata8.03: 976773168 sectors, multi 0: LBA48 NCQ (depth 31/32)
      ata8.03: configured for UDMA/133
      ata8.04: failed to IDENTIFY (I/O error, err_mask=0x100)
      ata8.15: hard resetting link
      ata8.15: SATA link up 6.0 Gbps (SStatus 133 SControl 330)
      ata8.15: Port Multiplier vendor mismatch '0x1b4b' != '0x133'
      ata8.15: PMP revalidation failed (errno=-19)
      ata8.15: hard resetting link
      ata8.15: SATA link up 6.0 Gbps (SStatus 133 SControl 330)
      ata8.15: Port Multiplier vendor mismatch '0x1b4b' != '0x133'
      ata8.15: PMP revalidation failed (errno=-19)
      ata8.15: limiting SATA link speed to 3.0 Gbps
      ata8.15: hard resetting link
      ata8.15: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
      ata8.15: Port Multiplier vendor mismatch '0x1b4b' != '0x133'
      ata8.15: PMP revalidation failed (errno=-19)
      ata8.15: failed to recover PMP after 5 tries, giving up
      ata8.15: Port Multiplier detaching
      ata8.03: disabled
      ata8.00: disabled
      ata8: EH complete
    
    The reason is that current detection code doesn't follow AHCI spec:
    
    First,the port multiplier detection process look like this:
    
    	ahci_hardreset(link, class, deadline)
    	if (class == ATA_DEV_PMP) {
    		sata_pmp_attach(dev)	/* will enable FBS */
    		sata_pmp_init_links(ap, nr_ports);
    		ata_for_each_link(link, ap, EDGE) {
    			sata_std_hardreset(link, class, deadline);
    			if (link_is_online)	/* do soft reset */
    				ahci_softreset(link, class, deadline);
    		}
    	}
    But, according to chapter 9.3.9 in AHCI spec: Prior to issuing software
    reset, software shall clear PxCMD.ST to '0' and then clear PxFBS.EN to
    '0'.
    
    The patch test ok with kernel 3.11.1.
    
    tj: Patch white space contaminated, applied manually with trivial
        updates.
    Signed-off-by: 's avatarXiangliang Yu <yuxiangl@marvell.com>
    Signed-off-by: 's avatarTejun Heo <tj@kernel.org>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    420df0f5
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
acard-ahci.c Loading commit data...
ahci.c Loading commit data...
ahci.h Loading commit data...
ahci_platform.c Loading commit data...
ata_generic.c Loading commit data...
ata_piix.c Loading commit data...
libahci.c Loading commit data...
libata-acpi.c Loading commit data...
libata-core.c Loading commit data...
libata-eh.c Loading commit data...
libata-pmp.c Loading commit data...
libata-scsi.c Loading commit data...
libata-sff.c Loading commit data...
libata-transport.c Loading commit data...
libata-transport.h Loading commit data...
libata-zpodd.c Loading commit data...
libata.h Loading commit data...
pata_acpi.c Loading commit data...
pata_ali.c Loading commit data...
pata_amd.c Loading commit data...
pata_arasan_cf.c Loading commit data...
pata_artop.c Loading commit data...
pata_at32.c Loading commit data...
pata_at91.c Loading commit data...
pata_atiixp.c Loading commit data...
pata_atp867x.c Loading commit data...
pata_bf54x.c Loading commit data...
pata_cmd640.c Loading commit data...
pata_cmd64x.c Loading commit data...
pata_cs5520.c Loading commit data...
pata_cs5530.c Loading commit data...
pata_cs5535.c Loading commit data...
pata_cs5536.c Loading commit data...
pata_cypress.c Loading commit data...
pata_efar.c Loading commit data...
pata_ep93xx.c Loading commit data...
pata_hpt366.c Loading commit data...
pata_hpt37x.c Loading commit data...
pata_hpt3x2n.c Loading commit data...
pata_hpt3x3.c Loading commit data...
pata_icside.c Loading commit data...
pata_imx.c Loading commit data...
pata_isapnp.c Loading commit data...
pata_it8213.c Loading commit data...
pata_it821x.c Loading commit data...
pata_ixp4xx_cf.c Loading commit data...
pata_jmicron.c Loading commit data...
pata_legacy.c Loading commit data...
pata_macio.c Loading commit data...
pata_marvell.c Loading commit data...
pata_mpc52xx.c Loading commit data...
pata_mpiix.c Loading commit data...
pata_netcell.c Loading commit data...
pata_ninja32.c Loading commit data...
pata_ns87410.c Loading commit data...
pata_ns87415.c Loading commit data...
pata_octeon_cf.c Loading commit data...
pata_of_platform.c Loading commit data...
pata_oldpiix.c Loading commit data...
pata_opti.c Loading commit data...
pata_optidma.c Loading commit data...
pata_palmld.c Loading commit data...
pata_pcmcia.c Loading commit data...
pata_pdc2027x.c Loading commit data...
pata_pdc202xx_old.c Loading commit data...
pata_piccolo.c Loading commit data...
pata_platform.c Loading commit data...
pata_pxa.c Loading commit data...
pata_radisys.c Loading commit data...
pata_rb532_cf.c Loading commit data...
pata_rdc.c Loading commit data...
pata_rz1000.c Loading commit data...
pata_samsung_cf.c Loading commit data...
pata_sc1200.c Loading commit data...
pata_scc.c Loading commit data...
pata_sch.c Loading commit data...
pata_serverworks.c Loading commit data...
pata_sil680.c Loading commit data...
pata_sis.c Loading commit data...
pata_sl82c105.c Loading commit data...
pata_triflex.c Loading commit data...
pata_via.c Loading commit data...
pdc_adma.c Loading commit data...
sata_dwc_460ex.c Loading commit data...
sata_fsl.c Loading commit data...
sata_highbank.c Loading commit data...
sata_inic162x.c Loading commit data...
sata_mv.c Loading commit data...
sata_nv.c Loading commit data...
sata_promise.c Loading commit data...
sata_promise.h Loading commit data...
sata_qstor.c Loading commit data...
sata_rcar.c Loading commit data...
sata_sil.c Loading commit data...
sata_sil24.c Loading commit data...
sata_sis.c Loading commit data...
sata_svw.c Loading commit data...
sata_sx4.c Loading commit data...
sata_uli.c Loading commit data...
sata_via.c Loading commit data...
sata_vsc.c Loading commit data...
sis.h Loading commit data...