diff options
author | will <will@FreeBSD.org> | 2011-06-22 21:43:10 +0000 |
---|---|---|
committer | will <will@FreeBSD.org> | 2011-06-22 21:43:10 +0000 |
commit | cc2a8545085333500e75f216bbaa6fa3ff7c0a71 (patch) | |
tree | e9c46c883d70d09e6ebce5ec8e9aef56fbee795b /sys | |
parent | da3820480591190db96ab7683ee5d3f085cdb7e2 (diff) | |
download | FreeBSD-src-cc2a8545085333500e75f216bbaa6fa3ff7c0a71.zip FreeBSD-src-cc2a8545085333500e75f216bbaa6fa3ff7c0a71.tar.gz |
Plumb support for the device advanced information CCB in the ATA XPT.
This was previously done only for SCSI XPT in r223081, on which the change
in r223089 depended in order to respond to serial number requests. As a
result of r223089, da(4) and ada(4) devices register a d_getattr for geom to
use to obtain the information.
Reported by: ache
Reviewed by: ken
Diffstat (limited to 'sys')
-rw-r--r-- | sys/cam/ata/ata_xpt.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c index d02b36f..216805d 100644 --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -1601,6 +1601,34 @@ ata_device_transport(struct cam_path *path) } static void +ata_dev_advinfo(union ccb *start_ccb) +{ + struct cam_ed *device; + struct ccb_dev_advinfo *cdai; + off_t amt; + + start_ccb->ccb_h.status = CAM_REQ_INVALID; + device = start_ccb->ccb_h.path->device; + cdai = &start_ccb->cdai; + switch(cdai->buftype) { + case CDAI_TYPE_SERIAL_NUM: + if (cdai->flags & CDAI_FLAG_STORE) + break; + start_ccb->ccb_h.status = CAM_REQ_CMP; + cdai->provsiz = device->serial_num_len; + if (device->serial_num_len == 0) + break; + amt = device->serial_num_len; + if (cdai->provsiz > cdai->bufsiz) + amt = cdai->bufsiz; + memcpy(cdai->buf, device->serial_num, amt); + break; + default: + break; + } +} + +static void ata_action(union ccb *start_ccb) { @@ -1652,6 +1680,11 @@ ata_action(union ccb *start_ccb) } /* FALLTHROUGH */ } + case XPT_DEV_ADVINFO: + { + ata_dev_advinfo(start_ccb); + break; + } default: xpt_action_default(start_ccb); break; |