1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * Copyright 2024 Oxide Computer Company 14 */ 15 16 #ifndef _NVME_UNIT_H 17 #define _NVME_UNIT_H 18 19 /* 20 * Common definitions for our unit tests. 21 */ 22 23 #include <nvme_common.h> 24 #include <stdbool.h> 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 typedef struct { 31 const char *nu_desc; 32 const nvme_field_info_t *nu_fields; 33 uint32_t nu_index; 34 const nvme_valid_ctrl_data_t *nu_data; 35 uint64_t nu_value; 36 nvme_field_error_t nu_ret; 37 } nvme_unit_field_test_t; 38 39 extern bool nvme_unit_field_test(const nvme_unit_field_test_t *, size_t); 40 41 /* 42 * Controllers defined in controllers.c for unit tests. See comments there for 43 * what each one does and doesn't do. 44 */ 45 extern const nvme_valid_ctrl_data_t nvme_ctrl_base_1v0; 46 extern const nvme_valid_ctrl_data_t nvme_ctrl_health_1v0; 47 extern const nvme_valid_ctrl_data_t nvme_ctrl_base_1v1; 48 extern const nvme_valid_ctrl_data_t nvme_ctrl_base_1v2; 49 extern const nvme_valid_ctrl_data_t nvme_ctrl_base_2v0; 50 extern const nvme_valid_ctrl_data_t nvme_ctrl_ns_1v2; 51 extern const nvme_valid_ctrl_data_t nvme_ctrl_ns_1v3; 52 extern const nvme_valid_ctrl_data_t nvme_ctrl_ns_1v4; 53 extern const nvme_valid_ctrl_data_t nvme_ctrl_ns_2v0; 54 extern const nvme_valid_ctrl_data_t nvme_ctrl_nolpa_1v4; 55 extern const nvme_valid_ctrl_data_t nvme_ctrl_nons_1v3; 56 extern const nvme_valid_ctrl_data_t nvme_ctrl_nons_1v4; 57 extern const nvme_valid_ctrl_data_t nvme_ctrl_nons_2v0; 58 extern const nvme_valid_ctrl_data_t nvme_ctrl_nocmds_1v0; 59 extern const nvme_valid_ctrl_data_t nvme_ctrl_nogran_1v3; 60 extern const nvme_valid_ctrl_data_t nvme_ctrl_8kgran_1v3; 61 62 #ifdef __cplusplus 63 } 64 #endif 65 66 #endif /* _NVME_UNIT_H */ 67