Re: git: 60159a98a837 - main - nvme: Move opcode and status code tables from base CAM to nvme_util.c

From: Charlie Li <vishwin_at_freebsd.org>
Date: Thu, 05 Jun 2025 23:29:59 UTC
John Baldwin wrote:
> The branch main has been updated by jhb:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=60159a98a83747e539eb14c6a0eaaa1875e2cacc
> 
> commit 60159a98a83747e539eb14c6a0eaaa1875e2cacc
> Author:     John Baldwin <jhb@FreeBSD.org>
> AuthorDate: 2025-06-05 21:03:01 +0000
> Commit:     John Baldwin <jhb@FreeBSD.org>
> CommitDate: 2025-06-05 21:03:01 +0000
> 
>      nvme: Move opcode and status code tables from base CAM to nvme_util.c
>      
>      This makes it possible to share these tables with the nvme(4) driver
>      in custom kernels that do not include any CAM support, only nvd(4).
>      
>      Reviewed by:    imp
>      Sponsored by:   Chelsio Communications
>      Differential Revision:  https://reviews.freebsd.org/D50685
> ---
>   sys/cam/nvme/nvme_all.c  | 224 ---------------------------------------------
>   sys/cam/nvme/nvme_all.h  |   2 -
>   sys/conf/files           |   2 +-
>   sys/dev/nvme/nvme.h      |   4 +
>   sys/dev/nvme/nvme_util.c | 231 +++++++++++++++++++++++++++++++++++++++++++++++
>   5 files changed, 236 insertions(+), 227 deletions(-)
> 
> diff --git a/sys/cam/nvme/nvme_all.c b/sys/cam/nvme/nvme_all.c
> index 4145aa16ed49..2ab8ae5340c6 100644
> --- a/sys/cam/nvme/nvme_all.c
> +++ b/sys/cam/nvme/nvme_all.c
> @@ -292,24 +130,6 @@ nvme_command_string(struct ccb_nvmeio *nvmeio, char *cmd_string, size_t len)
>   	return(sbuf_data(&sb));
>   }
>   
> -void
> -nvme_opcode_sbuf(bool admin, uint8_t opc, struct sbuf *sb)
> -{
> -	const char *s, *type;
> -
> -	if (admin) {
> -		s = admin_opcode[opc];
> -		type = "ADMIN";
> -	} else {
> -		s = nvm_opcode[opc];
> -		type = "NVM";
> -	}
> -	if (s == NULL)
> -		sbuf_printf(sb, "%s:0x%02x", type, opc);
> -	else
> -		sbuf_printf(sb, "%s", s);
> -}
> -
> diff --git a/sys/cam/nvme/nvme_all.h b/sys/cam/nvme/nvme_all.h
> index 17c068b825be..2bc1953e79be 100644
> --- a/sys/cam/nvme/nvme_all.h
> +++ b/sys/cam/nvme/nvme_all.h
> @@ -42,11 +42,9 @@ struct sbuf;
>   void	nvme_print_ident(const struct nvme_controller_data *, const struct nvme_namespace_data *, struct sbuf *);
>   void	nvme_print_ident_short(const struct nvme_controller_data *,
>       const struct nvme_namespace_data *, struct sbuf *);
> -void nvme_opcode_sbuf(bool admin, uint8_t opc, struct sbuf *sb);
>   void nvme_cmd_sbuf(const struct nvme_command *, struct sbuf *sb);
>   int nvme_command_sbuf(struct ccb_nvmeio *nvmeio, struct sbuf *sb);
>   const char *nvme_command_string(struct ccb_nvmeio *nvmeio, char *, size_t);
> -void nvme_cpl_sbuf(const struct nvme_completion *cpl, struct sbuf *sbuf);
>   int nvme_status_sbuf(struct ccb_nvmeio *nvmeio, struct sbuf *sb);
>   const void *nvme_get_identify_cntrl(struct cam_periph *);
>   const void *nvme_get_identify_ns(struct cam_periph *);
> 
> 
<sys/dev/nvme.h> doesn't appear to be making it in nvme_all.h as the 
build complains about missing nvme_opcode_sbuf() in nvme_all.c.

-- 
Charlie Li
...nope, still don't have an exit line.