• Opcode is 0x06.
  • The base address of the output (a single page) should be put in the DWORDs 6 and 7 of the command.
  • The low byte of command DWORD 10 indicates what is to be identified: 0 - a namespace, 1 - the controller, 2 - the namespace list.
  • If identifying a namespace, set DWORD 1 to the namespace ID.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
enum {
NVME_ID_CNS_NS = 0x00,
NVME_ID_CNS_CTRL = 0x01,
NVME_ID_CNS_NS_ACTIVE_LIST = 0x02,
NVME_ID_CNS_NS_DESC_LIST = 0x03,
NVME_ID_CNS_CS_NS = 0x05,
NVME_ID_CNS_CS_CTRL = 0x06,
NVME_ID_CNS_NS_CS_INDEP = 0x08,
NVME_ID_CNS_NS_PRESENT_LIST = 0x10,
NVME_ID_CNS_NS_PRESENT = 0x11,
NVME_ID_CNS_CTRL_NS_LIST = 0x12,
NVME_ID_CNS_CTRL_LIST = 0x13,
NVME_ID_CNS_SCNDRY_CTRL_LIST = 0x15,
NVME_ID_CNS_NS_GRANULARITY = 0x16,
NVME_ID_CNS_UUID_LIST = 0x17,
};

CDW1.NSID的含义:

总结:

  1. 想要某个controller或者namespace的identity,需要在command中指定controller id或者namespace id
  2. controller将结果以DMA的形式放到DWORDs 6 and 7指定的地址中

参考资料:

  1. NVMe 1.3 spec
  2. https://wiki.osdev.org/NVMe