diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-11 16:03:03 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-11 16:03:03 -0700 |
commit | fb2c922b8588115d8914492493a37109bfb07884 (patch) | |
tree | 9b532d2989d998b1997bf04eae0f3eb15f1843b5 | |
parent | 9ce3075c20d458040138690edfdf6446664ec3ee (diff) | |
parent | b9a3b4d1453689f2927668fcdc4827fdccf44d1b (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
pata_platform: don't use generic ata_port_start
Use menuconfig objects: libata
add the ATI SB700 SATA controller device id to AHCI pci table
Add the combined mode for ATI SB700
pata_pcmcia: recognize 2GB CompactFlash from Transcend
git-libata-all: sata_via build fix
libata-acpi: clean up parameters and misc stuff
libata-acpi: s/CONFIG_SATA_ACPI/CONFIG_ATA_ACPI/
libata: give devices one last chance even if recovery failed with -EINVAL
libata: fallback to the other IDENTIFY on device error, take#2
libata: ignore EH scheduling during initialization
libata: clean up SFF init mess
libata: implement libata.spindown_compat
libata: reimplement suspend/resume support using sdev->manage_start_stop
63 files changed, 532 insertions, 1025 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index c6322c76034..498ff31f3aa 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -328,3 +328,22 @@ Who: Adrian Bunk <bunk@stusta.de> --------------------------- +What: libata.spindown_compat module parameter +When: Dec 2008 +Why: halt(8) synchronizes caches for and spins down libata disks + because libata didn't use to spin down disk on system halt + (only synchronized caches). + Spin down on system halt is now implemented and can be tested + using sysfs node /sys/class/scsi_disk/h:c:i:l/manage_start_stop. + Because issuing spin down command to an already spun down disk + makes some disks spin up just to spin down again, the old + behavior needs to be maintained till userspace tool is updated + to check the sysfs node and not to spin down disks with the + node set to one. + This module parameter is to give userspace tool the time to + get updated and should be removed after userspace is + reasonably updated. +Who: Tejun Heo <htejun@gmail.com> + +--------------------------- + diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index f031b873233..ad1f59c1b3f 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -2,11 +2,9 @@ # SATA/PATA driver configuration # -menu "Serial ATA (prod) and Parallel ATA (experimental) drivers" +menuconfig ATA + tristate "Serial ATA (prod) and Parallel ATA (experimental) drivers" depends on HAS_IOMEM - -config ATA - tristate "ATA device support" depends on BLOCK depends on !(M32R || M68K) || BROKEN depends on !SUN4 || BROKEN @@ -24,6 +22,19 @@ config ATA_NONSTANDARD bool default n +config ATA_ACPI + bool + depends on ACPI && PCI + default y + help + This option adds support for ATA-related ACPI objects. + These ACPI objects add the ability to retrieve taskfiles + from the ACPI BIOS and write them to the disk controller. + These objects may be related to performance, security, + power management, or other areas. + You can disable this at kernel boot time by using the + option libata.noacpi=1 + config SATA_AHCI tristate "AHCI SATA support" depends on PCI @@ -157,19 +168,6 @@ config SATA_INIC162X help This option enables support for Initio 162x Serial ATA. -config SATA_ACPI - bool - depends on ACPI && PCI - default y - help - This option adds support for SATA-related ACPI objects. - These ACPI objects add the ability to retrieve taskfiles - from the ACPI BIOS and write them to the disk controller. - These objects may be related to performance, security, - power management, or other areas. - You can disable this at kernel boot time by using the - option libata.noacpi=1 - config PATA_ALI tristate "ALi PATA support (Experimental)" depends on PCI && EXPERIMENTAL @@ -585,6 +583,4 @@ config PATA_SCC If unsure, say N. -endif -endmenu - +endif # ATA diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 6f42a0e2812..8149c68ac2c 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -69,4 +69,4 @@ obj-$(CONFIG_ATA_GENERIC) += ata_generic.o obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o libata-objs := libata-core.o libata-scsi.o libata-sff.o libata-eh.o -libata-$(CONFIG_SATA_ACPI) += libata-acpi.o +libata-$(CONFIG_ATA_ACPI) += libata-acpi.o diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index d9617892fc2..1ae443d7ab9 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -250,10 +250,6 @@ static struct scsi_host_template ahci_sht = { .slave_configure = ata_scsi_slave_config, .slave_destroy = ata_scsi_slave_destroy, .bios_param = ata_std_bios_param, -#ifdef CONFIG_PM - .suspend = ata_scsi_device_suspend, - .resume = ata_scsi_device_resume, -#endif }; static const struct ata_port_operations ahci_ops = { @@ -400,6 +396,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { /* ATI */ { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 */ + { PCI_VDEVICE(ATI, 0x4390), board_ahci_sb600 }, /* ATI SB700 */ /* VIA */ { PCI_VDEVICE(VIA, 0x3349), board_ahci_vt8251 }, /* VIA VT8251 */ diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 92a491ddd03..c3d753296bc 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c @@ -54,7 +54,7 @@ static int generic_set_mode(struct ata_port *ap, struct ata_device **unused) for (i = 0; i < ATA_MAX_DEVICES; i++) { struct ata_device *dev = &ap->device[i]; - if (ata_dev_ready(dev)) { + if (ata_dev_enabled(dev)) { /* We don't really care */ dev->pio_mode = XFER_PIO_0; dev->dma_mode = XFER_MW_DMA_0; @@ -90,10 +90,6 @@ static struct scsi_host_template generic_sht = { .slave_configure = ata_scsi_slave_config, .slave_destroy = ata_scsi_slave_destroy, .bios_param = ata_std_bios_param, -#ifdef CONFIG_PM - .resume = ata_scsi_device_resume, - .suspend = ata_scsi_device_suspend, -#endif }; static struct ata_port_operations generic_port_ops = { @@ -145,7 +141,7 @@ static int all_generic_ide; /* Set to claim all devices */ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) { u16 command; - static struct ata_port_info info = { + static const struct ata_port_info info = { .sht = &generic_sht, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .pio_mask = 0x1f, @@ -153,7 +149,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id .udma_mask = 0x3f, .port_ops = &generic_port_ops }; - static struct ata_port_info *port_info[2] = { &info, &info }; + const struct ata_port_info *ppi[] = { &info, NULL }; /* Don't use the generic entry unless instructed to do so */ if (id->driver_data == 1 && all_generic_ide == 0) @@ -179,7 +175,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id if (dev->vendor == PCI_VENDOR_ID_AL) ata_pci_clear_simplex(dev); - return ata_pci_init_one(dev, port_info, 2); + return ata_pci_init_one(dev, ppi); } static struct pci_device_id ata_generic[] = { diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 4a795fdb6a0..13b6b1df2ac 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -275,10 +275,6 @@ static struct scsi_host_template piix_sht = { .slave_configure = ata_scsi_slave_config, .slave_destroy = ata_scsi_slave_destroy, .bios_param = ata_std_bios_param, -#ifdef CONFIG_PM - .resume = ata_scsi_device_resume, - .suspend = ata_scsi_device_suspend, -#endif }; static const struct ata_port_operations piix_pata_ops = { @@ -1034,7 +1030,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static int printed_version; struct device *dev = &pdev->dev; struct ata_port_info port_info[2]; - struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] }; + const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] }; struct piix_host_priv *hpriv; unsigned long port_flags; @@ -1093,7 +1089,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) port_info[1].mwdma_mask = 0; port_info[1].udma_mask = 0; } - return ata_pci_init_one(pdev, ppinfo, 2); + return ata_pci_init_one(pdev, ppi); } static int __init piix_init(void) diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index cb3eab6e379..ed4138e24b0 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c @@ -270,8 +270,7 @@ out: /** * do_drive_get_GTF - get the drive bootup default taskfile settings - * @ap: the ata_port for the drive - * @ix: target ata_device (drive) index + * @dev: target ATA device * @gtf_length: number of bytes of _GTF data returned at @gtf_address * @gtf_address: buffer containing _GTF taskfile arrays * @@ -286,20 +285,19 @@ out: * The returned @gtf_length and @gtf_address are only valid if the * function return value is 0. */ -static int do_drive_get_GTF(struct ata_port *ap, int ix, - unsigned int *gtf_length, unsigned long *gtf_address, - unsigned long *obj_loc) +static int do_drive_get_GTF(struct ata_device *dev, unsigned int *gtf_length, + unsigned long *gtf_address, unsigned long *obj_loc) { - acpi_status status; - acpi_handle dev_handle = NULL; - acpi_handle chan_handle, drive_handle; - acpi_integer pcidevfn = 0; - u32 dev_adr; - struct acpi_buffer output; - union acpi_object *out_obj; - struct device *dev = ap->host->dev; - struct ata_device *atadev = &ap->device[ix]; - int err = -ENODEV; + struct ata_port *ap = dev->ap; + acpi_status status; + acpi_handle dev_handle = NULL; + acpi_handle chan_handle, drive_handle; + acpi_integer pcidevfn = 0; + u32 dev_adr; + struct acpi_buffer output; + union acpi_object *out_obj; + struct device *gdev = ap->host->dev; + int err = -ENODEV; *gtf_length = 0; *gtf_address = 0UL; @@ -309,14 +307,14 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, return 0; if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", + ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", __FUNCTION__, ap->port_no); - if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) { + if (!ata_dev_enabled(dev) || (ap->flags & ATA_FLAG_DISABLED)) { if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, "%s: ERR: " + ata_dev_printk(dev, KERN_DEBUG, "%s: ERR: " "ata_dev_present: %d, PORT_DISABLED: %lu\n", - __FUNCTION__, ata_dev_enabled(atadev), + __FUNCTION__, ata_dev_enabled(dev), ap->flags & ATA_FLAG_DISABLED); goto out; } @@ -324,19 +322,19 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, /* Don't continue if device has no _ADR method. * _GTF is intended for known motherboard devices. */ if (!(ap->cbl == ATA_CBL_SATA)) { - err = pata_get_dev_handle(dev, &dev_handle, &pcidevfn); + err = pata_get_dev_handle(gdev, &dev_handle, &pcidevfn); if (err < 0) { if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, + ata_dev_printk(dev, KERN_DEBUG, "%s: pata_get_dev_handle failed (%d)\n", __FUNCTION__, err); goto out; } } else { - err = sata_get_dev_handle(dev, &dev_handle, &pcidevfn); + err = sata_get_dev_handle(gdev, &dev_handle, &pcidevfn); if (err < 0) { if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, + ata_dev_printk(dev, KERN_DEBUG, "%s: sata_get_dev_handle failed (%d\n", __FUNCTION__, err); goto out; @@ -344,7 +342,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, } /* Get this drive's _ADR info. if not already known. */ - if (!atadev->obj_handle) { + if (!dev->obj_handle) { if (!(ap->cbl == ATA_CBL_SATA)) { /* get child objects of dev_handle == channel objects, * + _their_ children == drive objects */ @@ -352,7 +350,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, chan_handle = acpi_get_child(dev_handle, ap->port_no); if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, + ata_dev_printk(dev, KERN_DEBUG, "%s: chan adr=%d: chan_handle=0x%p\n", __FUNCTION__, ap->port_no, chan_handle); @@ -361,26 +359,26 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, goto out; } /* TBD: could also check ACPI object VALID bits */ - drive_handle = acpi_get_child(chan_handle, ix); + drive_handle = acpi_get_child(chan_handle, dev->devno); if (!drive_handle) { err = -ENODEV; goto out; } - dev_adr = ix; - atadev->obj_handle = drive_handle; + dev_adr = dev->devno; + dev->obj_handle = drive_handle; } else { /* for SATA mode */ dev_adr = SATA_ADR_RSVD; - err = get_sata_adr(dev, dev_handle, pcidevfn, 0, - ap, atadev, &dev_adr); + err = get_sata_adr(gdev, dev_handle, pcidevfn, 0, + ap, dev, &dev_adr); } if (err < 0 || dev_adr == SATA_ADR_RSVD || - !atadev->obj_handle) { + !dev->obj_handle) { if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, + ata_dev_printk(dev, KERN_DEBUG, "%s: get_sata/pata_adr failed: " "err=%d, dev_adr=%u, obj_handle=0x%p\n", __FUNCTION__, err, dev_adr, - atadev->obj_handle); + dev->obj_handle); goto out; } } @@ -391,11 +389,11 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, /* _GTF has no input parameters */ err = -EIO; - status = acpi_evaluate_object(atadev->obj_handle, "_GTF", + status = acpi_evaluate_object(dev->obj_handle, "_GTF", NULL, &output); if (ACPI_FAILURE(status)) { if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, + ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF error: status = 0x%x\n", __FUNCTION__, status); goto out; @@ -403,7 +401,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, if (!output.length || !output.pointer) { if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, "%s: Run _GTF: " + ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " "length or ptr is NULL (0x%llx, 0x%p)\n", __FUNCTION__, (unsigned long long)output.length, @@ -416,7 +414,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, if (out_obj->type != ACPI_TYPE_BUFFER) { kfree(output.pointer); if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, "%s: Run _GTF: " + ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " "error: expected object type of " " ACPI_TYPE_BUFFER, got 0x%x\n", __FUNCTION__, out_obj->type); @@ -427,7 +425,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, if (!out_obj->buffer.length || !out_obj->buffer.pointer || out_obj->buffer.length % REGS_PER_GTF) { if (ata_msg_drv(ap)) - ata_dev_printk(atadev, KERN_ERR, + ata_dev_printk(dev, KERN_ERR, "%s: unexpected GTF length (%d) or addr (0x%p)\n", __FUNCTION__, out_obj->buffer.length, out_obj->buffer.pointer); @@ -439,7 +437,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, *gtf_address = (unsigned long)out_obj->buffer.pointer; *obj_loc = (unsigned long)out_obj; if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, "%s: returning " + ata_dev_printk(dev, KERN_DEBUG, "%s: returning " "gtf_length=%d, gtf_address=0x%lx, obj_loc=0x%lx\n", __FUNCTION__, *gtf_length, *gtf_address, *obj_loc); err = 0; @@ -449,7 +447,7 @@ out: /** * taskfile_load_raw - send taskfile registers to host controller - * @ap: Port to which output is sent + * @dev: target ATA device * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) * * Outputs ATA taskfile to standard ATA host controller using MMIO @@ -466,15 +464,15 @@ out: * LOCKING: TBD: * Inherited from caller. */ -static void taskfile_load_raw(struct ata_port *ap, - struct ata_device *atadev, - const struct taskfile_array *gtf) +static void taskfile_load_raw(struct ata_device *dev, + const struct taskfile_array *gtf) { + struct ata_port *ap = dev->ap; struct ata_taskfile tf; unsigned int err; if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, "%s: (0x1f1-1f7): hex: " + ata_dev_printk(dev, KERN_DEBUG, "%s: (0x1f1-1f7): hex: " "%02x %02x %02x %02x %02x %02x %02x\n", __FUNCTION__, gtf->tfa[0], gtf->tfa[1], gtf->tfa[2], @@ -485,7 +483,7 @@ static void taskfile_load_raw(struct ata_port *ap, && (gtf->tfa[6] == 0)) return; - ata_tf_init(atadev, &tf); + ata_tf_init(dev, &tf); /* convert gtf to tf */ tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */ @@ -498,17 +496,16 @@ static void taskfile_load_raw(struct ata_port *ap, tf.device = gtf->tfa[5]; /* 0x1f6 */ tf.command = gtf->tfa[6]; /* 0x1f7 */ - err = ata_exec_internal(atadev, &tf, NULL, DMA_NONE, NULL, 0); + err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); if (err && ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_ERR, + ata_dev_printk(dev, KERN_ERR, "%s: ata_exec_internal failed: %u\n", __FUNCTION__, err); } /** * do_drive_set_taskfiles - write the drive taskfile settings from _GTF - * @ap: the ata_port for the drive - * @atadev: target ata_device + * @dev: target ATA device * @gtf_length: total number of bytes of _GTF taskfiles * @gtf_address: location of _GTF taskfile arrays * @@ -517,30 +514,31 @@ static void taskfile_load_raw(struct ata_port *ap, * Write {gtf_address, length gtf_length} in groups of * REGS_PER_GTF bytes. */ -static int do_drive_set_taskfiles(struct ata_port *ap, - struct ata_device *atadev, unsigned int gtf_length, - unsigned long gtf_address) +static int do_drive_set_taskfiles(struct ata_device *dev, + unsigned int gtf_length, + unsigned long gtf_address) { - int err = -ENODEV; - int gtf_count = gtf_length / REGS_PER_GTF; - int ix; + struct ata_port *ap = dev->ap; + int err = -ENODEV; + int gtf_count = gtf_length / REGS_PER_GTF; + int ix; struct taskfile_array *gtf; if (ata_msg_probe(ap)) - ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", + ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", __FUNCTION__, ap->port_no); if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA)) return 0; - if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) + if (!ata_dev_enabled(dev) || (ap->flags & ATA_FLAG_DISABLED)) goto out; if (!gtf_count) /* shouldn't be here */ goto out; if (gtf_length % REGS_PER_GTF) { if (ata_msg_drv(ap)) - ata_dev_printk(atadev, KERN_ERR, + ata_dev_printk(dev, KERN_ERR, "%s: unexpected GTF length (%d)\n", __FUNCTION__, gtf_length); goto out; @@ -551,7 +549,7 @@ static int do_drive_set_taskfiles(struct ata_port *ap, (gtf_address + ix * REGS_PER_GTF); /* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */ - taskfile_load_raw(ap, atadev, gtf); + taskfile_load_raw(dev, gtf); } err = 0; @@ -567,11 +565,11 @@ out: */ int ata_acpi_exec_tfs(struct ata_port *ap) { - int ix; - int ret =0; - unsigned int gtf_length; - unsigned long gtf_address; - unsigned long obj_loc; + int ix; + int ret = 0; + unsigned int gtf_length; + unsigned long gtf_address; + unsigned long obj_loc; if (libata_noacpi) return 0; @@ -584,11 +582,13 @@ int ata_acpi_exec_tfs(struct ata_port *ap) return 0; for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { - if (!ata_dev_enabled(&ap->device[ix])) + struct ata_device *dev = &ap->device[ix]; + + if (!ata_dev_enabled(dev)) continue; - ret = do_drive_get_GTF(ap, ix, - >f_length, >f_address, &obj_loc); |