CAM fixes - queue empty tests, sim refcount, add XPORT_AHCI enum.
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 3 Jun 2009 03:36:27 +0000 (20:36 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 3 Jun 2009 03:36:27 +0000 (20:36 -0700)
commitd1f800ab0655d7064a4756718e01909e9a6f1374
tree1c877bed36f2812112b194eaea0a5d4f0774cfa5
parent941319553038bba25664cb804f0dc437d15a79e2
CAM fixes - queue empty tests, sim refcount, add XPORT_AHCI enum.

* CAMQ_GET_HEAD assumes the head entry in the devq array is NULL to
  indicate an empty queue.  Fix allocations and removal code to ensure
  that no bogus pointers are left in the array, cleaning it up and fixing
  a bug where CAMQ_GET_HEAD() could return non-NULL even when the queue
  was empty.

  This fixes numerous reports on detachment of non-empty device queues
  that are, in fact, empty, and also fixes a memory leak.

* xpt_bus_register() bumps the sim's refcount, but xpt_bus_deregister()
  did not properly release it.  This fixes a memory leak.

* Add XPORT_AHCI to the cam_xport enum for AHCI attachments.
sys/bus/cam/cam_ccb.h
sys/bus/cam/cam_queue.c
sys/bus/cam/cam_xpt.c