aboutsummaryrefslogtreecommitdiff
path: root/hw/block/nvme.h
diff options
context:
space:
mode:
Diffstat (limited to 'hw/block/nvme.h')
-rw-r--r--hw/block/nvme.h39
1 files changed, 1 insertions, 38 deletions
diff --git a/hw/block/nvme.h b/hw/block/nvme.h
index 8d1806c..5d05ec3 100644
--- a/hw/block/nvme.h
+++ b/hw/block/nvme.h
@@ -6,17 +6,9 @@
#include "nvme-subsys.h"
#include "nvme-ns.h"
-#define NVME_MAX_NAMESPACES 256
-
#define NVME_DEFAULT_ZONE_SIZE (128 * MiB)
#define NVME_DEFAULT_MAX_ZA_SIZE (128 * KiB)
-/*
- * Subsystem namespace list for allocated namespaces should be larger than
- * attached namespace list in a controller.
- */
-QEMU_BUILD_BUG_ON(NVME_MAX_NAMESPACES > NVME_SUBSYS_MAX_NAMESPACES);
-
typedef struct NvmeParams {
char *serial;
uint32_t num_queues; /* deprecated since 5.1 */
@@ -234,35 +226,6 @@ static inline NvmeNamespace *nvme_ns(NvmeCtrl *n, uint32_t nsid)
return n->namespaces[nsid - 1];
}
-static inline bool nvme_ns_is_attached(NvmeCtrl *n, NvmeNamespace *ns)
-{
- int nsid;
-
- for (nsid = 1; nsid <= n->num_namespaces; nsid++) {
- if (nvme_ns(n, nsid) == ns) {
- return true;
- }
- }
-
- return false;
-}
-
-static inline void nvme_ns_attach(NvmeCtrl *n, NvmeNamespace *ns)
-{
- uint32_t nsid = nvme_nsid(ns);
- assert(nsid && nsid <= NVME_MAX_NAMESPACES);
-
- n->namespaces[nsid - 1] = ns;
-}
-
-static inline void nvme_ns_detach(NvmeCtrl *n, NvmeNamespace *ns)
-{
- uint32_t nsid = nvme_nsid(ns);
- assert(nsid && nsid <= NVME_MAX_NAMESPACES);
-
- n->namespaces[nsid - 1] = NULL;
-}
-
static inline NvmeCQueue *nvme_cq(NvmeRequest *req)
{
NvmeSQueue *sq = req->sq;
@@ -291,7 +254,7 @@ typedef enum NvmeTxDirection {
NVME_TX_DIRECTION_FROM_DEVICE = 1,
} NvmeTxDirection;
-int nvme_register_namespace(NvmeCtrl *n, NvmeNamespace *ns, Error **errp);
+void nvme_attach_ns(NvmeCtrl *n, NvmeNamespace *ns);
uint16_t nvme_bounce_data(NvmeCtrl *n, uint8_t *ptr, uint32_t len,
NvmeTxDirection dir, NvmeRequest *req);
uint16_t nvme_bounce_mdata(NvmeCtrl *n, uint8_t *ptr, uint32_t len,