From b798bbb23e737448df52c9b02a63ac0d6540c35a Mon Sep 17 00:00:00 2001 From: krw Date: Mon, 11 Dec 2023 14:27:09 +0000 Subject: [PATCH] Fix the shift of status bits 2:0 to 11:9 from <<8 to <<9. Fix the mask of shifted 8 bit field from 0x7f to 0xff. Allows proper decoding of status fields SCT and SC. From mlelstv@netbsd via NetBSD. ok miod@ --- sys/dev/ic/nvmereg.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/dev/ic/nvmereg.h b/sys/dev/ic/nvmereg.h index 1c731154452..4296b543930 100644 --- a/sys/dev/ic/nvmereg.h +++ b/sys/dev/ic/nvmereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nvmereg.h,v 1.11 2016/11/15 12:01:11 mpi Exp $ */ +/* $OpenBSD: nvmereg.h,v 1.12 2023/12/11 14:27:09 krw Exp $ */ /* * Copyright (c) 2014 David Gwynne @@ -204,12 +204,12 @@ struct nvme_cqe { u_int16_t flags; #define NVME_CQE_DNR (1 << 15) #define NVME_CQE_M (1 << 14) -#define NVME_CQE_SCT(_f) ((_f) & (0x07 << 8)) -#define NVME_CQE_SCT_GENERIC (0x00 << 8) -#define NVME_CQE_SCT_COMMAND (0x01 << 8) -#define NVME_CQE_SCT_MEDIAERR (0x02 << 8) -#define NVME_CQE_SCT_VENDOR (0x07 << 8) -#define NVME_CQE_SC(_f) ((_f) & (0x7f << 1)) +#define NVME_CQE_SCT(_f) ((_f) & (0x07 << 9)) +#define NVME_CQE_SCT_GENERIC (0x00 << 9) +#define NVME_CQE_SCT_COMMAND (0x01 << 9) +#define NVME_CQE_SCT_MEDIAERR (0x02 << 9) +#define NVME_CQE_SCT_VENDOR (0x07 << 9) +#define NVME_CQE_SC(_f) ((_f) & (0xff << 1)) #define NVME_CQE_SC_SUCCESS (0x00 << 1) #define NVME_CQE_SC_INVALID_OPCODE (0x01 << 1) #define NVME_CQE_SC_INVALID_FIELD (0x02 << 1) -- 2.20.1