Lines Matching +full:pci +full:- +full:host +full:- +full:cam +full:- +full:generic
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (C) 2012-2013 Intel Corporation
47 /* NB: Fabrics-specific ioctls defined in nvmf.h start at 200. */
62 /* Host memory buffer sizes are always in 4096 byte chunks */
278 /** Controller Multi-path I/O and Namespace Sharing Capabilities */
285 /* SR-IOV Virtual Function */
292 /** OAES - Optional Asynchronous Events Supported */
321 /** CTRATT - Controller Attributes */
322 /* supports 128-bit Host Identifier */
325 /* supports Non-Operational Power State Permissive Mode */
353 /** OACS - optional admin command support */
366 /* supports Device Self-test command */
372 /* supports NVMe-MI Send/Receive */
386 /* first slot is read-only */
419 /** AVSCC - admin vendor specific command configuration */
439 /* No-Deallocate Inhibited */
442 /* No-Deallocate Modifies Media After Sanitize */
552 /** end-to-end data protection capabilities */
569 /** end-to-end data protection type settings */
578 /** Namespace Multi-path I/O and Namespace Sharing Capabilities */
596 /* supports the Exclusive Access - Registrants Only */
602 /* supports the Exclusive Access - All Registrants */
762 uint8_t reserved3[3476]; /* 6Ch - DFFh */
770 uint8_t reserved4[484]; /* E1Ch - FFFh */
820 /* dword 2-3 */
824 /* dword 4-5 */
827 /* dword 6-9 */
836 /* dword 10-15 */
837 uint32_t cdw10; /* command-specific */
838 uint32_t cdw11; /* command-specific */
839 uint32_t cdw12; /* command-specific */
840 uint32_t cdw13; /* command-specific */
841 uint32_t cdw14; /* command-specific */
842 uint32_t cdw15; /* command-specific */
849 uint32_t cdw0; /* command-specific */
882 /* 0x3-0x6 - reserved */
886 /* generic command status codes */
911 /* 0x17 - reserved */
937 /* 0x04 - reserved */
956 /* 0x17 - reserved */
1005 /* 0x03 - reserved */
1009 /* 0x07 - reserved */
1013 /* 0x0b - reserved */
1016 /* 0x0e-0x0f - reserved */
1019 /* 0x12-0x13 - reserved */
1022 /* 0x16-0x17 - reserved */
1026 /* 0x1b - reserved */
1030 /* 0x1f - reserved */
1032 /* 0x21-0x23 - reserved */
1034 /* 0x25-0x7b - reserved */
1036 /* 0x7d-0x7e - reserved */
1042 /* 0x83 - reserved */
1044 /* 0x85 - reserved */
1053 /* 0x03 - reserved */
1056 /* 0x06-0x07 - reserved */
1059 /* 0x0a-0x0b - reserved */
1063 /* 0x0f-0x10 - reserved */
1065 /* 0x12-0x14 - reserved */
1067 /* 0x16-0x18 - reserved */
1072 /* 0x00 - reserved */
1097 /* 0x19-0x77 - reserved */
1098 /* 0x78-0x7f - NVMe Management Interface */
1104 /* 0x85-0xBF - command set specific (reserved) */
1105 /* 0xC0-0xFF - vendor specific */
1124 uint8_t mps_nops; /* Max Power Scale, Non-Operational State */
1150 /* bytes 0-255: controller capabilities and features */
1152 /** pci vendor id */
1155 /** pci subsystem vendor id */
1173 /** multi-interface capabilities */
1219 /* bytes 256-511: admin command set attributes */
1257 /** Host Memory Buffer Preferred Size */
1260 /** Host Memory Buffer Minimum Size */
1273 /** Extended Device Self-test Time */
1276 /** Device Self-test Options */
1285 /** Host Controlled Thermal Management Attributes */
1297 /** Host Memory Buffer Minimum Descriptor Entry Size */
1300 /** Host Memory Maximum Descriptors Entries */
1325 /* bytes 512-703: nvm command set attributes */
1373 /* bytes 540-767: Reserved */
1379 /* bytes 1024-1791: Reserved */
1382 /* bytes 1792-2047: NVMe over Fabrics specification */
1391 /* bytes 2048-3071: power state descriptors */
1394 /* bytes 3072-4095: vendor specific */
1422 /** end-to-end data protection capabilities */
1425 /** end-to-end data protection type settings */
1428 /** Namespace Multi-path I/O and Namespace Sharing Capabilities */
1479 /* bytes 74-91: Reserved */
1485 /* bytes 96-98: Reserved */
1514 /* 0x00 - reserved */
1531 /* 0x06-0x7F - reserved */
1532 /* 0x80-0xBF - I/O command set specific */
1535 /* 0x82-0xBF - reserved */
1536 /* 0xC0-0xFF - vendor specific */
1582 * Note that the following are 128-bit values, but are
1583 * defined as an array of 2 64-bit values.
1585 /* Data Units Read is always in 512-byte units. */
1587 /* Data Units Written is always in 512-byte units. */
1664 * Header structure for both host initiated telemetry (page 7) and controller
1775 uint64_t hostid; /* Host Identifier */
1786 uint64_t hostid[2]; /* Host Identifier */
1844 * * nsid (namespace id) - for admin commands only
1845 * * cdw10-cdw15
1901 (NVME_STATUS_GET_SC((cpl)->status) != 0 || NVME_STATUS_GET_SCT((cpl)->status) != 0)
1988 return (NVMEV(NVME_CTRLR_DATA_ONCS_DSM, cd->oncs) != 0);
2009 * Command building helper functions -- shared with CAM
2011 * CAM's xpt_get_ccb and the request allocator for nvme both
2018 cmd->opc = NVME_OPC_FLUSH;
2019 cmd->nsid = htole32(nsid);
2026 cmd->opc = rwcmd;
2027 cmd->nsid = htole32(nsid);
2028 cmd->cdw10 = htole32(lba & 0xffffffffu);
2029 cmd->cdw11 = htole32(lba >> 32);
2030 cmd->cdw12 = htole32(count-1);
2051 cmd->opc = NVME_OPC_DATASET_MANAGEMENT;
2052 cmd->nsid = htole32(nsid);
2053 cmd->cdw10 = htole32(num_ranges - 1);
2054 cmd->cdw11 = htole32(NVME_DSM_ATTR_DEALLOCATE);
2067 s->cdw0 = le32toh(s->cdw0);
2069 s->sqhd = le16toh(s->sqhd);
2070 s->sqid = le16toh(s->sqid);
2072 s->status = le16toh(s->status);
2081 s->mp = le16toh(s->mp);
2082 s->enlat = le32toh(s->enlat);
2083 s->exlat = le32toh(s->exlat);
2084 s->idlp = le16toh(s->idlp);
2085 s->actp = le16toh(s->actp);
2095 s->vid = le16toh(s->vid);
2096 s->ssvid = le16toh(s->ssvid);
2097 s->ctrlr_id = le16toh(s->ctrlr_id);
2098 s->ver = le32toh(s->ver);
2099 s->rtd3r = le32toh(s->rtd3r);
2100 s->rtd3e = le32toh(s->rtd3e);
2101 s->oaes = le32toh(s->oaes);
2102 s->ctratt = le32toh(s->ctratt);
2103 s->rrls = le16toh(s->rrls);
2104 s->crdt1 = le16toh(s->crdt1);
2105 s->crdt2 = le16toh(s->crdt2);
2106 s->crdt3 = le16toh(s->crdt3);
2107 s->oacs = le16toh(s->oacs);
2108 s->wctemp = le16toh(s->wctemp);
2109 s->cctemp = le16toh(s->cctemp);
2110 s->mtfa = le16toh(s->mtfa);
2111 s->hmpre = le32toh(s->hmpre);
2112 s->hmmin = le32toh(s->hmmin);
2113 s->rpmbs = le32toh(s->rpmbs);
2114 s->edstt = le16toh(s->edstt);
2115 s->kas = le16toh(s->kas);
2116 s->hctma = le16toh(s->hctma);
2117 s->mntmt = le16toh(s->mntmt);
2118 s->mxtmt = le16toh(s->mxtmt);
2119 s->sanicap = le32toh(s->sanicap);
2120 s->hmminds = le32toh(s->hmminds);
2121 s->hmmaxd = le16toh(s->hmmaxd);
2122 s->nsetidmax = le16toh(s->nsetidmax);
2123 s->endgidmax = le16toh(s->endgidmax);
2124 s->anagrpmax = le32toh(s->anagrpmax);
2125 s->nanagrpid = le32toh(s->nanagrpid);
2126 s->pels = le32toh(s->pels);
2127 s->maxcmd = le16toh(s->maxcmd);
2128 s->nn = le32toh(s->nn);
2129 s->oncs = le16toh(s->oncs);
2130 s->fuses = le16toh(s->fuses);
2131 s->awun = le16toh(s->awun);
2132 s->awupf = le16toh(s->awupf);
2133 s->acwu = le16toh(s->acwu);
2134 s->sgls = le32toh(s->sgls);
2135 s->mnan = le32toh(s->mnan);
2136 s->ioccsz = le32toh(s->ioccsz);
2137 s->iorcsz = le32toh(s->iorcsz);
2138 s->icdoff = le16toh(s->icdoff);
2139 s->ofcs = le16toh(s->ofcs);
2141 nvme_power_state_swapbytes(&s->power_state[i]);
2151 s->nsze = le64toh(s->nsze);
2152 s->ncap = le64toh(s->ncap);
2153 s->nuse = le64toh(s->nuse);
2154 s->nawun = le16toh(s->nawun);
2155 s->nawupf = le16toh(s->nawupf);
2156 s->nacwu = le16toh(s->nacwu);
2157 s->nabsn = le16toh(s->nabsn);
2158 s->nabo = le16toh(s->nabo);
2159 s->nabspf = le16toh(s->nabspf);
2160 s->noiob = le16toh(s->noiob);
2161 s->npwg = le16toh(s->npwg);
2162 s->npwa = le16toh(s->npwa);
2163 s->npdg = le16toh(s->npdg);
2164 s->npda = le16toh(s->npda);
2165 s->nows = le16toh(s->nows);
2166 s->anagrpid = le32toh(s->anagrpid);
2167 s->nvmsetid = le16toh(s->nvmsetid);
2168 s->endgid = le16toh(s->endgid);
2170 s->lbaf[i] = le32toh(s->lbaf[i]);
2180 s->error_count = le64toh(s->error_count);
2181 s->sqid = le16toh(s->sqid);
2182 s->cid = le16toh(s->cid);
2183 s->status = le16toh(s->status);
2184 s->error_location = le16toh(s->error_location);
2185 s->lba = le64toh(s->lba);
2186 s->nsid = le32toh(s->nsid);
2187 s->csi = le64toh(s->csi);
2188 s->ttsi = le16toh(s->ttsi);
2202 tmp[i] = tmp[15-i];
2203 tmp[15-i] = b;
2215 s->temperature = le16toh(s->temperature);
2216 nvme_le128toh((void *)s->data_units_read);
2217 nvme_le128toh((void *)s->data_units_written);
2218 nvme_le128toh((void *)s->host_read_commands);
2219 nvme_le128toh((void *)s->host_write_commands);
2220 nvme_le128toh((void *)s->controller_busy_time);
2221 nvme_le128toh((void *)s->power_cycles);
2222 nvme_le128toh((void *)s->power_on_hours);
2223 nvme_le128toh((void *)s->unsafe_shutdowns);
2224 nvme_le128toh((void *)s->media_errors);
2225 nvme_le128toh((void *)s->num_error_info_log_entries);
2226 s->warning_temp_time = le32toh(s->warning_temp_time);
2227 s->error_temp_time = le32toh(s->error_temp_time);
2229 s->temp_sensor[i] = le16toh(s->temp_sensor[i]);
2230 s->tmt1tc = le32toh(s->tmt1tc);
2231 s->tmt2tc = le32toh(s->tmt2tc);
2232 s->ttftmt1 = le32toh(s->ttftmt1);
2233 s->ttftmt2 = le32toh(s->ttftmt2);
2244 s->ns[i] = le32toh(s->ns[i]);
2256 s->acs[i] = le32toh(s->acs[i]);
2258 s->iocs[i] = le32toh(s->iocs[i]);
2267 s->log_page_count = le64toh(s->log_page_count);
2268 s->nsid = le32toh(s->nsid);
2277 s->sprog = le16toh(s->sprog);
2278 s->sstat = le16toh(s->sstat);
2279 s->scdw10 = le32toh(s->scdw10);
2280 s->etfo = le32toh(s->etfo);
2281 s->etfbe = le32toh(s->etfbe);
2282 s->etfce = le32toh(s->etfce);
2283 s->etfownd = le32toh(s->etfownd);
2284 s->etfbewnd = le32toh(s->etfbewnd);
2285 s->etfcewnd = le32toh(s->etfcewnd);
2296 s->gen = le32toh(s->gen);
2297 n = (s->regctl[1] << 8) | s->regctl[0];
2298 n = MIN(n, (size - sizeof(s)) / sizeof(s->ctrlr[0]));
2300 s->ctrlr[i].ctrlr_id = le16toh(s->ctrlr[i].ctrlr_id);
2301 s->ctrlr[i].hostid = le64toh(s->ctrlr[i].hostid);
2302 s->ctrlr[i].rkey = le64toh(s->ctrlr[i].rkey);
2314 s->gen = le32toh(s->gen);
2315 n = (s->regctl[1] << 8) | s->regctl[0];
2316 n = MIN(n, (size - sizeof(s)) / sizeof(s->ctrlr[0]));
2318 s->ctrlr[i].ctrlr_id = le16toh(s->ctrlr[i].ctrlr_id);
2319 s->ctrlr[i].rkey = le64toh(s->ctrlr[i].rkey);
2320 nvme_le128toh((void *)s->ctrlr[i].hostid);
2334 s->result[r].poh = le64toh(s->result[r].poh);
2335 s->result[r].nsid = le32toh(s->result[r].nsid);
2336 /* Unaligned 64-bit loads fail on some architectures */
2337 tmp = s->result[r].failing_lba;
2340 tmp[i] = tmp[7-i];
2341 tmp[7-i] = b;
2351 s->portid = le16toh(s->portid);
2352 s->cntlid = le16toh(s->cntlid);
2353 s->aqsz = le16toh(s->aqsz);
2354 if (s->trtype == 0x01 /* RDMA */) {
2355 s->tsas.rdma.rdma_pkey = le16toh(s->tsas.rdma.rdma_pkey);
2364 s->genctr = le64toh(s->genctr);
2365 s->numrec = le64toh(s->numrec);
2366 s->recfmt = le16toh(s->recfmt);