Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/nvme/nvme_ctrlr.c
Show First 20 Lines • Show All 1,046 Lines • ▼ Show 20 Lines | if (pt->len > ctrlr->max_xfer_size) { | ||||
return EIO; | return EIO; | ||||
} | } | ||||
if (is_user_buffer) { | if (is_user_buffer) { | ||||
/* | /* | ||||
* Ensure the user buffer is wired for the duration of | * Ensure the user buffer is wired for the duration of | ||||
* this passthrough command. | * this passthrough command. | ||||
*/ | */ | ||||
PHOLD(curproc); | PHOLD(curproc); | ||||
buf = getpbuf(NULL); | buf = uma_zalloc(pbuf_zone, M_WAITOK); | ||||
buf->b_data = pt->buf; | buf->b_data = pt->buf; | ||||
buf->b_bufsize = pt->len; | buf->b_bufsize = pt->len; | ||||
buf->b_iocmd = pt->is_read ? BIO_READ : BIO_WRITE; | buf->b_iocmd = pt->is_read ? BIO_READ : BIO_WRITE; | ||||
#ifdef NVME_UNMAPPED_BIO_SUPPORT | #ifdef NVME_UNMAPPED_BIO_SUPPORT | ||||
if (vmapbuf(buf, 1) < 0) { | if (vmapbuf(buf, 1) < 0) { | ||||
#else | #else | ||||
if (vmapbuf(buf) < 0) { | if (vmapbuf(buf) < 0) { | ||||
#endif | #endif | ||||
Show All 30 Lines | #endif | ||||
mtx_lock(mtx); | mtx_lock(mtx); | ||||
while (pt->driver_lock != NULL) | while (pt->driver_lock != NULL) | ||||
mtx_sleep(pt, mtx, PRIBIO, "nvme_pt", 0); | mtx_sleep(pt, mtx, PRIBIO, "nvme_pt", 0); | ||||
mtx_unlock(mtx); | mtx_unlock(mtx); | ||||
err: | err: | ||||
if (buf != NULL) { | if (buf != NULL) { | ||||
relpbuf(buf, NULL); | uma_zfree(pbuf_zone, buf); | ||||
PRELE(curproc); | PRELE(curproc); | ||||
} | } | ||||
return (ret); | return (ret); | ||||
} | } | ||||
static int | static int | ||||
nvme_ctrlr_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int flag, | nvme_ctrlr_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int flag, | ||||
▲ Show 20 Lines • Show All 305 Lines • Show Last 20 Lines |