summaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-acpi.c
Commit message (Collapse)AuthorAgeFilesLines
* libata-link: implement and use link/device iteratorsTejun Heo2007-10-121-3/+3
| | | | | | | | | | | | | | | | | Multiple links and different number of devices per link should be considered to iterate over links and devices. This patch implements and uses link and device iterators - ata_port_for_each_link() and ata_link_for_each_dev() - and ata_link_max_devices(). This change makes a lot of functions iterate over only possible devices instead of from dev 0 to dev ATA_MAX_DEVICES. All such changes have been examined and nothing should be broken. While at it, add a separating comment before device helpers to distinguish them better from link helpers and others. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* libata-link: introduce ata_linkTejun Heo2007-10-121-10/+11
| | | | | | | | | | | | | | | | | | | Introduce ata_link. It abstracts PHY and sits between ata_port and ata_device. This new level of abstraction is necessary to support SATA Port Multiplier, which basically adds a bunch of links (PHYs) to a ATA host port. Fields related to command execution, spd_limit and EH are per-link and thus moved to ata_link. This patch only defines the host link. Multiple link handling will be added later. Also, a lot of ap->link derefences are added but many of them will be removed as each part is converted to deal directly with ata_link instead of ata_port. This patch introduces no behavior change. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: James Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* libata-acpi: implement _GTM/_STM supportTejun Heo2007-07-091-4/+149
| | | | | | | | | | | | | | | | | Implement _GTM/_STM support. acpi_gtm is added to ata_port which stores _GTM parameters over suspend/resume cycle. A new hook ata_acpi_on_suspend() is responsible for storing _GTM parameters during suspend. _STM is executed in ata_acpi_on_resume(). With this change, invoking _GTF is safe on IDE hierarchy and acpi_sata check before _GTF is removed. ata_acpi_gtm() and ata_acpi_stm() implementation is taken from Alan Cox's pata_acpi implementation. ata_acpi_gtm() is fixed such that the result parameter is not shifted by sizeof(union acpi_object). Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* libata-acpi: remove redundant checksTejun Heo2007-07-091-23/+0Star
| | | | | | | Remove remaining unnecessary feature and status checks. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* libata: reimplement ACPI invocationTejun Heo2007-07-091-79/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reimplements ACPI invocation such that, instead of exporting ACPI details to the rest of libata, ACPI event handlers - ata_acpi_on_resume() and ata_acpi_on_devcfg() - are used. These two functions are responsible for determining whether specific ACPI method is used and when. On resume, _GTF is scheduled by setting ATA_DFLAG_ACPI_PENDING device flag. This is done this way to avoid performing the action on wrong device device (device swapping while suspended). On every ata_dev_configure(), ata_acpi_on_devcfg() is called, which performs _SDD and _GTF. _GTF is performed only after resuming and, if SATA, hardreset as the ACPI spec specifies. As _GTF may contain arbitrary commands, IDENTIFY page is re-read after _GTF taskfiles are executed. If one of ACPI methods fails, ata_acpi_on_devcfg() retries on the first failure. If it fails again on the second try, ACPI is disabled on the device. Note that successful configuration clears ACPI failed status. With all feature checks moved to the above two functions, do_drive_set_taskfiles() is trivial and thus collapsed into ata_acpi_exec_tfs(), which is now static and converted to return the number of executed taskfiles to be used by ata_acpi_on_resume(). As failures are handled properly, ata_acpi_push_id() now returns -errno on errors instead of unconditional zero. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* libata-acpi: miscellaneous cleanupsTejun Heo2007-07-091-28/+23Star
| | | | | | | | | | | | * Add missing LOCKING: and RETURNS: to function comment. * Don't conditionalize warning messages with ata_msg_probe(). Print directly with KERN_WARNING. * Drop duplicate debug messages. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* libata-acpi: clean up ata_acpi_exec_tfs()Tejun Heo2007-07-091-115/+111Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch cleans up ata_acpi_exec_tfs() and its friends. * Rename taskfile_array to ata_acpi_gtf and make it __packed as it's used as argument to ACPI method, and use pointer to ata_acpi_gtf and number of taskfiles to represent _GTF taskfiles instead of a pointer casted into unsigned long and byte count. This makes argument re-checking in do_drive_set_taskfiles() unnecessary. * Pointer in void * not in unsigned long. * Clean up do_drive_get_GTF() error handling and make do_drive_get_GTF() return number of taskfiles on success, 0 if _GTF doesn't exist or doesn't contain valid ata. -errno on other errors. * Remove superflous check for acpi->buffer.pointer. * Update taskfile_load_raw() such that printed messages look similar to the messages printed by ata_eh_report(). * s/do_drive_get_GTF/ata_dev_get_GTF/ s/do_drive_set_taskfiles/ata_dev_set_taskfiles/ Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* libata-acpi: implement ata_acpi_associate()Tejun Heo2007-07-091-320/+49Star
| | | | | | | | | | | | | | | | | | * Add acpi_handle to ata_host and ata_port. Rename ata_device->obj_handle to ->acpi_handle and move it above such that it doesn't get cleared on reconfiguration. * Replace ACPI node association which ata_acpi_associate() which is called once during host initialization. Unlike the previous implementation, ata_acpi_associate() uses ATA_FLAG_ACPI_SATA to choose between IDE or SATA ACPI hierarchy and uses simple child look up instead of recursive walk to match the nodes. This is way safer and simpler. Please read the following message for more info. http://article.gmane.org/gmane.linux.ide/17554 Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* libata-acpi: add ATA_FLAG_ACPI_SATA port flagTejun Heo2007-05-161-5/+5
| | | | | | | | | | | | Whether a controller needs IDE or SATA ACPI hierarchy is determined by the programming interface of the controller not by whether the controller is SATA or PATA, or it supports slave device or not. This patch adds ATA_FLAG_ACPI_SATA port flags which tells libata-acpi that the port needs SATA ACPI nodes, and sets the flag for ahci and sata_sil24. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* libata-acpi: clean up parameters and misc stuffTejun Heo2007-05-121-97/+95Star
| | | | | | | | | | | | | This patch cleans up libata-acpi such that it looks similar to other libata files. This patch doesn't introuce any behavior changes. * make libata-acpi functions take ata_device instead of ata_port + device index * s/atadev/dev/ * de-indent local variable declarations Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* libata-acpi: fix _GTF command protocol for ATAPI devicesTejun Heo2007-05-101-2/+1Star
| | | | | | | | _GTF command is never ATA_PROT_ATAPI_NODATA whether the device is ATAPI or not. It's always ATA_PROT_NODATA. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* [libata] Disable ACPI by default; fix namespace problemsJeff Garzik2007-03-281-4/+4
| | | | | | | | | | Not yet ready to turn on ATA ACPI by default, for either PATA or SATA. Also, rename the global-scope module parameter variable 'noacpi' to something more libata-specific, reducing the potential for namespace collision. Signed-off-by: Jeff Garzik <jeff@garzik.org>
* Pull bugzilla-7907 into release branchLen Brown2007-03-101-0/+7
|\
| * libata-acpi: allow _GTF on SATA, but disable on PATA for nowKristen Accardi2007-03-101-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | The ACPI specification states, and BIOS implementations depend on, _STM being called before _GTF. SATA does this, but PATA does not. So for now, simply prevent execution of _GTF on PATA devices. Longer term we should implement ACPI support for PATA devices in libata. Signed-off-by: Kristen Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
* | [PATCH] libata-acpi: Try and stop all the non PCI devices crashingAlan Cox2007-03-081-1/+16
|/ | | | | | | | | | | For 2.6.20 it mostly used to just not work, for 2.6.21-rc it crashes, this seems to be down to luck (bad or good). The libata-acpi code needs to avoid doing PCI work on non-PCI devices. This is one hack although it's not pretty and perhaps there is a "right" way to check if a struct device * is PCI ? Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* [libata] ACPI: remove needless ->qc_issue hook existence testJeff Garzik2007-02-251-29/+22Star
| | | | | | | All drivers must implement this hook, otherwise ATA commands would go nowhere (and a lot of other oopsen would appear as well). Signed-off-by: Jeff Garzik <jeff@garzik.org>
* libata: fix remaining ap->idTejun Heo2007-02-231-12/+8Star
| | | | | | | | | Merge order left libata-acpi and pata_scc with remainling usage of ap->id. Kill superflous id printing and substitute the remaining ones with ap->print_id. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* [PATCH] libata: wrong sizeof for BUFFERFiodor Suietov2007-02-161-1/+1
| | | | | | | | | | | | | I have reproduced the AE_AML_BUFFER_LIMIT exception mentioned in <http://bugzilla.kernel.org/show_bug.cgi?id=7689> basing on the SSDT ASL code and libata ata_acpi_push_id() code. There is an oversight in ata_acpi_push_id() causing the exception. The following update fixes it: Signed-off-by: Fiodor Suietov <fiodor.f.suietov@intel.com> Cc: Jeff Garzik <jeff@garzik.org> Cc: Tejun Heo <htejun@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* [PATCH] libata: ACPI _SDD supportKristen Carlson Accardi2007-02-161-0/+96
| | | | | | | | | | | | _SDD (Set Device Data) is an ACPI method that is used to tell the firmware what the identify data is of the device that is attached to the port. It is an optional method, and it's ok for it to be missing. Because of this, we always return success from the routine that calls this method, even if the execution fails. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org> (cherry picked from 39aa79e0a1f5f2e28aa341f035940746a98b45b1 commit)
* [PATCH] libata: ACPI and _GTF supportKristen Carlson Accardi2007-02-161-0/+602
_GTF is an acpi method that is used to reinitialize the drive. It returns a task file containing ata commands that are sent back to the drive to restore it to boot up defaults. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org> (cherry picked from 9c69cab24b51a89664f4c0dfaf8a436d32117624 commit)