From abcdceb9d0bf39da7c7ff8bcdff6eb4d9dfec56f Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 11 Jun 2007 11:59:34 -0700 Subject: scsi disk help file is not complete On Mon, 11 Jun 2007 20:28:16 +0200 api wrote: > Good day, > When doing make menuconfig one comes across CONFIG_BLK_DEV_SD. > The help file states that this is for scsi disks.NO MENTION IS MADE THAT > IT IS NEEDE FOR SATA DISKS AS WELL! > Would have saved me a lot of time if the help was up to date. > I hope this can be changed so others can make a kernel for sata systems > quicker. From: Randy Dunlap Add help info for BLK_DEV_SD referring to its use in SATA or PATA driver configurations. Add help text for "ATA" indicating that it probably needs some SCSI config symbols enabled in order to be useful. Signed-off-by: Randy Dunlap Signed-off-by: Jeff Garzik --- drivers/ata/Kconfig | 5 +++++ drivers/scsi/Kconfig | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index b4a8d6030e4..4ad8675f5a1 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -16,6 +16,11 @@ menuconfig ATA that "speaks" the ATA protocol, also called ATA controller), because you will be asked for it. + NOTE: ATA enables basic SCSI support; *however*, + 'SCSI disk support', 'SCSI tape support', or + 'SCSI CDROM support' may also be needed, + depending on your hardware configuration. + if ATA config ATA_NONSTANDARD diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 2b2f5c12019..eb46cb0e3cb 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -60,6 +60,7 @@ config BLK_DEV_SD depends on SCSI ---help--- If you want to use SCSI hard disks, Fibre Channel disks, + Serial ATA (SATA) or Parallel ATA (PATA) hard disks, USB storage or the SCSI or parallel port version of the IOMEGA ZIP drive, say Y and read the SCSI-HOWTO, the Disk-HOWTO and the Multi-Disk-HOWTO, available from -- cgit v1.2.3 From 8c781bf77a339748839bfd5eedfe2ad3e0e05c4a Mon Sep 17 00:00:00 2001 From: Albert Lee Date: Tue, 26 Jun 2007 13:43:15 +0800 Subject: libata: pata_pdc2027x PLL input clock fix Recently the PLL input clock of pata_pdc2027x is sometimes detected higer than expected (e.g. 20.027 MHz compared to 16.714 MHz). It seems sometimes the mdelay() function is not as precise as it used to be. Per Alan's advice, HT or power management might affect the precision of mdelay(). This patch calls gettimeofday() to mesure the time elapsed and calculate the PLL input clock accordingly. Signed-off-by: Albert Lee Cc: Alan Cox Signed-off-by: Jeff Garzik --- drivers/ata/pata_pdc2027x.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index 0d2cc49fde4..69a5aa4949f 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c @@ -689,10 +689,12 @@ static long pdc_detect_pll_input_clock(struct ata_host *host) void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR]; u32 scr; long start_count, end_count; - long pll_clock; + struct timeval start_time, end_time; + long pll_clock, usec_elapsed; /* Read current counter value */ start_count = pdc_read_counter(host); + do_gettimeofday(&start_time); /* Start the test mode */ scr = readl(mmio_base + PDC_SYS_CTL); @@ -705,6 +707,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host) /* Read the counter values again */ end_count = pdc_read_counter(host); + do_gettimeofday(&end_time); /* Stop the test mode */ scr = readl(mmio_base + PDC_SYS_CTL); @@ -713,7 +716,11 @@ static long pdc_detect_pll_input_clock(struct ata_host *host) readl(mmio_base + PDC_SYS_CTL); /* flush */ /* calculate the input clock in Hz */ - pll_clock = (start_count - end_count) * 10; + usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 + + (end_time.tv_usec - start_time.tv_usec); + + pll_clock = (start_count - end_count) / 100 * + (100000000 / usec_elapsed); PDPRINTK("start[%ld] end[%ld] \n", start_count, end_count); PDPRINTK("PLL input clock[%ld]Hz\n", pll_clock); -- cgit v1.2.3 From 74cdbba42dd515887ef3fc0ab498e70bd086c075 Mon Sep 17 00:00:00 2001 From: Albert Lee Date: Thu, 28 Jun 2007 10:05:31 +0800 Subject: libata: remove reading alt_status from ata_hsm_qc_complete() In ata_hsm_qc_complete(): Calling ata_altstatus() after the qc is completed might race with next qc. Remove it. Signed-off-by: Albert Lee Signed-off-by: Jeff Garzik --- drivers/ata/libata-core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index bfc59a10472..95671d6a0ce 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -4781,8 +4781,6 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) } else ata_qc_complete(qc); } - - ata_altstatus(ap); /* flush */ } /** -- cgit v1.2.3 From 90c937853d792ea997d7fdec72dbbea4f92e12c4 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 29 Jun 2007 11:33:08 +0900 Subject: sata_inic162x: disable LBA48 devices sata_inic162x can't do LBA48 properly yet and is likely to corrupt data on drives larger than LBA28 limit. Disable LBA48 devices during device configuration. Signed-off-by: Tejun Heo Signed-off-by: Jeff Garzik --- drivers/ata/sata_inic162x.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index 2d80c9d95e9..dc3bbce0467 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c @@ -496,6 +496,13 @@ static void inic_dev_config(struct ata_device *dev) /* inic can only handle upto LBA28 max sectors */ if (dev->max_sectors > ATA_MAX_SECTORS) dev->max_sectors = ATA_MAX_SECTORS; + + if (dev->n_sectors >= 1 << 28) { + ata_dev_printk(dev, KERN_ERR, + "ERROR: This driver doesn't support LBA48 yet and may cause\n" + " data corruption on such devices. Disabling.\n"); + ata_dev_disable(dev); + } } static void init_port(struct ata_port *ap) -- cgit v1.2.3 From 1e0b5ab81e2abb8bbf7446f4a17f43a1e34944fe Mon Sep 17 00:00:00 2001 From: Robert Hancock Date: Thu, 28 Jun 2007 18:52:24 -0600 Subject: sata_nv: allow changing queue depth The sata_nv driver was missing the change_queue_depth hook in the SCSI host template which the other NCQ-capable libata drivers had. This made it impossible to change the queue depth by user request. Add this in. Signed-off-by: Robert Hancock Signed-off-by: Jeff Garzik --- drivers/ata/sata_nv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index adfa693db53..d53cb8c47f3 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c @@ -307,6 +307,7 @@ static struct scsi_host_template nv_sht = { .name = DRV_NAME, .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, + .change_queue_depth = ata_scsi_change_queue_depth, .can_queue = ATA_DEF_QUEUE, .this_id = ATA_SHT_THIS_ID, .sg_tablesize = LIBATA_MAX_PRD, @@ -325,6 +326,7 @@ static struct scsi_host_template nv_adma_sht = { .name = DRV_NAME, .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, + .change_queue_depth = ata_scsi_change_queue_depth, .can_queue = NV_ADMA_MAX_CPBS, .this_id = ATA_SHT_THIS_ID, .sg_tablesize = NV_ADMA_SGTBL_TOTAL_LEN, -- cgit v1.2.3 From e14cbfa630cd3ab2631ee21b718b290928f47868 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Mon, 25 Jun 2007 11:28:59 +0900 Subject: libata: add HTS541616J9SA00 to NCQ blacklist Another member of HTS5416* family doing spurious NCQ completion. Signed-off-by: Tejun Heo Cc: Enrico Sardi Signed-off-by: Jeff Garzik --- drivers/ata/libata-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 95671d6a0ce..2407f848294 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -3798,6 +3798,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { /* Drives which do spurious command completion */ { "HTS541680J9SA00", "SB2IC7EP", ATA_HORKAGE_NONCQ, }, { "HTS541612J9SA00", "SBDIC7JP", ATA_HORKAGE_NONCQ, }, + { "Hitachi HTS541616J9SA00", "SB4OC70P", ATA_HORKAGE_NONCQ, }, { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, }, /* Devices with NCQ limits */ -- cgit v1.2.3 From a3cabb271ea66739704497102536fb01bb72fe37 Mon Sep 17 00:00:00 2001 From: Uwe Koziolek Date: Thu, 14 Jun 2007 23:40:43 +0200 Subject: libata: PATA-mode fixes for sis_sata Changed PATA handler for PATA-ports used by sata_sis. This patch was originally submitted by Jeff Garzik. Added PCI-ID 1180 for SiS966 Controller in pata_sis. The 1180 mode is fully compatible to other SiS PATA-controller. The PCI-ID 1183 is SATA in PATA-emulation, but not fully compatible to SiS5513/5518. sata_sis.c is forwarding this ID to pata_sis. 1183 is not working if simply added to pata_sis. This handling fixes issues with SiS968. Signed-off-by: Uwe Koziolek Signed-off-by: Jeff Garzik --- drivers/ata/pata_sis.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- drivers/ata/sata_sis.c | 39 +++++++++++++++++++-------------------- drivers/ata/sis.h | 2 +- 3 files changed, 64 insertions(+), 23 deletions(-) diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index ec3ae937501..cfe4ec6eb3d 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c @@ -560,6 +560,40 @@ static const struct ata_port_operations sis_133_ops = { .port_start = ata_port_start, }; +static const struct ata_port_operations sis_133_for_sata_ops = { + .port_disable = ata_port_disable, + .set_piomode = sis_133_set_piomode, + .set_dmamode = sis_133_set_dmamode, + .mode_filter = ata_pci_default_filter, + + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, + .dev_select = ata_std_dev_select, + + .freeze = ata_bmdma_freeze, + .thaw = ata_bmdma_thaw, + .error_handler = ata_bmdma_error_handler, + .post_internal_cmd = ata_bmdma_post_internal_cmd, + .cable_detect = sis_133_cable_detect, + + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, + .bmdma_stop = ata_bmdma_stop, + .bmdma_status = ata_bmdma_status, + .qc_prep = ata_qc_prep, + .qc_issue = ata_qc_issue_prot, + .data_xfer = ata_data_xfer, + + .irq_handler = ata_interrupt, + .irq_clear = ata_bmdma_irq_clear, + .irq_on = ata_irq_on, + .irq_ack = ata_irq_ack, + + .port_start = ata_port_start, +}; + static const struct ata_port_operations sis_133_early_ops = { .port_disable = ata_port_disable, .set_piomode = sis_100_set_piomode, @@ -733,13 +767,20 @@ static const struct ata_port_info sis_info100_early = { .pio_mask = 0x1f, /* pio0-4 */ .port_ops = &sis_66_ops, }; -const struct ata_port_info sis_info133 = { +static const struct ata_port_info sis_info133 = { .sht = &sis_sht, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .pio_mask = 0x1f, /* pio0-4 */ .udma_mask = ATA_UDMA6, .port_ops = &sis_133_ops, }; +const struct ata_port_info sis_info133_for_sata = { + .sht = &sis_sht, + .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, + .pio_mask = 0x1f, /* pio0-4 */ + .udma_mask = ATA_UDMA6, + .port_ops = &sis_133_for_sata_ops, +}; static const struct ata_port_info sis_info133_early = { .sht = &sis_sht, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, @@ -749,7 +790,7 @@ static const struct ata_port_info sis_info133_early = { }; /* Privately shared with the SiS180 SATA driver, not for use elsewhere */ -EXPORT_SYMBOL_GPL(sis_info133); +EXPORT_SYMBOL_GPL(sis_info133_for_sata); static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis) { @@ -975,6 +1016,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static const struct pci_device_id sis_pci_tbl[] = { { PCI_VDEVICE(SI, 0x5513), }, /* SiS 5513 */ { PCI_VDEVICE(SI, 0x5518), }, /* SiS 5518 */ + { PCI_VDEVICE(SI, 0x1180), }, /* SiS 1180 */ { } }; diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c index 221099d1d08..f111c984a35 100644 --- a/drivers/ata/sata_sis.c +++ b/drivers/ata/sata_sis.c @@ -72,8 +72,8 @@ static const struct pci_device_id sis_pci_tbl[] = { { PCI_VDEVICE(SI, 0x0181), sis_180 }, /* SiS 964/180 */ { PCI_VDEVICE(SI, 0x0182), sis_180 }, /* SiS 965/965L */ { PCI_VDEVICE(SI, 0x0183), sis_180 }, /* SiS 965/965L */ - { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/966L */ - { PCI_VDEVICE(SI, 0x1183), sis_180 }, /* SiS 966/966L */ + { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/680 */ + { PCI_VDEVICE(SI, 0x1183), sis_180 }, /* SiS 966/966L/968/680 */ { } /* terminate list */ }; @@ -161,7 +161,6 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg) case 0x0182: case 0x0183: case 0x1182: - case 0x1183: addr += SIS182_SATA1_OFS; break; } @@ -183,8 +182,8 @@ static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) pci_read_config_dword(pdev, cfg_addr, &val); - if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || - (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) + if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || + (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) pci_read_config_dword(pdev, cfg_addr+0x10, &val2); return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */ @@ -203,8 +202,8 @@ static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val pci_write_config_dword(pdev, cfg_addr, val); - if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || - (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) + if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || + (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) pci_write_config_dword(pdev, cfg_addr+0x10, val); } @@ -224,8 +223,8 @@ static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg) val = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4)); - if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || - (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) + if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || + (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) val2 = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4) + 0x10); return (val | val2) & 0xfffffffb; @@ -245,8 +244,8 @@ static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) sis_scr_cfg_write(ap, sc_reg, val); else { iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)); - if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || - (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) + if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || + (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)+0x10); } } @@ -293,11 +292,11 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) /* The PATA-handling is provided by pata_sis */ switch (pmr & 0x30) { case 0x10: - ppi[1] = &sis_info133; + ppi[1] = &sis_info133_for_sata; break; case 0x30: - ppi[0] = &sis_info133; + ppi[0] = &sis_info133_for_sata; break; } if ((pmr & SIS_PMR_COMBINED) == 0) { @@ -324,14 +323,14 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) break; case 0x1182: + dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/966/680 SATA controller\n"); + pi.flags |= ATA_FLAG_SLAVE_POSS; + break; + case 0x1183: - pci_read_config_dword(pdev, 0x64, &val); - if (val & 0x10000000) { - dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966L SATA controller\n"); - } else { - dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966 SATA controller\n"); - pi.flags |= ATA_FLAG_SLAVE_POSS; - } + dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1183/966/966L/968/680 controller in PATA mode\n"); + ppi[0] = &sis_info133_for_sata; + ppi[1] = &sis_info133_for_sata; break; } diff --git a/drivers/ata/sis.h b/drivers/ata/sis.h index 0f2208d8d5e..f7f3eebe666 100644 --- a/drivers/ata/sis.h +++ b/drivers/ata/sis.h @@ -2,4 +2,4 @@ struct ata_port_info; /* pata_sis.c */ -extern const struct ata_port_info sis_info133; +extern const struct ata_port_info sis_info133_for_sata; -- cgit v1.2.3