Sync CAM with FreeBSD using lockmgr locks instead of mutexes.
authorPeter Avalos <pavalos@dragonflybsd.org>
Sun, 18 May 2008 20:30:23 +0000 (20:30 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 18 May 2008 20:30:23 +0000 (20:30 +0000)
commit1c8b7a9a1f2b7bbd5a314d488f2143a001654686
tree7ce6e4024d9215422220095fa6c47c017380504b
parentf6c36234c6dbe65d63a708436f643169bfe937e1
Sync CAM with FreeBSD using lockmgr locks instead of mutexes.
Note:  This is mostly a code sync with FreeBSD which improves stability
in addition to the items listed below.  This provides a framework for
releasing the mplock, but for now it's still there.

Add an xpt_print function to reduce most of the xpt_print_path/printf
pairs. Convert the core code to use it.

Initial cut at Basic Domain Validation.

Make cam_xpt's pronouncements match camcontrol (Tagged -> Command) Queueing.

Pay attention to return value from xpt_bus_register in xpt_init.

Add an xpt_rescan function and a thread that will field rescan requests.
The purpose of this is to allow a SIM (or other entities) to request a bus
rescan and have it then fielded in a different (process) context from the
caller.

Check the return value from cam_periph_acquire.

Drop the periph/sim lock when calling disk_destroy().

Drop the topology lock before calling the periph oninvalidate and dtor
vectors.

For the XPT_SASYNC_CB operation, only decouple the broadcast to the bus
and device lists instead of decoupling the whole operation.  This avoids
problems with SIMs going away.

Split the camisr into per-SIM done queues.  This optimizes the locking a
little bit and allows for direct dispatch of the doneq from certain
contexts that would otherwise face recursive locking problems.

Zero the CCBs when mallocing them.

Only schedule the xpt_finishconfig_task once.

Eliminate the use of M_TEMP.

Add a helper function for registering async callbacks.

Release the bus reference that is acquired when doing a CAMIOCOMMAND ioctl.

Zero scsi_readcapacity allocations so we can really tell if there has
been data returned.

Remove duplicate includes and fix typos.

Add a bunch of definitions and structures to support newer drivers.

When probing a newly found device, don't automatically assume that the
device supports retrieving a serial number.  Instead, first query the
list of VPD pages it does support, and only query the serial number if
it's supported, else silently move on.  This eliminates a lot of noise
during verbose booting, and will likely eliminate the need for most
NOSERIAL quirks.

Reduce diffs from FreeBSD.

Obtained-from: FreeBSD
53 files changed:
sys/bus/cam/cam_periph.c
sys/bus/cam/cam_periph.h
sys/bus/cam/cam_queue.c
sys/bus/cam/cam_sim.c
sys/bus/cam/cam_sim.h
sys/bus/cam/cam_xpt.c
sys/bus/cam/cam_xpt.h
sys/bus/cam/scsi/scsi_all.c
sys/bus/cam/scsi/scsi_all.h
sys/bus/cam/scsi/scsi_cd.c
sys/bus/cam/scsi/scsi_ch.c
sys/bus/cam/scsi/scsi_da.c
sys/bus/cam/scsi/scsi_low.c
sys/bus/cam/scsi/scsi_pass.c
sys/bus/cam/scsi/scsi_pt.c
sys/bus/cam/scsi/scsi_sa.c
sys/bus/cam/scsi/scsi_ses.c
sys/bus/cam/scsi/scsi_targ_bh.c
sys/bus/cam/scsi/scsi_target.c
sys/dev/disk/advansys/advansys.c
sys/dev/disk/advansys/adwcam.c
sys/dev/disk/aha/aha.c
sys/dev/disk/ahb/ahb.c
sys/dev/disk/aic/aic.c
sys/dev/disk/aic7xxx/ahc_eisa.c
sys/dev/disk/aic7xxx/ahc_isa.c
sys/dev/disk/aic7xxx/ahc_pci.c
sys/dev/disk/aic7xxx/ahd_pci.c
sys/dev/disk/aic7xxx/aic79xx.c
sys/dev/disk/aic7xxx/aic79xx_osm.c
sys/dev/disk/aic7xxx/aic7xxx.c
sys/dev/disk/aic7xxx/aic7xxx_osm.c
sys/dev/disk/aic7xxx/aic_osm_lib.h
sys/dev/disk/amd/amd.c
sys/dev/disk/ata/atapi-cam.c
sys/dev/disk/buslogic/bt.c
sys/dev/disk/isp/isp_freebsd.c
sys/dev/disk/mpt/mpt_freebsd.c
sys/dev/disk/nata/atapi-cam.c
sys/dev/disk/ncr/ncr.c
sys/dev/disk/sbp/sbp.c
sys/dev/disk/sym/sym_hipd.c
sys/dev/disk/trm/trm.c
sys/dev/disk/vpo/vpo.c
sys/dev/raid/aac/aac_cam.c
sys/dev/raid/amr/amr_cam.c
sys/dev/raid/asr/asr.c
sys/dev/raid/ciss/ciss.c
sys/dev/raid/dpt/dpt_scsi.c
sys/dev/raid/iir/iir.c
sys/dev/raid/mly/mly.c
sys/dev/raid/twa/twa_cam.c
sys/dev/usbmisc/umass/umass.c