Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/nvme/nvme_sim.c
Show First 20 Lines • Show All 206 Lines • ▼ Show 20 Lines | case XPT_PATH_INQ: /* Path routing inquiry */ | ||||
break; | break; | ||||
} | } | ||||
case XPT_GET_TRAN_SETTINGS: /* Get transport settings */ | case XPT_GET_TRAN_SETTINGS: /* Get transport settings */ | ||||
{ | { | ||||
struct ccb_trans_settings *cts; | struct ccb_trans_settings *cts; | ||||
struct ccb_trans_settings_nvme *nvmep; | struct ccb_trans_settings_nvme *nvmep; | ||||
struct ccb_trans_settings_nvme *nvmex; | struct ccb_trans_settings_nvme *nvmex; | ||||
device_t dev; | device_t dev; | ||||
uint32_t status, caps; | uint32_t status, caps, flags; | ||||
dev = ctrlr->dev; | dev = ctrlr->dev; | ||||
cts = &ccb->cts; | cts = &ccb->cts; | ||||
nvmex = &cts->xport_specific.nvme; | nvmex = &cts->xport_specific.nvme; | ||||
nvmep = &cts->proto_specific.nvme; | nvmep = &cts->proto_specific.nvme; | ||||
status = pcie_read_config(dev, PCIER_LINK_STA, 2); | status = pcie_read_config(dev, PCIER_LINK_STA, 2); | ||||
caps = pcie_read_config(dev, PCIER_LINK_CAP, 2); | caps = pcie_read_config(dev, PCIER_LINK_CAP, 2); | ||||
nvmex->valid = CTS_NVME_VALID_SPEC | CTS_NVME_VALID_LINK; | flags = pcie_read_config(dev, PCIER_FLAGS, 2); | ||||
nvmex->spec = nvme_mmio_read_4(ctrlr, vs); | nvmex->spec = nvme_mmio_read_4(ctrlr, vs); | ||||
nvmex->valid = CTS_NVME_VALID_SPEC; | |||||
if ((flags & PCIEM_FLAGS_TYPE) == PCIEM_TYPE_ENDPOINT) { | |||||
nvmex->valid |= CTS_NVME_VALID_LINK; | |||||
nvmex->speed = status & PCIEM_LINK_STA_SPEED; | nvmex->speed = status & PCIEM_LINK_STA_SPEED; | ||||
nvmex->lanes = (status & PCIEM_LINK_STA_WIDTH) >> 4; | nvmex->lanes = (status & PCIEM_LINK_STA_WIDTH) >> 4; | ||||
nvmex->max_speed = caps & PCIEM_LINK_CAP_MAX_SPEED; | nvmex->max_speed = caps & PCIEM_LINK_CAP_MAX_SPEED; | ||||
nvmex->max_lanes = (caps & PCIEM_LINK_CAP_MAX_WIDTH) >> 4; | nvmex->max_lanes = (caps & PCIEM_LINK_CAP_MAX_WIDTH) >> 4; | ||||
} | |||||
/* XXX these should be something else maybe ? */ | /* XXX these should be something else maybe ? */ | ||||
nvmep->valid = 1; | nvmep->valid = 1; | ||||
nvmep->spec = nvmex->spec; | nvmep->spec = nvmex->spec; | ||||
cts->transport = XPORT_NVME; | cts->transport = XPORT_NVME; | ||||
cts->protocol = PROTO_NVME; | cts->protocol = PROTO_NVME; | ||||
cts->ccb_h.status = CAM_REQ_CMP; | cts->ccb_h.status = CAM_REQ_CMP; | ||||
▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines |