From nobody Tue Aug 1 22:26:10 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RFqTQ0sm8z4pwk6; Tue, 1 Aug 2023 22:26:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RFqSy2HFHz3hlq; Tue, 1 Aug 2023 22:26:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690928770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OLPTplebUJJuL+4W5XJUjkiRIXoYQ/3gbTpemUuRd8M=; b=VuGjFohkPfMH2fm7SxO3CdR3aGhDLYIiwKM0gvtvRdh7NCvwpaA+55HsQlK/aQwMFWdLti NrlHVX5JAf6syebHb3NkecXGlmuGvmmI31MG49/YE6XX9gq/AcSzOPEKIZ9oieh1OO8uuK 9VJzsQI8HaMG8F1tHpr8owBLCNby8yaHtAKMbY/q+Li9716NsGn8PJ5Fmv2oHIluyolyrH /cLDo4Q+DrNCzt7R6UvZEdrHSIbTLV3q3G8++lJu2k8CaQ5ssETXlEluKm8NJgVzV1bGd7 zzKD6O4T9rvrtZDLUp3XLladTzY43mV31nQl2hcPzJa2bXeXL2udSJTVmpoG8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690928770; a=rsa-sha256; cv=none; b=cZajWQVWo+1Hn5KwugLJShryNLKBCQMlnuKeekHBMNRKxVQs1zUVgZU6odoIBOg/U6it/a hhea9qWIoHoYvRtpF1n8O8PG0kiL+aK2U53l/CJ+aSPX2Q2W+iPA+1otT22GbW9RR4Ns7W EoCuET7LOLlx7AdqGDUja+DxTFDJ9et5wYzt/fv0TuVprEK3K71pWLvo8KDhp0Il/Qnijm MJxb7F1Wz47eaRvPw7zamJGnKqnejhy/W6aZEqpGHKm75byq/13a6PeI9l0v+InPZNUVwr H5sBPdhMRjy96rCUcxNHUlzJtkI7ITTGhc0zqNz9fYPd5Z8HdBo8x1aJQoHt4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690928770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OLPTplebUJJuL+4W5XJUjkiRIXoYQ/3gbTpemUuRd8M=; b=aUX2TWKvAnHPiWUBt25UfoY1uYANQDrQK0sUdKev/bVhscvAYi0vz0W4K26leBr8Nc3ZnV Hi1yXSe4oRsXNldd6ZQ6mTytN6s28WLPx4d67ycbZdPfhQzRc7ssXRohASQ6vUDLa39/d0 r83yo2HTjLs0aHGXkBkcdnnYPd2SCXCiSUD+A5AsBexBX+Sjzz1LOY1oWzzxqZQgxzbmuJ 6Xkz6HbjmNMy5/eaqwcmDgnNfS7rZ2zKgPU16vI5r6ow/WtUE8LjG2t7uW/aK+UWVkhiiB VgSgePIVX4QmZfatt1je4QpCZAkcye31kApUeOs8s9TAZ48okroSCAssB8hOug== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RFqSy18rbzvd7; Tue, 1 Aug 2023 22:26:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 371MQAA9045604; Tue, 1 Aug 2023 22:26:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 371MQAKg045603; Tue, 1 Aug 2023 22:26:10 GMT (envelope-from git) Date: Tue, 1 Aug 2023 22:26:10 GMT Message-Id: <202308012226.371MQAKg045603@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 7eb538974c49 - main - cam mmc_xpt/nvme_xpt: Add _sbuf variants of {an,de}nounce xport and proto ops List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7eb538974c49857a590c79c91f1e4f1c107b5f7d Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7eb538974c49857a590c79c91f1e4f1c107b5f7d commit 7eb538974c49857a590c79c91f1e4f1c107b5f7d Author: John Baldwin AuthorDate: 2023-08-01 22:23:25 +0000 Commit: John Baldwin CommitDate: 2023-08-01 22:23:25 +0000 cam mmc_xpt/nvme_xpt: Add _sbuf variants of {an,de}nounce xport and proto ops Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D41261 --- sys/cam/mmc/mmc_xpt.c | 42 ++++++++++++++++++++++++++++++++++++++++++ sys/cam/nvme/nvme_xpt.c | 42 +++++++++++++++++++++++++++++++++++------- 2 files changed, 77 insertions(+), 7 deletions(-) diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c index 8fee7b4cad58..0930717b0a2a 100644 --- a/sys/cam/mmc/mmc_xpt.c +++ b/sys/cam/mmc/mmc_xpt.c @@ -74,6 +74,8 @@ static void mmc_dev_async(uint32_t async_code, struct cam_eb *bus, static void mmc_action(union ccb *start_ccb); static void mmc_dev_advinfo(union ccb *start_ccb); static void mmc_announce_periph(struct cam_periph *periph); +static void mmc_announce_periph_sbuf(struct cam_periph *periph, + struct sbuf *sb); static void mmc_scan_lun(struct cam_periph *periph, struct cam_path *path, cam_flags flags, union ccb *ccb); @@ -84,7 +86,9 @@ static void mmcprobe_cleanup(struct cam_periph *periph); static void mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb); static void mmc_proto_announce(struct cam_ed *device); +static void mmc_proto_announce_sbuf(struct cam_ed *device, struct sbuf *sb); static void mmc_proto_denounce(struct cam_ed *device); +static void mmc_proto_denounce_sbuf(struct cam_ed *device, struct sbuf *sb); static void mmc_proto_debug_out(union ccb *ccb); typedef enum { @@ -148,6 +152,7 @@ static struct xpt_xport_ops mmc_xport_ops = { .action = mmc_action, .async = mmc_dev_async, .announce = mmc_announce_periph, + .announce_sbuf = mmc_announce_periph_sbuf, }; #define MMC_XPT_XPORT(x, X) \ @@ -162,7 +167,9 @@ MMC_XPT_XPORT(mmc, MMCSD); static struct xpt_proto_ops mmc_proto_ops = { .announce = mmc_proto_announce, + .announce_sbuf = mmc_proto_announce_sbuf, .denounce = mmc_proto_denounce, + .denounce_sbuf = mmc_proto_denounce_sbuf, .debug_out = mmc_proto_debug_out, }; @@ -399,6 +406,29 @@ mmc_announce_periph(struct cam_periph *periph) ("XPT info: CLK %04d, ...\n", cts.proto_specific.mmc.ios.clock)); } +static void +mmc_announce_periph_sbuf(struct cam_periph *periph, struct sbuf *sb) +{ + struct ccb_pathinq cpi; + struct ccb_trans_settings cts; + struct cam_path *path = periph->path; + + cam_periph_assert(periph, MA_OWNED); + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("mmc_announce_periph")); + + memset(&cts, 0, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + xpt_action((union ccb*)&cts); + if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) + return; + xpt_path_inq(&cpi, periph->path); + CAM_DEBUG(path, CAM_DEBUG_INFO, + ("XPT info: CLK %04d, ...\n", cts.proto_specific.mmc.ios.clock)); +} + void mmccam_start_discovery(struct cam_sim *sim) { @@ -480,6 +510,12 @@ mmc_proto_announce(struct cam_ed *device) sbuf_putbuf(&sb); } +static void +mmc_proto_announce_sbuf(struct cam_ed *device, struct sbuf *sb) +{ + mmc_print_ident(&device->mmc_ident_data, sb); +} + static void mmc_proto_denounce(struct cam_ed *device) { @@ -487,6 +523,12 @@ mmc_proto_denounce(struct cam_ed *device) mmc_proto_announce(device); } +static void +mmc_proto_denounce_sbuf(struct cam_ed *device, struct sbuf *sb) +{ + mmc_proto_announce_sbuf(device, sb); +} + static void mmc_proto_debug_out(union ccb *ccb) { diff --git a/sys/cam/nvme/nvme_xpt.c b/sys/cam/nvme/nvme_xpt.c index 0662f476536c..d2968d1019d1 100644 --- a/sys/cam/nvme/nvme_xpt.c +++ b/sys/cam/nvme/nvme_xpt.c @@ -157,8 +157,14 @@ static void nvme_dev_async(uint32_t async_code, void *async_arg); static void nvme_action(union ccb *start_ccb); static void nvme_announce_periph(struct cam_periph *periph); +static void nvme_announce_periph_sbuf(struct cam_periph *periph, + struct sbuf *sb); static void nvme_proto_announce(struct cam_ed *device); +static void nvme_proto_announce_sbuf(struct cam_ed *device, + struct sbuf *sb); static void nvme_proto_denounce(struct cam_ed *device); +static void nvme_proto_denounce_sbuf(struct cam_ed *device, + struct sbuf *sb); static void nvme_proto_debug_out(union ccb *ccb); static struct xpt_xport_ops nvme_xport_ops = { @@ -166,6 +172,7 @@ static struct xpt_xport_ops nvme_xport_ops = { .action = nvme_action, .async = nvme_dev_async, .announce = nvme_announce_periph, + .announce_sbuf = nvme_announce_periph_sbuf, }; #define NVME_XPT_XPORT(x, X) \ static struct xpt_xport nvme_xport_ ## x = { \ @@ -181,7 +188,9 @@ NVME_XPT_XPORT(nvme, NVME); static struct xpt_proto_ops nvme_proto_ops = { .announce = nvme_proto_announce, + .announce_sbuf = nvme_proto_announce_sbuf, .denounce = nvme_proto_denounce, + .denounce_sbuf = nvme_proto_denounce_sbuf, .debug_out = nvme_proto_debug_out, }; static struct xpt_proto nvme_proto = { @@ -783,14 +792,12 @@ nvme_dev_async(uint32_t async_code, struct cam_eb *bus, struct cam_et *target, } static void -nvme_announce_periph(struct cam_periph *periph) +nvme_announce_periph_sbuf(struct cam_periph *periph, struct sbuf *sb) { struct ccb_pathinq cpi; struct ccb_trans_settings cts; struct cam_path *path = periph->path; struct ccb_trans_settings_nvme *nvmex; - struct sbuf sb; - char buffer[120]; cam_periph_assert(periph, MA_OWNED); @@ -805,20 +812,29 @@ nvme_announce_periph(struct cam_periph *periph) /* Ask the SIM for its base transfer speed */ xpt_path_inq(&cpi, periph->path); - sbuf_new(&sb, buffer, sizeof(buffer), SBUF_FIXEDLEN); - sbuf_printf(&sb, "%s%d: nvme version %d.%d", + sbuf_printf(sb, "%s%d: nvme version %d.%d", periph->periph_name, periph->unit_number, NVME_MAJOR(cts.protocol_version), NVME_MINOR(cts.protocol_version)); if (cts.transport == XPORT_NVME) { nvmex = &cts.proto_specific.nvme; if (nvmex->valid & CTS_NVME_VALID_LINK) - sbuf_printf(&sb, + sbuf_printf(sb, " x%d (max x%d) lanes PCIe Gen%d (max Gen%d) link", nvmex->lanes, nvmex->max_lanes, nvmex->speed, nvmex->max_speed); } - sbuf_printf(&sb, "\n"); + sbuf_printf(sb, "\n"); +} + +static void +nvme_announce_periph(struct cam_periph *periph) +{ + struct sbuf sb; + char buffer[120]; + + sbuf_new(&sb, buffer, sizeof(buffer), SBUF_FIXEDLEN); + nvme_announce_periph_sbuf(periph, &sb); sbuf_finish(&sb); sbuf_putbuf(&sb); } @@ -835,6 +851,12 @@ nvme_proto_announce(struct cam_ed *device) sbuf_putbuf(&sb); } +static void +nvme_proto_announce_sbuf(struct cam_ed *device, struct sbuf *sb) +{ + nvme_print_ident(device->nvme_cdata, device->nvme_data, sb); +} + static void nvme_proto_denounce(struct cam_ed *device) { @@ -847,6 +869,12 @@ nvme_proto_denounce(struct cam_ed *device) sbuf_putbuf(&sb); } +static void +nvme_proto_denounce_sbuf(struct cam_ed *device, struct sbuf *sb) +{ + nvme_print_ident_short(device->nvme_cdata, device->nvme_data, sb); +} + static void nvme_proto_debug_out(union ccb *ccb) {