libata fixes
PATCH 1/1 libata fixes
Please pull from 'upstream-greg' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-greg
to receive the following updates:
drivers/scsi/ata_piix.c | 84 +++++++++++++++++++++++++------- drivers/scsi/libata-core.c | 2 drivers/scsi/pdc_adma.c | 3 - drivers/scsi/sata_via.c | 117 +++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 180 insertions(+), 26 deletions(-)
Albert Lee:
libata: Use ATA_FLAG_PIO_POLLING for pdc_adma
Martin Hicks:
libata: PHY reset requires writing 0x4 to SControl
Tejun Heo:
ata_piix: fix ghost device probing by honoring PCS present bits
ata_piix: ignore PCS on ICH5
ata_piix: implement force_pcs module parameter
sata_via: use old SCR access pattern on vt6420
drivers/scsi/ata_piix.c +65 -19
@@ -390,7 +390,8 @@ #endif/* ich5_sata */ { .sht = &piix_sht, - .host_flags = ATA_FLAG_SATA | PIIX_FLAG_CHECKINTR, + .host_flags =ATA_FLAG_SATA |PIIX_FLAG_CHECKINTR | + PIIX_FLAG_IGNORE_PCS, .pio_mask = 0x1f, /* pio0-4 */ .mwdma_mask = 0x07, /* mwdma0-2 */ .udma_mask = 0x7f, /* udma0-6 */
@@ -467,6 +468,11 @@ MODULE_LICENSE("GPL");MODULE_DEVICE_TABLE (pci, piix_pci_tbl);MODULE_VERSION (DRV_VERSION ); +static int force_pcs =0 ; +module_param (force_pcs, int,0444 ); +MODULE_PARM_DESC (force_pcs,"force honoring or ignoring PCS to work around " +"device mis-detection (0=default, 1=ignore PCS, 2=honor PCS)" ); +/** * piix_pata_cbl_detect - Probe host controller cable detect info * @ap: Port for which cable detect info is desired
@@ -531,27 +537,25 @@ static void piix_pata_error_handler(stru }/** -* piix_sata_prereset - prereset for SATA host controller +* piix_sata_present_mask - determine present mask for SATA host controller * @ap: Target port * -* Reads and configures SATA PCI device's PCI config register -* Port Configuration and Status (PCS) to determine port and -* device availability. Return -ENODEV to skip reset if no -* device is present. +* Reads SATA PCI device's PCI config register Port Configuration +* and Status (PCS) to determine port and device availability. * * LOCKING: * None (inherited from caller). * * RETURNS: -* 0 if device is present, -ENODEV otherwise. +* determined present_mask */ -static int piix_sata_prereset (struct ata_port *ap) +static unsigned int piix_sata_present_mask (struct ata_port *ap) {struct pci_dev *pdev =to_pci_dev (ap->host_set->dev);struct piix_host_priv *hpriv = ap->host_set->private_data;const unsigned int *map = hpriv->map;int base =2 * ap->hard_port_no; -unsigned int present =0 ; +unsigned int present_mask =0 ;int port, i;u16 pcs;
@@ -564,24 +568,52 @@ static int piix_sata_prereset(struct atacontinue ;if ((ap->flags &PIIX_FLAG_IGNORE_PCS ) || (pcs &1 << (hpriv->map_db->present_shift + port))) - present =1 ; + present_mask |=1 << i; } -DPRINTK ("ata%u: LEAVE, pcs=0x%x present=0x%x\n" , - ap->id, pcs, present); +DPRINTK ("ata%u: LEAVE, pcs=0x%x present_mask=0x%x\n" , + ap->id, pcs, present_mask); -if (!present) { -ata_port_printk (ap,KERN_INFO ,"SATA port has no device.\n" ); - ap->eh_context.i.action &= ~ATA_EH_RESET_MASK ; -return 0 ; +return present_mask; +} + +/** +* piix_sata_softreset - reset SATA host port via ATA SRST +* @ap: port to reset +* @classes: resulting classes of attached devices +* +* Reset SATA host port via ATA SRST. On controllers with +* reliable PCS present bits, the bits are used to determine +* device presence. +* +* LOCKING: +* Kernel thread context (may sleep) +* +* RETURNS: +* 0 on success, -errno otherwise. +*/ +static int piix_sata_softreset (struct ata_port *ap,unsigned int *classes) +{ +unsigned int present_mask; +int i, rc; + + present_mask =piix_sata_present_mask (ap); + + rc =ata_std_softreset (ap, classes); +if (rc) +return rc; + +for (i =0 ; i <ATA_MAX_DEVICES ; i++) { +if (!(present_mask & (1 << i))) + classes[i] =ATA_DEV_NONE ; } -return ata_std_prereset (ap); +return 0 ; }static void piix_sata_error_handler (struct ata_port *ap) { -ata_bmdma_drive_eh (ap, piix_sata_prereset, ata_std_softreset,NULL , +ata_bmdma_drive_eh (ap, ata_std_prereset, piix_sata_softreset,NULL , ata_std_postreset); }
@@ -785,6 +817,7 @@ static int __devinit piix_check_450nx_er }static void __devinit piix_init_pcs (struct pci_dev *pdev, +struct ata_port_info *pinfo,const struct piix_map_db *map_db) {u16 pcs, new_pcs;
@@ -798,6 +831,18 @@ static void __devinit piix_init_pcs(strupci_write_config_word (pdev,ICH5_PCS , new_pcs);msleep (150 ); } + +if (force_pcs ==1 ) { +dev_printk (KERN_INFO , &pdev->dev, +"force ignoring PCS (0x%x)\n" , new_pcs); + pinfo[0 ].host_flags |=PIIX_FLAG_IGNORE_PCS ; + pinfo[1 ].host_flags |=PIIX_FLAG_IGNORE_PCS ; + }else if (force_pcs ==2 ) { +dev_printk (KERN_INFO , &pdev->dev, +"force honoring PCS (0x%x)\n" , new_pcs); + pinfo[0 ].host_flags &= ~PIIX_FLAG_IGNORE_PCS ; + pinfo[1 ].host_flags &= ~PIIX_FLAG_IGNORE_PCS ; + } } static void __devinit piix_init_sata_map(struct pci_dev *pdev,
@@ -906,7 +951,8 @@ static int piix_init_one (struct pci_devif (host_flags &ATA_FLAG_SATA ) {piix_init_sata_map (pdev, port_info, piix_map_db_table[ent->driver_data]); -piix_init_pcs (pdev, piix_map_db_table[ent->driver_data]); +piix_init_pcs (pdev, port_info, + piix_map_db_table[ent->driver_data]); }/* On ICH5, some BIOSen disable the interrupt using the
drivers/scsi/libata-core.c +1 -1
@@ -2746,7 +2746,7 @@ int sata_std_hardreset(struct ata_port *if ((rc =sata_scr_read (ap,SCR_CONTROL , &scontrol)))return rc; - scontrol = (scontrol &0x0f0 ) |0x302 ; + scontrol = (scontrol &0x0f0 ) |0x304 ;if ((rc =sata_scr_write (ap,SCR_CONTROL , scontrol)))return rc;
drivers/scsi/pdc_adma.c +2 -1
@@ -183,7 +183,8 @@ static struct ata_port_info adma_port_in { .sht = &adma_ata_sht, .host_flags =ATA_FLAG_SLAVE_POSS |ATA_FLAG_SRST | - ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO, +ATA_FLAG_NO_LEGACY |ATA_FLAG_MMIO | + ATA_FLAG_PIO_POLLING, .pio_mask = 0x10, /* pio4 */ .udma_mask = 0x1f, /* udma0-4 */ .port_ops = &adma_ata_ops,
drivers/scsi/sata_via.c +112 -5
158 lines not on this page · raw message
Quoted 11 lines · Jeff Garzik
Please pull from 'upstream-greg' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-greg
to receive the following updates:
drivers/scsi/ata_piix.c | 84 +++++++++++++++++++++++++------- drivers/scsi/libata-core.c | 2 drivers/scsi/pdc_adma.c | 3 - drivers/scsi/sata_via.c | 117 +++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 180 insertions(+), 26 deletions(-)
Pulled from, and pushed out. Is this set of patches supposed to fix my ata_piix cdrom problem for my laptop? I'll go build and test to see if it does or not...
thanks,
greg k-h
Quoted 13 lines · Greg KH
Quoted 11 lines · Jeff Garzik
Please pull from 'upstream-greg' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-greg
to receive the following updates:
drivers/scsi/ata_piix.c | 84 +++++++++++++++++++++++++------- drivers/scsi/libata-core.c | 2 drivers/scsi/pdc_adma.c | 3 - drivers/scsi/sata_via.c | 117 +++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 180 insertions(+), 26 deletions(-)
Quoted 3 lines
Pulled from, and pushed out. Is this set of patches supposed to fix my
ata_piixcdrom problem for my laptop? I'll go build and test to see if it does or not...
Yeah, it's fixed!
Ok, 2.6.18 is good to go as far as I'm concerned now :)
thanks,
greg k-h
Quoted 12 lines · Greg KH
Quoted 10 lines · Jeff Garzik
Please pull from 'upstream-greg' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-greg
to receive the following updates:
drivers/scsi/ata_piix.c | 84 +++++++++++++++++++++++++------- drivers/scsi/libata-core.c | 2 drivers/scsi/pdc_adma.c | 3 - drivers/scsi/sata_via.c | 117 +++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 180 insertions(+), 26 deletions(-)
Quoted 3 lines
Pulled from, and pushed out. Is this set of patches supposed to fix my
ata_piixcdrom problem for my laptop? I'll go build and test to see if it does or not...
It should, yes.
You can twiddle with the force_pcs module option if things are still wonky.
Jeff