hw/block/nvme: use constants in identify
Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Message-Id: <20200609190333.59390-6-its@irrelevant.dk> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
1065abfbf1
commit
3e829fd438
@ -692,7 +692,7 @@ static uint16_t nvme_identify_ns(NvmeCtrl *n, NvmeIdentify *c)
|
|||||||
|
|
||||||
static uint16_t nvme_identify_nslist(NvmeCtrl *n, NvmeIdentify *c)
|
static uint16_t nvme_identify_nslist(NvmeCtrl *n, NvmeIdentify *c)
|
||||||
{
|
{
|
||||||
static const int data_len = 4 * KiB;
|
static const int data_len = NVME_IDENTIFY_DATA_SIZE;
|
||||||
uint32_t min_nsid = le32_to_cpu(c->nsid);
|
uint32_t min_nsid = le32_to_cpu(c->nsid);
|
||||||
uint64_t prp1 = le64_to_cpu(c->prp1);
|
uint64_t prp1 = le64_to_cpu(c->prp1);
|
||||||
uint64_t prp2 = le64_to_cpu(c->prp2);
|
uint64_t prp2 = le64_to_cpu(c->prp2);
|
||||||
@ -722,11 +722,11 @@ static uint16_t nvme_identify(NvmeCtrl *n, NvmeCmd *cmd)
|
|||||||
NvmeIdentify *c = (NvmeIdentify *)cmd;
|
NvmeIdentify *c = (NvmeIdentify *)cmd;
|
||||||
|
|
||||||
switch (le32_to_cpu(c->cns)) {
|
switch (le32_to_cpu(c->cns)) {
|
||||||
case 0x00:
|
case NVME_ID_CNS_NS:
|
||||||
return nvme_identify_ns(n, c);
|
return nvme_identify_ns(n, c);
|
||||||
case 0x01:
|
case NVME_ID_CNS_CTRL:
|
||||||
return nvme_identify_ctrl(n, c);
|
return nvme_identify_ctrl(n, c);
|
||||||
case 0x02:
|
case NVME_ID_CNS_NS_ACTIVE_LIST:
|
||||||
return nvme_identify_nslist(n, c);
|
return nvme_identify_nslist(n, c);
|
||||||
default:
|
default:
|
||||||
trace_pci_nvme_err_invalid_identify_cns(le32_to_cpu(c->cns));
|
trace_pci_nvme_err_invalid_identify_cns(le32_to_cpu(c->cns));
|
||||||
|
@ -705,6 +705,14 @@ typedef struct NvmePSD {
|
|||||||
uint8_t resv[16];
|
uint8_t resv[16];
|
||||||
} NvmePSD;
|
} NvmePSD;
|
||||||
|
|
||||||
|
#define NVME_IDENTIFY_DATA_SIZE 4096
|
||||||
|
|
||||||
|
enum {
|
||||||
|
NVME_ID_CNS_NS = 0x0,
|
||||||
|
NVME_ID_CNS_CTRL = 0x1,
|
||||||
|
NVME_ID_CNS_NS_ACTIVE_LIST = 0x2,
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct NvmeIdCtrl {
|
typedef struct NvmeIdCtrl {
|
||||||
uint16_t vid;
|
uint16_t vid;
|
||||||
uint16_t ssvid;
|
uint16_t ssvid;
|
||||||
|
Loading…
Reference in New Issue
Block a user