xref: /freebsd/sys/cam/ctl/ctl_nvme_cmd_table.c (revision 5515e8874a8d85a8d961fca64c494dfc1bea4bd0)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2023 Chelsio Communications, Inc.
5  */
6 
7 #include <dev/nvme/nvme.h>
8 
9 #include <cam/ctl/ctl.h>
10 #include <cam/ctl/ctl_ha.h>
11 #include <cam/ctl/ctl_io.h>
12 #include <cam/ctl/ctl_ioctl.h>
13 #include <cam/ctl/ctl_private.h>
14 
15 /* Administrative Command Set (CTL_IO_NVME_ADMIN). */
16 const struct ctl_nvme_cmd_entry nvme_admin_cmd_table[256] =
17 {
18 	[NVME_OPC_IDENTIFY] = { ctl_nvme_identify, CTL_FLAG_DATA_IN |
19 				CTL_CMD_FLAG_OK_ON_NO_LUN },
20 };
21 
22 /* NVM Command Set (CTL_IO_NVME). */
23 const struct ctl_nvme_cmd_entry nvme_nvm_cmd_table[256] =
24 {
25 	[NVME_OPC_FLUSH] = { ctl_nvme_flush, CTL_FLAG_DATA_NONE },
26 	[NVME_OPC_WRITE] = { ctl_nvme_read_write, CTL_FLAG_DATA_OUT },
27 	[NVME_OPC_READ] = { ctl_nvme_read_write, CTL_FLAG_DATA_IN },
28 	[NVME_OPC_WRITE_UNCORRECTABLE] = { ctl_nvme_write_uncorrectable,
29 					   CTL_FLAG_DATA_NONE },
30 	[NVME_OPC_COMPARE] = { ctl_nvme_compare, CTL_FLAG_DATA_OUT },
31 	[NVME_OPC_WRITE_ZEROES] = { ctl_nvme_write_zeroes, CTL_FLAG_DATA_NONE },
32 	[NVME_OPC_DATASET_MANAGEMENT] = { ctl_nvme_dataset_management,
33 					  CTL_FLAG_DATA_OUT },
34 	[NVME_OPC_VERIFY] = { ctl_nvme_verify, CTL_FLAG_DATA_NONE },
35 };
36