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
This commit is contained in:
@@ -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_action(union ccb *start_ccb);
|
||||||
static void mmc_dev_advinfo(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(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,
|
static void mmc_scan_lun(struct cam_periph *periph,
|
||||||
struct cam_path *path, cam_flags flags, union ccb *ccb);
|
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 mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb);
|
||||||
|
|
||||||
static void mmc_proto_announce(struct cam_ed *device);
|
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(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);
|
static void mmc_proto_debug_out(union ccb *ccb);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -148,6 +152,7 @@ static struct xpt_xport_ops mmc_xport_ops = {
|
|||||||
.action = mmc_action,
|
.action = mmc_action,
|
||||||
.async = mmc_dev_async,
|
.async = mmc_dev_async,
|
||||||
.announce = mmc_announce_periph,
|
.announce = mmc_announce_periph,
|
||||||
|
.announce_sbuf = mmc_announce_periph_sbuf,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MMC_XPT_XPORT(x, X) \
|
#define MMC_XPT_XPORT(x, X) \
|
||||||
@@ -162,7 +167,9 @@ MMC_XPT_XPORT(mmc, MMCSD);
|
|||||||
|
|
||||||
static struct xpt_proto_ops mmc_proto_ops = {
|
static struct xpt_proto_ops mmc_proto_ops = {
|
||||||
.announce = mmc_proto_announce,
|
.announce = mmc_proto_announce,
|
||||||
|
.announce_sbuf = mmc_proto_announce_sbuf,
|
||||||
.denounce = mmc_proto_denounce,
|
.denounce = mmc_proto_denounce,
|
||||||
|
.denounce_sbuf = mmc_proto_denounce_sbuf,
|
||||||
.debug_out = mmc_proto_debug_out,
|
.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));
|
("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
|
void
|
||||||
mmccam_start_discovery(struct cam_sim *sim)
|
mmccam_start_discovery(struct cam_sim *sim)
|
||||||
{
|
{
|
||||||
@@ -480,6 +510,12 @@ mmc_proto_announce(struct cam_ed *device)
|
|||||||
sbuf_putbuf(&sb);
|
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
|
static void
|
||||||
mmc_proto_denounce(struct cam_ed *device)
|
mmc_proto_denounce(struct cam_ed *device)
|
||||||
{
|
{
|
||||||
@@ -487,6 +523,12 @@ mmc_proto_denounce(struct cam_ed *device)
|
|||||||
mmc_proto_announce(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
|
static void
|
||||||
mmc_proto_debug_out(union ccb *ccb)
|
mmc_proto_debug_out(union ccb *ccb)
|
||||||
{
|
{
|
||||||
|
|||||||
+35
-7
@@ -157,8 +157,14 @@ static void nvme_dev_async(uint32_t async_code,
|
|||||||
void *async_arg);
|
void *async_arg);
|
||||||
static void nvme_action(union ccb *start_ccb);
|
static void nvme_action(union ccb *start_ccb);
|
||||||
static void nvme_announce_periph(struct cam_periph *periph);
|
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(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(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 void nvme_proto_debug_out(union ccb *ccb);
|
||||||
|
|
||||||
static struct xpt_xport_ops nvme_xport_ops = {
|
static struct xpt_xport_ops nvme_xport_ops = {
|
||||||
@@ -166,6 +172,7 @@ static struct xpt_xport_ops nvme_xport_ops = {
|
|||||||
.action = nvme_action,
|
.action = nvme_action,
|
||||||
.async = nvme_dev_async,
|
.async = nvme_dev_async,
|
||||||
.announce = nvme_announce_periph,
|
.announce = nvme_announce_periph,
|
||||||
|
.announce_sbuf = nvme_announce_periph_sbuf,
|
||||||
};
|
};
|
||||||
#define NVME_XPT_XPORT(x, X) \
|
#define NVME_XPT_XPORT(x, X) \
|
||||||
static struct xpt_xport nvme_xport_ ## 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 = {
|
static struct xpt_proto_ops nvme_proto_ops = {
|
||||||
.announce = nvme_proto_announce,
|
.announce = nvme_proto_announce,
|
||||||
|
.announce_sbuf = nvme_proto_announce_sbuf,
|
||||||
.denounce = nvme_proto_denounce,
|
.denounce = nvme_proto_denounce,
|
||||||
|
.denounce_sbuf = nvme_proto_denounce_sbuf,
|
||||||
.debug_out = nvme_proto_debug_out,
|
.debug_out = nvme_proto_debug_out,
|
||||||
};
|
};
|
||||||
static struct xpt_proto nvme_proto = {
|
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
|
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_pathinq cpi;
|
||||||
struct ccb_trans_settings cts;
|
struct ccb_trans_settings cts;
|
||||||
struct cam_path *path = periph->path;
|
struct cam_path *path = periph->path;
|
||||||
struct ccb_trans_settings_nvme *nvmex;
|
struct ccb_trans_settings_nvme *nvmex;
|
||||||
struct sbuf sb;
|
|
||||||
char buffer[120];
|
|
||||||
|
|
||||||
cam_periph_assert(periph, MA_OWNED);
|
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 */
|
/* Ask the SIM for its base transfer speed */
|
||||||
xpt_path_inq(&cpi, periph->path);
|
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,
|
periph->periph_name, periph->unit_number,
|
||||||
NVME_MAJOR(cts.protocol_version),
|
NVME_MAJOR(cts.protocol_version),
|
||||||
NVME_MINOR(cts.protocol_version));
|
NVME_MINOR(cts.protocol_version));
|
||||||
if (cts.transport == XPORT_NVME) {
|
if (cts.transport == XPORT_NVME) {
|
||||||
nvmex = &cts.proto_specific.nvme;
|
nvmex = &cts.proto_specific.nvme;
|
||||||
if (nvmex->valid & CTS_NVME_VALID_LINK)
|
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",
|
" x%d (max x%d) lanes PCIe Gen%d (max Gen%d) link",
|
||||||
nvmex->lanes, nvmex->max_lanes,
|
nvmex->lanes, nvmex->max_lanes,
|
||||||
nvmex->speed, nvmex->max_speed);
|
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_finish(&sb);
|
||||||
sbuf_putbuf(&sb);
|
sbuf_putbuf(&sb);
|
||||||
}
|
}
|
||||||
@@ -835,6 +851,12 @@ nvme_proto_announce(struct cam_ed *device)
|
|||||||
sbuf_putbuf(&sb);
|
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
|
static void
|
||||||
nvme_proto_denounce(struct cam_ed *device)
|
nvme_proto_denounce(struct cam_ed *device)
|
||||||
{
|
{
|
||||||
@@ -847,6 +869,12 @@ nvme_proto_denounce(struct cam_ed *device)
|
|||||||
sbuf_putbuf(&sb);
|
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
|
static void
|
||||||
nvme_proto_debug_out(union ccb *ccb)
|
nvme_proto_debug_out(union ccb *ccb)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user