AHCI bug fixes & enhancements. port_init, port_stop, port_start, etc.
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 9 Jun 2009 08:50:36 +0000 (01:50 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 9 Jun 2009 08:50:36 +0000 (01:50 -0700)
commit17eab71eccd5f3dda84b5d70ba6e7156732915c1
tree8ee50d20890ca51a3e7075f64d0ca7ea58873968
parent037ebe780c51787e4736799bbc6b162ba1be5853
AHCI bug fixes & enhancements.  port_init, port_stop, port_start, etc.

* When initializing the AHCI device do an unconditional reset instead of
  a conditional reset.  The previous conditional reset did not cover
  all the bases and could result in an unusable device.

* Remove the second (unused) argument from ahci_port_start().

* ahci_port_init()  - init/reinit common code.  If the hard reset
  fails try a second time before giving up.  Devices can get into
  weird states and two attempts seems to clear it up.

* ahci_port_start() - FRE must be turned on before ST.   Wait for FR
  to come up before turning on ST.  The spec does not require this but
  it saves us from a race in ahci_port_stop() so do it anyway.

* ahci_port_stop() - When turning off ST we must wait for CR to go
  inactive before we can turn off FRE.

* ahci_port_free() - Properly sequence stopping of the port by calling
  ahci_port_stop().

* Create a consolidated ahci_port_reset() call to clean up some of the
  code paths.
sys/dev/disk/ahci/ahci.c
sys/dev/disk/ahci/ahci.h
sys/dev/disk/ahci/ahci_cam.c