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
53 /* NB: Fabrics-specific ioctls defined in nvmf.h start at 200. */
68 /* Host memory buffer sizes are always in 4096 byte chunks */
284 /** Controller Multi-path I/O and Namespace Sharing Capabilities */
291 /* SR-IOV Virtual Function */
298 /** OAES - Optional Asynchronous Events Supported */
327 /** CTRATT - Controller Attributes */
328 /* supports 128-bit Host Identifier */
331 /* supports Non-Operational Power State Permissive Mode */
359 /** OACS - optional admin command support */
372 /* supports Device Self-test command */
378 /* supports NVMe-MI Send/Receive */
392 /* first slot is read-only */
425 /** AVSCC - admin vendor specific command configuration */
445 /* No-Deallocate Inhibited */
448 /* No-Deallocate Modifies Media After Sanitize */
558 /** end-to-end data protection capabilities */
575 /** end-to-end data protection type settings */
584 /** Namespace Multi-path I/O and Namespace Sharing Capabilities */
602 /* supports the Exclusive Access - Registrants Only */
608 /* supports the Exclusive Access - All Registrants */
768 uint8_t reserved3[3476]; /* 6Ch - DFFh */
776 uint8_t reserved4[484]; /* E1Ch - FFFh */
826 /* dword 2-3 */
830 /* dword 4-5 */
833 /* dword 6-9 */
842 /* dword 10-15 */
843 uint32_t cdw10; /* command-specific */
844 uint32_t cdw11; /* command-specific */
845 uint32_t cdw12; /* command-specific */
846 uint32_t cdw13; /* command-specific */
847 uint32_t cdw14; /* command-specific */
848 uint32_t cdw15; /* command-specific */
855 uint32_t cdw0; /* command-specific */
888 /* 0x3-0x6 - reserved */
892 /* generic command status codes */
917 /* 0x17 - reserved */
943 /* 0x04 - reserved */
962 /* 0x17 - reserved */
1011 /* 0x03 - reserved */
1015 /* 0x07 - reserved */
1019 /* 0x0b - reserved */
1022 /* 0x0e-0x0f - reserved */
1025 /* 0x12-0x13 - reserved */
1028 /* 0x16-0x17 - reserved */
1032 /* 0x1b - reserved */
1036 /* 0x1f - reserved */
1038 /* 0x21-0x23 - reserved */
1040 /* 0x25-0x7b - reserved */
1042 /* 0x7d-0x7e - reserved */
1048 /* 0x83 - reserved */
1050 /* 0x85 - reserved */
1059 /* 0x03 - reserved */
1062 /* 0x06-0x07 - reserved */
1065 /* 0x0a-0x0b - reserved */
1069 /* 0x0f-0x10 - reserved */
1071 /* 0x12-0x14 - reserved */
1073 /* 0x16-0x18 - reserved */
1078 /* 0x00 - reserved */
1103 /* 0x19-0x77 - reserved */
1104 /* 0x78-0x7f - NVMe Management Interface */
1110 /* 0x85-0xBF - command set specific (reserved) */
1111 /* 0xC0-0xFF - vendor specific */
1130 uint8_t mps_nops; /* Max Power Scale, Non-Operational State */
1156 /* bytes 0-255: controller capabilities and features */
1158 /** pci vendor id */
1161 /** pci subsystem vendor id */
1179 /** multi-interface capabilities */
1225 /* bytes 256-511: admin command set attributes */
1263 /** Host Memory Buffer Preferred Size */
1266 /** Host Memory Buffer Minimum Size */
1279 /** Extended Device Self-test Time */
1282 /** Device Self-test Options */
1291 /** Host Controlled Thermal Management Attributes */
1303 /** Host Memory Buffer Minimum Descriptor Entry Size */
1306 /** Host Memory Maximum Descriptors Entries */
1331 /* bytes 512-703: nvm command set attributes */
1379 /* bytes 540-767: Reserved */
1385 /* bytes 1024-1791: Reserved */
1388 /* bytes 1792-2047: NVMe over Fabrics specification */
1397 /* bytes 2048-3071: power state descriptors */
1400 /* bytes 3072-4095: vendor specific */
1428 /** end-to-end data protection capabilities */
1431 /** end-to-end data protection type settings */
1434 /** Namespace Multi-path I/O and Namespace Sharing Capabilities */
1485 /* bytes 74-91: Reserved */
1491 /* bytes 96-98: Reserved */
1518 /* 0x00 - reserved */
1535 /* 0x06-0x7F - reserved */
1536 /* 0x80-0xBF - I/O command set specific */
1539 /* 0x82-0xBF - reserved */
1540 /* 0xC0-0xFF - vendor specific */
1586 * Note that the following are 128-bit values, but are
1587 * defined as an array of 2 64-bit values.
1589 /* Data Units Read is always in 512-byte units. */
1591 /* Data Units Written is always in 512-byte units. */
1668 * Header structure for both host initiated telemetry (page 7) and controller
1779 uint64_t hostid; /* Host Identifier */
1790 uint64_t hostid[2]; /* Host Identifier */
1848 * * nsid (namespace id) - for admin commands only
1849 * * cdw10-cdw15
1905 (NVME_STATUS_GET_SC((cpl)->status) != 0 || NVME_STATUS_GET_SCT((cpl)->status) != 0)
1995 return (NVMEV(NVME_CTRLR_DATA_ONCS_DSM, cd->oncs) != 0); in nvme_ctrlr_has_dataset_mgmt()
2016 * Command building helper functions -- shared with CAM
2018 * CAM's xpt_get_ccb and the request allocator for nvme both
2025 cmd->opc = NVME_OPC_FLUSH; in nvme_ns_flush_cmd()
2026 cmd->nsid = htole32(nsid); in nvme_ns_flush_cmd()
2033 cmd->opc = rwcmd; in nvme_ns_rw_cmd()
2034 cmd->nsid = htole32(nsid); in nvme_ns_rw_cmd()
2035 cmd->cdw10 = htole32(lba & 0xffffffffu); in nvme_ns_rw_cmd()
2036 cmd->cdw11 = htole32(lba >> 32); in nvme_ns_rw_cmd()
2037 cmd->cdw12 = htole32(count-1); in nvme_ns_rw_cmd()
2058 cmd->opc = NVME_OPC_DATASET_MANAGEMENT; in nvme_ns_trim_cmd()
2059 cmd->nsid = htole32(nsid); in nvme_ns_trim_cmd()
2060 cmd->cdw10 = htole32(num_ranges - 1); in nvme_ns_trim_cmd()
2061 cmd->cdw11 = htole32(NVME_DSM_ATTR_DEALLOCATE); in nvme_ns_trim_cmd()
2074 s->cdw0 = le32toh(s->cdw0); in nvme_completion_swapbytes()
2076 s->sqhd = le16toh(s->sqhd); in nvme_completion_swapbytes()
2077 s->sqid = le16toh(s->sqid); in nvme_completion_swapbytes()
2079 s->status = le16toh(s->status); in nvme_completion_swapbytes()
2088 s->mp = le16toh(s->mp); in nvme_power_state_swapbytes()
2089 s->enlat = le32toh(s->enlat); in nvme_power_state_swapbytes()
2090 s->exlat = le32toh(s->exlat); in nvme_power_state_swapbytes()
2091 s->idlp = le16toh(s->idlp); in nvme_power_state_swapbytes()
2092 s->actp = le16toh(s->actp); in nvme_power_state_swapbytes()
2102 s->vid = le16toh(s->vid); in nvme_controller_data_swapbytes()
2103 s->ssvid = le16toh(s->ssvid); in nvme_controller_data_swapbytes()
2104 s->ctrlr_id = le16toh(s->ctrlr_id); in nvme_controller_data_swapbytes()
2105 s->ver = le32toh(s->ver); in nvme_controller_data_swapbytes()
2106 s->rtd3r = le32toh(s->rtd3r); in nvme_controller_data_swapbytes()
2107 s->rtd3e = le32toh(s->rtd3e); in nvme_controller_data_swapbytes()
2108 s->oaes = le32toh(s->oaes); in nvme_controller_data_swapbytes()
2109 s->ctratt = le32toh(s->ctratt); in nvme_controller_data_swapbytes()
2110 s->rrls = le16toh(s->rrls); in nvme_controller_data_swapbytes()
2111 s->crdt1 = le16toh(s->crdt1); in nvme_controller_data_swapbytes()
2112 s->crdt2 = le16toh(s->crdt2); in nvme_controller_data_swapbytes()
2113 s->crdt3 = le16toh(s->crdt3); in nvme_controller_data_swapbytes()
2114 s->oacs = le16toh(s->oacs); in nvme_controller_data_swapbytes()
2115 s->wctemp = le16toh(s->wctemp); in nvme_controller_data_swapbytes()
2116 s->cctemp = le16toh(s->cctemp); in nvme_controller_data_swapbytes()
2117 s->mtfa = le16toh(s->mtfa); in nvme_controller_data_swapbytes()
2118 s->hmpre = le32toh(s->hmpre); in nvme_controller_data_swapbytes()
2119 s->hmmin = le32toh(s->hmmin); in nvme_controller_data_swapbytes()
2120 s->rpmbs = le32toh(s->rpmbs); in nvme_controller_data_swapbytes()
2121 s->edstt = le16toh(s->edstt); in nvme_controller_data_swapbytes()
2122 s->kas = le16toh(s->kas); in nvme_controller_data_swapbytes()
2123 s->hctma = le16toh(s->hctma); in nvme_controller_data_swapbytes()
2124 s->mntmt = le16toh(s->mntmt); in nvme_controller_data_swapbytes()
2125 s->mxtmt = le16toh(s->mxtmt); in nvme_controller_data_swapbytes()
2126 s->sanicap = le32toh(s->sanicap); in nvme_controller_data_swapbytes()
2127 s->hmminds = le32toh(s->hmminds); in nvme_controller_data_swapbytes()
2128 s->hmmaxd = le16toh(s->hmmaxd); in nvme_controller_data_swapbytes()
2129 s->nsetidmax = le16toh(s->nsetidmax); in nvme_controller_data_swapbytes()
2130 s->endgidmax = le16toh(s->endgidmax); in nvme_controller_data_swapbytes()
2131 s->anagrpmax = le32toh(s->anagrpmax); in nvme_controller_data_swapbytes()
2132 s->nanagrpid = le32toh(s->nanagrpid); in nvme_controller_data_swapbytes()
2133 s->pels = le32toh(s->pels); in nvme_controller_data_swapbytes()
2134 s->maxcmd = le16toh(s->maxcmd); in nvme_controller_data_swapbytes()
2135 s->nn = le32toh(s->nn); in nvme_controller_data_swapbytes()
2136 s->oncs = le16toh(s->oncs); in nvme_controller_data_swapbytes()
2137 s->fuses = le16toh(s->fuses); in nvme_controller_data_swapbytes()
2138 s->awun = le16toh(s->awun); in nvme_controller_data_swapbytes()
2139 s->awupf = le16toh(s->awupf); in nvme_controller_data_swapbytes()
2140 s->acwu = le16toh(s->acwu); in nvme_controller_data_swapbytes()
2141 s->sgls = le32toh(s->sgls); in nvme_controller_data_swapbytes()
2142 s->mnan = le32toh(s->mnan); in nvme_controller_data_swapbytes()
2143 s->ioccsz = le32toh(s->ioccsz); in nvme_controller_data_swapbytes()
2144 s->iorcsz = le32toh(s->iorcsz); in nvme_controller_data_swapbytes()
2145 s->icdoff = le16toh(s->icdoff); in nvme_controller_data_swapbytes()
2146 s->ofcs = le16toh(s->ofcs); in nvme_controller_data_swapbytes()
2148 nvme_power_state_swapbytes(&s->power_state[i]); in nvme_controller_data_swapbytes()
2156 s->nsze = le64toh(s->nsze); in nvme_namespace_data_swapbytes()
2157 s->ncap = le64toh(s->ncap); in nvme_namespace_data_swapbytes()
2158 s->nuse = le64toh(s->nuse); in nvme_namespace_data_swapbytes()
2159 s->nawun = le16toh(s->nawun); in nvme_namespace_data_swapbytes()
2160 s->nawupf = le16toh(s->nawupf); in nvme_namespace_data_swapbytes()
2161 s->nacwu = le16toh(s->nacwu); in nvme_namespace_data_swapbytes()
2162 s->nabsn = le16toh(s->nabsn); in nvme_namespace_data_swapbytes()
2163 s->nabo = le16toh(s->nabo); in nvme_namespace_data_swapbytes()
2164 s->nabspf = le16toh(s->nabspf); in nvme_namespace_data_swapbytes()
2165 s->noiob = le16toh(s->noiob); in nvme_namespace_data_swapbytes()
2166 s->npwg = le16toh(s->npwg); in nvme_namespace_data_swapbytes()
2167 s->npwa = le16toh(s->npwa); in nvme_namespace_data_swapbytes()
2168 s->npdg = le16toh(s->npdg); in nvme_namespace_data_swapbytes()
2169 s->npda = le16toh(s->npda); in nvme_namespace_data_swapbytes()
2170 s->nows = le16toh(s->nows); in nvme_namespace_data_swapbytes()
2171 s->anagrpid = le32toh(s->anagrpid); in nvme_namespace_data_swapbytes()
2172 s->nvmsetid = le16toh(s->nvmsetid); in nvme_namespace_data_swapbytes()
2173 s->endgid = le16toh(s->endgid); in nvme_namespace_data_swapbytes()
2174 for (unsigned i = 0; i < nitems(s->lbaf); i++) in nvme_namespace_data_swapbytes()
2175 s->lbaf[i] = le32toh(s->lbaf[i]); in nvme_namespace_data_swapbytes()
2185 s->error_count = le64toh(s->error_count); in nvme_error_information_entry_swapbytes()
2186 s->sqid = le16toh(s->sqid); in nvme_error_information_entry_swapbytes()
2187 s->cid = le16toh(s->cid); in nvme_error_information_entry_swapbytes()
2188 s->status = le16toh(s->status); in nvme_error_information_entry_swapbytes()
2189 s->error_location = le16toh(s->error_location); in nvme_error_information_entry_swapbytes()
2190 s->lba = le64toh(s->lba); in nvme_error_information_entry_swapbytes()
2191 s->nsid = le32toh(s->nsid); in nvme_error_information_entry_swapbytes()
2192 s->csi = le64toh(s->csi); in nvme_error_information_entry_swapbytes()
2193 s->ttsi = le16toh(s->ttsi); in nvme_error_information_entry_swapbytes()
2207 tmp[i] = tmp[15-i]; in nvme_le128toh()
2208 tmp[15-i] = b; in nvme_le128toh()
2220 s->temperature = le16toh(s->temperature); in nvme_health_information_page_swapbytes()
2221 nvme_le128toh((void *)s->data_units_read); in nvme_health_information_page_swapbytes()
2222 nvme_le128toh((void *)s->data_units_written); in nvme_health_information_page_swapbytes()
2223 nvme_le128toh((void *)s->host_read_commands); in nvme_health_information_page_swapbytes()
2224 nvme_le128toh((void *)s->host_write_commands); in nvme_health_information_page_swapbytes()
2225 nvme_le128toh((void *)s->controller_busy_time); in nvme_health_information_page_swapbytes()
2226 nvme_le128toh((void *)s->power_cycles); in nvme_health_information_page_swapbytes()
2227 nvme_le128toh((void *)s->power_on_hours); in nvme_health_information_page_swapbytes()
2228 nvme_le128toh((void *)s->unsafe_shutdowns); in nvme_health_information_page_swapbytes()
2229 nvme_le128toh((void *)s->media_errors); in nvme_health_information_page_swapbytes()
2230 nvme_le128toh((void *)s->num_error_info_log_entries); in nvme_health_information_page_swapbytes()
2231 s->warning_temp_time = le32toh(s->warning_temp_time); in nvme_health_information_page_swapbytes()
2232 s->error_temp_time = le32toh(s->error_temp_time); in nvme_health_information_page_swapbytes()
2234 s->temp_sensor[i] = le16toh(s->temp_sensor[i]); in nvme_health_information_page_swapbytes()
2235 s->tmt1tc = le32toh(s->tmt1tc); in nvme_health_information_page_swapbytes()
2236 s->tmt2tc = le32toh(s->tmt2tc); in nvme_health_information_page_swapbytes()
2237 s->ttftmt1 = le32toh(s->ttftmt1); in nvme_health_information_page_swapbytes()
2238 s->ttftmt2 = le32toh(s->ttftmt2); in nvme_health_information_page_swapbytes()
2249 s->ns[i] = le32toh(s->ns[i]); in nvme_ns_list_swapbytes()
2261 s->acs[i] = le32toh(s->acs[i]); in nvme_command_effects_page_swapbytes()
2263 s->iocs[i] = le32toh(s->iocs[i]); in nvme_command_effects_page_swapbytes()
2272 s->log_page_count = le64toh(s->log_page_count); in nvme_res_notification_page_swapbytes()
2273 s->nsid = le32toh(s->nsid); in nvme_res_notification_page_swapbytes()
2282 s->sprog = le16toh(s->sprog); in nvme_sanitize_status_page_swapbytes()
2283 s->sstat = le16toh(s->sstat); in nvme_sanitize_status_page_swapbytes()
2284 s->scdw10 = le32toh(s->scdw10); in nvme_sanitize_status_page_swapbytes()
2285 s->etfo = le32toh(s->etfo); in nvme_sanitize_status_page_swapbytes()
2286 s->etfbe = le32toh(s->etfbe); in nvme_sanitize_status_page_swapbytes()
2287 s->etfce = le32toh(s->etfce); in nvme_sanitize_status_page_swapbytes()
2288 s->etfownd = le32toh(s->etfownd); in nvme_sanitize_status_page_swapbytes()
2289 s->etfbewnd = le32toh(s->etfbewnd); in nvme_sanitize_status_page_swapbytes()
2290 s->etfcewnd = le32toh(s->etfcewnd); in nvme_sanitize_status_page_swapbytes()
2301 s->gen = le32toh(s->gen); in nvme_resv_status_swapbytes()
2302 n = (s->regctl[1] << 8) | s->regctl[0]; in nvme_resv_status_swapbytes()
2303 n = MIN(n, (size - sizeof(s)) / sizeof(s->ctrlr[0])); in nvme_resv_status_swapbytes()
2305 s->ctrlr[i].ctrlr_id = le16toh(s->ctrlr[i].ctrlr_id); in nvme_resv_status_swapbytes()
2306 s->ctrlr[i].hostid = le64toh(s->ctrlr[i].hostid); in nvme_resv_status_swapbytes()
2307 s->ctrlr[i].rkey = le64toh(s->ctrlr[i].rkey); in nvme_resv_status_swapbytes()
2319 s->gen = le32toh(s->gen); in nvme_resv_status_ext_swapbytes()
2320 n = (s->regctl[1] << 8) | s->regctl[0]; in nvme_resv_status_ext_swapbytes()
2321 n = MIN(n, (size - sizeof(s)) / sizeof(s->ctrlr[0])); in nvme_resv_status_ext_swapbytes()
2323 s->ctrlr[i].ctrlr_id = le16toh(s->ctrlr[i].ctrlr_id); in nvme_resv_status_ext_swapbytes()
2324 s->ctrlr[i].rkey = le64toh(s->ctrlr[i].rkey); in nvme_resv_status_ext_swapbytes()
2325 nvme_le128toh((void *)s->ctrlr[i].hostid); in nvme_resv_status_ext_swapbytes()
2339 s->result[r].poh = le64toh(s->result[r].poh); in nvme_device_self_test_swapbytes()
2340 s->result[r].nsid = le32toh(s->result[r].nsid); in nvme_device_self_test_swapbytes()
2341 /* Unaligned 64-bit loads fail on some architectures */ in nvme_device_self_test_swapbytes()
2342 tmp = s->result[r].failing_lba; in nvme_device_self_test_swapbytes()
2345 tmp[i] = tmp[7-i]; in nvme_device_self_test_swapbytes()
2346 tmp[7-i] = b; in nvme_device_self_test_swapbytes()
2356 s->portid = le16toh(s->portid); in nvme_discovery_log_entry_swapbytes()
2357 s->cntlid = le16toh(s->cntlid); in nvme_discovery_log_entry_swapbytes()
2358 s->aqsz = le16toh(s->aqsz); in nvme_discovery_log_entry_swapbytes()
2359 if (s->trtype == 0x01 /* RDMA */) { in nvme_discovery_log_entry_swapbytes()
2360 s->tsas.rdma.rdma_pkey = le16toh(s->tsas.rdma.rdma_pkey); in nvme_discovery_log_entry_swapbytes()
2369 s->genctr = le64toh(s->genctr); in nvme_discovery_log_swapbytes()
2370 s->numrec = le64toh(s->numrec); in nvme_discovery_log_swapbytes()
2371 s->recfmt = le16toh(s->recfmt); in nvme_discovery_log_swapbytes()