aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/scsi/scsi_da.c
diff options
context:
space:
mode:
authorMatt Jacob <mjacob@FreeBSD.org>2010-06-07 17:41:34 +0000
committerMatt Jacob <mjacob@FreeBSD.org>2010-06-07 17:41:34 +0000
commit9d8284a1aab42b5a66b4d2ed2e1df9c2eeb3b90b (patch)
tree08f78ef02f2dd8beb015414558da0e4bcb97f698 /sys/cam/scsi/scsi_da.c
parent95f7dfb2fad53e7e1ee894c9aff7b283e1c5dad4 (diff)
downloadsrc-9d8284a1aab42b5a66b4d2ed2e1df9c2eeb3b90b.tar.gz
src-9d8284a1aab42b5a66b4d2ed2e1df9c2eeb3b90b.zip
Do a minor amount of stylifying. Also, get a Fibre Channel WWPN if one exists
for a da unit and create a sysctl OID for it.
Notes
Notes: svn path=/head/; revision=208896
Diffstat (limited to 'sys/cam/scsi/scsi_da.c')
-rw-r--r--sys/cam/scsi/scsi_da.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 377275a86e52..34b42ff7506b 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -130,6 +130,7 @@ struct da_softc {
struct sysctl_ctx_list sysctl_ctx;
struct sysctl_oid *sysctl_tree;
struct callout sendordered_c;
+ uint64_t wwpn;
};
struct da_quirk_entry {
@@ -1099,14 +1100,38 @@ dasysctlinit(void *context, int pending)
}
/*
- * Now register the sysctl handler, so the user can the value on
+ * Now register the sysctl handler, so the user can change the value on
* the fly.
*/
- SYSCTL_ADD_PROC(&softc->sysctl_ctx,SYSCTL_CHILDREN(softc->sysctl_tree),
+ SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
OID_AUTO, "minimum_cmd_size", CTLTYPE_INT | CTLFLAG_RW,
&softc->minimum_cmd_size, 0, dacmdsizesysctl, "I",
"Minimum CDB size");
+ /*
+ * Add some addressing info.
+ */
+ memset(&cts, 0, sizeof (cts));
+ xpt_setup_ccb(&cts.ccb_h, periph->path, /*priority*/1);
+ cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
+ cts.type = CTS_TYPE_CURRENT_SETTINGS;
+ cam_periph_lock(periph);
+ xpt_action((union ccb *)&cts);
+ cam_periph_unlock(periph);
+ if (cts.ccb_h.status != CAM_REQ_CMP) {
+ cam_periph_release(periph);
+ return;
+ }
+ if (cts.protocol == PROTO_SCSI && cts.transport == XPORT_FC) {
+ struct ccb_trans_settings_fc *fc = &cts.xport_specific.fc;
+ if (fc->valid & CTS_FC_VALID_WWPN) {
+ softc->wwpn = fc->wwpn;
+ SYSCTL_ADD_XLONG(&softc->sysctl_ctx,
+ SYSCTL_CHILDREN(softc->sysctl_tree),
+ OID_AUTO, "wwpn", CTLTYPE_QUAD | CTLFLAG_RD,
+ &softc->wwpn, "World Wide Port Name");
+ }
+ }
cam_periph_release(periph);
}