aboutsummaryrefslogtreecommitdiffstats
path: root/sys/cam/nvme/nvme_da.c
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2017-08-29 17:03:30 +0000
committerWarner Losh <imp@FreeBSD.org>2017-08-29 17:03:30 +0000
commit9f8ed7e40b527b88fced22bd56218da9f06fcd79 (patch)
tree69066ee0f699c9ef097112791fecc60a9dc91f3e /sys/cam/nvme/nvme_da.c
parentc2005bba7796670be964c6872bddd68a69a73026 (diff)
downloadsrc-9f8ed7e40b527b88fced22bd56218da9f06fcd79.tar.gz
src-9f8ed7e40b527b88fced22bd56218da9f06fcd79.zip
Fix NVMe's use of XPT_GDEV_TYPE
This patch changes the way XPT_GDEV_TYPE works for NVMe. The current ccb_getdev structure includes pointers to the NVMe Identify Controller and Namespace structures, but these are kernel virtual addresses which are not accessible from user space. As an alternative, the patch changes the pointers into padding in ccb_getdev and adds two new types to ccb_dev_advinfo to retrieve the Identify Controller (CDAI_TYPE_NVME_CNTRL) and Namespace (CDAI_TYPE_NVME_NS) data structures. Reviewed By: rpokala, imp Differential Revision: https://reviews.freebsd.org/D10466 Submitted by: Chuck Tuffli
Notes
Notes: svn path=/head/; revision=322999
Diffstat (limited to 'sys/cam/nvme/nvme_da.c')
-rw-r--r--sys/cam/nvme/nvme_da.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
index f4b62f2086d7..3e829a4e8e9b 100644
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -684,21 +684,14 @@ ndaregister(struct cam_periph *periph, void *arg)
struct nda_softc *softc;
struct disk *disk;
struct ccb_pathinq cpi;
- struct ccb_getdev *cgd;
const struct nvme_namespace_data *nsd;
const struct nvme_controller_data *cd;
char announce_buf[80];
-// caddr_t match;
u_int maxio;
int quirks;
- cgd = (struct ccb_getdev *)arg;
- if (cgd == NULL) {
- printf("ndaregister: no getdev CCB, can't register device\n");
- return(CAM_REQ_CMP_ERR);
- }
- nsd = cgd->nvme_data;
- cd = cgd->nvme_cdata;
+ nsd = nvme_get_identify_ns(periph);
+ cd = nvme_get_identify_cntrl(periph);
softc = (struct nda_softc *)malloc(sizeof(*softc), M_DEVBUF,
M_NOWAIT | M_ZERO);
@@ -719,19 +712,7 @@ ndaregister(struct cam_periph *periph, void *arg)
periph->softc = softc;
-#if 0
- /*
- * See if this device has any quirks.
- */
- match = cam_quirkmatch((caddr_t)&cgd->ident_data,
- (caddr_t)nda_quirk_table,
- sizeof(nda_quirk_table)/sizeof(*nda_quirk_table),
- sizeof(*nda_quirk_table), ata_identify_match);
- if (match != NULL)
- softc->quirks = ((struct nda_quirk_entry *)match)->quirks;
- else
-#endif
- softc->quirks = NDA_Q_NONE;
+ softc->quirks = NDA_Q_NONE;
bzero(&cpi, sizeof(cpi));
xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE);