Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/nvme/nvme_ctrlr.c
Show First 20 Lines • Show All 1,242 Lines • ▼ Show 20 Lines | nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr, | ||||
struct mtx *mtx; | struct mtx *mtx; | ||||
struct buf *buf = NULL; | struct buf *buf = NULL; | ||||
int ret = 0; | int ret = 0; | ||||
vm_offset_t addr, end; | vm_offset_t addr, end; | ||||
if (pt->len > 0) { | if (pt->len > 0) { | ||||
/* | /* | ||||
* vmapbuf calls vm_fault_quick_hold_pages which only maps full | * vmapbuf calls vm_fault_quick_hold_pages which only maps full | ||||
* pages. Ensure this request has fewer than MAXPHYS bytes when | * pages. Ensure this request has fewer than maxphys bytes when | ||||
* extended to full pages. | * extended to full pages. | ||||
*/ | */ | ||||
addr = (vm_offset_t)pt->buf; | addr = (vm_offset_t)pt->buf; | ||||
end = round_page(addr + pt->len); | end = round_page(addr + pt->len); | ||||
addr = trunc_page(addr); | addr = trunc_page(addr); | ||||
if (end - addr > MAXPHYS) | if (end - addr > maxphys) | ||||
return EIO; | return EIO; | ||||
if (pt->len > ctrlr->max_xfer_size) { | if (pt->len > ctrlr->max_xfer_size) { | ||||
nvme_printf(ctrlr, "pt->len (%d) " | nvme_printf(ctrlr, "pt->len (%d) " | ||||
"exceeds max_xfer_size (%d)\n", pt->len, | "exceeds max_xfer_size (%d)\n", pt->len, | ||||
ctrlr->max_xfer_size); | ctrlr->max_xfer_size); | ||||
return EIO; | return EIO; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 428 Lines • Show Last 20 Lines |