1
0
Fork 0
Commit Graph

30 Commits (69b16a5f4c4f1dab70d4d555c487c318c6878b3e)

Author SHA1 Message Date
Tejun Heo fafbae87db libata-acpi: implement ata_acpi_associate()
* 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>
2007-07-09 12:17:31 -04:00
Tejun Heo d9aca22cf4 libata: remove libata.spindown_compat
With STANDBYDOWN tracking added, libata.spindown_compat isn't
necessary anymore.  If userspace shutdown(8) issues STANDBYNOW, libata
warns.  If userspace shutdown(8) doesn't issue STANDBYNOW, libata does
the right thing.  Userspace can tell whether kernel supports spindown
by testing whether sysfs node manage_start_stop exists as before.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-05-17 20:57:38 -04:00
Tejun Heo fe30911b34 libata: separate out ata_dev_reread_id()
Separate out ata_dev_reread_id() from ata_dev_revalidate().
ata_dev_reread_id() reads IDENTIFY page and determines whether the
same device is still there.  ata_dev_revalidate() reconfigures after
reread completes.  This will be used by ACPI update.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-05-16 01:18:30 -04:00
Tejun Heo 3a32a8e966 libata-acpi: clean up parameters and misc stuff
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>
2007-05-11 18:12:42 -04:00
Tejun Heo e92351bb53 libata-acpi: s/CONFIG_SATA_ACPI/CONFIG_ATA_ACPI/
ACPI applies to both SATA and PATA.  Drop the 'S' from the config
variable.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-05-11 18:12:42 -04:00
Tejun Heo 920a4b1038 libata: implement libata.spindown_compat
Now that libata uses sd->manage_start_stop, libata spins down disk on
shutdown.  In an attempt to compensate libata's previous shortcoming,
some distros sync and spin down disks attached via libata in their
shutdown(8).  Some disks spin back up just to spin down again on
STANDBYNOW1 if the command is issued when the disk is spun down, so
this double spinning down causes problem.

This patch implements module parameter libata.spindown_compat which,
when set to one (default value), prevents libata from spinning down
disks on shutdown thus avoiding double spinning down.  Note that
libata spins down disks for suspend to mem and disk, so with
libata.spindown_compat set to one, disks should be properly spun down
in all cases without modifying shutdown(8).

shutdown(8) should be fixed eventually.  Some drive do spin up on
SYNCHRONZE_CACHE even when their cache is clean.  Those disks
currently spin up briefly when sd tries to shutdown the device and
then the machine powers off immediately, which can't be good for the
head.  We can't skip SYNCHRONIZE_CACHE during shudown as it can be
dangerous data integrity-wise.

So, this spindown_compat parameter is already scheduled for removal by
the end of the next year and here's what shutdown(8) should do.

  * Check whether /sys/modules/libata/parameters/spindown_compat
    exists.  If it does, write 0 to it.

  * For each libata harddisk {
	* Check whether /sys/class/scsi_disk/h:c:i:l/manage_start_stop
	  exists.  Iff it doesn't, synchronize cache and spin the disk
	  down as before.
  }

The above procedure will make shutdown(8) work properly with kernels
before this change, ones with this workaround and later ones without
it.

To accelerate shutdown(8) updates, if the compat mode is in use, this
patch prints BIG FAT warning for five seconds during shutdown (the
optimal interval to annoy the user just the right amount discovered by
hours of tireless usability testing).

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-05-11 18:01:04 -04:00
Tejun Heo 6bfff31e77 libata: kill probe_ent and related helpers
All drivers are converted to new init model.  Kill probe_ent,
ata_device_add() and ata_pci_init_native_mode().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-28 14:16:06 -04:00
Tejun Heo f31871951b libata: separate out ata_host_alloc() and ata_host_register()
Reorganize ata_host_alloc() and its subroutines into the following
three functions.

* ata_host_alloc() : allocates host and its ports.  shost is not
  registered automatically.

* ata_scsi_add_hosts() : allocates and adds shosts associated with an
  ATA host.  Used by ata_host_register().

* ata_host_register() : takes a fully initialized ata_host structure
  and registers it to libata layer and probes it.

Only ata_host_alloc() and ata_host_register() are exported.
ata_device_add() is rewritten using the above functions.  This patch
does not introduce any observable behavior change.  Things worth
mentioning.

* print_id is assigned at registration time and LLDs are allowed to
  overallocate ports and reduce host->n_ports during initialization.
  ata_host_register() will throw away unused ports automatically.

* All SCSI host initialization stuff now resides in
  ata_scsi_add_hosts() in libata-scsi.c, where it should be.

* ipr is now the only user of ata_host_init().  Either kill it by
  converting ipr to use ata_host_alloc() and friends or rename and
  move it to libata-scsi.c

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-28 14:16:03 -04:00
Jeff Garzik d7d0dad62a [libata] Disable ACPI by default; fix namespace problems
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>
2007-03-28 01:57:37 -04:00
Alan 4bb64fb981 SiS warning fixes
Somehow the sis_info133 external definition ended up in libata.h and that
was included by both drivers.  However libata.h contains libata-* specific
internals and clashing defines like DRV_NAME so this makes a mess.  Move
the extern into the C file and remove the warnings

[akpm@linux-foundation.org: create sis.h to avoid extern-decl-in-C]
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-21 04:58:17 -05:00
Tejun Heo 909706a247 libata: kill ATA_DNXFER_ANY
ATA_DNXFER_ANY isn't used anymore.  Kill it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-21 04:58:17 -05:00
Tejun Heo 458337dbb1 libata: improve ata_down_xfermask_limit()
Make ata_down_xfermask_limit() accept @sel instead of @force_pio0.
@sel selects how the xfermask limit will be adjusted.  The following
selectors are defined.

* ATA_DNXFER_PIO	: only speed down PIO
* ATA_DNXFER_DMA	: only speed down DMA, don't cause transfer mode change
* ATA_DNXFER_40C	: apply 40c cable limit
* ATA_DNXFER_FORCE_PIO	: force PIO
* ATA_DNXFER_FORCE_PIO0	: force PIO0 (same as original with @force_pio0 == 1)
* ATA_DNXFER_ANY	: same as original with @force_pio0 == 0

Currently, only ANY and FORCE_PIO0 are used to maintain the original
behavior.  Other selectors will be used later to improve EH speed down
sequence.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-21 04:58:16 -05:00
Kristen Carlson Accardi 7ea1fbc2a2 [PATCH] libata: ACPI _SDD support
_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)
2007-02-16 13:32:41 -05:00
Kristen Carlson Accardi 11ef697b37 [PATCH] libata: ACPI and _GTF support
_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)
2007-02-16 13:32:41 -05:00
Jeff Garzik fda0efc597 [libata] Shuffle DRV_xxx in core and SiS drivers, to kill warnings
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-09 17:39:37 -05:00
Adrian Bunk 77a527eadb fix CONFIG_SATA_SIS=y compile error
Static code shouldn't be used from other modules.

drivers/built-in.o: In function `sis_init_one':
sata_sis.c:(.text+0x7634cd): undefined reference to `sis_info133'
sata_sis.c:(.text+0x7634d6): undefined reference to `sis_info133'

While I was at it, I also moved the prototype of this struct to a header
file.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
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>
2007-02-09 17:39:34 -05:00
David Howells 9db7372445 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:

	drivers/ata/libata-scsi.c
	include/linux/libata.h

Futher merge of Linus's head and compilation fixups.

Signed-Off-By: David Howells <dhowells@redhat.com>
2006-12-05 17:01:28 +00:00
Tejun Heo 800b399669 [PATCH] libata: always use polling IDENTIFY
libata switched to IRQ-driven IDENTIFY when IRQ-driven PIO was
introduced.  This has caused a lot of problems including device
misdetection and phantom device.

ATA_FLAG_DETECT_POLLING was added recently to selectively use polling
IDENTIFY on problemetic drivers but many controllers and devices are
affected by this problem and trying to adding ATA_FLAG_DETECT_POLLING
for each such case is diffcult and not very rewarding.

This patch makes libata always use polling IDENTIFY.  This is
consistent with libata's original behavior and drivers/ide's behavior.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-12-03 07:58:10 -05:00
Tejun Heo 70e6ad0c6d [PATCH] libata: prepare ata_sg_clean() for invocation from EH
Make ata_sg_clean() global and don't allow NCQ for internal commands.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-12-03 17:56:24 +09:00
Tejun Heo bd056d7eeb [PATCH] libata: separate out rw ATA taskfile building into ata_build_rw_tf()
Separate out rw ATA taskfile building from ata_scsi_rw_xlat() into
ata_build_rw_tf().  This will be used to improve media error handling.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-12-03 17:56:24 +09:00
Tejun Heo 2432697ba0 [PATCH] libata: implement ata_exec_internal_sg()
Sg'ify ata_exec_internal() and call it ata_exec_internal_sg().
Wrapper function around ata_exec_internal_sg() is implemented to
provide ata_exec_internal() interface.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-12-03 17:56:24 +09:00
Tejun Heo 35b649fe25 [PATCH] libata: implement ata_tf_read_block()
Implement ata_tf_read_block().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-12-01 22:46:00 -05:00
Tejun Heo 55a8e2c83c [PATCH] libata: implement presence detection via polling IDENTIFY
On some controllers (ICHs in piix mode), there is *NO* reliable way to
determine device presence other than issuing IDENTIFY and see how the
transaction proceeds by watching the TF status register.

libata acted this way before irq-pio and phantom devices caused very
little problem but now that IDENTIFY is performed using IRQ drive PIO,
such phantom devices now result in multiple 30sec timeouts during
boot.

This patch implements ATA_FLAG_DETECT_POLLING.  If a LLD sets this
flag, libata core issues the initial IDENTIFY in polling mode and if
the initial data transfer fails w/ HSM violation, the port is
considered to be empty thus replicating the old libata and IDE
behavior.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-12-01 22:45:55 -05:00
Tejun Heo bff0464769 [PATCH] libata: convert @post_reset to @flags in ata_dev_read_id()
Make ata_dev_read_id() take @flags instead of @post_reset.  Currently
there is only one flag defined - ATA_READID_POSTRESET, which is
equivalent to @post_reset.  This is preparation for polling presence
detection.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-12-01 22:45:55 -05:00
Tejun Heo efdaedc443 [PATCH] libata: implement ATA_EHI_PRINTINFO
Implement ehi flag ATA_EHI_PRINTINFO.  This flag is set when device
configuration needs to print out device info.  This used to be handled
by @print_info argument to ata_dev_configure() but LLDs also need to
know about it in ->dev_config() callback.

This patch replaces @print_info w/ ATA_EHI_PRINTINFO and make sata_sil
print workaround messages only on the initial configuration.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-12-01 22:41:31 -05:00
Tejun Heo 90088bb412 [PATCH] libata: move ata_irq_on() into libata-sff.c
ata_irq_on() isn't used outside of libata core layer.  The function is
TF/SFF interface specific but currently used by core path with some
hack too.  Move it from include/linux/libata.h to
drivers/ata/libata-sff.c.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-12-01 22:40:28 -05:00
David Howells 65f27f3844 WorkStruct: Pass the work_struct pointer instead of context data
Pass the work_struct pointer to the work function rather than context data.
The work function can use container_of() to work out the data.

For the cases where the container of the work_struct may go away the moment the
pending bit is cleared, it is made possible to defer the release of the
structure by deferring the clearing of the pending bit.

To make this work, an extra flag is introduced into the management side of the
work_struct.  This governs auto-release of the structure upon execution.

Ordinarily, the work queue executor would release the work_struct for further
scheduling or deallocation by clearing the pending bit prior to jumping to the
work function.  This means that, unless the driver makes some guarantee itself
that the work_struct won't go away, the work function may not access anything
else in the work_struct or its container lest they be deallocated..  This is a
problem if the auxiliary data is taken away (as done by the last patch).

However, if the pending bit is *not* cleared before jumping to the work
function, then the work function *may* access the work_struct and its container
with no problems.  But then the work function must itself release the
work_struct by calling work_release().

In most cases, automatic release is fine, so this is the default.  Special
initiators exist for the non-auto-release case (ending in _NAR).


Signed-Off-By: David Howells <dhowells@redhat.com>
2006-11-22 14:55:48 +00:00
Tejun Heo 6e42acc411 [PATCH] libata: unexport ata_dev_revalidate()
ata_dev_revalidate() isn't used outside of libata core.  Unexport it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-31 20:40:09 -05:00
Jeff Garzik cca3974e48 libata: Grand renaming.
The biggest change is that ata_host_set is renamed to ata_host.

* ata_host_set			=> ata_host
* ata_probe_ent->host_flags	=> ata_probe_ent->port_flags
* ata_probe_ent->host_set_flags	=> ata_probe_ent->_host_flags
* ata_host_stats		=> ata_port_stats
* ata_port->host		=> ata_port->scsi_host
* ata_port->host_set		=> ata_port->host
* ata_port_info->host_flags	=> ata_port_info->flags
* ata_(.*)host_set(.*)\(\)	=> ata_\1host\2()

The leading underscore in ata_probe_ent->_host_flags is to avoid
reusing ->host_flags for different purpose.  Currently, the only user
of the field is libata-bmdma.c and probe_ent itself is scheduled to be
removed.

ata_port->host is reused for different purpose but this field is used
inside libata core proper and of different type.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-08-24 03:19:22 -04:00
Jeff Garzik c6fd280766 Move libata to drivers/ata. 2006-08-10 07:31:37 -04:00