diff mbox series

[PULL,02/23] hw/nvme: add identify namespace flbas/mc enums

Message ID 20210629184743.230173-3-its@irrelevant.dk
State New
Headers show
Series [PULL,01/23] hw/nvme: fix style | expand

Commit Message

Klaus Jensen June 29, 2021, 6:47 p.m. UTC
From: Gollu Appalanaidu <anaidu.gollu@samsung.com>

Add enums for the Identify Namespace FLBAS and MC fields.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[k.jensen: squashed separate flbas/mc commits into one]
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
 include/block/nvme.h | 9 +++++++++
 hw/nvme/ns.c         | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/include/block/nvme.h b/include/block/nvme.h
index 0ff9ce17a99e..333affdb8534 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -1341,6 +1341,15 @@  enum NvmeIdNsDps {
     NVME_ID_NS_DPS_FIRST_EIGHT = 8,
 };
 
+enum NvmeIdNsFlbas {
+    NVME_ID_NS_FLBAS_EXTENDED = 1 << 4,
+};
+
+enum NvmeIdNsMc {
+    NVME_ID_NS_MC_EXTENDED = 1 << 0,
+    NVME_ID_NS_MC_SEPARATE = 1 << 1,
+};
+
 #define NVME_ID_NS_DPS_TYPE(dps) (dps & NVME_ID_NS_DPS_TYPE_MASK)
 
 typedef struct NvmeDifTuple {
diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c
index 992e5a13f538..8066e311d1a2 100644
--- a/hw/nvme/ns.c
+++ b/hw/nvme/ns.c
@@ -82,10 +82,10 @@  static int nvme_ns_init(NvmeNamespace *ns, Error **errp)
     ms = ns->params.ms;
 
     if (ns->params.ms) {
-        id_ns->mc = 0x3;
+        id_ns->mc = NVME_ID_NS_MC_EXTENDED | NVME_ID_NS_MC_SEPARATE;
 
         if (ns->params.mset) {
-            id_ns->flbas |= 0x10;
+            id_ns->flbas |= NVME_ID_NS_FLBAS_EXTENDED;
         }
 
         id_ns->dpc = 0x1f;