Deleted Added
full compact
nvme_ns.c (253112) nvme_ns.c (253474)
1/*-
2 * Copyright (C) 2012-2013 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-2013 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 253112 2013-07-09 21:22:17Z jimharris $");
28__FBSDID("$FreeBSD: head/sys/dev/nvme/nvme_ns.c 253474 2013-07-19 21:33:24Z 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>

--- 113 unchanged lines hidden (view full) ---

150nvme_ns_get_max_io_xfer_size(struct nvme_namespace *ns)
151{
152 return ns->ctrlr->max_xfer_size;
153}
154
155uint32_t
156nvme_ns_get_sector_size(struct nvme_namespace *ns)
157{
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>

--- 113 unchanged lines hidden (view full) ---

150nvme_ns_get_max_io_xfer_size(struct nvme_namespace *ns)
151{
152 return ns->ctrlr->max_xfer_size;
153}
154
155uint32_t
156nvme_ns_get_sector_size(struct nvme_namespace *ns)
157{
158 return (1 << ns->data.lbaf[0].lbads);
158 return (1 << ns->data.lbaf[ns->data.flbas.format].lbads);
159}
160
161uint64_t
162nvme_ns_get_num_sectors(struct nvme_namespace *ns)
163{
164 return (ns->data.nsze);
165}
166

--- 138 unchanged lines hidden (view full) ---

305 if (nvme_completion_is_error(&status.cpl)) {
306 nvme_printf(ctrlr, "nvme_identify_namespace failed\n");
307 return (ENXIO);
308 }
309#ifdef CHATHAM2
310 }
311#endif
312
159}
160
161uint64_t
162nvme_ns_get_num_sectors(struct nvme_namespace *ns)
163{
164 return (ns->data.nsze);
165}
166

--- 138 unchanged lines hidden (view full) ---

305 if (nvme_completion_is_error(&status.cpl)) {
306 nvme_printf(ctrlr, "nvme_identify_namespace failed\n");
307 return (ENXIO);
308 }
309#ifdef CHATHAM2
310 }
311#endif
312
313 /*
314 * Note: format is a 0-based value, so > is appropriate here,
315 * not >=.
316 */
317 if (ns->data.flbas.format > ns->data.nlbaf) {
318 printf("lba format %d exceeds number supported (%d)\n",
319 ns->data.flbas.format, ns->data.nlbaf+1);
320 return (1);
321 }
322
313 if (ctrlr->cdata.oncs.dsm)
314 ns->flags |= NVME_NS_DEALLOCATE_SUPPORTED;
315
316 if (ctrlr->cdata.vwc.present)
317 ns->flags |= NVME_NS_FLUSH_SUPPORTED;
318
319 /*
320 * cdev may have already been created, if we are reconstructing the

--- 33 unchanged lines hidden ---
323 if (ctrlr->cdata.oncs.dsm)
324 ns->flags |= NVME_NS_DEALLOCATE_SUPPORTED;
325
326 if (ctrlr->cdata.vwc.present)
327 ns->flags |= NVME_NS_FLUSH_SUPPORTED;
328
329 /*
330 * cdev may have already been created, if we are reconstructing the

--- 33 unchanged lines hidden ---