nvme_ns.c (248835) | nvme_ns.c (248977) |
---|---|
1/*- 2 * Copyright (C) 2012 Intel Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (C) 2012 Intel Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/nvme/nvme_ns.c 248835 2013-03-28 16:57:48Z jimharris $"); | 28__FBSDID("$FreeBSD: head/sys/dev/nvme/nvme_ns.c 248977 2013-04-01 16:23:34Z jimharris $"); |
29 30#include <sys/param.h> 31#include <sys/bio.h> 32#include <sys/bus.h> 33#include <sys/conf.h> 34#include <sys/disk.h> 35#include <sys/fcntl.h> 36#include <sys/ioccom.h> --- 108 unchanged lines hidden (view full) --- 145 bp->bio_resid = bp->bio_bcount; 146 biodone(bp); 147 } 148 149} 150 151static struct cdevsw nvme_ns_cdevsw = { 152 .d_version = D_VERSION, | 29 30#include <sys/param.h> 31#include <sys/bio.h> 32#include <sys/bus.h> 33#include <sys/conf.h> 34#include <sys/disk.h> 35#include <sys/fcntl.h> 36#include <sys/ioccom.h> --- 108 unchanged lines hidden (view full) --- 145 bp->bio_resid = bp->bio_bcount; 146 biodone(bp); 147 } 148 149} 150 151static struct cdevsw nvme_ns_cdevsw = { 152 .d_version = D_VERSION, |
153#ifdef NVME_UNMAPPED_BIO_SUPPORT 154 .d_flags = D_DISK | D_UNMAPPED_IO, 155 .d_read = physread, 156 .d_write = physwrite, 157#else |
|
153 .d_flags = D_DISK, | 158 .d_flags = D_DISK, |
154 .d_open = nvme_ns_open, 155 .d_close = nvme_ns_close, | |
156 .d_read = nvme_ns_physio, 157 .d_write = nvme_ns_physio, | 159 .d_read = nvme_ns_physio, 160 .d_write = nvme_ns_physio, |
161#endif 162 .d_open = nvme_ns_open, 163 .d_close = nvme_ns_close, |
|
158 .d_strategy = nvme_ns_strategy, 159 .d_ioctl = nvme_ns_ioctl 160}; 161 162uint32_t 163nvme_ns_get_max_io_xfer_size(struct nvme_namespace *ns) 164{ 165 return ns->ctrlr->max_xfer_size; --- 62 unchanged lines hidden (view full) --- 228{ 229 struct nvme_dsm_range *dsm_range; 230 int err; 231 232 bp->bio_driver1 = cb_fn; 233 234 switch (bp->bio_cmd) { 235 case BIO_READ: | 164 .d_strategy = nvme_ns_strategy, 165 .d_ioctl = nvme_ns_ioctl 166}; 167 168uint32_t 169nvme_ns_get_max_io_xfer_size(struct nvme_namespace *ns) 170{ 171 return ns->ctrlr->max_xfer_size; --- 62 unchanged lines hidden (view full) --- 234{ 235 struct nvme_dsm_range *dsm_range; 236 int err; 237 238 bp->bio_driver1 = cb_fn; 239 240 switch (bp->bio_cmd) { 241 case BIO_READ: |
236 err = nvme_ns_cmd_read(ns, bp->bio_data, 237 bp->bio_offset/nvme_ns_get_sector_size(ns), 238 bp->bio_bcount/nvme_ns_get_sector_size(ns), 239 nvme_ns_bio_done, bp); | 242 err = nvme_ns_cmd_read_bio(ns, bp, nvme_ns_bio_done, bp); |
240 break; 241 case BIO_WRITE: | 243 break; 244 case BIO_WRITE: |
242 err = nvme_ns_cmd_write(ns, bp->bio_data, 243 bp->bio_offset/nvme_ns_get_sector_size(ns), 244 bp->bio_bcount/nvme_ns_get_sector_size(ns), 245 nvme_ns_bio_done, bp); | 245 err = nvme_ns_cmd_write_bio(ns, bp, nvme_ns_bio_done, bp); |
246 break; 247 case BIO_FLUSH: 248 err = nvme_ns_cmd_flush(ns, nvme_ns_bio_done, bp); 249 break; 250 case BIO_DELETE: 251 dsm_range = 252 malloc(sizeof(struct nvme_dsm_range), M_NVME, 253 M_ZERO | M_WAITOK); --- 108 unchanged lines hidden --- | 246 break; 247 case BIO_FLUSH: 248 err = nvme_ns_cmd_flush(ns, nvme_ns_bio_done, bp); 249 break; 250 case BIO_DELETE: 251 dsm_range = 252 malloc(sizeof(struct nvme_dsm_range), M_NVME, 253 M_ZERO | M_WAITOK); --- 108 unchanged lines hidden --- |