diff options
author | sephe <sephe@FreeBSD.org> | 2016-10-14 03:11:31 +0000 |
---|---|---|
committer | sephe <sephe@FreeBSD.org> | 2016-10-14 03:11:31 +0000 |
commit | 1fc32826a308f353f2f31fd4a5beaf0b6e4bc201 (patch) | |
tree | 76a42c5917f755240b5926f7572d7e98b0473e8c /sys/cam | |
parent | 0b0197573cc7f2a2fba367810fbb63edfc756515 (diff) | |
download | FreeBSD-src-1fc32826a308f353f2f31fd4a5beaf0b6e4bc201.zip FreeBSD-src-1fc32826a308f353f2f31fd4a5beaf0b6e4bc201.tar.gz |
MFC 306396
cam/ata: Allow drivers to veto ATA disk attachment.
This eventhandler is mainly used by VMs, e.g. Hyper-V, whose disk
controllers share the disks with the simulated ATA controllers.
Submitted by: Hongjiang Zhang <honzhan microsoft com>
Discussed with: mav
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7693
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/ata/ata_xpt.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c index 3429bb29a6..584b75d 100644 --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include <sys/interrupt.h> #include <sys/sbuf.h> +#include <sys/eventhandler.h> #include <sys/lock.h> #include <sys/mutex.h> #include <sys/sysctl.h> @@ -827,12 +828,24 @@ noerror: { struct ccb_pathinq cpi; int16_t *ptr; + int veto = 0; ident_buf = &softc->ident_data; for (ptr = (int16_t *)ident_buf; ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { *ptr = le16toh(*ptr); } + + /* + * Allow others to veto this ATA disk attachment. This + * is mainly used by VMs, whose disk controllers may + * share the disks with the simulated ATA controllers. + */ + EVENTHANDLER_INVOKE(ada_probe_veto, path, ident_buf, &veto); + if (veto) { + goto device_fail; + } + if (strncmp(ident_buf->model, "FX", 2) && strncmp(ident_buf->model, "NEC", 3) && strncmp(ident_buf->model, "Pioneer", 7) && |