nvme_ns_cmd.c (248977) | nvme_ns_cmd.c (253474) |
---|---|
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_cmd.c 248977 2013-04-01 16:23:34Z jimharris $"); | 28__FBSDID("$FreeBSD: head/sys/dev/nvme/nvme_ns_cmd.c 253474 2013-07-19 21:33:24Z jimharris $"); |
29 30#include "nvme_private.h" 31 32int 33nvme_ns_cmd_read(struct nvme_namespace *ns, void *payload, uint64_t lba, 34 uint32_t lba_count, nvme_cb_fn_t cb_fn, void *cb_arg) 35{ 36 struct nvme_request *req; 37 struct nvme_command *cmd; 38 | 29 30#include "nvme_private.h" 31 32int 33nvme_ns_cmd_read(struct nvme_namespace *ns, void *payload, uint64_t lba, 34 uint32_t lba_count, nvme_cb_fn_t cb_fn, void *cb_arg) 35{ 36 struct nvme_request *req; 37 struct nvme_command *cmd; 38 |
39 req = nvme_allocate_request_vaddr(payload, lba_count*512, cb_fn, cb_arg); | 39 req = nvme_allocate_request_vaddr(payload, 40 lba_count*nvme_ns_get_sector_size(ns), cb_fn, cb_arg); |
40 41 if (req == NULL) 42 return (ENOMEM); 43 cmd = &req->cmd; 44 cmd->opc = NVME_OPC_READ; 45 cmd->nsid = ns->id; 46 47 /* TODO: create a read command data structure */ --- 36 unchanged lines hidden (view full) --- 84 85int 86nvme_ns_cmd_write(struct nvme_namespace *ns, void *payload, uint64_t lba, 87 uint32_t lba_count, nvme_cb_fn_t cb_fn, void *cb_arg) 88{ 89 struct nvme_request *req; 90 struct nvme_command *cmd; 91 | 41 42 if (req == NULL) 43 return (ENOMEM); 44 cmd = &req->cmd; 45 cmd->opc = NVME_OPC_READ; 46 cmd->nsid = ns->id; 47 48 /* TODO: create a read command data structure */ --- 36 unchanged lines hidden (view full) --- 85 86int 87nvme_ns_cmd_write(struct nvme_namespace *ns, void *payload, uint64_t lba, 88 uint32_t lba_count, nvme_cb_fn_t cb_fn, void *cb_arg) 89{ 90 struct nvme_request *req; 91 struct nvme_command *cmd; 92 |
92 req = nvme_allocate_request_vaddr(payload, lba_count*512, cb_fn, 93 cb_arg); | 93 req = nvme_allocate_request_vaddr(payload, 94 lba_count*nvme_ns_get_sector_size(ns), cb_fn, cb_arg); |
94 95 if (req == NULL) 96 return (ENOMEM); 97 98 cmd = &req->cmd; 99 cmd->opc = NVME_OPC_WRITE; 100 cmd->nsid = ns->id; 101 --- 83 unchanged lines hidden --- | 95 96 if (req == NULL) 97 return (ENOMEM); 98 99 cmd = &req->cmd; 100 cmd->opc = NVME_OPC_WRITE; 101 cmd->nsid = ns->id; 102 --- 83 unchanged lines hidden --- |